Browse Source

Add compleate to subject and do subscribe if display pagination turn on

pull/5330/head
ArtemDzhereleiko 5 years ago
parent
commit
e2b0fd6c15
  1. 4
      ui-ngx/src/app/core/api/widget-api.models.ts
  2. 9
      ui-ngx/src/app/modules/home/components/widget/lib/alarms-table-widget.component.ts
  3. 1
      ui-ngx/src/app/modules/home/components/widget/lib/date-range-navigator/date-range-navigator.component.ts
  4. 21
      ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts
  5. 1
      ui-ngx/src/app/modules/home/models/dashboard-component.models.ts

4
ui-ngx/src/app/core/api/widget-api.models.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { Observable } from 'rxjs';
import { Observable, Subject } from 'rxjs';
import { EntityId } from '@app/shared/models/id/entity-id';
import {
DataSet,
@ -277,6 +277,8 @@ export interface IWidgetSubscription {
hiddenData?: Array<{data: DataSet}>;
timeWindowConfig?: Timewindow;
timeWindow?: WidgetTimewindow;
widgetTimewindowChanged: Observable<WidgetTimewindow>;
widgetTimewindowChangedSubject: Subject<WidgetTimewindow>;
comparisonEnabled?: boolean;
comparisonTimeWindow?: WidgetTimewindow;

9
ui-ngx/src/app/modules/home/components/widget/lib/alarms-table-widget.component.ts

@ -246,9 +246,11 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit,
this.updateAlarmSource();
this.ctx.updateWidgetParams();
this.widgetTimewindowChangedSubscription = this.ctx.defaultSubscription.widgetTimewindowChanged.subscribe(
() => this.pageLink.page = 0
);
if (this.displayPagination) {
this.widgetTimewindowChangedSubscription = this.ctx.defaultSubscription.widgetTimewindowChanged.subscribe(
() => this.pageLink.page = 0
);
}
}
ngOnDestroy(): void {
@ -256,6 +258,7 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit,
this.widgetTimewindowChangedSubscription.unsubscribe();
this.widgetTimewindowChangedSubscription = null;
}
this.ctx.defaultSubscription.widgetTimewindowChangedSubject.complete();
}
ngAfterViewInit(): void {

1
ui-ngx/src/app/modules/home/components/widget/lib/date-range-navigator/date-range-navigator.component.ts

@ -119,6 +119,7 @@ export class DateRangeNavigatorWidgetComponent extends PageComponent implements
this.dashboardTimewindowChangedSubscription.unsubscribe();
this.dashboardTimewindowChangedSubscription = null;
}
this.ctx.dashboard.dashboardTimewindowChangedSubject.complete();
}
openNavigatorPanel($event: Event) {

21
ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts

@ -171,15 +171,17 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
this.initialize();
this.ctx.updateWidgetParams();
this.widgetTimewindowChangedSubscription = this.ctx.defaultSubscription.widgetTimewindowChanged.subscribe(
() => {
this.sources.forEach((source) => {
if (this.displayPagination) {
source.pageLink.page = 0;
}
});
}
);
if (this.displayPagination) {
this.widgetTimewindowChangedSubscription = this.ctx.defaultSubscription.widgetTimewindowChanged.subscribe(
() => {
this.sources.forEach((source) => {
if (this.displayPagination) {
source.pageLink.page = 0;
}
});
}
);
}
}
ngOnDestroy(): void {
@ -187,6 +189,7 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
this.widgetTimewindowChangedSubscription.unsubscribe();
this.widgetTimewindowChangedSubscription = null;
}
this.ctx.defaultSubscription.widgetTimewindowChangedSubject.complete();
}
ngAfterViewInit(): void {

1
ui-ngx/src/app/modules/home/models/dashboard-component.models.ts

@ -67,6 +67,7 @@ export interface IDashboardComponent {
autofillHeight: boolean;
dashboardTimewindow: Timewindow;
dashboardTimewindowChanged: Observable<Timewindow>;
dashboardTimewindowChangedSubject: Subject<Timewindow>;
aliasController: IAliasController;
stateController: IStateController;
onUpdateTimewindow(startTimeMs: number, endTimeMs: number, interval?: number, persist?: boolean): void;

Loading…
Cancel
Save