Browse Source
Merge pull request #8292 from vvlladd28/improvement/navigate_prev_state_with_update
Fixer RP: Optionally update dashboard state when using navigate back API
pull/8294/head
Igor Kulikov
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
16 additions and
8 deletions
-
ui-ngx/src/app/core/api/widget-api.models.ts
-
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
|
|
|
@ -160,7 +160,7 @@ export interface IStateController { |
|
|
|
openRightLayout(): void; |
|
|
|
preserveState(): void; |
|
|
|
cleanupPreservedStates(): void; |
|
|
|
navigatePrevState(index: number): void; |
|
|
|
navigatePrevState(index: number, params?: StateParams): void; |
|
|
|
getStateId(): string; |
|
|
|
getStateIndex(): number; |
|
|
|
getStateIdAtIndex(index: number): string; |
|
|
|
|
|
|
|
@ -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 { |
|
|
|
const lastStateIndex = this.stateObject.length - 1; |
|
|
|
if (index < lastStateIndex) { |
|
|
|
this.stateObject.splice(index + 1, lastStateIndex - index); |
|
|
|
const selectedStateIndex = this.stateObject.length - 1; |
|
|
|
if (params) { |
|
|
|
this.stateObject[selectedStateIndex].params = params; |
|
|
|
} |
|
|
|
this.gotoState(this.stateObject[selectedStateIndex].id, true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -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; |
|
|
|
|
|
|
|
|