Browse Source

Merge pull request #4820 from vvlladd28/improvement/state-controller/update-current-state

UI: Fixed not updated dashboard URL, after updated a current dashboard state
pull/4851/head
Igor Kulikov 5 years ago
committed by GitHub
parent
commit
fc94031c6c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      ui-ngx/src/app/modules/home/components/dashboard-page/states/entity-state-controller.component.ts
  2. 3
      ui-ngx/src/app/modules/home/components/dashboard-page/states/state-controller.component.ts

8
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) { 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.dashboardCtrl.openDashboardState(stateId, openRightLayout);
this.mobileService.handleDashboardStateName(this.getStateName(this.stateObject.length - 1)); this.mobileService.handleDashboardStateName(this.getStateName(this.stateObject.length - 1));
if (update) { if (update) {
this.updateLocation(); this.updateLocation(isStateIdChanged);
} }
} }
private updateLocation() { private updateLocation(isStateIdChanged: boolean) {
if (this.stateObject[this.stateObject.length - 1].id) { if (this.stateObject[this.stateObject.length - 1].id) {
let newState; let newState;
if (this.isDefaultState()) { if (this.isDefaultState()) {
@ -291,7 +291,7 @@ export class EntityStateControllerComponent extends StateControllerComponent imp
} else { } else {
newState = objToBase64URI(this.stateObject); newState = objToBase64URI(this.stateObject);
} }
this.updateStateParam(newState); this.updateStateParam(newState, !isStateIdChanged);
} }
} }

3
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; this.rxSubscriptions.length = 0;
} }
protected updateStateParam(newState: string) { protected updateStateParam(newState: string, replaceCurrentHistoryUrl = false) {
this.currentState = newState; this.currentState = newState;
if (this.syncStateWithQueryParam) { if (this.syncStateWithQueryParam) {
const queryParams: Params = {state: this.currentState}; const queryParams: Params = {state: this.currentState};
@ -137,6 +137,7 @@ export abstract class StateControllerComponent implements IStateControllerCompon
relativeTo: this.route, relativeTo: this.route,
queryParams, queryParams,
queryParamsHandling: 'merge', queryParamsHandling: 'merge',
replaceUrl: replaceCurrentHistoryUrl
}); });
}); });
} }

Loading…
Cancel
Save