From b46827f24420e062fac8ae1252ec55e1c1c1a5ac Mon Sep 17 00:00:00 2001 From: naiba Date: Sun, 20 Dec 2020 21:19:27 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E4=BC=98=E5=8C=96=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E6=9D=A1=E9=A2=9C=E8=89=B2=E3=80=81=E6=8A=A5=E8=AD=A6?= =?UTF-8?q?=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/static/theme-hotaru/css/core.css | 2 -- resource/static/theme-hotaru/css/main.css | 1 + resource/template/common/footer.html | 2 +- resource/template/theme-default/home.html | 2 +- resource/template/theme-hotaru/home.html | 4 ++-- service/alertmanager/alertmanager.go | 10 +++++++--- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/resource/static/theme-hotaru/css/core.css b/resource/static/theme-hotaru/css/core.css index c5f0214..21e9086 100644 --- a/resource/static/theme-hotaru/css/core.css +++ b/resource/static/theme-hotaru/css/core.css @@ -1,5 +1,3 @@ -/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */ - @media print { *, *:before, *:after { color: #000 !important; diff --git a/resource/static/theme-hotaru/css/main.css b/resource/static/theme-hotaru/css/main.css index a74ae53..8f7459b 100644 --- a/resource/static/theme-hotaru/css/main.css +++ b/resource/static/theme-hotaru/css/main.css @@ -170,6 +170,7 @@ h1 { .ui.progress .bar { line-height: unset !important; + height: unset !important; } table tr { diff --git a/resource/template/common/footer.html b/resource/template/common/footer.html index a395dd7..60f9ffb 100644 --- a/resource/template/common/footer.html +++ b/resource/template/common/footer.html @@ -9,7 +9,7 @@ - + diff --git a/resource/template/theme-default/home.html b/resource/template/theme-default/home.html index 2354788..8f0c36c 100644 --- a/resource/template/theme-default/home.html +++ b/resource/template/theme-default/home.html @@ -126,7 +126,7 @@ this.cache[percent].style['background-color'] = 'slategray' this.cache[percent].class.offline = true } else if (percent < 51) { - this.cache[percent].style['background-color'] = 'lime' + this.cache[percent].style['background-color'] = 'rgb(0, 235, 139)' this.cache[percent].class.fine = true } else if (percent < 81) { this.cache[percent].style['background-color'] = 'orange' diff --git a/resource/template/theme-hotaru/home.html b/resource/template/theme-hotaru/home.html index 4b4d0b4..73cf890 100644 --- a/resource/template/theme-hotaru/home.html +++ b/resource/template/theme-hotaru/home.html @@ -17,7 +17,7 @@ - + {{if ts .CustomCSS}} {{tag "style"}} @@ -177,7 +177,7 @@ this.cache[percent].style['background-color'] = 'slategray' this.cache[percent].class.offline = true } else if (percent < 51) { - this.cache[percent].style['background-color'] = 'lime' + this.cache[percent].style['background-color'] = 'rgb(0, 235, 139)' this.cache[percent].class.fine = true } else if (percent < 81) { this.cache[percent].style['background-color'] = 'orange' diff --git a/service/alertmanager/alertmanager.go b/service/alertmanager/alertmanager.go index 2a8299b..fd603a7 100644 --- a/service/alertmanager/alertmanager.go +++ b/service/alertmanager/alertmanager.go @@ -113,14 +113,18 @@ func checkStatus() { var flag bool if cacheN, has := dao.Cache.Get(nID); has { nHistory := cacheN.(NotificationHistory) - // 超过一天或者超过上次提醒阈值 - if time.Now().After(nHistory.Until) || nHistory.Duration >= time.Hour*24 { + // 每次提醒都增加一倍等待时间,最后每天最多提醒一次 + if time.Now().After(nHistory.Until) { flag = true nHistory.Duration *= 2 + if nHistory.Duration > time.Hour*24 { + nHistory.Duration = time.Hour * 24 + } nHistory.Until = time.Now().Add(nHistory.Duration) + dao.Cache.Set(nID, nHistory, nHistory.Duration) } } else { - // 新提醒 + // 新提醒直接通知 flag = true dao.Cache.Set(nID, NotificationHistory{ Duration: firstNotificationDelay,