diff --git a/src/App/ZoneInterface.purs b/src/App/ZoneInterface.purs index babc14c..49c8497 100644 --- a/src/App/ZoneInterface.purs +++ b/src/App/ZoneInterface.purs @@ -402,8 +402,8 @@ render state , maybe (Bulma.p "no mechanism") display_mechanisms state._currentRR.mechanisms , Bulma.box [ Bulma.h3 "New mechanism" - , Bulma.selection SPF_Mechanism_q qualifier_types state.spf_mechanism_q - , Bulma.selection SPF_Mechanism_t mechanism_types state.spf_mechanism_t + , Bulma.selection_field "idMechanismQ" "Policy" SPF_Mechanism_q qualifier_types state.spf_mechanism_q + , Bulma.selection_field "idMechanismT" "Type" SPF_Mechanism_t mechanism_types state.spf_mechanism_t , Bulma.box_input "valueNewMechanismSPF" "Value" "" SPF_Mechanism_v state.spf_mechanism_v @@ -414,7 +414,7 @@ render state , maybe (Bulma.p "no modifier") display_modifiers state._currentRR.modifiers , Bulma.box [ Bulma.h3 "New modifier" - , Bulma.selection SPF_Modifier_t modifier_types state.spf_modifier_t + , Bulma.selection_field "idModifierT" "Modifier" SPF_Modifier_t modifier_types state.spf_modifier_t , Bulma.box_input "valueNewModifierSPF" "Value" "" SPF_Modifier_v state.spf_modifier_v @@ -773,7 +773,7 @@ render_resources records , HH.td_ [ Bulma.p $ maybe "(default)" id rr.v ] , HH.td_ [ Bulma.p $ maybe "" (A.fold <<< A.intersperse " " <<< map show_mechanism) rr.mechanisms ] , HH.td_ [ Bulma.p $ maybe "" (A.fold <<< A.intersperse " " <<< map show_modifier) rr.modifiers ] - , HH.td_ [ Bulma.p $ maybe "" show_qualifier_char rr.q ] + , HH.td_ [ Bulma.p $ maybe "" fancy_qualifier_display rr.q ] , if rr.readonly then HH.td_ [ Bulma.btn_readonly ] else HH.td_ [ Bulma.btn_modify (CreateUpdateRRModal rr.rrid) ] @@ -804,6 +804,9 @@ render_resources records , HH.td_ [ Bulma.btn_delete (DeleteRRModal rr.rrid) ] ] + fancy_qualifier_display :: RR.Qualifier -> String + fancy_qualifier_display qualifier = "(" <> show_qualifier_char qualifier <> ") " <> show_qualifier qualifier + display_mechanisms :: forall w. Array RR.Mechanism -> HH.HTML w Action display_mechanisms ms = Bulma.box_ C.has_background_warning_light @@ -811,7 +814,7 @@ display_mechanisms ms = where render_mechanism_row :: (Tuple Int RR.Mechanism) -> HH.HTML w Action render_mechanism_row (Tuple i m) = HH.tr_ - [ Bulma.txt_name $ "(" <> show i <> ") " <> maybe "" show_qualifier m.q + [ Bulma.txt_name $ maybe "" show_qualifier m.q , HH.td_ [ Bulma.p $ show_mechanism_type m.t ] , HH.td_ [ Bulma.p m.v ] , HH.td_ [ Bulma.alert_btn "x" (SPF_remove_mechanism i) ] diff --git a/src/Bulma.purs b/src/Bulma.purs index 4c5634d..9ff7cd3 100644 --- a/src/Bulma.purs +++ b/src/Bulma.purs @@ -131,7 +131,7 @@ spf_table_header , HH.th_ [ HH.text "Version" ] , HH.th_ [ HH.text "Mechanisms" ] , HH.th_ [ HH.text "Modifiers" ] - , HH.th_ [ HH.text "Qualifier" ] + , HH.th_ [ HH.text "Default Policy" ] , HH.th_ [ HH.text "" ] , HH.th_ [ HH.text "" ] , HH.th_ [ HH.text "" ] @@ -464,6 +464,13 @@ selection action values selected = HH.div [HP.classes $ C.select <> C.is_normal] $ map (\n -> HH.option [HP.value n, HP.selected (n == selected)] [HH.text n]) values ] +selection_field :: forall w i. String -> String -> (Int -> i) -> Array String -> String -> HH.HTML w i +selection_field id title action values selected + = div_field + [ div_field_label id title + , div_field_content $ selection action values selected + ] + tag_light_info :: forall w i. String -> HH.HTML w i tag_light_info str = HH.span [HP.classes (C.tag <> C.is_info <> C.is_light)] [HH.text str]