Commit e2b0fd6c155ffa4a2b5488d05a5d9fc518afc521

Authored by ArtemDzhereleiko
1 parent 246390b4

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

... ... @@ -14,7 +14,7 @@
14 14 /// limitations under the License.
15 15 ///
16 16
17   -import { Observable } from 'rxjs';
  17 +import { Observable, Subject } from 'rxjs';
18 18 import { EntityId } from '@app/shared/models/id/entity-id';
19 19 import {
20 20 DataSet,
... ... @@ -277,6 +277,8 @@ export interface IWidgetSubscription {
277 277 hiddenData?: Array<{data: DataSet}>;
278 278 timeWindowConfig?: Timewindow;
279 279 timeWindow?: WidgetTimewindow;
  280 + widgetTimewindowChanged: Observable<WidgetTimewindow>;
  281 + widgetTimewindowChangedSubject: Subject<WidgetTimewindow>;
280 282 comparisonEnabled?: boolean;
281 283 comparisonTimeWindow?: WidgetTimewindow;
282 284
... ...
... ... @@ -246,9 +246,11 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit,
246 246 this.updateAlarmSource();
247 247 this.ctx.updateWidgetParams();
248 248
249   - this.widgetTimewindowChangedSubscription = this.ctx.defaultSubscription.widgetTimewindowChanged.subscribe(
250   - () => this.pageLink.page = 0
251   - );
  249 + if (this.displayPagination) {
  250 + this.widgetTimewindowChangedSubscription = this.ctx.defaultSubscription.widgetTimewindowChanged.subscribe(
  251 + () => this.pageLink.page = 0
  252 + );
  253 + }
252 254 }
253 255
254 256 ngOnDestroy(): void {
... ... @@ -256,6 +258,7 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit,
256 258 this.widgetTimewindowChangedSubscription.unsubscribe();
257 259 this.widgetTimewindowChangedSubscription = null;
258 260 }
  261 + this.ctx.defaultSubscription.widgetTimewindowChangedSubject.complete();
259 262 }
260 263
261 264 ngAfterViewInit(): void {
... ...
... ... @@ -119,6 +119,7 @@ export class DateRangeNavigatorWidgetComponent extends PageComponent implements
119 119 this.dashboardTimewindowChangedSubscription.unsubscribe();
120 120 this.dashboardTimewindowChangedSubscription = null;
121 121 }
  122 + this.ctx.dashboard.dashboardTimewindowChangedSubject.complete();
122 123 }
123 124
124 125 openNavigatorPanel($event: Event) {
... ...
... ... @@ -171,15 +171,17 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
171 171 this.initialize();
172 172 this.ctx.updateWidgetParams();
173 173
174   - this.widgetTimewindowChangedSubscription = this.ctx.defaultSubscription.widgetTimewindowChanged.subscribe(
175   - () => {
176   - this.sources.forEach((source) => {
177   - if (this.displayPagination) {
178   - source.pageLink.page = 0;
179   - }
180   - });
181   - }
182   - );
  174 + if (this.displayPagination) {
  175 + this.widgetTimewindowChangedSubscription = this.ctx.defaultSubscription.widgetTimewindowChanged.subscribe(
  176 + () => {
  177 + this.sources.forEach((source) => {
  178 + if (this.displayPagination) {
  179 + source.pageLink.page = 0;
  180 + }
  181 + });
  182 + }
  183 + );
  184 + }
183 185 }
184 186
185 187 ngOnDestroy(): void {
... ... @@ -187,6 +189,7 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
187 189 this.widgetTimewindowChangedSubscription.unsubscribe();
188 190 this.widgetTimewindowChangedSubscription = null;
189 191 }
  192 + this.ctx.defaultSubscription.widgetTimewindowChangedSubject.complete();
190 193 }
191 194
192 195 ngAfterViewInit(): void {
... ...
... ... @@ -67,6 +67,7 @@ export interface IDashboardComponent {
67 67 autofillHeight: boolean;
68 68 dashboardTimewindow: Timewindow;
69 69 dashboardTimewindowChanged: Observable<Timewindow>;
  70 + dashboardTimewindowChangedSubject: Subject<Timewindow>;
70 71 aliasController: IAliasController;
71 72 stateController: IStateController;
72 73 onUpdateTimewindow(startTimeMs: number, endTimeMs: number, interval?: number, persist?: boolean): void;
... ...