Show errors for both Simple, MX and SRV RR.
This commit is contained in:
parent
b0b0429ace
commit
9b674a9d1e
@ -664,7 +664,7 @@ render_records errors records
|
||||
, HH.td_ [ Bulma.input_domain ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_SRR <<< Update_SRR_Domain) rr.name rr.valid ]
|
||||
, HH.td_ [ Bulma.input_ttl ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_SRR <<< Update_SRR_TTL ) rr.ttl rr.valid ]
|
||||
, HH.td_ [ Bulma.input_target ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_SRR <<< Update_SRR_Target) rr.target rr.valid ]
|
||||
, HH.td_ [ Bulma.btn_change (SaveSRR rr.rrid) (TellSomethingWentWrong rr.rrid "cannot update") rr.modified rr.valid ]
|
||||
, HH.td_ [ Bulma.btn_change (SaveSRR rr.rrid) (TellSomethingWentWrong rr.rrid "cannot update") rr.modified rr.valid ]
|
||||
, HH.td_ [ Bulma.btn_delete (\_ -> DeleteRRModal rr.rrid) ]
|
||||
]
|
||||
] <> error_row rr
|
||||
@ -679,14 +679,14 @@ render_records errors records
|
||||
, HH.td_ []
|
||||
]
|
||||
]
|
||||
where
|
||||
from_error_array_to_td :: Validation.Errors -> Validation.Attribute -> _
|
||||
from_error_array_to_td [] _ = []
|
||||
from_error_array_to_td errors attribute = case A.uncons errors of
|
||||
Just { head: (Tuple attr err), tail: xs } -> if attr == attribute
|
||||
then [Bulma.p err]
|
||||
else from_error_array_to_td xs attribute
|
||||
Nothing -> []
|
||||
|
||||
from_error_array_to_td :: Validation.Errors -> Validation.Attribute -> _
|
||||
from_error_array_to_td [] _ = []
|
||||
from_error_array_to_td errors attribute = case A.uncons errors of
|
||||
Just { head: (Tuple attr err), tail: xs } -> if attr == attribute
|
||||
then [Bulma.p err]
|
||||
else from_error_array_to_td xs attribute
|
||||
Nothing -> []
|
||||
|
||||
|
||||
render_mx_records :: forall (w :: Type) (l :: Row Type)
|
||||
@ -702,16 +702,29 @@ render_mx_records errors records
|
||||
where
|
||||
title_txt = "MX records"
|
||||
table_rr = HH.table [] [ Bulma.mx_table_header, table_content ]
|
||||
table_content = HH.tbody_ $ map row records
|
||||
table_content = HH.tbody_ $ A.concat $ map rows records
|
||||
|
||||
row rr = HH.tr_ $
|
||||
[ HH.td_ [ Bulma.input_domain ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_MXRR <<< Update_MX_Domain) rr.name rr.valid ]
|
||||
, HH.td_ [ Bulma.input_ttl ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_MXRR <<< Update_MX_TTL) rr.ttl rr.valid ]
|
||||
, HH.td_ [ Bulma.input_priority ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_MXRR <<< Update_MX_Priority) rr.priority rr.valid ]
|
||||
, HH.td_ [ Bulma.input_target ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_MXRR <<< Update_MX_Target) rr.target rr.valid ]
|
||||
, HH.td_ [ Bulma.btn_change (SaveMXRR rr.rrid) (TellSomethingWentWrong rr.rrid "cannot update") rr.modified rr.valid ]
|
||||
, HH.td_ [ Bulma.btn_delete (\_ -> DeleteRRModal rr.rrid) ]
|
||||
]
|
||||
rows rr = [ HH.tr_ $
|
||||
[ HH.td_ [ Bulma.input_domain ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_MXRR <<< Update_MX_Domain) rr.name rr.valid ]
|
||||
, HH.td_ [ Bulma.input_ttl ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_MXRR <<< Update_MX_TTL) rr.ttl rr.valid ]
|
||||
, HH.td_ [ Bulma.input_priority ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_MXRR <<< Update_MX_Priority) rr.priority rr.valid ]
|
||||
, HH.td_ [ Bulma.input_target ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_MXRR <<< Update_MX_Target) rr.target rr.valid ]
|
||||
, HH.td_ [ Bulma.btn_change (SaveMXRR rr.rrid) (TellSomethingWentWrong rr.rrid "cannot update") rr.modified rr.valid ]
|
||||
, HH.td_ [ Bulma.btn_delete (\_ -> DeleteRRModal rr.rrid) ]
|
||||
]
|
||||
] <> error_row rr
|
||||
error_row rr = case Hash.lookup rr.rrid errors of
|
||||
Nothing -> []
|
||||
Just error_array ->
|
||||
[ HH.tr_ $
|
||||
[ HH.td_ $ from_error_array_to_td error_array Validation.Name
|
||||
, HH.td_ $ from_error_array_to_td error_array Validation.TTL
|
||||
, HH.td_ $ from_error_array_to_td error_array Validation.Priority
|
||||
, HH.td_ $ from_error_array_to_td error_array Validation.Target
|
||||
, HH.td_ []
|
||||
, HH.td_ []
|
||||
]
|
||||
]
|
||||
|
||||
render_srv_records :: forall (w :: Type) (l :: Row Type)
|
||||
. Hash.HashMap RRId Validation.Errors -> Array (SRVRR l) -> HH.HTML w Action
|
||||
@ -725,19 +738,36 @@ render_srv_records errors records
|
||||
where
|
||||
title_txt = "SRV records"
|
||||
table_rr = HH.table [] [ Bulma.srv_table_header, table_content ]
|
||||
table_content = HH.tbody_ $ map row records
|
||||
table_content = HH.tbody_ $ A.concat $ map rows records
|
||||
|
||||
row rr = HH.tr_ $
|
||||
[ HH.td_ [ Bulma.input_domain ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_SRVRR <<< Update_SRV_Domain ) rr.name rr.valid ]
|
||||
, HH.td_ [ Bulma.input_ttl ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_SRVRR <<< Update_SRV_TTL ) rr.ttl rr.valid ]
|
||||
, HH.td_ [ Bulma.input_priority ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_SRVRR <<< Update_SRV_Priority) rr.priority rr.valid ]
|
||||
, HH.td_ [ Bulma.input_protocol ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_SRVRR <<< Update_SRV_Protocol) rr.protocol rr.valid ]
|
||||
, HH.td_ [ Bulma.input_weight ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_SRVRR <<< Update_SRV_Weight ) rr.weight rr.valid ]
|
||||
, HH.td_ [ Bulma.input_port ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_SRVRR <<< Update_SRV_Port ) rr.port rr.valid ]
|
||||
, HH.td_ [ Bulma.input_target ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_SRVRR <<< Update_SRV_Target ) rr.target rr.valid ]
|
||||
, HH.td_ [ Bulma.btn_change (SaveSRVRR rr.rrid) (TellSomethingWentWrong rr.rrid "cannot update") rr.modified rr.valid ]
|
||||
, HH.td_ [ Bulma.btn_delete (\_ -> DeleteRRModal rr.rrid) ]
|
||||
]
|
||||
rows rr
|
||||
= [ HH.tr_ $
|
||||
[ HH.td_ [ Bulma.input_domain ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_SRVRR <<< Update_SRV_Domain ) rr.name rr.valid ]
|
||||
, HH.td_ [ Bulma.input_ttl ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_SRVRR <<< Update_SRV_TTL ) rr.ttl rr.valid ]
|
||||
, HH.td_ [ Bulma.input_priority ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_SRVRR <<< Update_SRV_Priority) rr.priority rr.valid ]
|
||||
, HH.td_ [ Bulma.input_protocol ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_SRVRR <<< Update_SRV_Protocol) rr.protocol rr.valid ]
|
||||
, HH.td_ [ Bulma.input_weight ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_SRVRR <<< Update_SRV_Weight ) rr.weight rr.valid ]
|
||||
, HH.td_ [ Bulma.input_port ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_SRVRR <<< Update_SRV_Port ) rr.port rr.valid ]
|
||||
, HH.td_ [ Bulma.input_target ((UpdateLocalForm rr.rrid) <<< Update_Local_Form_SRVRR <<< Update_SRV_Target ) rr.target rr.valid ]
|
||||
, HH.td_ [ Bulma.btn_change (SaveSRVRR rr.rrid) (TellSomethingWentWrong rr.rrid "cannot update") rr.modified rr.valid ]
|
||||
, HH.td_ [ Bulma.btn_delete (\_ -> DeleteRRModal rr.rrid) ]
|
||||
]
|
||||
] <> error_row rr
|
||||
error_row rr = case Hash.lookup rr.rrid errors of
|
||||
Nothing -> []
|
||||
Just error_array ->
|
||||
[ HH.tr_ $
|
||||
[ HH.td_ $ from_error_array_to_td error_array Validation.Name
|
||||
, HH.td_ $ from_error_array_to_td error_array Validation.TTL
|
||||
, HH.td_ $ from_error_array_to_td error_array Validation.Priority
|
||||
, HH.td_ $ from_error_array_to_td error_array Validation.Protocol
|
||||
, HH.td_ $ from_error_array_to_td error_array Validation.Weight
|
||||
, HH.td_ $ from_error_array_to_td error_array Validation.Port
|
||||
, HH.td_ $ from_error_array_to_td error_array Validation.Target
|
||||
, HH.td_ []
|
||||
, HH.td_ []
|
||||
]
|
||||
]
|
||||
|
||||
baseRecords :: Array String
|
||||
baseRecords = [ "NS", "A", "AAAA", "CNAME", "TXT" ]
|
||||
|
Loading…
Reference in New Issue
Block a user