Browse Source
Fixed "Navigate to other dashboard" losing the entity when the target dashboard state is empty or missing (#16841)
* Fixed "Navigate to other dashboard" losing the entity when the target dashboard state is empty or missing
* PR comments fixes
pull/16142/merge
Maksym Tsymbarov
1 week ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
10 additions and
2 deletions
-
ui-ngx/src/app/modules/home/components/dashboard-page/states/default-state-controller.component.ts
-
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
|
|
|
@ -217,7 +217,7 @@ export class DefaultStateControllerComponent extends StateControllerComponent im |
|
|
|
if (result && result.length > 1) { |
|
|
|
result = [ result[result.length - 1] ]; |
|
|
|
} |
|
|
|
return this.normalizeStateObject(result); |
|
|
|
return this.normalizeIncomingStateObject(result); |
|
|
|
} |
|
|
|
|
|
|
|
private gotoState(stateId: string, update: boolean, openRightLayout?: boolean) { |
|
|
|
|
|
|
|
@ -258,7 +258,7 @@ export class EntityStateControllerComponent extends StateControllerComponent imp |
|
|
|
result = []; |
|
|
|
} |
|
|
|
} |
|
|
|
return this.normalizeStateObject(result); |
|
|
|
return this.normalizeIncomingStateObject(result); |
|
|
|
} |
|
|
|
|
|
|
|
private gotoState(stateId: string, update: boolean, openRightLayout?: boolean, replaceCurrentHistoryUrl?: boolean) { |
|
|
|
|
|
|
|
@ -133,6 +133,14 @@ export abstract class StateControllerComponent implements IStateControllerCompon |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
protected normalizeIncomingStateObject(stateObject: StateControllerState): StateControllerState { |
|
|
|
const result = Array.isArray(stateObject) ? [...stateObject] : []; |
|
|
|
if (result.length && (!result[0]?.id || !this.states[result[0].id])) { |
|
|
|
result[0] = { ...result[0], id: this.dashboardUtils.getRootStateId(this.states) }; |
|
|
|
} |
|
|
|
return this.normalizeStateObject(result); |
|
|
|
} |
|
|
|
|
|
|
|
protected updateStateParam(newState: string, replaceCurrentHistoryUrl = false) { |
|
|
|
this.currentState = newState; |
|
|
|
if (this.syncStateWithQueryParam) { |
|
|
|
|