Philippe Pittoli 2023-07-04 03:11:02 +02:00
parent 6d4268820d
commit 7c9f5a7a56
2 changed files with 9 additions and 10 deletions

View File

@ -75,17 +75,17 @@ render state
render_logs = Bulma.box [ HH.slot_ _log unit Log.component unit ] render_logs = Bulma.box [ HH.slot_ _log unit Log.component unit ]
render_auth_WS :: forall monad. MonadAff monad => H.ComponentHTML Action ChildSlots monad render_auth_WS :: forall monad. MonadAff monad => H.ComponentHTML Action ChildSlots monad
render_auth_WS = Bulma.box [ HH.slot _ws_auth unit WS.component "ws://127.0.0.1:8080" AuthDEvent ] render_auth_WS = HH.slot _ws_auth unit WS.component "ws://127.0.0.1:8080" AuthDEvent
render_dnsmanager_WS :: forall monad. MonadAff monad => H.ComponentHTML Action ChildSlots monad render_dnsmanager_WS :: forall monad. MonadAff monad => H.ComponentHTML Action ChildSlots monad
render_dnsmanager_WS = Bulma.box $ case state.token of render_dnsmanager_WS = case state.token of
Nothing -> [ Bulma.p "We don't have a token right now." ] Nothing -> Bulma.p "We don't have a token right now."
Just _ -> [ HH.slot _ws_dns unit WS.component "ws://127.0.0.1:8081" DNSManagerDEvent ] Just _ -> HH.slot _ws_dns unit WS.component "ws://127.0.0.1:8081" DNSManagerDEvent
render_auth_form :: forall monad. MonadAff monad => H.ComponentHTML Action ChildSlots monad render_auth_form :: forall monad. MonadAff monad => H.ComponentHTML Action ChildSlots monad
render_auth_form = Bulma.box $ case state.token of render_auth_form = case state.token of
Nothing -> [ HH.slot _af unit AF.component unit OutputAuthComponent ] Nothing -> Bulma.box [ HH.slot _af unit AF.component unit OutputAuthComponent ]
Just current_token -> [ Bulma.p ("Token is: " <> current_token) ] Just current_token -> Bulma.p ("Token is: " <> current_token)
render_authd_admin_interface :: forall monad. MonadAff monad => H.ComponentHTML Action ChildSlots monad render_authd_admin_interface :: forall monad. MonadAff monad => H.ComponentHTML Action ChildSlots monad
render_authd_admin_interface = Bulma.box $ case state.token of render_authd_admin_interface = Bulma.box $ case state.token of

View File

@ -2,9 +2,8 @@ module App.WS where
{- This component handles all WS operations. -} {- This component handles all WS operations. -}
import Prelude (Unit, bind, discard, map, pure, show, void, when, ($), (&&), (<$>), (<>), (>>=), unit) import Prelude (Unit, bind, discard, pure, show, void, when, ($), (&&), (<$>), (<>), (>>=))
import Bulma as Bulma
import Data.Maybe (Maybe(..), isJust, isNothing) import Data.Maybe (Maybe(..), isJust, isNothing)
import Data.String as String import Data.String as String
@ -113,7 +112,7 @@ handleAction action = do
handleAction ConnectWebSocket handleAction ConnectWebSocket
Finalize -> do Finalize -> do
H.raise $ AppendSystemMessage "Finalize" H.raise $ AppendSystemMessage $ "Closing websocket for '" <> wsInfo.url <> "'"
case wsInfo.connection of case wsInfo.connection of
Nothing -> H.raise $ AppendSystemMessage "No socket? How is that even possible?" Nothing -> H.raise $ AppendSystemMessage "No socket? How is that even possible?"
Just socket -> H.liftEffect $ WS.close socket Just socket -> H.liftEffect $ WS.close socket