Browse Source

Fixed "Navigate to other dashboard" opening the target dashboard in its root state without the entity when the dashboard page is reused

pull/16892/head
Maksym Tsymbarov 10 hours ago
parent
commit
4897121fd8
  1. 4
      ui-ngx/src/app/modules/home/components/dashboard-page/states/state-controller.component.ts
  2. 1
      ui-ngx/src/app/modules/home/components/dashboard-page/states/state-controller.models.ts
  3. 9
      ui-ngx/src/app/modules/home/components/dashboard-page/states/states-component.directive.ts

4
ui-ngx/src/app/modules/home/components/dashboard-page/states/state-controller.component.ts

@ -79,6 +79,10 @@ export abstract class StateControllerComponent implements IStateControllerCompon
return this.statesValue;
}
public replaceStates(states: { [id: string]: DashboardState }) {
this.statesValue = states;
}
currentState: string;
syncStateWithQueryParam: boolean;

1
ui-ngx/src/app/modules/home/components/dashboard-page/states/state-controller.models.ts

@ -15,4 +15,5 @@ export interface IStateControllerComponent extends IStateController {
dashboardId: string;
preservedState: any;
init(): void;
replaceStates(states: {[id: string]: DashboardState }): void;
}

9
ui-ngx/src/app/modules/home/components/dashboard-page/states/states-component.directive.ts

@ -71,13 +71,20 @@ export class StatesComponentDirective implements OnInit, OnDestroy, OnChanges {
ngOnChanges(changes: SimpleChanges): void {
let reInitController = false;
let initController = false;
const dashboardIdChange = changes.dashboardId;
const dashboardChanged = !!dashboardIdChange && !dashboardIdChange.firstChange &&
dashboardIdChange.currentValue !== dashboardIdChange.previousValue;
for (const propName of Object.keys(changes)) {
const change = changes[propName];
if (!change.firstChange && change.currentValue !== change.previousValue) {
if (propName === 'statesControllerId') {
this.reInit();
} else if (propName === 'states') {
this.stateControllerComponent.states = this.states;
if (dashboardChanged) {
this.stateControllerComponent.replaceStates(this.states);
} else {
this.stateControllerComponent.states = this.states;
}
} else if (propName === 'dashboardId') {
this.stateControllerComponent.dashboardId = this.dashboardId;
reInitController = true;

Loading…
Cancel
Save