From cd89d77d9fa6ef7e87b2f277ff2a00bc56e2aa5e Mon Sep 17 00:00:00 2001 From: James Hillyerd Date: Mon, 18 Feb 2019 12:51:49 -0800 Subject: [PATCH] ui: Unknown routes redirect to Home --- ui/src/Main.elm | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ui/src/Main.elm b/ui/src/Main.elm index 87a17ae..00cd708 100644 --- a/ui/src/Main.elm +++ b/ui/src/Main.elm @@ -245,17 +245,6 @@ changeRouteTo route model = { model | layout = Layout.reset model.layout } in case route of - Route.Unknown path -> - let - flash = - { title = "Unknown route requested" - , table = [ ( "Path", path ) ] - } - in - ( applyToModelSession (Session.showFlash flash) newModel - , Cmd.none - ) - Route.Home -> Home.init session |> updateWith Home HomeMsg newModel @@ -276,7 +265,7 @@ changeRouteTo route model = else let flash = - { title = "Unknown route requested" + { title = "Disabled route requested" , table = [ ( "Error", "Monitor disabled by configuration." ) ] } in @@ -288,6 +277,17 @@ changeRouteTo route model = Status.init session |> updateWith Status StatusMsg newModel + Route.Unknown path -> + -- Unknown routes display Home with an error flash. + let + flash = + { title = "Unknown route requested" + , table = [ ( "Path", path ) ] + } + in + Home.init (Session.showFlash flash session) + |> updateWith Home HomeMsg newModel + getSession : Model -> Session getSession model =