Browse Source

Merge branch 'navigate_prev_state_with_update' of github.com:engix-ltd/thingsboard into engix-ltd-navigate_prev_state_with_update

pull/8292/head
Vladyslav_Prykhodko 4 years ago
parent
commit
092fadde05
  1. 13
      ui-ngx/src/app/modules/home/components/dashboard-page/states/default-state-controller.component.ts
  2. 7
      ui-ngx/src/app/modules/home/components/dashboard-page/states/entity-state-controller.component.ts
  3. 2
      ui-ngx/src/app/modules/home/components/dashboard-page/states/state-controller.component.ts

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

@ -168,10 +168,15 @@ export class DefaultStateControllerComponent extends StateControllerComponent im
}
}
public navigatePrevState(index: number): void {
if (index < this.stateObject.length - 1) {
this.stateObject.splice(index + 1, this.stateObject.length - index - 1);
this.gotoState(this.stateObject[this.stateObject.length - 1].id, true);
public navigatePrevState(index: number, params?: StateParams): void {
let lastIndex: number = this.stateObject.length - 1;
if (index < lastIndex) {
this.stateObject.splice(index + 1, lastIndex - 1);
lastIndex = this.stateObject.length - 1;
if (params) {
this.stateObject[lastIndex].params = params;
}
this.gotoState(this.stateObject[lastIndex].id, true);
}
}

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

@ -195,11 +195,14 @@ export class EntityStateControllerComponent extends StateControllerComponent imp
}
}
public navigatePrevState(index: number): void {
public navigatePrevState(index: number, params?: StateParams): void {
if (index < this.stateObject.length - 1) {
this.stateObject.splice(index + 1, this.stateObject.length - index - 1);
this.selectedStateIndex = this.stateObject.length - 1;
this.gotoState(this.stateObject[this.stateObject.length - 1].id, true);
if (params) {
this.stateObject[this.selectedStateIndex].params = params;
}
this.gotoState(this.stateObject[this.selectedStateIndex].id, true);
}
}

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

@ -199,7 +199,7 @@ export abstract class StateControllerComponent implements IStateControllerCompon
public abstract getStateParamsByStateId(stateId: string): StateParams;
public abstract navigatePrevState(index: number): void;
public abstract navigatePrevState(index: number, params?: StateParams): void;
public abstract openState(id: string, params?: StateParams, openRightLayout?: boolean): void;

Loading…
Cancel
Save