This is an automated email from the ASF dual-hosted git repository.
gongchao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git
The following commit(s) were added to refs/heads/master by this push:
new 1c17c7cb4 [improve] support notify auto refresh (#2712)
1c17c7cb4 is described below
commit 1c17c7cb4418ca961c065dd96a3440e59fc0c25b
Author: aias00 <[email protected]>
AuthorDate: Sun Sep 15 10:24:29 2024 +0800
[improve] support notify auto refresh (#2712)
---
web-app/src/app/layout/basic/widgets/notify.component.ts | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/web-app/src/app/layout/basic/widgets/notify.component.ts
b/web-app/src/app/layout/basic/widgets/notify.component.ts
index ed1feced5..5d8a940ce 100644
--- a/web-app/src/app/layout/basic/widgets/notify.component.ts
+++ b/web-app/src/app/layout/basic/widgets/notify.component.ts
@@ -1,4 +1,4 @@
-import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Inject, OnInit
} from '@angular/core';
+import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Inject,
OnInit, OnDestroy } from '@angular/core';
import { Router } from '@angular/router';
import { I18NService } from '@core';
import { ALAIN_I18N_TOKEN } from '@delon/theme';
@@ -95,7 +95,7 @@ import { AlertService } from '../../../service/alert.service';
`,
changeDetection: ChangeDetectionStrategy.OnPush
})
-export class HeaderNotifyComponent implements OnInit {
+export class HeaderNotifyComponent implements OnInit, OnDestroy {
data: any[] = [
{
title: this.i18nSvc.fanyi('dashboard.alerts.title-no'),
@@ -109,7 +109,7 @@ export class HeaderNotifyComponent implements OnInit {
count = 0;
loading = false;
popoverVisible = false;
-
+ refreshInterval: any;
constructor(
private router: Router,
@Inject(ALAIN_I18N_TOKEN) private i18nSvc: I18NService,
@@ -121,6 +121,15 @@ export class HeaderNotifyComponent implements OnInit {
ngOnInit(): void {
this.loadData();
+ this.refreshInterval = setInterval(() => {
+ this.loadData();
+ }, 30000); // every 30 seconds refresh the tabs
+ }
+
+ ngOnDestroy() {
+ if (this.refreshInterval) {
+ clearInterval(this.refreshInterval);
+ }
}
onPopoverVisibleChange(visible: boolean): void {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]