Show a zone template.

beta
Philippe Pittoli 2023-07-09 05:27:53 +02:00
parent 6ccc1846df
commit 7f08646fda
2 changed files with 11 additions and 5 deletions

View File

@ -13,6 +13,7 @@ import App.Log as Log
import App.WS as WS
import App.AuthenticationDaemonAdminInterface as AAI
import App.DomainListInterface as DomainListInterface
import App.ZoneInterface as ZoneInterface
import App.Messages.DNSManagerDaemon as DNSManager
import Halogen as H
import Halogen.HTML as HH
@ -21,7 +22,7 @@ import Effect.Aff.Class (class MonadAff)
import App.LogMessage (LogMessage(..))
data Page = Home | LoginRegister | DomainList | Zone | AuthAdmin
data Page = Home | LoginRegister | DomainList | Zone String | AuthAdmin
data Action
= AuthenticationComponentEvent AF.Output
@ -46,6 +47,7 @@ type ChildSlots =
, af :: AF.Slot Unit
, aai :: AAI.Slot Unit
, dli :: DomainListInterface.Slot Unit
, zi :: ZoneInterface.Slot Unit
)
_log = Proxy :: Proxy "log"
@ -54,6 +56,7 @@ _ws_dns = Proxy :: Proxy "ws_dns"
_af = Proxy :: Proxy "af"
_aai = Proxy :: Proxy "aai"
_dli = Proxy :: Proxy "dli"
_zi = Proxy :: Proxy "zi"
component :: forall q i o m. MonadAff m => H.Component q i o m
component =
@ -80,7 +83,7 @@ render state
Home -> render_home
LoginRegister -> render_auth_form
DomainList -> render_newdomain_interface
Zone -> render_zone
Zone domain -> render_zone domain
AuthAdmin -> render_authd_admin_interface
, Bulma.columns_ [ Bulma.column_ [ render_logs ], Bulma.column_ [ render_auth_WS, render_dnsmanager_WS ] ]
]
@ -89,8 +92,7 @@ render state
-- TODO
render_home = render_nothing
-- TODO
render_zone = render_nothing
render_zone domain = Bulma.box [ HH.slot_ _zi unit ZoneInterface.component domain ]
authenticated = case state.token of
Nothing -> false
@ -173,6 +175,9 @@ handleAction = case _ of
DomainListInterface.Log message -> H.tell _log unit (Log.Log message)
DomainListInterface.DNSManagerReconnect -> handleAction AuthenticateToDNSManager
DomainListInterface.StoreState s -> H.modify_ _ { store_DomainListInterface_state = Just s }
DomainListInterface.ChangePageZoneInterface domain -> do
handleAction $ Routing $ Zone domain
DomainListInterface.AskState -> do
state <- H.get
H.tell _dli unit (DomainListInterface.ProvideState state.store_DomainListInterface_state)

View File

@ -50,6 +50,7 @@ data Output
= MessageToSend ArrayBuffer
| Log LogMessage
| DNSManagerReconnect
| ChangePageZoneInterface String
| AskState
| StoreState State
@ -258,7 +259,7 @@ handleAction = case _ of
UpdateSelectedDomain domain -> H.modify_ _ { newDomainForm { selected_domain = domain } }
EnterDomain domain -> do
H.raise $ Log $ SimpleLog $ "[???] trying to enter domain: " <> domain
H.raise $ ChangePageZoneInterface domain
DeleteDomainModal domain -> do
H.modify_ _ { active_modal = Just domain }