From 4016627da43e9ea1e1ed091dfc22cd836bb909f0 Mon Sep 17 00:00:00 2001 From: Noor Yameen Date: Thu, 24 Jan 2019 09:20:45 +0200 Subject: [PATCH] Support auto-refresh in Vitrage Alarm view Change-Id: I2041f0edf9f403837dfa250d55dae566e10dfe64 story: #2004726 task: #28764 --- .../project/alarmList/alarmList.controller.js | 28 ++++++++++++++++-- .../project/alarmList/alarmList.html | 8 +++-- .../project/alarmList/alarmList.scss | 5 ++++ .../dashboard/project/assets/spinner.gif | Bin 0 -> 1555 bytes 4 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 vitrage_dashboard/dashboard/static/dashboard/project/assets/spinner.gif diff --git a/vitrage_dashboard/dashboard/static/dashboard/project/alarmList/alarmList.controller.js b/vitrage_dashboard/dashboard/static/dashboard/project/alarmList/alarmList.controller.js index fdf436a..7354744 100644 --- a/vitrage_dashboard/dashboard/static/dashboard/project/alarmList/alarmList.controller.js +++ b/vitrage_dashboard/dashboard/static/dashboard/project/alarmList/alarmList.controller.js @@ -60,6 +60,15 @@ opened: false }; + alarmList.autoRefreshChanged = function () { + if (alarmList.checkboxAutoRefresh && alarmList.radioModel !== 'historyAlarms') { + startCollectData(); + } else { + stopCollectData(); + } + }; + + alarmList.getHistoryData = function (nextPrev) { if (nextPrev === 'next' && !alarmList.nextEnabled) { return; @@ -104,9 +113,12 @@ if (alarmList.radioModel === 'historyAlarms') { - vitrageTopologySrv.getHistoryAlarms(config).then(function (result) { + $("#table").hide(); + $("#spinner").show(); + vitrageTopologySrv.getHistoryAlarms(config).then(function (result) { alarmList.alarms = result.data; - + $("#spinner").hide(); + $("#table").show(); alarmList.nextEnabled = result.data.length === LIMIT; alarmList.prevEnabled = true; }); @@ -123,6 +135,18 @@ alarmList.getHistoryData(); + function startCollectData() { + if (angular.isDefined(alarmList.alarmInterval)) return; + alarmList.alarmInterval = alarmList.$interval(alarmList.getHistoryData,10000); + } + + function stopCollectData() { + if (angular.isDefined(alarmList.alarmInterval)) { + alarmList.$interval.cancel(alarmList.alarmInterval); + alarmList.alarmInterval = undefined; + } + } + alarmList.sortBy = function (fieldName) { if (fieldName === alarmList.sortByFieldName) { alarmList.sortOrder = alarmList.sortOrder === 'asc' ? 'desc' : 'asc'; diff --git a/vitrage_dashboard/dashboard/static/dashboard/project/alarmList/alarmList.html b/vitrage_dashboard/dashboard/static/dashboard/project/alarmList/alarmList.html index 67e3136..669f15c 100644 --- a/vitrage_dashboard/dashboard/static/dashboard/project/alarmList/alarmList.html +++ b/vitrage_dashboard/dashboard/static/dashboard/project/alarmList/alarmList.html @@ -15,7 +15,10 @@ ng-click="alarmList.getHistoryData('')" uib-btn-radio="'historyAlarms'">Alarm History - +
+ + +
@@ -58,7 +61,7 @@ fa-angle-double-right prev-next-btn"
- @@ -123,5 +126,6 @@ fa-angle-double-right prev-next-btn"
+
diff --git a/vitrage_dashboard/dashboard/static/dashboard/project/alarmList/alarmList.scss b/vitrage_dashboard/dashboard/static/dashboard/project/alarmList/alarmList.scss index cc3e00e..ac9f6ad 100644 --- a/vitrage_dashboard/dashboard/static/dashboard/project/alarmList/alarmList.scss +++ b/vitrage_dashboard/dashboard/static/dashboard/project/alarmList/alarmList.scss @@ -20,6 +20,11 @@ } } + .spinner{ + display:none; + margin-left:45%; + } + .td-red { background: #f67171 !important; } diff --git a/vitrage_dashboard/dashboard/static/dashboard/project/assets/spinner.gif b/vitrage_dashboard/dashboard/static/dashboard/project/assets/spinner.gif new file mode 100644 index 0000000000000000000000000000000000000000..7de75b15b1a42a0851ce607b94cc6e5ef566e840 GIT binary patch literal 1555 zcmYk+drVVT90%~*_TKik_iAZ-DcA?4P}))|AkTtm;PxsMu+)MM6%Dc~Oc^WH2{skl z(y~@4QmBXy4HSH%L1o4f+)c80T}QH37B{^v31+li619QR+bE(9R|tZ=*TEK7oC1N{pO!H4!h&c>o?P{rl)?L z>e<(Wak24xnKgK9 zFeNReL|@`)b|~YOh6=;j?XmF(jV~$=iX;s zIC_=P-cJe$DSaDr9HYGz`P#$1{_H-1__IbG94*6FdZgoS z(bx%H&O0d?P|mP9Z>7F$n^A5^3`)zNnyY{xbp;SZ}<%CR3CySKDO3@yOqKh*^aR^CHvE)bJtmtPbl#CBhU5MNiZwBI!<+n$J~8=8&C`9ZX|&AHvaoh*{!^j*0oC;C-G!CJLj(nbLV7c%KjhZjBqx{&KV&FyYem^9%n6ZL=<&Ak1Y+wpALz6 ztc4FQmGcxXm)}@50`G94SIQSHiw9d?msl0OZDs(b!jbDEZ2+aBd8NzNLa{Vh%`gZ9 zbwzHCsN3A5=F=MXY8W)hcAT_cilc|ogU~uWb|ozrq|rcJ0tsbAEQx<{r6f4tSImr$ z_N$RtDZTi8lGND_%}%B_yU8dYFIDpVdU~u1X+LPp;RjG}h_o$t>MCOn;oT!i^O&+PswZ1dh9#}4+)QNZlk(!`T;#6 z=vT{9q42dK^J2FY9V(ay3H>;rgt%@XDG9)1g<<)CSca3dB=xyQPzxS5Hhg&RcTJy7 zvpv{!Iha>X_UpfXjxpvpx1Z6ylxik^cXOs0%**Y6T6)57{ zpnlU27cs^>srTbNX~cKeDr!%myyEH&cW-3%dn?yxryS{AYRL7U4Vkwaw`z1R+;mtk z1lcS@lOAM%IG@CK3mKajXem?EMB7B$1MPM96w!pcyl!6+qaz;-^PK3w*yJX_MQ|au d9)RW+aJW=;$PppJDt9By)u#y#rzr