Merge pull request #164 from AkkiaS7/enhance-notification

feat: 添加/修改通知方式时可选择不发送测试信息

Co-authored-by: AkkiaS7 <68485070+AkkiaS7@users.noreply.github.com>
This commit is contained in:
naiba 2022-04-23 16:21:50 +08:00 committed by GitHub
commit c3c4080e71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 21 additions and 5 deletions

View File

@ -4,7 +4,7 @@
<br> <br>
<small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small> <small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small>
<br><br> <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>
<br> <br>
<p>:trollface: <b>哪吒监控</b> 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,计划任务和在线终端。</p> <p>:trollface: <b>哪吒监控</b> 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,计划任务和在线终端。</p>

View File

@ -395,6 +395,7 @@ type notificationForm struct {
RequestHeader string RequestHeader string
RequestBody string RequestBody string
VerifySSL string VerifySSL string
SkipCheck string
} }
func (ma *memberAPI) addOrEditNotification(c *gin.Context) { func (ma *memberAPI) addOrEditNotification(c *gin.Context) {
@ -416,8 +417,11 @@ func (ma *memberAPI) addOrEditNotification(c *gin.Context) {
Notification: &n, Notification: &n,
Server: nil, Server: nil,
} }
// 勾选了跳过检查
if nf.SkipCheck != "on" {
err = ns.Send("这是测试消息") err = ns.Send("这是测试消息")
} }
}
if err == nil { if err == nil {
// 保证Tag不为空 // 保证Tag不为空
if n.Tag == "" { if n.Tag == "" {

View File

@ -4,6 +4,11 @@
} }
} }
td {
word-wrap: break-word;
word-break: break-all;
}
.nb-container { .nb-container {
padding-top: 75px; padding-top: 75px;
min-height: 100vh; min-height: 100vh;

View File

@ -154,6 +154,7 @@ function addOrEditNotification(notification) {
} else { } else {
modal.find(".ui.nf-ssl.checkbox").checkbox("set unchecked"); modal.find(".ui.nf-ssl.checkbox").checkbox("set unchecked");
} }
modal.find(".ui.nf-skip-check.checkbox").checkbox("set unchecked");
showFormModal( showFormModal(
".notification.modal", ".notification.modal",
"#notificationForm", "#notificationForm",

View File

@ -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="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="/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="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> </body>
</html> </html>

View File

@ -9,7 +9,7 @@
<title>{{.Title}}</title> <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="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/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" /> <link rel="shortcut icon" type="image/png" href="/static/logo.svg?v20210804" />
</head> </head>

View File

@ -44,6 +44,12 @@
<label>验证SSL</label> <label>验证SSL</label>
</div> </div>
</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> </form>
</div> </div>
<div class="actions"> <div class="actions">

View File

@ -12,7 +12,7 @@ import (
"github.com/naiba/nezha/pkg/utils" "github.com/naiba/nezha/pkg/utils"
) )
var Version = "v0.12.22" // !!记得修改 README 中的 badge 版本!! var Version = "v0.12.23" // !!记得修改 README 中的 badge 版本!!
var ( var (
Conf *model.Config Conf *model.Config