mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-05 21:20:06 +00:00
✨ feat(notification): 添加通知方式
This commit is contained in:
@@ -4,10 +4,11 @@
|
||||
<div class="item">
|
||||
<img src="/static/logo.png">
|
||||
</div>
|
||||
<a class="item{{if eq .MatchedPath "/"}} active{{end}}" href="/">首页</a>
|
||||
<a class="item{{if eq .MatchedPath " /"}} active{{end}}" href="/">首页</a>
|
||||
{{if .Admin}}
|
||||
<a class="item{{if eq .MatchedPath "/server"}} active{{end}}" href="/server">服务器</a>
|
||||
<a class="item{{if eq .MatchedPath "/setting"}} active{{end}}" href="/setting">设置</a>
|
||||
<a class="item{{if eq .MatchedPath " /server"}} active{{end}}" href="/server">服务器</a>
|
||||
<a class="item{{if eq .MatchedPath " /notification"}} active{{end}}" href="/notification">通知</a>
|
||||
<a class="item{{if eq .MatchedPath " /setting"}} active{{end}}" href="/setting">设置</a>
|
||||
{{end}}
|
||||
<div class="right menu">
|
||||
<a class="item" href="https://github.com/naiba/nezha/issues" target="_blank">反馈</a>
|
||||
|
||||
47
resource/template/component/notification.html
Normal file
47
resource/template/component/notification.html
Normal file
@@ -0,0 +1,47 @@
|
||||
{{define "component/notification"}}
|
||||
<div class="ui tiny notification modal transition hidden">
|
||||
<div class="header">添加通知方式</div>
|
||||
<div class="content">
|
||||
<form id="notificationForm" class="ui form">
|
||||
<input type="hidden" name="ID">
|
||||
<div class="field">
|
||||
<label>备注</label>
|
||||
<input type="text" name="Name">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>URL</label>
|
||||
<input type="text" name="URL">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>请求方式</label>
|
||||
<select name="RequestMethod" class="ui fluid dropdown">
|
||||
<option value="1">GET</option>
|
||||
<option value="2">POST</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>请求类型</label>
|
||||
<select name="RequestType" class="ui fluid dropdown">
|
||||
<option value="1">JSON</option>
|
||||
<option value="2">FORM</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="secret field">
|
||||
<label>Body</label>
|
||||
<textarea name="RequestBody"></textarea>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui checkbox">
|
||||
<input name="VerifySSL" type="checkbox" tabindex="0" class="hidden">
|
||||
<label>验证SSL</label>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="ui negative button">取消</div>
|
||||
<button class="ui positive right labeled icon button">确认<i class="checkmark icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
29
resource/template/component/rule.html
Normal file
29
resource/template/component/rule.html
Normal file
@@ -0,0 +1,29 @@
|
||||
{{define "component/rule"}}
|
||||
<div class="ui tiny notification modal transition hidden">
|
||||
<div class="header">添加通知规则</div>
|
||||
<div class="content">
|
||||
<form id="notificationForm" class="ui form">
|
||||
<input type="hidden" name="ID">
|
||||
<div class="field">
|
||||
<label>备注</label>
|
||||
<input type="text" name="Name">
|
||||
</div>
|
||||
<div class="secret field">
|
||||
<label>规则</label>
|
||||
<textarea name="RequestBody"></textarea>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui checkbox">
|
||||
<input name="VerifySSL" type="checkbox" tabindex="0" class="hidden">
|
||||
<label>启用</label>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="ui negative button">取消</div>
|
||||
<button class="ui positive right labeled icon button">确认<i class="checkmark icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
@@ -16,7 +16,7 @@
|
||||
</div>
|
||||
<div class=" actions">
|
||||
<div class="ui negative button">取消</div>
|
||||
<button class="ui positive right labeled icon button">绑定<i class="checkmark icon"></i>
|
||||
<button class="ui positive right labeled icon button">确认<i class="checkmark icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
88
resource/template/dashboard/notification.html
Normal file
88
resource/template/dashboard/notification.html
Normal file
@@ -0,0 +1,88 @@
|
||||
{{define "dashboard/notification"}}
|
||||
{{template "common/header" .}}
|
||||
{{template "common/menu" .}}
|
||||
<div class="nb-container">
|
||||
<div class="ui container">
|
||||
<div class="ui grid">
|
||||
<div class="right floated right aligned twelve wide column">
|
||||
<button class="ui right labeled positive icon button" onclick="addOrEditNotification()"><i
|
||||
class="add icon"></i> 添加通知方式
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<table class="ui very basic table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>备注</th>
|
||||
<th>URL</th>
|
||||
<th>管理</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range $notification := .Notifications}}
|
||||
<tr>
|
||||
<td>{{$notification.ID}}</td>
|
||||
<td>{{$notification.Name}}</td>
|
||||
<td>{{$notification.URL}}</td>
|
||||
<td>
|
||||
<div class="ui mini icon buttons">
|
||||
<button class="ui button" onclick="addOrEditNotification({{$notification}})">
|
||||
<i class="edit icon"></i>
|
||||
</button>
|
||||
<button class="ui button"
|
||||
onclick="showConfirm('删除通知方式','确认删除此通知方式?',deleteRequest,'/api/notification/'+{{$notification.ID}})">
|
||||
<i class="delete icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="ui grid">
|
||||
<div class="right floated right aligned twelve wide column">
|
||||
<button class="ui right labeled positive icon button" onclick="addOrEditNotification()"><i
|
||||
class="add icon"></i> 添加报警规则
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<table class="ui very basic table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>备注</th>
|
||||
<th>URL</th>
|
||||
<th>管理</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range $notification := .Notifications}}
|
||||
<tr>
|
||||
<td>{{$notification.ID}}</td>
|
||||
<td>{{$notification.Name}}</td>
|
||||
<td>{{$notification.URL}}</td>
|
||||
<td>
|
||||
<div class="ui mini icon buttons">
|
||||
<button class="ui button" onclick="addOrEditNotification({{$notification}})">
|
||||
<i class="edit icon"></i>
|
||||
</button>
|
||||
<button class="ui button"
|
||||
onclick="showConfirm('删除通知方式','确认删除此通知方式?',deleteRequest,'/api/notification/'+{{$notification.ID}})">
|
||||
<i class="delete icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{{template "component/notification"}}
|
||||
{{template "common/footer" .}}
|
||||
<script>
|
||||
$('.checkbox').checkbox()
|
||||
</script>
|
||||
{{end}}
|
||||
@@ -20,7 +20,7 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>自定义CSS</label>
|
||||
<textarea name="CustomCSS" value="{{.Conf.Site.CustomCSS}}"></textarea>
|
||||
<textarea name="CustomCSS">{{.Conf.Site.CustomCSS}}</textarea>
|
||||
</div>
|
||||
<button class="ui button" type="submit">保存</button>
|
||||
</form>
|
||||
|
||||
@@ -134,8 +134,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button id="darkmodeButton"></button>
|
||||
<footer>
|
||||
<p style="text-align:center;padding: 15px;">Powered by <a href="https://github.com/naiba/nezha">哪吒面板</a> build ·
|
||||
{{.Version}}
|
||||
@@ -202,30 +200,6 @@
|
||||
if (hour > 17 || hour < 4) {
|
||||
document.body.classList.add('dark');
|
||||
}
|
||||
return
|
||||
//darkmode
|
||||
if (document.getElementById("darkmodeButton")) {
|
||||
var night = parseInt(document.cookie.replace(/(?:(?:^|.*;\s*)dark\s*=\s*([^;]*).*$)|^.*$/, "$1") || '0');
|
||||
if (night) {
|
||||
document.body.classList.add('dark');
|
||||
console.log('Dark mode on', night);
|
||||
}
|
||||
document.getElementById("darkmodeButton").onclick = function () {
|
||||
night = parseInt(document.cookie.replace(/(?:(?:^|.*;\s*)dark\s*=\s*([^;]*).*$)|^.*$/, "$1") || '0');
|
||||
if (!night) {
|
||||
document.body.classList.add('dark');
|
||||
document.cookie = "dark=1";
|
||||
console.log('Dark mode on', night);
|
||||
} else {
|
||||
document.body.classList.remove('dark');
|
||||
document.cookie = "dark=0";
|
||||
console.log('Dark mode off', night);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
document.cookie && (document.cookie = "");
|
||||
console.log('Darkmode not Support');
|
||||
}
|
||||
},
|
||||
secondToDate(s) {
|
||||
var d = Math.floor(s / 3600 / 24);
|
||||
|
||||
Reference in New Issue
Block a user