From ea2160b85777cfe7b585b866b0df53ba3326ef69 Mon Sep 17 00:00:00 2001 From: Philippe PITTOLI Date: Sat, 27 Apr 2024 19:59:00 +0200 Subject: [PATCH] Handle DomainChanged message. --- src/App/Container.purs | 5 +++-- src/App/Page/DomainList.purs | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/App/Container.purs b/src/App/Container.purs index e741bd8..234b4ce 100644 --- a/src/App/Container.purs +++ b/src/App/Container.purs @@ -684,8 +684,9 @@ handleAction = case _ of (DNSManager.MkInvalidZone _) -> do handleAction $ Log $ ErrorLog $ "InvalidZone" handleAction $ AddNotif $ BadNotification $ "The domain zone is invalid." - (DNSManager.MkDomainChanged _) -> do - handleAction $ Log $ ErrorLog $ "DomainChanged" + m@(DNSManager.MkDomainChanged response) -> do + handleAction $ Log $ SystemLog $ "Domain \"" <> response.domain.name <> "\" has been updated." + handleAction $ DispatchDNSMessage m (DNSManager.MkUnknownZone _) -> do handleAction $ Log $ ErrorLog $ "UnknownZone" handleAction $ AddNotif $ BadNotification $ "The domain zone is unknown." diff --git a/src/App/Page/DomainList.purs b/src/App/Page/DomainList.purs index 1e7f466..4aae597 100644 --- a/src/App/Page/DomainList.purs +++ b/src/App/Page/DomainList.purs @@ -405,6 +405,10 @@ handleQuery = case _ of (DNSManager.MkDomainAdded response) -> do { my_domains } <- H.get handleAction $ UpdateMyDomains (my_domains <> [ emptyDomainInfo { name = response.domain } ]) + (DNSManager.MkDomainChanged response) -> do + { my_domains } <- H.get + let new_domains = map (\d -> if d.name == response.domain.name then response.domain else d) my_domains + handleAction $ UpdateMyDomains new_domains (DNSManager.MkDomainDeleted response) -> do { my_domains } <- H.get handleAction $ UpdateMyDomains $ A.filter (\d -> d.name /= response.domain) my_domains