Merge pull request #4820 from vvlladd28/improvement/state-controller/update-current-state
UI: Fixed not updated dashboard URL, after updated a current dashboard state
This commit is contained in:
commit
fc94031c6c
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user