Browse Source

Fixed clear state params for change dashboardId

pull/3378/head
Vladyslav_Prykhodko 6 years ago
parent
commit
bdd4c30fc0
  1. 9
      ui-ngx/src/app/modules/home/pages/dashboard/states/state-controller.component.ts

9
ui-ngx/src/app/modules/home/pages/dashboard/states/state-controller.component.ts

@ -100,7 +100,7 @@ export abstract class StateControllerComponent implements IStateControllerCompon
this.rxSubscriptions.push(this.route.queryParamMap.subscribe((paramMap) => { this.rxSubscriptions.push(this.route.queryParamMap.subscribe((paramMap) => {
const dashboardId = this.route.snapshot.params.dashboardId; const dashboardId = this.route.snapshot.params.dashboardId;
if (this.dashboardId === dashboardId) { if (this.dashboardId === dashboardId) {
const newState = decodeURIComponent(paramMap.get('state')); const newState = this.decodeStateParam(paramMap.get('state'));
if (this.currentState !== newState) { if (this.currentState !== newState) {
this.currentState = newState; this.currentState = newState;
if (this.inited) { if (this.inited) {
@ -147,10 +147,15 @@ export abstract class StateControllerComponent implements IStateControllerCompon
} }
public reInit() { public reInit() {
this.currentState = decodeURIComponent(this.route.snapshot.queryParamMap.get('state')); this.preservedState = null;
this.currentState = this.decodeStateParam(this.route.snapshot.queryParamMap.get('state'));
this.init(); this.init();
} }
private decodeStateParam(stateURI: string): string{
return stateURI !== null ? decodeURIComponent(stateURI) : null;
}
protected abstract init(); protected abstract init();
protected abstract onMobileChanged(); protected abstract onMobileChanged();

Loading…
Cancel
Save