From b7342f6b7f50d139e2b50e94e0a86d0c5479c7bb Mon Sep 17 00:00:00 2001 From: ddelpiano Date: Mon, 20 May 2024 11:06:27 +0200 Subject: [PATCH] Fixing import state application, the mininimize helper model needs to be reset when the action is triggered --- .../geppetto-client/src/common/layout/LayoutManager.tsx | 3 +-- .../src/common/layout/helpers/MinimizeHelper.tsx | 4 ++++ geppetto.js/geppetto-client/src/common/layout/reducer.ts | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/geppetto.js/geppetto-client/src/common/layout/LayoutManager.tsx b/geppetto.js/geppetto-client/src/common/layout/LayoutManager.tsx index f4d54a5f6..d689ac87a 100644 --- a/geppetto.js/geppetto-client/src/common/layout/LayoutManager.tsx +++ b/geppetto.js/geppetto-client/src/common/layout/LayoutManager.tsx @@ -319,8 +319,8 @@ class LayoutManager { case GeppettoActions.IMPORT_APPLICATION_STATE: { const incomingState = action.data.redux.layout; this.model = FlexLayout.Model.fromJson(incomingState); + this.minimizeHelper = new MinimizeHelper(this.minimizeHelper.getIsMinimizeEnabled(), this.model) this.importSession(action.data.sessions); - nextSetLayout = false; } default: { @@ -332,7 +332,6 @@ class LayoutManager { next(action); } if (nextSetLayout) { - this.fixRowRecursive(this.model._root) next(updateLayout(this.model)); } diff --git a/geppetto.js/geppetto-client/src/common/layout/helpers/MinimizeHelper.tsx b/geppetto.js/geppetto-client/src/common/layout/helpers/MinimizeHelper.tsx index 696ce9b6e..c2a6ff708 100644 --- a/geppetto.js/geppetto-client/src/common/layout/helpers/MinimizeHelper.tsx +++ b/geppetto.js/geppetto-client/src/common/layout/helpers/MinimizeHelper.tsx @@ -24,6 +24,10 @@ export class MinimizeHelper { this.store = null; } + getIsMinimizeEnabled() { + return this.isMinimizeEnabled; + } + setStore(store: Store) { this.store = store; } diff --git a/geppetto.js/geppetto-client/src/common/layout/reducer.ts b/geppetto.js/geppetto-client/src/common/layout/reducer.ts index bd2d36b6e..08f43e10c 100644 --- a/geppetto.js/geppetto-client/src/common/layout/reducer.ts +++ b/geppetto.js/geppetto-client/src/common/layout/reducer.ts @@ -125,7 +125,7 @@ export const widgets = (state: WidgetMap = {}, action) => { // want to restore previous position when activated updatedWidgets[node.getId()].pos = parseInt(i) } - + updatedWidgets[node.getId()].panelName = parent.getId(); if (parent.isMaximized() && node.isVisible()) { updatedWidgets[node.getId()].status = WidgetStatus.MAXIMIZED; @@ -136,9 +136,9 @@ export const widgets = (state: WidgetMap = {}, action) => { } else { updatedWidgets[node.getId()].status = WidgetStatus.HIDDEN; } - } + } } - + return updatedWidgets }