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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
6 additions and
5 deletions
-
ui-ngx/src/app/modules/home/components/dashboard-page/states/entity-state-controller.component.ts
-
ui-ngx/src/app/modules/home/components/dashboard-page/states/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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -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 |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
|