Interface slightly fixed.
This commit is contained in:
parent
faf7129989
commit
5dc03a9649
@ -111,7 +111,7 @@ data Update_SRV_Form
|
|||||||
| Update_SRV_Port Port
|
| Update_SRV_Port Port
|
||||||
|
|
||||||
data Action
|
data Action
|
||||||
= DeleteRRModal String
|
= DeleteRRModal Int
|
||||||
| CancelModal
|
| CancelModal
|
||||||
|
|
||||||
| Initialize
|
| Initialize
|
||||||
@ -134,6 +134,8 @@ data Action
|
|||||||
|
|
||||||
| SyncRR RRId
|
| SyncRR RRId
|
||||||
|
|
||||||
|
| RemoveRR RRId
|
||||||
|
|
||||||
| DeleteSimple RRId
|
| DeleteSimple RRId
|
||||||
| DeleteMX RRId
|
| DeleteMX RRId
|
||||||
| DeleteSRV RRId
|
| DeleteSRV RRId
|
||||||
@ -152,7 +154,7 @@ type State =
|
|||||||
, _current_entry_srv :: (SRVRR ())
|
, _current_entry_srv :: (SRVRR ())
|
||||||
|
|
||||||
, wsUp :: Boolean
|
, wsUp :: Boolean
|
||||||
, active_modal :: Maybe String
|
, active_modal :: Maybe Int
|
||||||
}
|
}
|
||||||
|
|
||||||
component :: forall m. MonadAff m => H.Component Query Input Output m
|
component :: forall m. MonadAff m => H.Component Query Input Output m
|
||||||
@ -192,7 +194,7 @@ render state
|
|||||||
= Bulma.section_small
|
= Bulma.section_small
|
||||||
[ case state.wsUp, state.active_modal of
|
[ case state.wsUp, state.active_modal of
|
||||||
false, _ -> Bulma.p "You are disconnected."
|
false, _ -> Bulma.p "You are disconnected."
|
||||||
true, Just domain -> modal_rr_delete domain
|
true, Just rr_id -> modal_rr_delete rr_id
|
||||||
true, Nothing -> HH.div_ [ Bulma.h1 state._current_domain
|
true, Nothing -> HH.div_ [ Bulma.h1 state._current_domain
|
||||||
, Bulma.hr
|
, Bulma.hr
|
||||||
, render_records sorted
|
, render_records sorted
|
||||||
@ -207,8 +209,8 @@ render state
|
|||||||
$ map toArray
|
$ map toArray
|
||||||
$ groupAllBy (comparing (_.t)) state._srr
|
$ groupAllBy (comparing (_.t)) state._srr
|
||||||
|
|
||||||
modal_rr_delete :: forall w. String -> HH.HTML w Action
|
modal_rr_delete :: forall w. Int -> HH.HTML w Action
|
||||||
modal_rr_delete domain =
|
modal_rr_delete rr_id =
|
||||||
modal
|
modal
|
||||||
[ modal_background
|
[ modal_background
|
||||||
, modal_card [modal_header, modal_body]
|
, modal_card [modal_header, modal_body]
|
||||||
@ -225,7 +227,7 @@ render state
|
|||||||
modal_foot = HH.div [HP.classes C.modal_card_foot]
|
modal_foot = HH.div [HP.classes C.modal_card_foot]
|
||||||
modal_delete_button
|
modal_delete_button
|
||||||
= HH.button [ HP.classes (C.button <> C.is_success)
|
= HH.button [ HP.classes (C.button <> C.is_success)
|
||||||
-- TODO: , HE.onClick \_ -> RemoveRR domain
|
, HE.onClick \_ -> RemoveRR rr_id
|
||||||
] [HH.text "Delete the resource record."]
|
] [HH.text "Delete the resource record."]
|
||||||
modal_cancel_button
|
modal_cancel_button
|
||||||
= HH.button [ HP.classes C.button
|
= HH.button [ HP.classes C.button
|
||||||
@ -242,9 +244,14 @@ handleAction = case _ of
|
|||||||
CancelModal -> do
|
CancelModal -> do
|
||||||
H.modify_ _ { active_modal = Nothing }
|
H.modify_ _ { active_modal = Nothing }
|
||||||
|
|
||||||
-- IMPORTED
|
DeleteRRModal rr_id -> do
|
||||||
|
H.modify_ _ { active_modal = Just rr_id }
|
||||||
|
|
||||||
Initialize -> do
|
Initialize -> do
|
||||||
H.raise $ Log $ SimpleLog "Initialized"
|
{ _current_domain } <- H.get
|
||||||
|
H.raise $ Log $ SimpleLog $ "Asking the server for the zone" <> _current_domain
|
||||||
|
message <- H.liftEffect $ DNSManager.serialize $ DNSManager.MkGetZone { domain: _current_domain }
|
||||||
|
H.raise $ MessageToSend message
|
||||||
|
|
||||||
Finalize -> do
|
Finalize -> do
|
||||||
state <- H.get
|
state <- H.get
|
||||||
@ -404,6 +411,14 @@ handleAction = case _ of
|
|||||||
SyncRR rr_id -> do
|
SyncRR rr_id -> do
|
||||||
H.raise $ Log $ SimpleLog ("TODO: SyncRR: " <> show rr_id)
|
H.raise $ Log $ SimpleLog ("TODO: SyncRR: " <> show rr_id)
|
||||||
|
|
||||||
|
RemoveRR rr_id -> do
|
||||||
|
{ _current_domain } <- H.get
|
||||||
|
H.raise $ Log $ SimpleLog $ "Ask to remove rr (id: " <> show rr_id <> ")"
|
||||||
|
message <- H.liftEffect
|
||||||
|
$ DNSManager.serialize
|
||||||
|
$ DNSManager.MkDeleteRR { domain: _current_domain, rrid: rr_id }
|
||||||
|
H.raise $ MessageToSend message
|
||||||
|
|
||||||
DeleteSimple rr_id -> do
|
DeleteSimple rr_id -> do
|
||||||
H.raise $ Log $ SimpleLog ("Delete SimpleRR: " <> show rr_id)
|
H.raise $ Log $ SimpleLog ("Delete SimpleRR: " <> show rr_id)
|
||||||
state <- H.get
|
state <- H.get
|
||||||
@ -426,9 +441,6 @@ 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)
|
||||||
|
|
||||||
DeleteRRModal domain -> do
|
|
||||||
H.modify_ _ { active_modal = Just domain }
|
|
||||||
|
|
||||||
-- HandleNewDomainInput adduserinp -> do
|
-- HandleNewDomainInput adduserinp -> do
|
||||||
-- case adduserinp of
|
-- case adduserinp of
|
||||||
-- INP_newdomain v -> H.modify_ _ { newDomainForm { new_domain = v } }
|
-- INP_newdomain v -> H.modify_ _ { newDomainForm { new_domain = v } }
|
||||||
@ -506,6 +518,17 @@ handleQuery = case _ of
|
|||||||
(DNSManager.MkDomainDeleted response) -> do
|
(DNSManager.MkDomainDeleted response) -> do
|
||||||
H.raise $ Log $ SimpleLog $ "[TODO] The domain '" <> response.domain <> "' has been deleted!"
|
H.raise $ Log $ SimpleLog $ "[TODO] The domain '" <> response.domain <> "' has been deleted!"
|
||||||
-- handleAction $ UpdateMyDomains $ A.filter ((/=) response.domain) my_domains
|
-- handleAction $ UpdateMyDomains $ A.filter ((/=) response.domain) my_domains
|
||||||
|
(DNSManager.MkRRDeleted response) -> do
|
||||||
|
H.raise $ Log $ SimpleLog $ "[🎉] RR (id: '" <> show response.rrid <> "') has been deleted!"
|
||||||
|
state <- H.get
|
||||||
|
H.modify_ _ { _srr = filter (\rr -> rr.id /= response.rrid) state._srr
|
||||||
|
, _mxrr = filter (\rr -> rr.id /= response.rrid) state._mxrr
|
||||||
|
, _srvrr = filter (\rr -> rr.id /= response.rrid) state._srvrr
|
||||||
|
}
|
||||||
|
|
||||||
|
(DNSManager.MkZone response) -> do
|
||||||
|
H.raise $ Log $ SimpleLog $ "[🎉] Got the zone!"
|
||||||
|
H.raise $ Log $ SimpleLog $ "DEBUG: the zone has domain: " <> response.zone.domain
|
||||||
|
|
||||||
(DNSManager.MkSuccess _) -> do
|
(DNSManager.MkSuccess _) -> do
|
||||||
H.raise $ Log $ SimpleLog $ "[🎉] Success!"
|
H.raise $ Log $ SimpleLog $ "[🎉] Success!"
|
||||||
|
Loading…
Reference in New Issue
Block a user