From bfe17c2db9c9186b106d8b55fe6283ab7be78294 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Tue, 29 Jun 2021 16:45:55 +0300 Subject: [PATCH] UI: Fixed not updated dashboard URL, after updated a current dashboard state --- .../states/entity-state-controller.component.ts | 8 ++++---- .../dashboard-page/states/state-controller.component.ts | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/states/entity-state-controller.component.ts b/ui-ngx/src/app/modules/home/components/dashboard-page/states/entity-state-controller.component.ts index e399e74529..1891f5246e 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/states/entity-state-controller.component.ts +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/states/entity-state-controller.component.ts @@ -275,15 +275,15 @@ export class EntityStateControllerComponent extends StateControllerComponent imp } private gotoState(stateId: string, update: boolean, openRightLayout?: boolean) { - update = update && this.dashboardCtrl.dashboardCtx.state !== stateId; + const isStateIdChanged = this.dashboardCtrl.dashboardCtx.state !== stateId; this.dashboardCtrl.openDashboardState(stateId, openRightLayout); this.mobileService.handleDashboardStateName(this.getStateName(this.stateObject.length - 1)); if (update) { - this.updateLocation(); + this.updateLocation(isStateIdChanged); } } - private updateLocation() { + private updateLocation(isStateIdChanged: boolean) { if (this.stateObject[this.stateObject.length - 1].id) { let newState; if (this.isDefaultState()) { @@ -291,7 +291,7 @@ export class EntityStateControllerComponent extends StateControllerComponent imp } else { newState = objToBase64URI(this.stateObject); } - this.updateStateParam(newState); + this.updateStateParam(newState, !isStateIdChanged); } } diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/states/state-controller.component.ts b/ui-ngx/src/app/modules/home/components/dashboard-page/states/state-controller.component.ts index 428624c881..f888264d8d 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/states/state-controller.component.ts +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/states/state-controller.component.ts @@ -126,7 +126,7 @@ export abstract class StateControllerComponent implements IStateControllerCompon this.rxSubscriptions.length = 0; } - protected updateStateParam(newState: string) { + protected updateStateParam(newState: string, replaceCurrentHistoryUrl = false) { this.currentState = newState; if (this.syncStateWithQueryParam) { const queryParams: Params = {state: this.currentState}; @@ -137,6 +137,7 @@ export abstract class StateControllerComponent implements IStateControllerCompon relativeTo: this.route, queryParams, queryParamsHandling: 'merge', + replaceUrl: replaceCurrentHistoryUrl }); }); }