Display: a lot of small changes.

This commit is contained in:
Philippe Pittoli 2024-03-31 19:52:21 +02:00
parent 4d93cbc79f
commit 83393df37e
4 changed files with 12 additions and 10 deletions

View File

@ -606,7 +606,6 @@ handleAction = case _ of
(AuthD.GotToken msg) -> do (AuthD.GotToken msg) -> do
handleAction $ Log $ SuccessLog $ "Authenticated to authd!" handleAction $ Log $ SuccessLog $ "Authenticated to authd!"
H.modify_ _ { token = Just msg.token } H.modify_ _ { token = Just msg.token }
handleAction $ AddNotif $ GoodNotification "Authenticated!"
handleAction $ ToggleAuthenticated (Just msg.token) handleAction $ ToggleAuthenticated (Just msg.token)
sessionstorage <- H.liftEffect $ Window.sessionStorage =<< HTML.window sessionstorage <- H.liftEffect $ Window.sessionStorage =<< HTML.window
@ -720,10 +719,11 @@ handleAction = case _ of
m@(DNSManager.MkLogged logged_message) -> do m@(DNSManager.MkLogged logged_message) -> do
handleAction $ Log $ SuccessLog $ "Authenticated to dnsmanagerd!" handleAction $ Log $ SuccessLog $ "Authenticated to dnsmanagerd!"
H.tell _nav unit $ NavigationInterface.ToggleAdmin logged_message.admin H.tell _nav unit $ NavigationInterface.ToggleAdmin logged_message.admin
handleAction $ AddNotif $ GoodNotification "You are now authenticated!"
handleAction $ DispatchDNSMessage m handleAction $ DispatchDNSMessage m
m@(DNSManager.MkDomainAdded response) -> do m@(DNSManager.MkDomainAdded response) -> do
handleAction $ Log $ SuccessLog $ "Domain added: " <> response.domain handleAction $ Log $ SuccessLog $ "Domain added: " <> response.domain
handleAction $ AddNotif $ GoodNotification $ "You just registered the domain \"" handleAction $ AddNotif $ GoodNotification $ "You have just registered the domain \""
<> response.domain <> "\"! 🥳 You can now manage it (click on its button)." <> response.domain <> "\"! 🥳 You can now manage it (click on its button)."
handleAction $ DispatchDNSMessage m handleAction $ DispatchDNSMessage m
(DNSManager.MkRRReadOnly response) -> do (DNSManager.MkRRReadOnly response) -> do

View File

@ -87,7 +87,7 @@ show_error_domain e = case e of
_ -> Bulma.p """ _ -> Bulma.p """
The domain (or label) contains invalid characters. The domain (or label) contains invalid characters.
A domain label should start with a letter, A domain label should start with a letter,
then eventually a series of letters, digits and hyphenations ('-'), then eventually a series of letters, digits and hyphenations ("-"),
and must finish with either a letter or a digit. and must finish with either a letter or a digit.
""" """
@ -147,10 +147,10 @@ error_to_paragraph_label v = Bulma.error_message (Bulma.p $ show_error_title_lab
show_error_title_label :: ValidationLabel.Error -> String show_error_title_label :: ValidationLabel.Error -> String
show_error_title_label v = case v of show_error_title_label v = case v of
ValidationLabel.ParsingError x -> case x.error of ValidationLabel.ParsingError x -> case x.error of
Nothing -> "Cannot parse the label (position: " <> show x.position <> ")." Nothing -> "Invalid label"
Just (ValidationLabel.CannotParse _) -> Just (ValidationLabel.CannotParse _) ->
"Cannot parse the label (position: " <> show x.position <> ")." "Invalid label"
Just (ValidationLabel.CannotEntirelyParse) -> "Cannot entirely parse the label." Just (ValidationLabel.CannotEntirelyParse) -> "Invalid label (cannot entirely parse the label)"
Just (ValidationLabel.Size min max n) -> Just (ValidationLabel.Size min max n) ->
"Label size should be between " <> show min <> " and " <> show max "Label size should be between " <> show min <> " and " <> show max
<> " (current size: " <> show n <> ")." <> " (current size: " <> show n <> ")."

View File

@ -348,7 +348,7 @@ handleAction = case _ of
let { login, token, password, confirmation} = newPasswordForm let { login, token, password, confirmation} = newPasswordForm
if A.any (_ == "") [ login, token, password, confirmation ] if A.any (_ == "") [ login, token, password, confirmation ]
then H.raise $ Log $ ErrorLog "All entries are required" then H.raise $ Log $ ErrorLog "All entries are required."
else if password == confirmation else if password == confirmation
then case L.login login, P.password password of then case L.login login, P.password password of
Left errors, _ -> H.modify_ _ { errors = [ Login errors ] } Left errors, _ -> H.modify_ _ { errors = [ Login errors ] }

View File

@ -164,7 +164,9 @@ render { accepted_domains, my_domains, newDomainForm, wsUp, active_modal }
Nothing -> Bulma.columns_ Nothing -> Bulma.columns_
[ Bulma.column_ [ Bulma.h3 "New domain", render_add_domain_form] [ Bulma.column_ [ Bulma.h3 "New domain", render_add_domain_form]
, Bulma.column_ [ Bulma.h3 "My domains" , Bulma.column_ [ Bulma.h3 "My domains"
, HH.ul_ $ map (\domain -> HH.li_ (domain_buttons domain)) my_domains , if A.length my_domains > 0
then HH.ul_ $ map (\domain -> HH.li_ (domain_buttons domain)) $ A.sort my_domains
else Bulma.p "No domain yet."
] ]
] ]
Just domain -> Bulma.modal "Deleting a domain" Just domain -> Bulma.modal "Deleting a domain"
@ -261,7 +263,7 @@ handleAction = case _ of
H.raise $ Log $ SystemLog $ "Add a new domain (" <> new_domain <> ")" H.raise $ Log $ SystemLog $ "Add a new domain (" <> new_domain <> ")"
handleAction $ HandleNewDomainInput $ INP_newdomain "" handleAction $ HandleNewDomainInput $ INP_newdomain ""
_, _ -> _, _ ->
H.raise $ Log $ UnableToSend $ "You didn't enter a valid new domain" H.raise $ Log $ UnableToSend $ "The new domain name is invalid."
handleQuery :: forall a m. MonadAff m => Query a -> H.HalogenM State Action () Output m (Maybe a) handleQuery :: forall a m. MonadAff m => Query a -> H.HalogenM State Action () Output m (Maybe a)
handleQuery = case _ of handleQuery = case _ of
@ -303,7 +305,7 @@ page_reload s1 message =
case message of case message of
DNSManager.MkLogged response -> DNSManager.MkLogged response ->
s1 { accepted_domains = response.accepted_domains s1 { accepted_domains = response.accepted_domains
, my_domains = response.my_domains , my_domains = A.sort response.my_domains
} }
_ -> s1 _ -> s1