Commit bfe17c2db9c9186b106d8b55fe6283ab7be78294

Authored by Vladyslav_Prykhodko
1 parent 27b4c996

UI: Fixed not updated dashboard URL, after updated a current dashboard state

@@ -275,15 +275,15 @@ export class EntityStateControllerComponent extends StateControllerComponent imp @@ -275,15 +275,15 @@ export class EntityStateControllerComponent extends StateControllerComponent imp
275 } 275 }
276 276
277 private gotoState(stateId: string, update: boolean, openRightLayout?: boolean) { 277 private gotoState(stateId: string, update: boolean, openRightLayout?: boolean) {
278 - update = update && this.dashboardCtrl.dashboardCtx.state !== stateId; 278 + const isStateIdChanged = this.dashboardCtrl.dashboardCtx.state !== stateId;
279 this.dashboardCtrl.openDashboardState(stateId, openRightLayout); 279 this.dashboardCtrl.openDashboardState(stateId, openRightLayout);
280 this.mobileService.handleDashboardStateName(this.getStateName(this.stateObject.length - 1)); 280 this.mobileService.handleDashboardStateName(this.getStateName(this.stateObject.length - 1));
281 if (update) { 281 if (update) {
282 - this.updateLocation(); 282 + this.updateLocation(isStateIdChanged);
283 } 283 }
284 } 284 }
285 285
286 - private updateLocation() { 286 + private updateLocation(isStateIdChanged: boolean) {
287 if (this.stateObject[this.stateObject.length - 1].id) { 287 if (this.stateObject[this.stateObject.length - 1].id) {
288 let newState; 288 let newState;
289 if (this.isDefaultState()) { 289 if (this.isDefaultState()) {
@@ -291,7 +291,7 @@ export class EntityStateControllerComponent extends StateControllerComponent imp @@ -291,7 +291,7 @@ export class EntityStateControllerComponent extends StateControllerComponent imp
291 } else { 291 } else {
292 newState = objToBase64URI(this.stateObject); 292 newState = objToBase64URI(this.stateObject);
293 } 293 }
294 - this.updateStateParam(newState); 294 + this.updateStateParam(newState, !isStateIdChanged);
295 } 295 }
296 } 296 }
297 297
@@ -126,7 +126,7 @@ export abstract class StateControllerComponent implements IStateControllerCompon @@ -126,7 +126,7 @@ export abstract class StateControllerComponent implements IStateControllerCompon
126 this.rxSubscriptions.length = 0; 126 this.rxSubscriptions.length = 0;
127 } 127 }
128 128
129 - protected updateStateParam(newState: string) { 129 + protected updateStateParam(newState: string, replaceCurrentHistoryUrl = false) {
130 this.currentState = newState; 130 this.currentState = newState;
131 if (this.syncStateWithQueryParam) { 131 if (this.syncStateWithQueryParam) {
132 const queryParams: Params = {state: this.currentState}; 132 const queryParams: Params = {state: this.currentState};
@@ -137,6 +137,7 @@ export abstract class StateControllerComponent implements IStateControllerCompon @@ -137,6 +137,7 @@ export abstract class StateControllerComponent implements IStateControllerCompon
137 relativeTo: this.route, 137 relativeTo: this.route,
138 queryParams, 138 queryParams,
139 queryParamsHandling: 'merge', 139 queryParamsHandling: 'merge',
  140 + replaceUrl: replaceCurrentHistoryUrl
140 }); 141 });
141 }); 142 });
142 } 143 }