minor code cleaning
parent
8f75a4e88b
commit
bf97e0bc60
|
@ -42,7 +42,7 @@ import App.AcceptedRRTypes (AcceptedRRTypes(..))
|
|||
import App.ResourceRecord (ResourceRecord, emptyRR
|
||||
, show_qualifier, show_mechanism_type
|
||||
, mechanism_types, qualifier_types, modifier_types)
|
||||
import App.ResourceRecord (Mechanism(..), Modifier(..), Qualifier(..)) as RR
|
||||
import App.ResourceRecord (Mechanism, Modifier, Qualifier) as RR
|
||||
|
||||
import App.DisplayErrors (error_to_paragraph)
|
||||
|
||||
|
@ -145,10 +145,10 @@ data Action
|
|||
-- | Ask `dnsmanagerd` for the generated zone file.
|
||||
| AskZoneFile
|
||||
|
||||
| SPF_Select_Mechanism_q Int
|
||||
| SPF_Select_Mechanism_t Int
|
||||
| SPF_Select_Modifier Int
|
||||
| SPF_Select_Qualifier Int
|
||||
| SPF_Mechanism_q Int
|
||||
| SPF_Mechanism_t Int
|
||||
| SPF_Modifier Int
|
||||
| SPF_Qualifier Int
|
||||
|
||||
data RRModal
|
||||
= NoModal
|
||||
|
@ -193,10 +193,10 @@ type State =
|
|||
-- Unique RR form.
|
||||
, _currentRR :: ResourceRecord
|
||||
, _currentRR_errors :: Array Validation.Error
|
||||
, _current_selected_mechanism_q :: String
|
||||
, _current_selected_mechanism_t :: String
|
||||
, _current_selected_modifier :: String
|
||||
, _current_selected_qualifier :: String
|
||||
, spf_mechanism_q :: String
|
||||
, spf_mechanism_t :: String
|
||||
, spf_modifier :: String
|
||||
, spf_qualifier :: String
|
||||
|
||||
, _zonefile :: Maybe String
|
||||
}
|
||||
|
@ -240,10 +240,10 @@ initialState domain =
|
|||
, _currentRR_errors: []
|
||||
, _zonefile: Nothing
|
||||
|
||||
, _current_selected_mechanism_q: "pass"
|
||||
, _current_selected_mechanism_t: "a"
|
||||
, _current_selected_modifier: "redirect"
|
||||
, _current_selected_qualifier: "none"
|
||||
, spf_mechanism_q: "pass"
|
||||
, spf_mechanism_t: "a"
|
||||
, spf_modifier: "redirect"
|
||||
, spf_qualifier: "none"
|
||||
}
|
||||
|
||||
type SortableRecord l = Record (rrtype :: String, rrid :: Int | l)
|
||||
|
@ -396,17 +396,17 @@ render state
|
|||
, maybe (Bulma.p "no mechanism") display_mechanisms state._currentRR.mechanisms
|
||||
, Bulma.box
|
||||
[ Bulma.h3 "New mechanism"
|
||||
, Bulma.selection SPF_Select_Mechanism_q qualifier_types state._current_selected_mechanism_q
|
||||
, Bulma.selection SPF_Select_Mechanism_t mechanism_types state._current_selected_mechanism_t
|
||||
, Bulma.selection SPF_Mechanism_q qualifier_types state.spf_mechanism_q
|
||||
, Bulma.selection SPF_Mechanism_t mechanism_types state.spf_mechanism_t
|
||||
]
|
||||
, Bulma.hr
|
||||
, Bulma.box
|
||||
[ Bulma.h3 "New modifier"
|
||||
, Bulma.selection SPF_Select_Modifier modifier_types state._current_selected_modifier
|
||||
, Bulma.selection SPF_Modifier modifier_types state.spf_modifier
|
||||
]
|
||||
, Bulma.box
|
||||
[ Bulma.h3 "Default behavior"
|
||||
, Bulma.selection SPF_Select_Qualifier qualifier_types state._current_selected_qualifier
|
||||
, Bulma.selection SPF_Qualifier qualifier_types state.spf_qualifier
|
||||
]
|
||||
]
|
||||
|
||||
|
@ -543,17 +543,10 @@ handleAction = case _ of
|
|||
$ DNSManager.MkAskGeneratedZoneFile { domain: state._domain }
|
||||
H.raise $ MessageToSend message
|
||||
|
||||
SPF_Select_Mechanism_q v -> do
|
||||
H.modify_ _ { _current_selected_mechanism_q = maybe "pass" id $ qualifier_types A.!! v }
|
||||
|
||||
SPF_Select_Mechanism_t v -> do
|
||||
H.modify_ _ { _current_selected_mechanism_t = maybe "a" id $ mechanism_types A.!! v }
|
||||
|
||||
SPF_Select_Modifier v -> do
|
||||
H.modify_ _ { _current_selected_modifier = maybe "redirect" id $ modifier_types A.!! v }
|
||||
|
||||
SPF_Select_Qualifier v -> do
|
||||
H.modify_ _ { _current_selected_qualifier = maybe "none" id $ qualifier_types A.!! v }
|
||||
SPF_Mechanism_q v -> H.modify_ _ { spf_mechanism_q = maybe "pass" id $ qualifier_types A.!! v }
|
||||
SPF_Mechanism_t v -> H.modify_ _ { spf_mechanism_t = maybe "a" id $ mechanism_types A.!! v }
|
||||
SPF_Modifier v -> H.modify_ _ { spf_modifier = maybe "redirect" id $ modifier_types A.!! v }
|
||||
SPF_Qualifier v -> H.modify_ _ { spf_qualifier = maybe "none" id $ qualifier_types A.!! v }
|
||||
|
||||
handleQuery :: forall a m. MonadAff m => Query a -> H.HalogenM State Action () Output m (Maybe a)
|
||||
handleQuery = case _ of
|
||||
|
|
Loading…
Reference in New Issue