mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-22 20:58:14 -05:00
fix: add toggle to service (#317)
* fix: short nework word * fix: add toggle on service * fix: delete console log update main.js version --------- Co-authored-by: LvGJ <lvgj1998@gmail.com>
This commit is contained in:
parent
b86b73a433
commit
626613441d
@ -394,6 +394,7 @@ type monitorForm struct {
|
|||||||
MaxLatency float32
|
MaxLatency float32
|
||||||
LatencyNotify string
|
LatencyNotify string
|
||||||
EnableTriggerTask string
|
EnableTriggerTask string
|
||||||
|
EnableShowInService string
|
||||||
FailTriggerTasksRaw string
|
FailTriggerTasksRaw string
|
||||||
RecoverTriggerTasksRaw string
|
RecoverTriggerTasksRaw string
|
||||||
}
|
}
|
||||||
@ -415,6 +416,7 @@ func (ma *memberAPI) addOrEditMonitor(c *gin.Context) {
|
|||||||
m.LatencyNotify = mf.LatencyNotify == "on"
|
m.LatencyNotify = mf.LatencyNotify == "on"
|
||||||
m.MinLatency = mf.MinLatency
|
m.MinLatency = mf.MinLatency
|
||||||
m.MaxLatency = mf.MaxLatency
|
m.MaxLatency = mf.MaxLatency
|
||||||
|
m.EnableShowInService = mf.EnableShowInService == "on"
|
||||||
m.EnableTriggerTask = mf.EnableTriggerTask == "on"
|
m.EnableTriggerTask = mf.EnableTriggerTask == "on"
|
||||||
m.RecoverTriggerTasksRaw = mf.RecoverTriggerTasksRaw
|
m.RecoverTriggerTasksRaw = mf.RecoverTriggerTasksRaw
|
||||||
m.FailTriggerTasksRaw = mf.FailTriggerTasksRaw
|
m.FailTriggerTasksRaw = mf.FailTriggerTasksRaw
|
||||||
|
@ -50,6 +50,7 @@ type Monitor struct {
|
|||||||
Cover uint8
|
Cover uint8
|
||||||
|
|
||||||
EnableTriggerTask bool `gorm:"default: false"`
|
EnableTriggerTask bool `gorm:"default: false"`
|
||||||
|
EnableShowInService bool `gorm:"default: false"`
|
||||||
FailTriggerTasksRaw string `gorm:"default:'[]'"`
|
FailTriggerTasksRaw string `gorm:"default:'[]'"`
|
||||||
RecoverTriggerTasksRaw string `gorm:"default:'[]'"`
|
RecoverTriggerTasksRaw string `gorm:"default:'[]'"`
|
||||||
FailTriggerTasks []uint64 `gorm:"-" json:"-"` // 失败时执行的触发任务id
|
FailTriggerTasks []uint64 `gorm:"-" json:"-"` // 失败时执行的触发任务id
|
||||||
|
5
resource/l10n/en-US.toml
vendored
5
resource/l10n/en-US.toml
vendored
@ -611,4 +611,7 @@ other = "Hide for Guest"
|
|||||||
other = "Menu"
|
other = "Menu"
|
||||||
|
|
||||||
[NetworkSpiter]
|
[NetworkSpiter]
|
||||||
other = "Network Monitor"
|
other = "Network"
|
||||||
|
|
||||||
|
[EnableShowInService]
|
||||||
|
other = "Enable Show in Service"
|
5
resource/l10n/es-ES.toml
vendored
5
resource/l10n/es-ES.toml
vendored
@ -611,4 +611,7 @@ other = "Ocultar para Invitados"
|
|||||||
other = "Menú"
|
other = "Menú"
|
||||||
|
|
||||||
[NetworkSpiter]
|
[NetworkSpiter]
|
||||||
other = "Supervisión De Redes"
|
other = "Red"
|
||||||
|
|
||||||
|
[EnableShowInService]
|
||||||
|
other = "Mostrar en servicio"
|
5
resource/l10n/zh-CN.toml
vendored
5
resource/l10n/zh-CN.toml
vendored
@ -611,4 +611,7 @@ other = "对游客隐藏"
|
|||||||
other = "菜单"
|
other = "菜单"
|
||||||
|
|
||||||
[NetworkSpiter]
|
[NetworkSpiter]
|
||||||
other = "网络监控"
|
other = "网络"
|
||||||
|
|
||||||
|
[EnableShowInService]
|
||||||
|
other = "在服务中显示"
|
||||||
|
5
resource/l10n/zh-TW.toml
vendored
5
resource/l10n/zh-TW.toml
vendored
@ -611,4 +611,7 @@ other = "對遊客隱藏"
|
|||||||
other = "菜單"
|
other = "菜單"
|
||||||
|
|
||||||
[NetworkSpiter]
|
[NetworkSpiter]
|
||||||
other = "網絡監控"
|
other = "網絡"
|
||||||
|
|
||||||
|
[EnableShowInService]
|
||||||
|
other = "在服務中顯示"
|
@ -339,6 +339,11 @@ function addOrEditMonitor(monitor) {
|
|||||||
modal.find("select[name=Type]").val(monitor ? monitor.Type : 1);
|
modal.find("select[name=Type]").val(monitor ? monitor.Type : 1);
|
||||||
modal.find("select[name=Cover]").val(monitor ? monitor.Cover : 0);
|
modal.find("select[name=Cover]").val(monitor ? monitor.Cover : 0);
|
||||||
modal.find("input[name=NotificationTag]").val(monitor ? monitor.NotificationTag : null);
|
modal.find("input[name=NotificationTag]").val(monitor ? monitor.NotificationTag : null);
|
||||||
|
if (monitor && monitor.EnableShowInService) {
|
||||||
|
modal.find(".ui.nb-show-in-service.checkbox").checkbox("set checked")
|
||||||
|
} else {
|
||||||
|
modal.find(".ui.nb-show-in-service.checkbox").checkbox("set unchecked")
|
||||||
|
}
|
||||||
if (monitor && monitor.Notify) {
|
if (monitor && monitor.Notify) {
|
||||||
modal.find(".ui.nb-notify.checkbox").checkbox("set checked");
|
modal.find(".ui.nb-notify.checkbox").checkbox("set checked");
|
||||||
} else {
|
} else {
|
||||||
|
2
resource/template/common/footer.html
vendored
2
resource/template/common/footer.html
vendored
@ -10,7 +10,7 @@
|
|||||||
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/semantic-ui/2.4.1/semantic.min.js"></script>
|
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/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-y/vue/2.6.14/vue.min.js"></script>
|
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/vue/2.6.14/vue.min.js"></script>
|
||||||
<script src="/static/main.js?v20230614"></script>
|
<script src="/static/main.js?v20240213"></script>
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
updateLang({{.LANG }});
|
updateLang({{.LANG }});
|
||||||
|
7
resource/template/component/monitor.html
vendored
7
resource/template/component/monitor.html
vendored
@ -24,6 +24,12 @@
|
|||||||
<option value="3">TCP-Ping</option>
|
<option value="3">TCP-Ping</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui nb-show-in-service checkbox">
|
||||||
|
<input name="EnableShowInService" type="checkbox" tabindex="0" class="hidden" />
|
||||||
|
<label>{{tr "EnableShowInService"}}</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>{{tr "Duration"}}</label>
|
<label>{{tr "Duration"}}</label>
|
||||||
<input type="number" name="Duration" placeholder="{{tr "Seconds"}}" />
|
<input type="number" name="Duration" placeholder="{{tr "Seconds"}}" />
|
||||||
@ -110,3 +116,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/semantic-ui/2.4.1/semantic.min.js"></script>
|
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/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-y/vue/2.6.14/vue.min.js"></script>
|
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/vue/2.6.14/vue.min.js"></script>
|
||||||
<script src="/static/main.js?v20230614"></script>
|
<script src="/static/main.js?v20240213"></script>
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
updateLang({{.LANG }});
|
updateLang({{.LANG }});
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
</section>
|
</section>
|
||||||
<section class="monitor-container">
|
<section class="monitor-container">
|
||||||
{{range $service := .Services}}
|
{{range $service := .Services}}
|
||||||
|
{{if $service.Monitor.EnableShowInService}}
|
||||||
<section class="monitor-info-container">
|
<section class="monitor-info-container">
|
||||||
<div class="monitor-state">
|
<div class="monitor-state">
|
||||||
<span class="monitor-state-dot {{className (divU64 $service.CurrentUp (addU64 $service.CurrentUp $service.CurrentDown))}}"></span>
|
<span class="monitor-state-dot {{className (divU64 $service.CurrentUp (addU64 $service.CurrentUp $service.CurrentDown))}}"></span>
|
||||||
@ -82,6 +83,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{end}}
|
||||||
</section>
|
</section>
|
||||||
{{if .CycleTransferStats}}
|
{{if .CycleTransferStats}}
|
||||||
<h2 class="mdui-m-t-5 mdui-text-center">{{tr "CycleTransferStats"}}</h2>
|
<h2 class="mdui-m-t-5 mdui-text-center">{{tr "CycleTransferStats"}}</h2>
|
||||||
|
3
resource/template/theme-default/service.html
vendored
3
resource/template/theme-default/service.html
vendored
@ -18,6 +18,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{range $service := .Services}}
|
{{range $service := .Services}}
|
||||||
|
{{if $service.Monitor.EnableShowInService}}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="ui center aligned">{{$service.Monitor.Name}}</td>
|
<td class="ui center aligned">{{$service.Monitor.Name}}</td>
|
||||||
<td class="ui center aligned">
|
<td class="ui center aligned">
|
||||||
@ -33,7 +34,7 @@
|
|||||||
class="delay-today {{className (divU64 $service.CurrentUp (addU64 $service.CurrentUp $service.CurrentDown))}}"></i>
|
class="delay-today {{className (divU64 $service.CurrentUp (addU64 $service.CurrentUp $service.CurrentDown))}}"></i>
|
||||||
{{statusName (divU64 $service.CurrentUp (addU64 $service.CurrentUp $service.CurrentDown))}}
|
{{statusName (divU64 $service.CurrentUp (addU64 $service.CurrentUp $service.CurrentDown))}}
|
||||||
</td>
|
</td>
|
||||||
</tr> {{end}}
|
</tr> {{end}} {{end}}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody id="servers">
|
<tbody id="servers">
|
||||||
<template v-for="service in services">
|
<template v-for="service in services">
|
||||||
<tr>
|
<tr v-if="service.enableShow === 'true'">
|
||||||
<td class="node-cell center">
|
<td class="node-cell center">
|
||||||
<div class="delay-today">
|
<div class="delay-today">
|
||||||
<i class="delay-today" :class="service.health.className"></i>
|
<i class="delay-today" :class="service.health.className"></i>
|
||||||
@ -137,6 +137,7 @@
|
|||||||
delay: '{{$service.Delay}}'.replaceAll("[","").replaceAll("]","").split(" "),
|
delay: '{{$service.Delay}}'.replaceAll("[","").replaceAll("]","").split(" "),
|
||||||
up: '{{$service.Up}}'.replaceAll("[","").replaceAll("]","").split(" "),
|
up: '{{$service.Up}}'.replaceAll("[","").replaceAll("]","").split(" "),
|
||||||
down: '{{$service.Down}}'.replaceAll("[","").replaceAll("]","").split(" "),
|
down: '{{$service.Down}}'.replaceAll("[","").replaceAll("]","").split(" "),
|
||||||
|
enableShow: '{{$service.Monitor.EnableShowInService}}',
|
||||||
})
|
})
|
||||||
{{end}}
|
{{end}}
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
Loading…
Reference in New Issue
Block a user