Slowly removing Bulma module.

This commit is contained in:
Philippe Pittoli 2025-05-03 03:25:21 +02:00
parent 138488e52c
commit 49fced1992
18 changed files with 572 additions and 569 deletions

View file

@ -45,7 +45,7 @@ module App.Container where
import Prelude (Unit, bind, discard, unit, ($), (=<<), (<>), show, pure, (+), (&&), (>))
import App.Style as Style
import Style as Style
import Data.Array as A
import Data.ArrayBuffer.Types (ArrayBuffer)

View file

@ -15,7 +15,7 @@ import App.Validation.Label as ValidationLabel
import GenericParser.DomainParser.Common (DomainError(..)) as DomainParser
import GenericParser.IPAddress as IPAddress
import App.Style as Style
import Style as Style
error_to_paragraph :: forall w i. ValidationDNS.Error -> HH.HTML w i
error_to_paragraph v = Style.error_message (Style.p $ show_error_title v)

View file

@ -13,7 +13,7 @@ module App.Page.Administration where
import Prelude (Unit, bind, discard, not, pure, show, ($), (<<<), (<>), (=<<), map, (/=), (==), unit)
import Data.Eq (class Eq)
import App.Style as Style
import Style as Style
import Data.Maybe (Maybe(..))
import Data.Array as A

View file

@ -17,7 +17,7 @@ import Halogen.HTML.Events as HE
import Web.Event.Event as Event
import Web.Event.Event (Event)
import App.Style as Style
import Style as Style
import Web.HTML (window) as HTML
import Web.HTML.Window (sessionStorage) as Window

View file

@ -18,7 +18,7 @@ import Data.Array as A
import Data.ArrayBuffer.Types (ArrayBuffer)
import Data.Either (Either(..))
import Data.String (toLower)
import Data.Maybe (Maybe(..), maybe, fromMaybe)
import Data.Maybe (Maybe(..), maybe)
import Data.String.Utils (endsWith)
import Effect.Aff.Class (class MonadAff)
import Halogen as H
@ -27,13 +27,12 @@ import Halogen.HTML.Events as HE
import Halogen.HTML.Events as HHE
import Web.Event.Event as Event
import Web.Event.Event (Event)
import App.Style as Style
import Style as Style
import App.DisplayErrors (error_to_paragraph_label)
import App.Validation.Label as Validation
import CSSClasses as C
import App.Type.DomainInfo
import App.Type.LogMessage (LogMessage(..))
import App.Message.DNSManagerDaemon as DNSManager
@ -200,11 +199,7 @@ render { accepted_domains, my_domains, newDomainForm, askDomainTransferForm, del
render_my_domains =
[ Style.h3 "My domains"
, Style.simple_quote "You are the exclusive owner of the following domains."
, if A.length domains_i_exclusively_own > 0
then Style.table [] [ Style.table_header_owned_domains
, HH.tbody_ $ map owned_domain_row domains_i_exclusively_own
]
else Style.p "No domain yet."
, Style.owned_domains_table domains_i_exclusively_own EnterDomain TransferDomain ShareDomain DeleteDomainModal
]
render_my_shared_domains =
[ Style.h3 "Shared domains"
@ -212,11 +207,7 @@ render { accepted_domains, my_domains, newDomainForm, askDomainTransferForm, del
The following domains are shared with other users.
In case you are the last owner, you can "unshare" it and gain exclusive ownership.
"""
, if A.length domains_i_share > 0
then Style.table [] [ Style.table_header_shared_domains
, HH.tbody_ $ map shared_domain_row domains_i_share
]
else Style.p "No domain yet."
, Style.shared_domains_table domains_i_share EnterDomain UnShareDomain DeleteDomainModal
]
render_new_domain =
[ Style.h3 "New domain"
@ -272,24 +263,6 @@ render { accepted_domains, my_domains, newDomainForm, askDomainTransferForm, del
"""
]
shared_domain_row domain = HH.tr_
[ HH.td_ [ Style.btn domain.name (EnterDomain domain.name) ]
, HH.td_ [ HH.text $ fromMaybe "" domain.share_key ]
, if A.length domain.owners == 1
then HH.td_ [ Style.alert_btn_abbr "Unshare the domain by removing the \"share\" token." "Unshare" (UnShareDomain domain.name) ]
else HH.td_ [ Style.btn_ro [C.is_warning] "Cannot unshare it" ]
, HH.td_ [ Style.alert_btn_abbr "Delete the domain from your list of owned domains. In case you are the only owner, this will also remove all zone data and the domain won't be served anymore." "Delete" (DeleteDomainModal domain.name) ]
]
owned_domain_row domain = HH.tr_
[ HH.td_ [ Style.btn domain.name (EnterDomain domain.name) ]
, case domain.transfer_key of
Just key -> HH.td_ [ Style.p "Token key:", Style.p key ]
Nothing -> HH.td_ [ Style.btn_abbr "Generate a token to transfer the ownership of a domain." "Transfer" (TransferDomain domain.name) ]
, HH.td_ [ Style.btn_abbr "Generate a token to share the ownership of a domain." "Share" (ShareDomain domain.name) ]
, HH.td_ [ Style.alert_btn_abbr "Delete the domain. This will remove all zone data and the domain won't be served anymore." "Delete" (DeleteDomainModal domain.name) ]
]
render_add_domain_form = HH.form
[ HE.onSubmit NewDomainAttempt ]
[ Style.new_domain_field

View file

@ -13,7 +13,7 @@ import Halogen.HTML as HH
import Halogen.HTML.Properties as HP
import CSSClasses as C
import App.Style as Style
import Style as Style
type Input = Unit
type Action = Unit

View file

@ -16,7 +16,7 @@ import Halogen.HTML.Events as HE
import Web.Event.Event as Event
import Web.Event.Event (Event)
import App.Style as Style
import Style as Style
import App.Type.LogMessage
import App.Message.AuthenticationDaemon as AuthD

View file

@ -36,7 +36,7 @@ import Web.Event.Event (Event)
-- import Data.Generic.Rep (class Generic)
-- import Data.Show.Generic (genericShow)
import App.Style as Style
import Style as Style
import Scroll (scrollToTop)
import App.Type.LogMessage

View file

@ -18,7 +18,7 @@ import Halogen.HTML.Properties as HP
import Halogen.HTML.Properties.ARIA as ARIA
import CSSClasses as C
import App.Style as Style
import Style as Style
import App.Type.Pages (Page(..))
import App.Type.LogMessage (LogMessage)

View file

@ -18,7 +18,7 @@ import Web.Event.Event (Event)
import App.Text.Explanations as Explanations
import App.Style as Style
import Style as Style
import CSSClasses as C
import Data.String as S

View file

@ -15,7 +15,7 @@ import Halogen.HTML.Events as HE
import Web.Event.Event as Event
import Web.Event.Event (Event)
import App.Style as Style
import Style as Style
import CSSClasses as C
import App.Type.Email as Email

View file

@ -43,7 +43,7 @@ import Halogen as H
import Halogen.HTML as HH
import Halogen.HTML.Properties as HP
import App.Style as Style
import Style as Style
import CSSClasses as C
import App.Text.Explanations as Explanations

View file

@ -1,526 +0,0 @@
module App.Style
( module Bulma
, alert_btn_abbr
, btn_abbr
, btn_abbr_
, btn_add
, btn_delete
, btn_delete_ro
, btn_modify
, btn_modify_ro
, btn_readonly
, btn_ro
, btn_save
, btn_validation
, btn_validation_
, caa_table_header
, dkim_notes_header
, dkim_table_header
, dmarc_dkim_policy_header
, dmarc_dmarcuri_table_header
, dmarc_policy_header
, dmarc_report_interval_header
, dmarc_report_on_header
, dmarc_sample_rate_header
, dmarc_spf_policy_header
, dmarc_subdom_policy_header
, dmarc_table_header
, email_input
, expire_soa_header
, mechanism_table_header
, minttl_soa_header
, mname_soa_header
, modifier_table_header
, mx_table_header
, name_header
, name_soa_header
, password_input
, password_input_confirmation
, password_input_new
, port_header
, priority_header
, protocol_header
, refresh_soa_header
, retry_soa_header
, rname_soa_header
, serial_soa_header
, simple_table_header
, simple_table_header_ro
, soa_table_header
, spf_table_header
, srv_default_policy_header
, srv_mechanisms_header
, srv_modifiers_header
, srv_table_header
, table_header_owned_domains
, table_header_shared_domains
, target_header
, token_header
, token_input
, ttl_header
, txt_name
, username_input
, weight_header
) where
import Prelude (($), (<>))
import Bulma
import CSSClasses as C
import DOM.HTML.Indexed.AutocompleteType (AutocompleteType(..))
import Halogen.HTML as HH
import Halogen.HTML.Properties as HP
import Halogen.HTML.Events as HE
btn_abbr_ :: forall w action.
Array HH.ClassName -- button classes
-> Array HH.ClassName -- inner div classes
-> String
-> String
-> action
-> HH.HTML w action
btn_abbr_ btnclasses divclasses explanation_ title action
= HH.button
[ HE.onClick \_ -> action
, HP.classes $ [C.button] <> btnclasses
] [ HH.abbr [ HP.title explanation_ ] [ HH.div [ HP.classes divclasses ] [ HH.text title ] ] ]
btn_abbr :: forall w action. String -> String -> action -> HH.HTML w action
btn_abbr explanation_ title action = btn_abbr_ [] [] explanation_ title action
alert_btn_abbr :: forall w action. String -> String -> action -> HH.HTML w action
alert_btn_abbr explanation_ title action = btn_abbr_ [C.is_danger] [] explanation_ title action
btn_modify :: forall w i. i -> HH.HTML w i
btn_modify action = btn_abbr_ [C.is_small, C.is_info] [C.is_size 4] "Edit" "⚒" action
btn_save :: forall w i. i -> HH.HTML w i
btn_save action = btn_ [C.is_info] "Save" action
btn_add :: forall w i. i -> HH.HTML w i
btn_add action = btn_ [C.is_info] "Add" action
btn_delete :: forall w i. i -> HH.HTML w i
btn_delete action = btn_abbr_ [C.is_small, C.is_danger] [C.is_size 4] "Delete" "✖" action
btn_ro :: forall w i. Array HH.ClassName -> String -> HH.HTML w i
btn_ro classes title
= HH.button
[ HP.classes $ [C.button] <> classes
] [ HH.text title ]
btn_modify_ro :: forall w i. HH.HTML w i
btn_modify_ro = btn_ro [C.is_small, C.is_warning] "modify"
btn_readonly :: forall w i. HH.HTML w i
btn_readonly = btn_ro [C.is_small, C.is_warning] "read only"
btn_delete_ro :: forall w i. HH.HTML w i
btn_delete_ro = btn_ro [C.is_small, C.is_warning] "remove"
username_input :: forall w i. String -> String -> (String -> i) -> HH.HTML w i
username_input title value action
= div_field []
[ div_field_label "username" title
, div_field_content $ HH.input
[ HE.onValueInput action
, HP.type_ HP.InputText
, HP.value value
, HP.name "username"
, HP.autocomplete AutocompleteUsername
, HP.placeholder "Username"
, HP.id "username"
, HP.classes input_classes
]
]
email_input :: forall w i. String -> String -> (String -> i) -> HH.HTML w i
email_input title value action
= div_field []
[ div_field_label "email" title
, div_field_content $ HH.input
[ HE.onValueInput action
, HP.type_ HP.InputEmail
, HP.value value
, HP.name "email"
, HP.autocomplete AutocompleteEmail
, HP.placeholder "email@example.com"
, HP.id "email"
, HP.classes input_classes
]
]
password_input :: forall w i. String -> String -> (String -> i) -> HH.HTML w i
password_input title value action
= div_field []
[ div_field_label "password" title
, div_field_content $ HH.input
[ HE.onValueInput action
, HP.type_ HP.InputPassword
, HP.value value
, HP.name "password"
, HP.autocomplete AutocompleteCurrentPassword
, HP.placeholder ""
, HP.id "password"
, HP.classes input_classes
]
]
password_input_new :: forall w i. String -> String -> (String -> i) -> HH.HTML w i
password_input_new title value action
= div_field []
[ div_field_label "password" title
, div_field_content $ HH.input
[ HE.onValueInput action
, HP.type_ HP.InputPassword
, HP.value value
, HP.name "password"
, HP.autocomplete AutocompleteNewPassword
, HP.placeholder ""
, HP.id "password"
, HP.classes input_classes
]
]
password_input_confirmation :: forall w i. String -> String -> (String -> i) -> HH.HTML w i
password_input_confirmation title value action
= div_field []
[ div_field_label "password_confirmation" title
, div_field_content $ HH.input
[ HE.onValueInput action
, HP.type_ HP.InputPassword
, HP.value value
, HP.name "password_confirmation"
, HP.autocomplete AutocompleteOff
, HP.placeholder ""
, HP.id "password_confirmation"
, HP.classes input_classes
]
]
token_input :: forall w i. String -> String -> (String -> i) -> HH.HTML w i
token_input title value action
= div_field []
[ div_field_label "token" title
, div_field_content $ HH.input
[ HE.onValueInput action
, HP.type_ HP.InputText
, HP.value value
, HP.name "token"
, HP.autocomplete AutocompleteOff
, HP.placeholder ""
, HP.id "token"
, HP.classes input_classes
]
]
txt_name :: forall w i. String -> HH.HTML w i
txt_name t
= HH.td [ rr_name_style ] [ rr_name_text ]
where
rr_name_style = HP.style "width: 80px;"
rr_name_text = HH.text t
table_header_owned_domains :: forall w i. HH.HTML w i
table_header_owned_domains
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Name" ]
, HH.th_ [ HH.text "" ]
, HH.th_ [ HH.text "" ]
, HH.th_ [ HH.text "" ]
]
]
table_header_shared_domains :: forall w i. HH.HTML w i
table_header_shared_domains
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Name" ]
, HH.th_ [ HH.text "Share key" ]
, HH.th_ [ HH.text "" ]
, HH.th_ [ HH.text "" ]
]
]
mechanism_table_header :: forall w i. HH.HTML w i
mechanism_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Policy" ]
, HH.th_ [ HH.text "Type" ]
, HH.th_ [ HH.text "Value" ]
, HH.th_ [ HH.text "" ]
]
]
modifier_table_header :: forall w i. HH.HTML w i
modifier_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Type" ]
, HH.th_ [ HH.text "Value" ]
, HH.th_ [ HH.text "" ]
]
]
dmarc_dmarcuri_table_header :: forall w i. HH.HTML w i
dmarc_dmarcuri_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Email address" ]
, HH.th_ [ HH.text "Report size limit" ]
, HH.th_ [ HH.text "" ]
]
]
name_header :: forall w i. HH.HTML w i
name_header = HH.abbr
[ HP.title "Name of the DNS entry, the fully-qualified-domain-name is <name>.<domain>." ]
[ HH.text "Name" ]
ttl_header :: forall w i. HH.HTML w i
ttl_header = HH.abbr
[ HP.title "Time-to-Live, nb seconds before being considered invalid" ]
[ HH.text "TTL" ]
target_header :: forall w i. HH.HTML w i
target_header = HH.abbr
[ HP.title "In the DNS jargon, the target means the most important value associated with the entry, for an A entry it would be an IPv4 address, for example" ]
[ HH.text "Target" ]
token_header :: forall w i. HH.HTML w i
token_header = HH.abbr
[ HP.title "Tokens are used to update the entry, see the tab: \"Tokens? 🤨\"" ]
[ HH.text "Token" ]
priority_header :: forall w i. HH.HTML w i
priority_header = HH.abbr
[ HP.title "A numeric value that indicates the preference of the server (lower values indicate higher priority)" ]
[ HH.text "Priority" ]
weight_header :: forall w i. HH.HTML w i
weight_header = HH.abbr
[ HP.title "A relative weight used when multiple servers have the same priority, determining how often they should be used" ]
[ HH.text "Weight" ]
srv_mechanisms_header :: forall w i. HH.HTML w i
srv_mechanisms_header = HH.abbr
[ HP.title "Mechanisms specify which mail servers are allowed to send mail for the domain and how to evaluate the sending mail servers IP address" ]
[ HH.text "Mechanisms" ]
srv_modifiers_header :: forall w i. HH.HTML w i
srv_modifiers_header = HH.abbr
[ HP.title "Modifiers provide additional instructions, such as explanations for SPF failures or redirecting SPF checks to another domain" ]
[ HH.text "Modifiers" ]
srv_default_policy_header :: forall w i. HH.HTML w i
srv_default_policy_header = HH.abbr
[ HP.title "" ]
[ HH.text "Default Policy" ]
protocol_header :: forall w i. HH.HTML w i
protocol_header = HH.abbr
[ HP.title "The related communication protocol, either TCP or UDP (want more? Just ask me)" ]
[ HH.text "Protocol" ]
port_header :: forall w i. HH.HTML w i
port_header = HH.abbr
[ HP.title "Related connection port" ]
[ HH.text "Port" ]
dkim_notes_header :: forall w i. HH.HTML w i
dkim_notes_header = HH.abbr
[ HP.title "Arbitrary string related to this cryptographic material" ]
[ HH.text "Notes" ]
dmarc_policy_header :: forall w i. HH.HTML w i
dmarc_policy_header = HH.abbr
[ HP.title "How to handle email when SPF and DKIM aren't valid?" ]
[ HH.text "Policy" ]
dmarc_subdom_policy_header :: forall w i. HH.HTML w i
dmarc_subdom_policy_header = HH.abbr
[ HP.title "How to handle email when SPF and DKIM aren't valid?" ]
[ HH.text "Subdomain Policy" ]
dmarc_dkim_policy_header :: forall w i. HH.HTML w i
dmarc_dkim_policy_header = HH.abbr
[ HP.title "What should be considered acceptable to do with an email not conforming with DKIM" ]
[ HH.text "DKIM Policy" ]
dmarc_spf_policy_header :: forall w i. HH.HTML w i
dmarc_spf_policy_header = HH.abbr
[ HP.title "What should be considered acceptable to do with an email not conforming with SPF" ]
[ HH.text "SPF Policy" ]
dmarc_sample_rate_header :: forall w i. HH.HTML w i
dmarc_sample_rate_header = HH.abbr
[ HP.title "Percentage of messages subjected to the requested policy [0-100]" ]
[ HH.text "Sample Rate" ]
dmarc_report_on_header :: forall w i. HH.HTML w i
dmarc_report_on_header = HH.abbr
[ HP.title "What error should be reported? DKIM, SPF, Both, Any or None?" ]
[ HH.text "Report on" ]
dmarc_report_interval_header :: forall w i. HH.HTML w i
dmarc_report_interval_header = HH.abbr
[ HP.title "Minimal duration between two DMARC reports (in seconds)" ]
[ HH.text "Report interval" ]
simple_table_header :: forall w i. HH.HTML w i
simple_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Type" ]
, HH.th_ [ name_header ]
, HH.th_ [ ttl_header ]
, HH.th_ [ target_header ]
, HH.th_ [ HH.text "" ]
, HH.th_ [ token_header ]
]
]
simple_table_header_ro :: forall w i. HH.HTML w i
simple_table_header_ro
= HH.thead_ [ HH.tr [ HP.classes [C.has_background_warning_light] ]
[ HH.th [ HP.style "width: 50px;" ] [ HH.text "Type" ]
, HH.th_ [ name_header ]
, HH.th_ [ ttl_header ]
, HH.th_ [ target_header ]
, HH.th_ [ HH.text "" ]
]
]
mx_table_header :: forall w i. HH.HTML w i
mx_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ name_header ]
, HH.th_ [ ttl_header ]
, HH.th_ [ priority_header ]
, HH.th_ [ target_header ]
, HH.th_ [ HH.text "" ]
]
]
caa_table_header :: forall w i. HH.HTML w i
caa_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ name_header ]
, HH.th_ [ ttl_header ]
, HH.th_ [ HH.text "Flag" ]
, HH.th_ [ HH.text "Tag" ]
, HH.th_ [ HH.text "Value" ]
, HH.th_ [ HH.text "" ]
]
]
srv_table_header :: forall w i. HH.HTML w i
srv_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ name_header ]
, HH.th_ [ protocol_header ]
, HH.th_ [ target_header ]
, HH.th_ [ port_header ]
, HH.th_ [ ttl_header ]
, HH.th_ [ priority_header ]
, HH.th_ [ weight_header ]
, HH.th_ [ HH.text "" ]
]
]
spf_table_header :: forall w i. HH.HTML w i
spf_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ name_header ]
, HH.th_ [ ttl_header ]
-- , HH.th_ [ HH.text "Version" ] -- For now, version isn't displayed.
, HH.th_ [ srv_mechanisms_header ]
, HH.th_ [ srv_modifiers_header ]
, HH.th_ [ srv_default_policy_header ]
, HH.th_ [ HH.text "" ]
]
]
dkim_table_header :: forall w i. HH.HTML w i
dkim_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ name_header ]
, HH.th_ [ ttl_header ]
-- , HH.th_ [ HH.text "Version" ] -- For now, version isn't displayed. Assume DKIM1.
, HH.th_ [ HH.text "Hash algo" ]
, HH.th_ [ HH.text "Signature algo" ]
, HH.th_ [ HH.text "Public Key" ]
, HH.th_ [ dkim_notes_header ]
, HH.th_ [ HH.text "" ]
]
]
dmarc_table_header :: forall w i. HH.HTML w i
dmarc_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ name_header ]
, HH.th_ [ ttl_header ]
-- , HH.th_ [ HH.text "Version" ] -- For now, version isn't displayed. Assume DMARC1.
, HH.th_ [ dmarc_policy_header ] -- p
, HH.th_ [ dmarc_subdom_policy_header ] -- sp
, HH.th_ [ dmarc_dkim_policy_header ] -- adkim
, HH.th_ [ dmarc_spf_policy_header ] -- aspf
, HH.th_ [ dmarc_sample_rate_header ] -- pct
, HH.th_ [ dmarc_report_on_header ] -- fo
, HH.th_ [ dmarc_report_interval_header ] -- ri
-- TODO? rua & ruf
-- , HH.th_ [ HH.text "Accepted report formats" ] -- For now, assume AFRF.
, HH.th_ [ HH.text "" ]
]
]
name_soa_header :: forall w i. HH.HTML w i
name_soa_header = HH.abbr
[ HP.title "Your actual domain name (technical term: \"fully qualified domain name\")." ]
[ HH.text "Name" ]
mname_soa_header :: forall w i. HH.HTML w i
mname_soa_header = HH.abbr
[ HP.title "Domain name of the primary authoritative DNS server for the zone (SOA \"MNAME\" field)." ]
[ HH.text "Primary NS" ]
rname_soa_header :: forall w i. HH.HTML w i
rname_soa_header = HH.abbr
[ HP.title "The email address of the person responsible for managing the zone (the \"@\" is replaced by \".\" for some reason). This is the SOA \"RNAME\" field." ]
[ HH.text "Contact" ]
serial_soa_header :: forall w i. HH.HTML w i
serial_soa_header = HH.abbr
[ HP.title "A number that is incremented every time the zone is updated. Secondary DNS servers use this number to check for updates." ]
[ HH.text "Serial" ]
refresh_soa_header :: forall w i. HH.HTML w i
refresh_soa_header = HH.abbr
[ HP.title "The interval (in seconds) at which secondary DNS servers should check the primary server for changes to the zone." ]
[ HH.text "Refresh" ]
retry_soa_header :: forall w i. HH.HTML w i
retry_soa_header = HH.abbr
[ HP.title "The time in seconds that secondary servers should wait before retrying a failed attempt to contact the primary DNS server." ]
[ HH.text "Retry" ]
expire_soa_header :: forall w i. HH.HTML w i
expire_soa_header = HH.abbr
[ HP.title "The time in seconds that secondary DNS servers will keep the zone data before discarding it if they cannot contact the primary server." ]
[ HH.text "Expire" ]
minttl_soa_header :: forall w i. HH.HTML w i
minttl_soa_header = HH.abbr
[ HP.title "The minimum time (in seconds) that other DNS servers should cache negative responses (e.g., for non-existent domain names)." ]
[ HH.text "Minimum TTL" ]
soa_table_header :: forall w i. HH.HTML w i
soa_table_header
= HH.thead_ [ HH.tr [ HP.classes [C.has_background_warning_light] ]
[ HH.th_ [ name_soa_header ]
, HH.th_ [ ttl_header ]
, HH.th_ [ mname_soa_header ]
, HH.th_ [ rname_soa_header ]
, HH.th_ [ serial_soa_header ]
, HH.th_ [ refresh_soa_header ]
, HH.th_ [ retry_soa_header ]
, HH.th_ [ expire_soa_header ]
, HH.th_ [ minttl_soa_header ]
]
]
btn_validation_ :: forall w i. String -> HH.HTML w i
btn_validation_ str = HH.button
-- [ HP.style "padding: 0.5rem 1.25rem;"
[ HP.type_ HP.ButtonSubmit
, HP.classes [C.button, C.is_primary]
]
[ HH.text str ]
btn_validation :: forall w i. HH.HTML w i
btn_validation = btn_validation_ "Validate"

View file

@ -1,7 +1,7 @@
module App.Text.Explanations where
import Halogen.HTML as HH
import Halogen.HTML.Properties as HP
import App.Style as Style
import Style as Style
import CSSClasses as C
expl' :: forall w i. String -> HH.HTML w i

23
src/Style.purs Normal file
View file

@ -0,0 +1,23 @@
module Style
( module Bulma
, module Style.Button
, module Style.Input
, module Style.Table
, txt_name
) where
import Style.Button
import Style.Input
import Style.Table
import Bulma
import Halogen.HTML as HH
import Halogen.HTML.Properties as HP
txt_name :: forall w i. String -> HH.HTML w i
txt_name t
= HH.td [ rr_name_style ] [ rr_name_text ]
where
rr_name_style = HP.style "width: 80px;"
rr_name_text = HH.text t

80
src/Style/Button.purs Normal file
View file

@ -0,0 +1,80 @@
module Style.Button
( alert_btn_abbr
, btn_abbr
, btn_abbr_
, btn_add
, btn_delete
, btn_delete_ro
, btn_modify
, btn_modify_ro
, btn_readonly
, btn_ro
, btn_save
, btn_validation
, btn_validation_
) where
import Prelude (($), (<>))
import Bulma as Bulma
import CSSClasses as C
import Halogen.HTML as HH
import Halogen.HTML.Properties as HP
import Halogen.HTML.Events as HE
btn_abbr_ :: forall w action.
Array HH.ClassName -- button classes
-> Array HH.ClassName -- inner div classes
-> String
-> String
-> action
-> HH.HTML w action
btn_abbr_ btnclasses divclasses explanation_ title action
= HH.button
[ HE.onClick \_ -> action
, HP.classes $ [C.button] <> btnclasses
] [ HH.abbr [ HP.title explanation_ ] [ HH.div [ HP.classes divclasses ] [ HH.text title ] ] ]
btn_abbr :: forall w action. String -> String -> action -> HH.HTML w action
btn_abbr explanation_ title action = btn_abbr_ [] [] explanation_ title action
alert_btn_abbr :: forall w action. String -> String -> action -> HH.HTML w action
alert_btn_abbr explanation_ title action = btn_abbr_ [C.is_danger] [] explanation_ title action
btn_modify :: forall w i. i -> HH.HTML w i
btn_modify action = btn_abbr_ [C.is_small, C.is_info] [C.is_size 4] "Edit" "⚒" action
btn_save :: forall w i. i -> HH.HTML w i
btn_save action = Bulma.btn_ [C.is_info] "Save" action
btn_add :: forall w i. i -> HH.HTML w i
btn_add action = Bulma.btn_ [C.is_info] "Add" action
btn_delete :: forall w i. i -> HH.HTML w i
btn_delete action = btn_abbr_ [C.is_small, C.is_danger] [C.is_size 4] "Delete" "✖" action
btn_ro :: forall w i. Array HH.ClassName -> String -> HH.HTML w i
btn_ro classes title
= HH.button
[ HP.classes $ [C.button] <> classes
] [ HH.text title ]
btn_modify_ro :: forall w i. HH.HTML w i
btn_modify_ro = btn_ro [C.is_small, C.is_warning] "modify"
btn_readonly :: forall w i. HH.HTML w i
btn_readonly = btn_ro [C.is_small, C.is_warning] "read only"
btn_delete_ro :: forall w i. HH.HTML w i
btn_delete_ro = btn_ro [C.is_small, C.is_warning] "remove"
btn_validation_ :: forall w i. String -> HH.HTML w i
btn_validation_ str = HH.button
-- [ HP.style "padding: 0.5rem 1.25rem;"
[ HP.type_ HP.ButtonSubmit
, HP.classes [C.button, C.is_primary]
]
[ HH.text str ]
btn_validation :: forall w i. HH.HTML w i
btn_validation = btn_validation_ "Validate"

113
src/Style/Input.purs Normal file
View file

@ -0,0 +1,113 @@
module Style.Input
( email_input
, password_input
, password_input_confirmation
, password_input_new
, token_input
, username_input
) where
import Prelude (($))
import Bulma
import DOM.HTML.Indexed.AutocompleteType (AutocompleteType(..))
import Halogen.HTML as HH
import Halogen.HTML.Properties as HP
import Halogen.HTML.Events as HE
username_input :: forall w i. String -> String -> (String -> i) -> HH.HTML w i
username_input title value action
= div_field []
[ div_field_label "username" title
, div_field_content $ HH.input
[ HE.onValueInput action
, HP.type_ HP.InputText
, HP.value value
, HP.name "username"
, HP.autocomplete AutocompleteUsername
, HP.placeholder "Username"
, HP.id "username"
, HP.classes input_classes
]
]
email_input :: forall w i. String -> String -> (String -> i) -> HH.HTML w i
email_input title value action
= div_field []
[ div_field_label "email" title
, div_field_content $ HH.input
[ HE.onValueInput action
, HP.type_ HP.InputEmail
, HP.value value
, HP.name "email"
, HP.autocomplete AutocompleteEmail
, HP.placeholder "email@example.com"
, HP.id "email"
, HP.classes input_classes
]
]
password_input :: forall w i. String -> String -> (String -> i) -> HH.HTML w i
password_input title value action
= div_field []
[ div_field_label "password" title
, div_field_content $ HH.input
[ HE.onValueInput action
, HP.type_ HP.InputPassword
, HP.value value
, HP.name "password"
, HP.autocomplete AutocompleteCurrentPassword
, HP.placeholder ""
, HP.id "password"
, HP.classes input_classes
]
]
password_input_new :: forall w i. String -> String -> (String -> i) -> HH.HTML w i
password_input_new title value action
= div_field []
[ div_field_label "password" title
, div_field_content $ HH.input
[ HE.onValueInput action
, HP.type_ HP.InputPassword
, HP.value value
, HP.name "password"
, HP.autocomplete AutocompleteNewPassword
, HP.placeholder ""
, HP.id "password"
, HP.classes input_classes
]
]
password_input_confirmation :: forall w i. String -> String -> (String -> i) -> HH.HTML w i
password_input_confirmation title value action
= div_field []
[ div_field_label "password_confirmation" title
, div_field_content $ HH.input
[ HE.onValueInput action
, HP.type_ HP.InputPassword
, HP.value value
, HP.name "password_confirmation"
, HP.autocomplete AutocompleteOff
, HP.placeholder ""
, HP.id "password_confirmation"
, HP.classes input_classes
]
]
token_input :: forall w i. String -> String -> (String -> i) -> HH.HTML w i
token_input title value action
= div_field []
[ div_field_label "token" title
, div_field_content $ HH.input
[ HE.onValueInput action
, HP.type_ HP.InputText
, HP.value value
, HP.name "token"
, HP.autocomplete AutocompleteOff
, HP.placeholder ""
, HP.id "token"
, HP.classes input_classes
]
]

340
src/Style/Table.purs Normal file
View file

@ -0,0 +1,340 @@
module Style.Table
( caa_table_header
, dkim_table_header
, dmarc_dmarcuri_table_header
, dmarc_table_header
, mechanism_table_header
, modifier_table_header
, mx_table_header
, simple_table_header
, simple_table_header_ro
, soa_table_header
, spf_table_header
, srv_table_header
, owned_domains_table
, shared_domains_table
) where
import Prelude (map, ($), (==), (>))
import CSSClasses as C
import Data.Array as A
import Data.Maybe (Maybe(..), fromMaybe)
import Style.Button
import Bulma as Bulma
import Halogen.HTML as HH
import Halogen.HTML.Properties as HP
import App.Type.DomainInfo (DomainInfo)
owned_domains_table :: forall w i. Array DomainInfo -> (String -> i) -> (String -> i) -> (String -> i) -> (String -> i) -> HH.HTML w i
owned_domains_table domains_i_exclusively_own action_enter_domain action_transfer_domain action_share_domain action_delete_domain
= if A.length domains_i_exclusively_own > 0
then Bulma.table [] [ owned_domains_table_header
, HH.tbody_ $ map owned_domain_row domains_i_exclusively_own
]
else Bulma.p "No domain yet."
where
owned_domains_table_header :: HH.HTML w i
owned_domains_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Name" ]
, HH.th_ [ HH.text "" ]
, HH.th_ [ HH.text "" ]
, HH.th_ [ HH.text "" ]
]
]
owned_domain_row domain = HH.tr_
[ HH.td_ [ Bulma.btn domain.name (action_enter_domain domain.name) ]
, case domain.transfer_key of
Just key -> HH.td_ [ Bulma.p "Token key:", Bulma.p key ]
Nothing -> HH.td_ [ btn_abbr "Generate a token to transfer the ownership of a domain." "Transfer" (action_transfer_domain domain.name) ]
, HH.td_ [ btn_abbr "Generate a token to share the ownership of a domain." "Share" (action_share_domain domain.name) ]
, HH.td_ [ alert_btn_abbr "Delete the domain. This will remove all zone data and the domain won't be served anymore." "Delete" (action_delete_domain domain.name) ]
]
shared_domains_table :: forall w i. Array DomainInfo -> (String -> i) -> (String -> i) -> (String -> i) -> HH.HTML w i
shared_domains_table domains_i_share action_enter_domain action_unshare_domain action_delete_domain
= if A.length domains_i_share > 0
then Bulma.table [] [ shared_domains_table_header
, HH.tbody_ $ map shared_domain_row domains_i_share
]
else Bulma.p "No domain yet."
where
shared_domains_table_header :: HH.HTML w i
shared_domains_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Name" ]
, HH.th_ [ HH.text "Share key" ]
, HH.th_ [ HH.text "" ]
, HH.th_ [ HH.text "" ]
]
]
shared_domain_row domain = HH.tr_
[ HH.td_ [ Bulma.btn domain.name (action_enter_domain domain.name) ]
, HH.td_ [ HH.text $ fromMaybe "" domain.share_key ]
, if A.length domain.owners == 1
then HH.td_ [ alert_btn_abbr "Unshare the domain by removing the \"share\" token." "Unshare" (action_unshare_domain domain.name) ]
else HH.td_ [ btn_ro [C.is_warning] "Cannot unshare it" ]
, HH.td_ [ alert_btn_abbr "Delete the domain from your list of owned domains. In case you are the only owner, this will also remove all zone data and the domain won't be served anymore." "Delete" (action_delete_domain domain.name) ]
]
mechanism_table_header :: forall w i. HH.HTML w i
mechanism_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Policy" ]
, HH.th_ [ HH.text "Type" ]
, HH.th_ [ HH.text "Value" ]
, HH.th_ [ HH.text "" ]
]
]
modifier_table_header :: forall w i. HH.HTML w i
modifier_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Type" ]
, HH.th_ [ HH.text "Value" ]
, HH.th_ [ HH.text "" ]
]
]
dmarc_dmarcuri_table_header :: forall w i. HH.HTML w i
dmarc_dmarcuri_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Email address" ]
, HH.th_ [ HH.text "Report size limit" ]
, HH.th_ [ HH.text "" ]
]
]
simple_table_header :: forall w i. HH.HTML w i
simple_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Type" ]
, HH.th_ [ name_header ]
, HH.th_ [ ttl_header ]
, HH.th_ [ target_header ]
, HH.th_ [ HH.text "" ]
, HH.th_ [ token_header ]
]
]
where
token_header :: HH.HTML w i
token_header = HH.abbr
[ HP.title "Tokens are used to update the entry, see the tab: \"Tokens? 🤨\"" ]
[ HH.text "Token" ]
simple_table_header_ro :: forall w i. HH.HTML w i
simple_table_header_ro
= HH.thead_ [ HH.tr [ HP.classes [C.has_background_warning_light] ]
[ HH.th [ HP.style "width: 50px;" ] [ HH.text "Type" ]
, HH.th_ [ name_header ]
, HH.th_ [ ttl_header ]
, HH.th_ [ target_header ]
, HH.th_ [ HH.text "" ]
]
]
mx_table_header :: forall w i. HH.HTML w i
mx_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ name_header ]
, HH.th_ [ ttl_header ]
, HH.th_ [ priority_header ]
, HH.th_ [ target_header ]
, HH.th_ [ HH.text "" ]
]
]
caa_table_header :: forall w i. HH.HTML w i
caa_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ name_header ]
, HH.th_ [ ttl_header ]
, HH.th_ [ HH.text "Flag" ]
, HH.th_ [ HH.text "Tag" ]
, HH.th_ [ HH.text "Value" ]
, HH.th_ [ HH.text "" ]
]
]
srv_table_header :: forall w i. HH.HTML w i
srv_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ name_header ]
, HH.th_ [ protocol_header ]
, HH.th_ [ target_header ]
, HH.th_ [ port_header ]
, HH.th_ [ ttl_header ]
, HH.th_ [ priority_header ]
, HH.th_ [ weight_header ]
, HH.th_ [ HH.text "" ]
]
]
where
weight_header :: HH.HTML w i
weight_header = HH.abbr
[ HP.title "A relative weight used when multiple servers have the same priority, determining how often they should be used" ]
[ HH.text "Weight" ]
spf_table_header :: forall w i. HH.HTML w i
spf_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ name_header ]
, HH.th_ [ ttl_header ]
-- , HH.th_ [ HH.text "Version" ] -- For now, version isn't displayed.
, HH.th_ [ srv_mechanisms_header ]
, HH.th_ [ srv_modifiers_header ]
, HH.th_ [ srv_default_policy_header ]
, HH.th_ [ HH.text "" ]
]
]
where
srv_mechanisms_header :: HH.HTML w i
srv_mechanisms_header = HH.abbr
[ HP.title "Mechanisms specify which mail servers are allowed to send mail for the domain and how to evaluate the sending mail servers IP address" ]
[ HH.text "Mechanisms" ]
srv_modifiers_header :: HH.HTML w i
srv_modifiers_header = HH.abbr
[ HP.title "Modifiers provide additional instructions, such as explanations for SPF failures or redirecting SPF checks to another domain" ]
[ HH.text "Modifiers" ]
srv_default_policy_header :: HH.HTML w i
srv_default_policy_header = HH.abbr
[ HP.title "" ]
[ HH.text "Default Policy" ]
dkim_table_header :: forall w i. HH.HTML w i
dkim_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ name_header ]
, HH.th_ [ ttl_header ]
-- , HH.th_ [ HH.text "Version" ] -- For now, version isn't displayed. Assume DKIM1.
, HH.th_ [ HH.text "Hash algo" ]
, HH.th_ [ HH.text "Signature algo" ]
, HH.th_ [ HH.text "Public Key" ]
, HH.th_ [ dkim_notes_header ]
, HH.th_ [ HH.text "" ]
]
]
where
dkim_notes_header :: HH.HTML w i
dkim_notes_header = HH.abbr
[ HP.title "Arbitrary string related to this cryptographic material" ]
[ HH.text "Notes" ]
dmarc_table_header :: forall w i. HH.HTML w i
dmarc_table_header
= HH.thead_ [ HH.tr_ [ HH.th_ [ name_header ]
, HH.th_ [ ttl_header ]
-- , HH.th_ [ HH.text "Version" ] -- For now, version isn't displayed. Assume DMARC1.
, HH.th_ [ dmarc_policy_header ] -- p
, HH.th_ [ dmarc_subdom_policy_header ] -- sp
, HH.th_ [ dmarc_dkim_policy_header ] -- adkim
, HH.th_ [ dmarc_spf_policy_header ] -- aspf
, HH.th_ [ dmarc_sample_rate_header ] -- pct
, HH.th_ [ dmarc_report_on_header ] -- fo
, HH.th_ [ dmarc_report_interval_header ] -- ri
-- TODO? rua & ruf
-- , HH.th_ [ HH.text "Accepted report formats" ] -- For now, assume AFRF.
, HH.th_ [ HH.text "" ]
]
]
where
dmarc_policy_header :: HH.HTML w i
dmarc_policy_header = HH.abbr
[ HP.title "How to handle email when SPF and DKIM aren't valid?" ]
[ HH.text "Policy" ]
dmarc_subdom_policy_header :: HH.HTML w i
dmarc_subdom_policy_header = HH.abbr
[ HP.title "How to handle email when SPF and DKIM aren't valid?" ]
[ HH.text "Subdomain Policy" ]
dmarc_dkim_policy_header :: HH.HTML w i
dmarc_dkim_policy_header = HH.abbr
[ HP.title "What should be considered acceptable to do with an email not conforming with DKIM" ]
[ HH.text "DKIM Policy" ]
dmarc_spf_policy_header :: HH.HTML w i
dmarc_spf_policy_header = HH.abbr
[ HP.title "What should be considered acceptable to do with an email not conforming with SPF" ]
[ HH.text "SPF Policy" ]
dmarc_sample_rate_header :: HH.HTML w i
dmarc_sample_rate_header = HH.abbr
[ HP.title "Percentage of messages subjected to the requested policy [0-100]" ]
[ HH.text "Sample Rate" ]
dmarc_report_on_header :: HH.HTML w i
dmarc_report_on_header = HH.abbr
[ HP.title "What error should be reported? DKIM, SPF, Both, Any or None?" ]
[ HH.text "Report on" ]
dmarc_report_interval_header :: HH.HTML w i
dmarc_report_interval_header = HH.abbr
[ HP.title "Minimal duration between two DMARC reports (in seconds)" ]
[ HH.text "Report interval" ]
soa_table_header :: forall w i. HH.HTML w i
soa_table_header
= HH.thead_ [ HH.tr [ HP.classes [C.has_background_warning_light] ]
[ HH.th_ [ name_soa_header ]
, HH.th_ [ ttl_header ]
, HH.th_ [ mname_soa_header ]
, HH.th_ [ rname_soa_header ]
, HH.th_ [ serial_soa_header ]
, HH.th_ [ refresh_soa_header ]
, HH.th_ [ retry_soa_header ]
, HH.th_ [ expire_soa_header ]
, HH.th_ [ minttl_soa_header ]
]
]
where
name_soa_header :: HH.HTML w i
name_soa_header = HH.abbr
[ HP.title "Your actual domain name (technical term: \"fully qualified domain name\")." ]
[ HH.text "Name" ]
mname_soa_header :: HH.HTML w i
mname_soa_header = HH.abbr
[ HP.title "Domain name of the primary authoritative DNS server for the zone (SOA \"MNAME\" field)." ]
[ HH.text "Primary NS" ]
rname_soa_header :: HH.HTML w i
rname_soa_header = HH.abbr
[ HP.title "The email address of the person responsible for managing the zone (the \"@\" is replaced by \".\" for some reason). This is the SOA \"RNAME\" field." ]
[ HH.text "Contact" ]
serial_soa_header :: HH.HTML w i
serial_soa_header = HH.abbr
[ HP.title "A number that is incremented every time the zone is updated. Secondary DNS servers use this number to check for updates." ]
[ HH.text "Serial" ]
refresh_soa_header :: HH.HTML w i
refresh_soa_header = HH.abbr
[ HP.title "The interval (in seconds) at which secondary DNS servers should check the primary server for changes to the zone." ]
[ HH.text "Refresh" ]
expire_soa_header :: HH.HTML w i
expire_soa_header = HH.abbr
[ HP.title "The time in seconds that secondary DNS servers will keep the zone data before discarding it if they cannot contact the primary server." ]
[ HH.text "Expire" ]
minttl_soa_header :: HH.HTML w i
minttl_soa_header = HH.abbr
[ HP.title "The minimum time (in seconds) that other DNS servers should cache negative responses (e.g., for non-existent domain names)." ]
[ HH.text "Minimum TTL" ]
retry_soa_header :: HH.HTML w i
retry_soa_header = HH.abbr
[ HP.title "The time in seconds that secondary servers should wait before retrying a failed attempt to contact the primary DNS server." ]
[ HH.text "Retry" ]
name_header :: forall w i. HH.HTML w i
name_header = HH.abbr
[ HP.title "Name of the DNS entry, the fully-qualified-domain-name is <name>.<domain>." ]
[ HH.text "Name" ]
ttl_header :: forall w i. HH.HTML w i
ttl_header = HH.abbr
[ HP.title "Time-to-Live, nb seconds before being considered invalid" ]
[ HH.text "TTL" ]
target_header :: forall w i. HH.HTML w i
target_header = HH.abbr
[ HP.title "In the DNS jargon, the target means the most important value associated with the entry, for an A entry it would be an IPv4 address, for example" ]
[ HH.text "Target" ]
priority_header :: forall w i. HH.HTML w i
priority_header = HH.abbr
[ HP.title "A numeric value that indicates the preference of the server (lower values indicate higher priority)" ]
[ HH.text "Priority" ]
protocol_header :: forall w i. HH.HTML w i
protocol_header = HH.abbr
[ HP.title "The related communication protocol, either TCP or UDP (want more? Just ask me)" ]
[ HH.text "Protocol" ]
port_header :: forall w i. HH.HTML w i
port_header = HH.abbr
[ HP.title "Related connection port" ]
[ HH.text "Port" ]