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

View File

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