Skip to content

Commit

Permalink
Merge pull request #164 from AkkiaS7/enhance-notification
Browse files Browse the repository at this point in the history
feat: 添加/修改通知方式时可选择不发送测试信息

Co-authored-by: AkkiaS7 <[email protected]>
  • Loading branch information
naiba and AkkiaS7 authored Apr 23, 2022
2 parents 994f5dd + 5bf29da commit c3c4080
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<br>
<small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small>
<br><br>
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.12.22&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.8.2-brightgreen?style=for-the-badge&logo=linux">
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.12.23&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.8.2-brightgreen?style=for-the-badge&logo=linux">
<br>
<br>
<p>:trollface: <b>哪吒监控</b> 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,计划任务和在线终端。</p>
Expand Down
6 changes: 5 additions & 1 deletion cmd/dashboard/controller/member_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ type notificationForm struct {
RequestHeader string
RequestBody string
VerifySSL string
SkipCheck string
}

func (ma *memberAPI) addOrEditNotification(c *gin.Context) {
Expand All @@ -416,7 +417,10 @@ func (ma *memberAPI) addOrEditNotification(c *gin.Context) {
Notification: &n,
Server: nil,
}
err = ns.Send("这是测试消息")
// 勾选了跳过检查
if nf.SkipCheck != "on" {
err = ns.Send("这是测试消息")
}
}
if err == nil {
// 保证Tag不为空
Expand Down
5 changes: 5 additions & 0 deletions resource/static/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
}
}

td {
word-wrap: break-word;
word-break: break-all;
}

.nb-container {
padding-top: 75px;
min-height: 100vh;
Expand Down
1 change: 1 addition & 0 deletions resource/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ function addOrEditNotification(notification) {
} else {
modal.find(".ui.nf-ssl.checkbox").checkbox("set unchecked");
}
modal.find(".ui.nf-skip-check.checkbox").checkbox("set unchecked");
showFormModal(
".notification.modal",
"#notificationForm",
Expand Down
2 changes: 1 addition & 1 deletion resource/template/common/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<script src="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/semantic-ui/2.4.1/semantic.min.js"></script>
<script src="/static/semantic-ui-alerts.min.js"></script>
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.12/vue.min.js"></script>
<script src="/static/main.js?v20211105"></script>
<script src="/static/main.js?v20220423"></script>
</body>

</html>
Expand Down
2 changes: 1 addition & 1 deletion resource/template/common/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<title>{{.Title}}</title>
<link rel="stylesheet" type="text/css" href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/semantic-ui/2.4.1/semantic.min.css">
<link rel="stylesheet" type="text/css" href="/static/semantic-ui-alerts.min.css">
<link rel="stylesheet" type="text/css" href="/static/main.css?v2021111109">
<link rel="stylesheet" type="text/css" href="/static/main.css?v2022042314">
<link rel="shortcut icon" type="image/png" href="/static/logo.svg?v20210804" />
</head>

Expand Down
6 changes: 6 additions & 0 deletions resource/template/component/notification.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
<label>验证SSL</label>
</div>
</div>
<div class="field">
<div class="ui nf-skip-check checkbox">
<input name="SkipCheck" type="checkbox" tabindex="0" class="hidden">
<label>不发送测试信息</label>
</div>
</div>
</form>
</div>
<div class="actions">
Expand Down
2 changes: 1 addition & 1 deletion service/singleton/singleton.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/naiba/nezha/pkg/utils"
)

var Version = "v0.12.22" // !!记得修改 README 中的 badge 版本!!
var Version = "v0.12.23" // !!记得修改 README 中的 badge 版本!!

var (
Conf *model.Config
Expand Down

0 comments on commit c3c4080

Please sign in to comment.