Skip to content

Commit

Permalink
trigger for starting realtime monitoring in analyticsService
Browse files Browse the repository at this point in the history
  • Loading branch information
ck-c8y committed Feb 27, 2024
1 parent 52c8268 commit 601cf04
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
15 changes: 2 additions & 13 deletions analytics-ui/src/manage/extension-grid.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { IManagedObject } from '@c8y/client';
import { WizardConfig, WizardModalService } from '@c8y/ngx-components';
import { ModalOptions } from 'ngx-bootstrap/modal';
Expand All @@ -11,12 +11,11 @@ import { AnalyticsService } from '../shared';
templateUrl: './extension-grid.component.html',
styleUrls: ['./extension-grid.component.css']
})
export class ExtensionGridComponent implements OnInit, OnDestroy {
export class ExtensionGridComponent implements OnInit {
loading: boolean = false;
restarting$: Subject<boolean>;
loadingError: boolean = false;
reload$: BehaviorSubject<boolean> = new BehaviorSubject(false);
subscription: any;
extensions$: Observable<IManagedObject[]>;
listClass: string;
rescue: boolean = false;
Expand Down Expand Up @@ -47,7 +46,6 @@ export class ExtensionGridComponent implements OnInit, OnDestroy {
);

this.reload$.next(false);
this.initializeMonitoringService();
}

loadExtensions() {
Expand Down Expand Up @@ -77,13 +75,4 @@ export class ExtensionGridComponent implements OnInit, OnDestroy {
});
}

private async initializeMonitoringService(): Promise<void> {
this.subscription =
await this.analyticsService.subscribeMonitoringChannel();
}

ngOnDestroy(): void {
console.log('Stop subscription');
this.analyticsService.unsubscribeFromMonitoringChannel(this.subscription);
}
}
1 change: 1 addition & 0 deletions analytics-ui/src/shared/analytics.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export class AnalyticsService {
private applicationService: ApplicationService
) {
this.realtime = new Realtime(this.fetchClient);
this.subscribeMonitoringChannel();
}

getExtensions(): Promise<IResultList<IManagedObject>> {
Expand Down

0 comments on commit 601cf04

Please sign in to comment.