Slight refactoring.
parent
106245c6c6
commit
50eeb340f8
|
@ -325,36 +325,15 @@ handleAction = case _ of
|
||||||
AddRR form -> case form of
|
AddRR form -> case form of
|
||||||
Add_SRR -> do
|
Add_SRR -> do
|
||||||
state <- H.get
|
state <- H.get
|
||||||
case Validation.validateSRR state._current_entry of
|
try_add_new_entry state._current_domain (Validation.validateSRR state._current_entry) "simple"
|
||||||
Left _ -> H.raise $ Log $ SimpleLog "Cannot add this simple RR, some errors occured in the record"
|
|
||||||
Right newrr -> do
|
|
||||||
H.raise $ Log $ SimpleLog "Add new simple RR"
|
|
||||||
message <- H.liftEffect
|
|
||||||
$ DNSManager.serialize
|
|
||||||
$ DNSManager.MkAddRR { domain: state._current_domain, rr: newrr }
|
|
||||||
H.raise $ MessageToSend message
|
|
||||||
|
|
||||||
Add_MXRR -> do
|
Add_MXRR -> do
|
||||||
state <- H.get
|
state <- H.get
|
||||||
case Validation.validateMXRR state._current_entry_mx of
|
try_add_new_entry state._current_domain (Validation.validateMXRR state._current_entry_mx) "MX"
|
||||||
Left _ -> H.raise $ Log $ SimpleLog "Cannot add this MX RR, some errors occured in the record"
|
|
||||||
Right newrr -> do
|
|
||||||
H.raise $ Log $ SimpleLog "Add new MX"
|
|
||||||
message <- H.liftEffect
|
|
||||||
$ DNSManager.serialize
|
|
||||||
$ DNSManager.MkAddRR { domain: state._current_domain, rr: newrr }
|
|
||||||
H.raise $ MessageToSend message
|
|
||||||
|
|
||||||
Add_SRVRR -> do
|
Add_SRVRR -> do
|
||||||
state <- H.get
|
state <- H.get
|
||||||
case Validation.validateSRVRR state._current_entry_srv of
|
try_add_new_entry state._current_domain (Validation.validateSRVRR state._current_entry_srv) "SRV"
|
||||||
Left _ -> H.raise $ Log $ SimpleLog "Cannot add this SRV RR, some errors occured in the record"
|
|
||||||
Right newrr -> do
|
|
||||||
H.raise $ Log $ SimpleLog "Add new SRV"
|
|
||||||
message <- H.liftEffect
|
|
||||||
$ DNSManager.serialize
|
|
||||||
$ DNSManager.MkAddRR { domain: state._current_domain, rr: newrr }
|
|
||||||
H.raise $ MessageToSend message
|
|
||||||
|
|
||||||
UpdateLocalForm rr_id form -> case form of
|
UpdateLocalForm rr_id form -> case form of
|
||||||
Update_Local_Form_SRR rr_update -> case rr_update of
|
Update_Local_Form_SRR rr_update -> case rr_update of
|
||||||
|
@ -488,6 +467,16 @@ handleAction = case _ of
|
||||||
-- H.raise $ Log $ SimpleLog (show rr)
|
-- H.raise $ Log $ SimpleLog (show rr)
|
||||||
H.raise $ Log $ SimpleLog (" => " <> val)
|
H.raise $ Log $ SimpleLog (" => " <> val)
|
||||||
|
|
||||||
|
where
|
||||||
|
try_add_new_entry d v t = case v of
|
||||||
|
Left _ -> H.raise $ Log $ SimpleLog $ "Cannot add this " <> t <> " RR, some errors occured in the record"
|
||||||
|
Right newrr -> do
|
||||||
|
H.raise $ Log $ SimpleLog $ "Add new " <> t
|
||||||
|
message <- H.liftEffect
|
||||||
|
$ DNSManager.serialize
|
||||||
|
$ DNSManager.MkAddRR { domain: d, rr: newrr }
|
||||||
|
H.raise $ MessageToSend message
|
||||||
|
|
||||||
handleQuery :: forall a m. MonadAff m => Query a -> H.HalogenM State Action () Output m (Maybe a)
|
handleQuery :: forall a m. MonadAff m => Query a -> H.HalogenM State Action () Output m (Maybe a)
|
||||||
handleQuery = case _ of
|
handleQuery = case _ of
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue