Big reconnection button is now working.
parent
db8cd669ae
commit
346a23b8f7
|
@ -129,6 +129,9 @@ data Action
|
|||
-- | then return to the home page.
|
||||
| Disconnection
|
||||
|
||||
-- | Reconnection to both `authd` and `dnsmanagerd`.
|
||||
| Reconnection
|
||||
|
||||
-- | Try to authenticate the user to `dnsmanagerd`.
|
||||
| AuthenticateToDNSManager
|
||||
|
||||
|
@ -271,11 +274,11 @@ render state
|
|||
, Bulma.column_ [ Bulma.level [ render_auth_WS, render_dnsmanager_WS ] [] ] ]
|
||||
]
|
||||
where
|
||||
reconnection_bar :: forall w i. HH.HTML w i
|
||||
reconnection_bar :: forall w. HH.HTML w Action
|
||||
reconnection_bar =
|
||||
if (state.are_we_connected_to_authd && state.are_we_connected_to_dnsmanagerd)
|
||||
then Bulma.p "yay, you're connected"
|
||||
else Bulma.p "OH NOES :("
|
||||
then HH.div_ []
|
||||
else Bulma.btn_ (C.is_large <> C.is_danger) "You are disconnected. Click here to reconnect." Reconnection
|
||||
render_auth_WS :: forall monad. MonadAff monad => H.ComponentHTML Action ChildSlots monad
|
||||
render_auth_WS = HH.slot _ws_auth unit WS.component (Tuple "ws://127.0.0.1:8080" "authd") AuthenticationDaemonEvent
|
||||
|
||||
|
@ -682,6 +685,10 @@ handleAction = case _ of
|
|||
CloseNotif -> do
|
||||
H.modify_ _ { notif = NoNotification }
|
||||
|
||||
Reconnection -> do
|
||||
H.tell _ws_auth unit WS.Connect
|
||||
H.tell _ws_dns unit WS.Connect
|
||||
|
||||
Disconnection -> do
|
||||
handleAction $ Routing Home
|
||||
|
||||
|
|
|
@ -229,6 +229,11 @@ handleQuery = case _ of
|
|||
pure (Just a)
|
||||
-- Sending a keepalive: do not tell the parent to reset the keepalive counter.
|
||||
ToSendKeepAlive message a -> do
|
||||
-- In case a KeepAlive is sent while the connection is down, just ignore it.
|
||||
state <- H.get
|
||||
case state.wsInfo.connection of
|
||||
Nothing -> pure Nothing
|
||||
Just _ -> do
|
||||
send_message message
|
||||
pure (Just a)
|
||||
Connect a -> do
|
||||
|
|
Loading…
Reference in New Issue