All updates in only two actions.
This commit is contained in:
parent
c307e1679e
commit
f0db34d694
@ -77,6 +77,11 @@ type Input = String
|
||||
-- | - remove a resource record
|
||||
-- | - handle user inputs
|
||||
|
||||
data Add_RR
|
||||
= Add_SRR
|
||||
| Add_MXRR
|
||||
| Add_SRVRR
|
||||
|
||||
data Update_SRR_Form
|
||||
= Update_SRR_Type Int
|
||||
| Update_SRR_Domain RecordDomain
|
||||
@ -98,6 +103,16 @@ data Update_SRV_Form
|
||||
| Update_SRV_Weight Weight
|
||||
| Update_SRV_Port Port
|
||||
|
||||
data Update_New_Form
|
||||
= Update_New_Form_SRR Update_SRR_Form
|
||||
| Update_New_Form_MXRR Update_MX_Form
|
||||
| Update_New_Form_SRVRR Update_SRV_Form
|
||||
|
||||
data Update_Local_Form
|
||||
= Update_Local_Form_SRR Update_SRR_Form
|
||||
| Update_Local_Form_MXRR Update_MX_Form
|
||||
| Update_Local_Form_SRVRR Update_SRV_Form
|
||||
|
||||
data Action
|
||||
= DeleteRRModal RRId
|
||||
| CancelModal
|
||||
@ -105,20 +120,14 @@ data Action
|
||||
| Initialize
|
||||
| Finalize
|
||||
|
||||
-- New entries.
|
||||
| UpdateNewSRRForm Update_SRR_Form
|
||||
| UpdateNewMXForm Update_MX_Form
|
||||
| UpdateNewSRVForm Update_SRV_Form
|
||||
|
||||
-- Add new entries.
|
||||
| AddSRR
|
||||
| AddMX
|
||||
| AddSRV
|
||||
| AddRR Add_RR
|
||||
|
||||
-- Entry already in our zone.
|
||||
| UpdateLocalSRRForm RRId Update_SRR_Form
|
||||
| UpdateLocalMXForm RRId Update_MX_Form
|
||||
| UpdateLocalSRVForm RRId Update_SRV_Form
|
||||
-- Update new entry forms.
|
||||
| UpdateNewForm Update_New_Form
|
||||
|
||||
-- Update an already active entry.
|
||||
| UpdateLocalForm RRId Update_Local_Form
|
||||
|
||||
| SyncRR RRId
|
||||
| RemoveRR RRId
|
||||
@ -242,171 +251,177 @@ handleAction = case _ of
|
||||
Finalize -> do
|
||||
H.raise $ Log $ SimpleLog "Finalized!"
|
||||
|
||||
UpdateNewSRRForm rr_update -> case rr_update of
|
||||
Update_SRR_Type val -> do
|
||||
-- let new_type = fromMaybe "unknown" (baseRecords A.!! val)
|
||||
-- H.raise $ Log $ SimpleLog ("Update new entry type: " <> new_type)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry = changeType state._current_entry (baseRecords A.!! val) }
|
||||
Update_SRR_Domain val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new entry domain: " <> val)
|
||||
H.modify_ _ { _current_entry { domain = val } }
|
||||
Update_SRR_TTL val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new entry ttl: " <> val)
|
||||
H.modify_ _ { _current_entry { ttl = val, valid = isInteger val } }
|
||||
Update_SRR_Value val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new entry value: " <> val)
|
||||
H.modify_ _ { _current_entry { value = val } }
|
||||
UpdateNewForm form -> case form of
|
||||
Update_New_Form_SRR rr_update -> case rr_update of
|
||||
Update_SRR_Type val -> do
|
||||
-- let new_type = fromMaybe "unknown" (baseRecords A.!! val)
|
||||
-- H.raise $ Log $ SimpleLog ("Update new entry type: " <> new_type)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry = changeType state._current_entry (baseRecords A.!! val) }
|
||||
Update_SRR_Domain val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new entry domain: " <> val)
|
||||
H.modify_ _ { _current_entry { domain = val } }
|
||||
Update_SRR_TTL val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new entry ttl: " <> val)
|
||||
H.modify_ _ { _current_entry { ttl = val, valid = isInteger val } }
|
||||
Update_SRR_Value val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new entry value: " <> val)
|
||||
H.modify_ _ { _current_entry { value = val } }
|
||||
|
||||
UpdateNewMXForm rr_update -> case rr_update of
|
||||
-- TODO: FIXME: test all inputs
|
||||
Update_MX_Domain val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new MX entry domain: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_mx = state._current_entry_mx { domain = val } }
|
||||
-- TODO: FIXME: test all inputs
|
||||
Update_MX_TTL val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new MX entry ttl: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_mx = state._current_entry_mx {ttl = val, valid = isInteger val} }
|
||||
-- TODO: FIXME: test all inputs
|
||||
Update_MX_Value val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new MX entry value: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_mx = state._current_entry_mx { value = val } }
|
||||
Update_MX_Priority val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new MX entry priority: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_mx = state._current_entry_mx { priority = val } }
|
||||
|
||||
UpdateNewSRVForm rr_update -> case rr_update of
|
||||
Update_SRV_Domain val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new SRV entry domain: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_srv = state._current_entry_srv { domain = val } }
|
||||
Update_SRV_Value val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new SRV entry value: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_srv = state._current_entry_srv { value = val } }
|
||||
Update_New_Form_MXRR rr_update -> case rr_update of
|
||||
-- TODO: FIXME: test all inputs
|
||||
Update_SRV_TTL val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new SRV entry ttl: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_srv = state._current_entry_srv {ttl = val, valid = isInteger val}}
|
||||
Update_SRV_Priority val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new SRV entry priority: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_srv = state._current_entry_srv { priority = val } }
|
||||
Update_SRV_Protocol val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new SRV entry protocol: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_srv = state._current_entry_srv { protocol = val } }
|
||||
Update_SRV_Weight val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new SRV entry weight: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_srv = state._current_entry_srv { weight = val } }
|
||||
Update_SRV_Port val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new SRV entry port: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_srv = state._current_entry_srv { port = val } }
|
||||
Update_MX_Domain val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new MX entry domain: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_mx = state._current_entry_mx { domain = val } }
|
||||
-- TODO: FIXME: test all inputs
|
||||
Update_MX_TTL val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new MX entry ttl: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_mx = state._current_entry_mx {ttl = val, valid = isInteger val} }
|
||||
-- TODO: FIXME: test all inputs
|
||||
Update_MX_Value val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new MX entry value: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_mx = state._current_entry_mx { value = val } }
|
||||
Update_MX_Priority val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new MX entry priority: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_mx = state._current_entry_mx { priority = val } }
|
||||
|
||||
Update_New_Form_SRVRR rr_update -> case rr_update of
|
||||
Update_SRV_Domain val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new SRV entry domain: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_srv = state._current_entry_srv { domain = val } }
|
||||
Update_SRV_Value val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new SRV entry value: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_srv = state._current_entry_srv { value = val } }
|
||||
-- TODO: FIXME: test all inputs
|
||||
Update_SRV_TTL val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new SRV entry ttl: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_srv = state._current_entry_srv {ttl = val, valid = isInteger val}}
|
||||
Update_SRV_Priority val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new SRV entry priority: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_srv = state._current_entry_srv { priority = val } }
|
||||
Update_SRV_Protocol val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new SRV entry protocol: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_srv = state._current_entry_srv { protocol = val } }
|
||||
Update_SRV_Weight val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new SRV entry weight: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_srv = state._current_entry_srv { weight = val } }
|
||||
Update_SRV_Port val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new SRV entry port: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _current_entry_srv = state._current_entry_srv { port = val } }
|
||||
|
||||
-- This action only is possible if inputs are correct.
|
||||
AddSRR -> do
|
||||
state <- H.get
|
||||
let newrr = fromLocalSimpleRRRepresentationToResourceRecord state._current_entry
|
||||
H.raise $ Log $ SimpleLog ("Add new simple RR: " <> show state._current_entry)
|
||||
message <- H.liftEffect
|
||||
$ DNSManager.serialize
|
||||
$ DNSManager.MkAddRR { domain: state._current_domain, rr: newrr }
|
||||
H.raise $ MessageToSend message
|
||||
AddMX -> do
|
||||
state <- H.get
|
||||
let newrr = fromLocalMXRRRepresentationToResourceRecord state._current_entry_mx
|
||||
H.raise $ Log $ SimpleLog ("Add new MX: " <> show state._current_entry_mx)
|
||||
message <- H.liftEffect
|
||||
$ DNSManager.serialize
|
||||
$ DNSManager.MkAddRR { domain: state._current_domain, rr: newrr }
|
||||
H.raise $ MessageToSend message
|
||||
AddSRV -> do
|
||||
state <- H.get
|
||||
let newrr = fromLocalSRVRRepresentationToResourceRecord state._current_entry_srv
|
||||
H.raise $ Log $ SimpleLog ("Add new SRV: " <> show state._current_entry_srv)
|
||||
message <- H.liftEffect
|
||||
$ DNSManager.serialize
|
||||
$ DNSManager.MkAddRR { domain: state._current_domain, rr: newrr }
|
||||
H.raise $ MessageToSend message
|
||||
AddRR form -> case form of
|
||||
Add_SRR -> do
|
||||
state <- H.get
|
||||
let newrr = fromLocalSimpleRRRepresentationToResourceRecord state._current_entry
|
||||
H.raise $ Log $ SimpleLog ("Add new simple RR: " <> show state._current_entry)
|
||||
message <- H.liftEffect
|
||||
$ DNSManager.serialize
|
||||
$ DNSManager.MkAddRR { domain: state._current_domain, rr: newrr }
|
||||
H.raise $ MessageToSend message
|
||||
|
||||
UpdateLocalSRRForm rr_id rr_update -> case rr_update of
|
||||
Update_SRR_Type val -> do
|
||||
let new_type = fromMaybe "unknown" (baseRecords A.!! val)
|
||||
H.raise $ Log $ SimpleLog ("TODO: Update local RR " <> show rr_id <> " type: " <> new_type)
|
||||
-- state <- H.get
|
||||
-- H.modify_ _ { _srr = changeType state._current_entry (baseRecords A.!! val) }
|
||||
Update_SRR_Domain val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local RR " <> show rr_id <> " domain: " <> val)
|
||||
Add_MXRR -> do
|
||||
state <- H.get
|
||||
H.modify_ _ { _srr = (update_domain rr_id val state._srr) }
|
||||
Update_SRR_TTL val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local RR " <> show rr_id <> " TTL: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srr = (update_ttl rr_id val state._srr) }
|
||||
Update_SRR_Value val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local RR " <> show rr_id <> " value: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srr = (update_value rr_id val state._srr) }
|
||||
let newrr = fromLocalMXRRRepresentationToResourceRecord state._current_entry_mx
|
||||
H.raise $ Log $ SimpleLog ("Add new MX: " <> show state._current_entry_mx)
|
||||
message <- H.liftEffect
|
||||
$ DNSManager.serialize
|
||||
$ DNSManager.MkAddRR { domain: state._current_domain, rr: newrr }
|
||||
H.raise $ MessageToSend message
|
||||
|
||||
UpdateLocalMXForm rr_id rr_update -> case rr_update of
|
||||
-- TODO: FIXME: test all inputs
|
||||
Update_MX_Domain val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local MX RR " <> show rr_id <> " domain: " <> val)
|
||||
Add_SRVRR -> do
|
||||
state <- H.get
|
||||
H.modify_ _ { _mxrr = (update_domain rr_id val state._mxrr) }
|
||||
-- TODO: FIXME: test all inputs
|
||||
Update_MX_TTL val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local MX " <> show rr_id <> " entry ttl: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _mxrr = (update_ttl rr_id val state._mxrr) }
|
||||
-- TODO: FIXME: test all inputs
|
||||
Update_MX_Value val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local MX " <> show rr_id <> " entry value: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _mxrr = (update_value rr_id val state._mxrr) }
|
||||
Update_MX_Priority val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local MX " <> show rr_id <> " entry priority: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _mxrr = (update_priority rr_id val state._mxrr) }
|
||||
case fromLocalToRR state._current_entry_srv of
|
||||
Left errmsg -> H.raise $ Log $ SimpleLog $ "Add new SRV failed: " <> errmsg
|
||||
Right newrr -> do
|
||||
H.raise $ Log $ SimpleLog $ "Add new SRV: " <> show state._current_entry_srv
|
||||
message <- H.liftEffect
|
||||
$ DNSManager.serialize
|
||||
$ DNSManager.MkAddRR { domain: state._current_domain, rr: newrr }
|
||||
H.raise $ MessageToSend message
|
||||
|
||||
UpdateLocalSRVForm rr_id rr_update -> case rr_update of
|
||||
Update_SRV_Domain val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local SRV " <> show rr_id <> " entry domain: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srvrr = (update_domain rr_id val state._srvrr) }
|
||||
Update_SRV_Value val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local SRV " <> show rr_id <> " entry value: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srvrr = (update_value rr_id val state._srvrr) }
|
||||
UpdateLocalForm rr_id form -> case form of
|
||||
Update_Local_Form_SRR rr_update -> case rr_update of
|
||||
Update_SRR_Type val -> do
|
||||
let new_type = fromMaybe "unknown" (baseRecords A.!! val)
|
||||
H.raise $ Log $ SimpleLog ("TODO: Update local RR " <> show rr_id <> " type: " <> new_type)
|
||||
-- state <- H.get
|
||||
-- H.modify_ _ { _srr = changeType state._current_entry (baseRecords A.!! val) }
|
||||
Update_SRR_Domain val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local RR " <> show rr_id <> " domain: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srr = (update_domain rr_id val state._srr) }
|
||||
Update_SRR_TTL val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local RR " <> show rr_id <> " TTL: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srr = (update_ttl rr_id val state._srr) }
|
||||
Update_SRR_Value val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local RR " <> show rr_id <> " value: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srr = (update_value rr_id val state._srr) }
|
||||
|
||||
Update_Local_Form_MXRR rr_update -> case rr_update of
|
||||
-- TODO: FIXME: test all inputs
|
||||
Update_SRV_TTL val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local SRV " <> show rr_id <> " entry ttl: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srvrr = (update_ttl rr_id val state._srvrr) }
|
||||
Update_SRV_Priority val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local SRV " <> show rr_id <> " entry priority: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srvrr = (update_priority rr_id val state._srvrr) }
|
||||
Update_SRV_Protocol val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new SRV entry protocol: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srvrr = (update_protocol rr_id val state._srvrr) }
|
||||
Update_SRV_Weight val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local SRV " <> show rr_id <> " entry weight: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srvrr = (update_weight rr_id val state._srvrr) }
|
||||
Update_SRV_Port val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local SRV " <> show rr_id <> " entry port: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srvrr = (update_port rr_id val state._srvrr) }
|
||||
Update_MX_Domain val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local MX RR " <> show rr_id <> " domain: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _mxrr = (update_domain rr_id val state._mxrr) }
|
||||
-- TODO: FIXME: test all inputs
|
||||
Update_MX_TTL val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local MX " <> show rr_id <> " entry ttl: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _mxrr = (update_ttl rr_id val state._mxrr) }
|
||||
-- TODO: FIXME: test all inputs
|
||||
Update_MX_Value val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local MX " <> show rr_id <> " entry value: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _mxrr = (update_value rr_id val state._mxrr) }
|
||||
Update_MX_Priority val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local MX " <> show rr_id <> " entry priority: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _mxrr = (update_priority rr_id val state._mxrr) }
|
||||
|
||||
Update_Local_Form_SRVRR rr_update -> case rr_update of
|
||||
Update_SRV_Domain val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local SRV " <> show rr_id <> " entry domain: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srvrr = (update_domain rr_id val state._srvrr) }
|
||||
Update_SRV_Value val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local SRV " <> show rr_id <> " entry value: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srvrr = (update_value rr_id val state._srvrr) }
|
||||
-- TODO: FIXME: test all inputs
|
||||
Update_SRV_TTL val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local SRV " <> show rr_id <> " entry ttl: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srvrr = (update_ttl rr_id val state._srvrr) }
|
||||
Update_SRV_Priority val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local SRV " <> show rr_id <> " entry priority: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srvrr = (update_priority rr_id val state._srvrr) }
|
||||
Update_SRV_Protocol val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update new SRV entry protocol: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srvrr = (update_protocol rr_id val state._srvrr) }
|
||||
Update_SRV_Weight val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local SRV " <> show rr_id <> " entry weight: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srvrr = (update_weight rr_id val state._srvrr) }
|
||||
Update_SRV_Port val -> do
|
||||
-- H.raise $ Log $ SimpleLog ("Update local SRV " <> show rr_id <> " entry port: " <> val)
|
||||
state <- H.get
|
||||
H.modify_ _ { _srvrr = (update_port rr_id val state._srvrr) }
|
||||
|
||||
-- TODO: network operations
|
||||
SyncRR rr_id -> do
|
||||
@ -595,9 +610,9 @@ render_records records
|
||||
|
||||
row rr = HH.tr_ $
|
||||
[ Bulma.txt_name rr.t
|
||||
, HH.td_ [ Bulma.input_domain ((UpdateLocalSRRForm rr.id) <<< Update_SRR_Domain) rr.domain rr.valid ]
|
||||
, HH.td_ [ Bulma.input_ttl ((UpdateLocalSRRForm rr.id) <<< Update_SRR_TTL ) rr.ttl rr.valid ]
|
||||
, HH.td_ [ Bulma.input_value ((UpdateLocalSRRForm rr.id) <<< Update_SRR_Value) rr.value rr.valid ]
|
||||
, HH.td_ [ Bulma.input_domain ((UpdateLocalForm rr.id) <<< Update_Local_Form_SRR <<< Update_SRR_Domain) rr.domain rr.valid ]
|
||||
, HH.td_ [ Bulma.input_ttl ((UpdateLocalForm rr.id) <<< Update_Local_Form_SRR <<< Update_SRR_TTL ) rr.ttl rr.valid ]
|
||||
, HH.td_ [ Bulma.input_value ((UpdateLocalForm rr.id) <<< Update_Local_Form_SRR <<< Update_SRR_Value) rr.value rr.valid ]
|
||||
, HH.td_ [ Bulma.btn_change (SyncRR rr.id) (TellSomethingWentWrong rr.id "cannot update") rr.modified rr.valid ]
|
||||
, HH.td_ [ Bulma.btn_delete (\_ -> DeleteRRModal rr.id) ]
|
||||
]
|
||||
@ -619,10 +634,10 @@ render_mx_records records
|
||||
table_content = HH.tbody_ $ map row records
|
||||
|
||||
row rr = HH.tr_ $
|
||||
[ HH.td_ [ Bulma.input_domain ((UpdateLocalMXForm rr.id) <<< Update_MX_Domain) rr.domain rr.valid ]
|
||||
, HH.td_ [ Bulma.input_ttl ((UpdateLocalMXForm rr.id) <<< Update_MX_TTL) rr.ttl rr.valid ]
|
||||
, HH.td_ [ Bulma.input_priority ((UpdateLocalMXForm rr.id) <<< Update_MX_Priority) rr.priority rr.valid ]
|
||||
, HH.td_ [ Bulma.input_value ((UpdateLocalMXForm rr.id) <<< Update_MX_Value) rr.value rr.valid ]
|
||||
[ HH.td_ [ Bulma.input_domain ((UpdateLocalForm rr.id) <<< Update_Local_Form_MXRR <<< Update_MX_Domain) rr.domain rr.valid ]
|
||||
, HH.td_ [ Bulma.input_ttl ((UpdateLocalForm rr.id) <<< Update_Local_Form_MXRR <<< Update_MX_TTL) rr.ttl rr.valid ]
|
||||
, HH.td_ [ Bulma.input_priority ((UpdateLocalForm rr.id) <<< Update_Local_Form_MXRR <<< Update_MX_Priority) rr.priority rr.valid ]
|
||||
, HH.td_ [ Bulma.input_value ((UpdateLocalForm rr.id) <<< Update_Local_Form_MXRR <<< Update_MX_Value) rr.value rr.valid ]
|
||||
, HH.td_ [ Bulma.btn_change (SyncRR rr.id) (TellSomethingWentWrong rr.id "cannot update") rr.modified rr.valid ]
|
||||
, HH.td_ [ Bulma.btn_delete (\_ -> DeleteRRModal rr.id) ]
|
||||
]
|
||||
@ -643,13 +658,13 @@ render_srv_records records
|
||||
table_content = HH.tbody_ $ map row records
|
||||
|
||||
row rr = HH.tr_ $
|
||||
[ HH.td_ [ Bulma.input_domain ((UpdateLocalSRVForm rr.id) <<< Update_SRV_Domain ) rr.domain rr.valid ]
|
||||
, HH.td_ [ Bulma.input_ttl ((UpdateLocalSRVForm rr.id) <<< Update_SRV_TTL ) rr.ttl rr.valid ]
|
||||
, HH.td_ [ Bulma.input_priority ((UpdateLocalSRVForm rr.id) <<< Update_SRV_Priority) rr.priority rr.valid ]
|
||||
, HH.td_ [ Bulma.input_protocol ((UpdateLocalSRVForm rr.id) <<< Update_SRV_Protocol) rr.protocol rr.valid ]
|
||||
, HH.td_ [ Bulma.input_weight ((UpdateLocalSRVForm rr.id) <<< Update_SRV_Weight ) rr.weight rr.valid ]
|
||||
, HH.td_ [ Bulma.input_port ((UpdateLocalSRVForm rr.id) <<< Update_SRV_Port ) rr.port rr.valid ]
|
||||
, HH.td_ [ Bulma.input_value ((UpdateLocalSRVForm rr.id) <<< Update_SRV_Value ) rr.value rr.valid ]
|
||||
[ HH.td_ [ Bulma.input_domain ((UpdateLocalForm rr.id) <<< Update_Local_Form_SRVRR <<< Update_SRV_Domain ) rr.domain rr.valid ]
|
||||
, HH.td_ [ Bulma.input_ttl ((UpdateLocalForm rr.id) <<< Update_Local_Form_SRVRR <<< Update_SRV_TTL ) rr.ttl rr.valid ]
|
||||
, HH.td_ [ Bulma.input_priority ((UpdateLocalForm rr.id) <<< Update_Local_Form_SRVRR <<< Update_SRV_Priority) rr.priority rr.valid ]
|
||||
, HH.td_ [ Bulma.input_protocol ((UpdateLocalForm rr.id) <<< Update_Local_Form_SRVRR <<< Update_SRV_Protocol) rr.protocol rr.valid ]
|
||||
, HH.td_ [ Bulma.input_weight ((UpdateLocalForm rr.id) <<< Update_Local_Form_SRVRR <<< Update_SRV_Weight ) rr.weight rr.valid ]
|
||||
, HH.td_ [ Bulma.input_port ((UpdateLocalForm rr.id) <<< Update_Local_Form_SRVRR <<< Update_SRV_Port ) rr.port rr.valid ]
|
||||
, HH.td_ [ Bulma.input_value ((UpdateLocalForm rr.id) <<< Update_Local_Form_SRVRR <<< Update_SRV_Value ) rr.value rr.valid ]
|
||||
, HH.td_ [ Bulma.btn_change (SyncRR rr.id) (TellSomethingWentWrong rr.id "cannot update") rr.modified rr.valid ]
|
||||
, HH.td_ [ Bulma.btn_delete (\_ -> DeleteRRModal rr.id) ]
|
||||
]
|
||||
@ -681,16 +696,16 @@ render_new_record_column_simple rr
|
||||
= Bulma.column_ $ [ Bulma.box
|
||||
[ Bulma.zone_rr_title "NS, A, AAAA, CNAME, TXT"
|
||||
, type_selection
|
||||
, Bulma.box_input_domain (UpdateNewSRRForm <<< Update_SRR_Domain) rr.domain rr.valid
|
||||
, Bulma.box_input_ttl (UpdateNewSRRForm <<< Update_SRR_TTL) rr.ttl rr.valid
|
||||
, Bulma.box_input_value (UpdateNewSRRForm <<< Update_SRR_Value) rr.value rr.valid
|
||||
, Bulma.btn_add AddSRR (TellSomethingWentWrong rr.id "cannot add") rr.valid
|
||||
, Bulma.box_input_domain (UpdateNewForm <<< Update_New_Form_SRR <<< Update_SRR_Domain) rr.domain rr.valid
|
||||
, Bulma.box_input_ttl (UpdateNewForm <<< Update_New_Form_SRR <<< Update_SRR_TTL) rr.ttl rr.valid
|
||||
, Bulma.box_input_value (UpdateNewForm <<< Update_New_Form_SRR <<< Update_SRR_Value) rr.value rr.valid
|
||||
, Bulma.btn_add (AddRR Add_SRR) (TellSomethingWentWrong rr.id "cannot add") rr.valid
|
||||
]
|
||||
]
|
||||
where
|
||||
-- type_selection :: forall w i. HH.HTML w i
|
||||
type_selection = HH.select
|
||||
[ HE.onSelectedIndexChange (UpdateNewSRRForm <<< Update_SRR_Type) ]
|
||||
[ HE.onSelectedIndexChange (UpdateNewForm <<< Update_New_Form_SRR <<< Update_SRR_Type) ]
|
||||
$ map type_option baseRecords
|
||||
type_option n
|
||||
= HH.option
|
||||
@ -703,11 +718,11 @@ render_new_record_colunm_mx :: forall (w :: Type). (MXRR ()) -> HH.HTML w Action
|
||||
render_new_record_colunm_mx rr
|
||||
= Bulma.column_ $ [ Bulma.box
|
||||
[ Bulma.zone_rr_title "MX"
|
||||
, Bulma.box_input_domain (UpdateNewMXForm <<< Update_MX_Domain) rr.domain rr.valid
|
||||
, Bulma.box_input_ttl (UpdateNewMXForm <<< Update_MX_TTL) rr.ttl rr.valid
|
||||
, Bulma.box_input_priority (UpdateNewMXForm <<< Update_MX_Priority) rr.priority rr.valid
|
||||
, Bulma.box_input_value (UpdateNewMXForm <<< Update_MX_Value) rr.value rr.valid
|
||||
, Bulma.btn_add AddMX (TellSomethingWentWrong rr.id "cannot add") rr.valid
|
||||
, Bulma.box_input_domain (UpdateNewForm <<< Update_New_Form_MXRR <<< Update_MX_Domain) rr.domain rr.valid
|
||||
, Bulma.box_input_ttl (UpdateNewForm <<< Update_New_Form_MXRR <<< Update_MX_TTL) rr.ttl rr.valid
|
||||
, Bulma.box_input_priority (UpdateNewForm <<< Update_New_Form_MXRR <<< Update_MX_Priority) rr.priority rr.valid
|
||||
, Bulma.box_input_value (UpdateNewForm <<< Update_New_Form_MXRR <<< Update_MX_Value) rr.value rr.valid
|
||||
, Bulma.btn_add (AddRR Add_MXRR) (TellSomethingWentWrong rr.id "cannot add") rr.valid
|
||||
]
|
||||
]
|
||||
|
||||
@ -715,14 +730,14 @@ render_new_record_colunm_srv :: forall (w :: Type). (SRVRR ()) -> HH.HTML w Acti
|
||||
render_new_record_colunm_srv rr
|
||||
= Bulma.column_ $ [ Bulma.box
|
||||
[ Bulma.zone_rr_title "SRV"
|
||||
, Bulma.box_input_domain (UpdateNewSRVForm <<< Update_SRV_Domain) rr.domain rr.valid
|
||||
, Bulma.box_input_ttl (UpdateNewSRVForm <<< Update_SRV_TTL) rr.ttl rr.valid
|
||||
, Bulma.box_input_priority (UpdateNewSRVForm <<< Update_SRV_Priority) rr.priority rr.valid
|
||||
, Bulma.box_input_protocol (UpdateNewSRVForm <<< Update_SRV_Protocol) rr.protocol rr.valid
|
||||
, Bulma.box_input_weight (UpdateNewSRVForm <<< Update_SRV_Weight) rr.weight rr.valid
|
||||
, Bulma.box_input_port (UpdateNewSRVForm <<< Update_SRV_Port) rr.port rr.valid
|
||||
, Bulma.box_input_value (UpdateNewSRVForm <<< Update_SRV_Value) rr.value rr.valid
|
||||
, Bulma.btn_add AddSRV (TellSomethingWentWrong rr.id "cannot add") rr.valid
|
||||
, Bulma.box_input_domain (UpdateNewForm <<< Update_New_Form_SRVRR <<< Update_SRV_Domain) rr.domain rr.valid
|
||||
, Bulma.box_input_ttl (UpdateNewForm <<< Update_New_Form_SRVRR <<< Update_SRV_TTL) rr.ttl rr.valid
|
||||
, Bulma.box_input_priority (UpdateNewForm <<< Update_New_Form_SRVRR <<< Update_SRV_Priority) rr.priority rr.valid
|
||||
, Bulma.box_input_protocol (UpdateNewForm <<< Update_New_Form_SRVRR <<< Update_SRV_Protocol) rr.protocol rr.valid
|
||||
, Bulma.box_input_weight (UpdateNewForm <<< Update_New_Form_SRVRR <<< Update_SRV_Weight) rr.weight rr.valid
|
||||
, Bulma.box_input_port (UpdateNewForm <<< Update_New_Form_SRVRR <<< Update_SRV_Port) rr.port rr.valid
|
||||
, Bulma.box_input_value (UpdateNewForm <<< Update_New_Form_SRVRR <<< Update_SRV_Value) rr.value rr.valid
|
||||
, Bulma.btn_add (AddRR Add_SRVRR) (TellSomethingWentWrong rr.id "cannot add") rr.valid
|
||||
]
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user