Interface slightly fixed.
This commit is contained in:
parent
faf7129989
commit
5dc03a9649
@ -111,7 +111,7 @@ data Update_SRV_Form
|
||||
| Update_SRV_Port Port
|
||||
|
||||
data Action
|
||||
= DeleteRRModal String
|
||||
= DeleteRRModal Int
|
||||
| CancelModal
|
||||
|
||||
| Initialize
|
||||
@ -134,6 +134,8 @@ data Action
|
||||
|
||||
| SyncRR RRId
|
||||
|
||||
| RemoveRR RRId
|
||||
|
||||
| DeleteSimple RRId
|
||||
| DeleteMX RRId
|
||||
| DeleteSRV RRId
|
||||
@ -152,7 +154,7 @@ type State =
|
||||
, _current_entry_srv :: (SRVRR ())
|
||||
|
||||
, wsUp :: Boolean
|
||||
, active_modal :: Maybe String
|
||||
, active_modal :: Maybe Int
|
||||
}
|
||||
|
||||
component :: forall m. MonadAff m => H.Component Query Input Output m
|
||||
@ -192,7 +194,7 @@ render state
|
||||
= Bulma.section_small
|
||||
[ case state.wsUp, state.active_modal of
|
||||
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
|
||||
, Bulma.hr
|
||||
, render_records sorted
|
||||
@ -207,8 +209,8 @@ render state
|
||||
$ map toArray
|
||||
$ groupAllBy (comparing (_.t)) state._srr
|
||||
|
||||
modal_rr_delete :: forall w. String -> HH.HTML w Action
|
||||
modal_rr_delete domain =
|
||||
modal_rr_delete :: forall w. Int -> HH.HTML w Action
|
||||
modal_rr_delete rr_id =
|
||||
modal
|
||||
[ modal_background
|
||||
, modal_card [modal_header, modal_body]
|
||||
@ -225,7 +227,7 @@ render state
|
||||
modal_foot = HH.div [HP.classes C.modal_card_foot]
|
||||
modal_delete_button
|
||||
= 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."]
|
||||
modal_cancel_button
|
||||
= HH.button [ HP.classes C.button
|
||||
@ -242,9 +244,14 @@ handleAction = case _ of
|
||||
CancelModal -> do
|
||||
H.modify_ _ { active_modal = Nothing }
|
||||
|
||||
-- IMPORTED
|
||||
DeleteRRModal rr_id -> do
|
||||
H.modify_ _ { active_modal = Just rr_id }
|
||||
|
||||
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
|
||||
state <- H.get
|
||||
@ -404,6 +411,14 @@ handleAction = case _ of
|
||||
SyncRR rr_id -> do
|
||||
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
|
||||
H.raise $ Log $ SimpleLog ("Delete SimpleRR: " <> show rr_id)
|
||||
state <- H.get
|
||||
@ -426,9 +441,6 @@ handleAction = case _ of
|
||||
-- H.raise $ Log $ SimpleLog (show rr)
|
||||
H.raise $ Log $ SimpleLog (" => " <> val)
|
||||
|
||||
DeleteRRModal domain -> do
|
||||
H.modify_ _ { active_modal = Just domain }
|
||||
|
||||
-- HandleNewDomainInput adduserinp -> do
|
||||
-- case adduserinp of
|
||||
-- INP_newdomain v -> H.modify_ _ { newDomainForm { new_domain = v } }
|
||||
@ -506,6 +518,17 @@ handleQuery = case _ of
|
||||
(DNSManager.MkDomainDeleted response) -> do
|
||||
H.raise $ Log $ SimpleLog $ "[TODO] The domain '" <> response.domain <> "' has been deleted!"
|
||||
-- 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
|
||||
H.raise $ Log $ SimpleLog $ "[🎉] Success!"
|
||||
|
Loading…
Reference in New Issue
Block a user