Skip to content

Commit

Permalink
Merge pull request #1011 from ds-wizard/hotfix/4.0.2
Browse files Browse the repository at this point in the history
Hotfix 4.0.2
  • Loading branch information
janslifka committed Nov 20, 2023
2 parents e219720 + 6147202 commit 49c28ad
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 15 deletions.
1 change: 0 additions & 1 deletion engine-wizard/elm/Wizard/Common/Menu/Msgs.elm
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ type Msg
| GetElement String
| GotElement String (Result Dom.Error Dom.Element)
| HideElement String
| OpenAppSwitcherLink String
4 changes: 0 additions & 4 deletions engine-wizard/elm/Wizard/Common/Menu/Update.elm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module Wizard.Common.Menu.Update exposing (update)

import ActionResult exposing (ActionResult(..))
import Browser.Dom as Dom
import Browser.Navigation as Navigation
import Dict
import Gettext exposing (gettext)
import Shared.Api.BuildInfo as BuildInfoApi
Expand Down Expand Up @@ -92,9 +91,6 @@ update wrapMsg msg appState model =
HideElement elementId ->
( { model | submenuPositions = Dict.remove elementId model.submenuPositions }, Cmd.none )

OpenAppSwitcherLink url ->
( model, Navigation.load url )


loadBuildInfo : (Msg -> Wizard.Msgs.Msg) -> AppState -> Cmd Wizard.Msgs.Msg
loadBuildInfo wrapMsg appState =
Expand Down
2 changes: 1 addition & 1 deletion engine-wizard/elm/Wizard/Common/Menu/View.elm
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ viewLogo model =
in
li []
[ a
[ onClick (Wizard.Msgs.MenuMsg (Wizard.Common.Menu.Msgs.OpenAppSwitcherLink item.url))
[ href item.url
, classList
[ ( "internal", not item.external )
, ( "external", item.external )
Expand Down
22 changes: 15 additions & 7 deletions engine-wizard/elm/Wizard/Update.elm
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,23 @@ update msg model =
case urlRequest of
Browser.Internal url ->
let
nextRoute =
parseLocation model.appState url
isWizardRoute =
String.startsWith "/wizard" url.path
in
case isGuarded nextRoute model of
Just guardMsg ->
( model, Ports.alert guardMsg )
if isWizardRoute then
let
nextRoute =
parseLocation model.appState url
in
case isGuarded nextRoute model of
Just guardMsg ->
( model, Ports.alert guardMsg )

Nothing ->
( model, pushUrl model.appState.key (Url.toString url) )

Nothing ->
( model, pushUrl model.appState.key (Url.toString url) )
else
( model, load (Url.toString url) )

Browser.External url ->
if url == "" then
Expand Down
2 changes: 1 addition & 1 deletion engine-wizard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function loadApp(config, locale, provisioning) {
registerLocalStoragePorts(app)
registerPageUnloadPorts(app)
registerRefreshPorts(app)
registerSessionPorts(app, sessionKey)
registerSessionPorts(app, sessionKey, ['session/admin'])
registerThemePorts(app)
registerWebsocketPorts(app)
cookies.registerCookiePorts(app)
Expand Down
7 changes: 6 additions & 1 deletion engine-wizard/js/ports/session.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function (app, sessionKey) {
module.exports = function (app, sessionKey, otherSessionKeys) {
app.ports.storeSession.subscribe(storeSession);
app.ports.clearSession.subscribe(clearSession);
app.ports.clearSessionAndReload.subscribe(clearSessionAndReload);
Expand All @@ -11,6 +11,11 @@ module.exports = function (app, sessionKey) {

function clearSession() {
localStorage.removeItem(sessionKey);
if (otherSessionKeys) {
otherSessionKeys.forEach(function (otherSessionKey) {
localStorage.removeItem(otherSessionKey)
})
}
}


Expand Down

0 comments on commit 49c28ad

Please sign in to comment.