Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
  • Loading branch information
xOS committed Feb 14, 2024
1 parent e4dbeaf commit f4dce4a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 5 deletions.
6 changes: 3 additions & 3 deletions cmd/agent/monitor/myip.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ func UpdateIP() {
continue
}
if ipv4.IP != "" && ipv6.IP == "" {
CachedIP = fmt.Sprintf("IPv4:%s", ipv4.IP)
CachedIP = fmt.Sprintf("%s", ipv4.IP)
} else if ipv4.IP == "" && ipv6.IP != "" {
CachedIP = fmt.Sprintf("IPv6:[%s]", ipv6.IP)
CachedIP = fmt.Sprintf("[%s]", ipv6.IP)
} else {
CachedIP = fmt.Sprintf("IPv4:%s/IPv6:[%s]", ipv4.IP, ipv6.IP)
CachedIP = fmt.Sprintf("%s/[%s]", ipv4.IP, ipv6.IP)
}
if ipv4.CountryCode != "" {
cachedCountry = ipv4.CountryCode
Expand Down
2 changes: 2 additions & 0 deletions cmd/dashboard/controller/member_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ type monitorForm struct {
MaxLatency float32
LatencyNotify string
EnableTriggerTask string
EnableShowInService string
FailTriggerTasksRaw string
RecoverTriggerTasksRaw string
}
Expand All @@ -416,6 +417,7 @@ func (ma *memberAPI) addOrEditMonitor(c *gin.Context) {
m.LatencyNotify = mf.LatencyNotify == "on"
m.MinLatency = mf.MinLatency
m.MaxLatency = mf.MaxLatency
m.EnableShowInService = mf.EnableShowInService == "on"
m.EnableTriggerTask = mf.EnableTriggerTask == "on"
m.RecoverTriggerTasksRaw = mf.RecoverTriggerTasksRaw
m.FailTriggerTasksRaw = mf.FailTriggerTasksRaw
Expand Down
1 change: 1 addition & 0 deletions model/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type Monitor struct {
Cover uint8

EnableTriggerTask bool `gorm:"default: false"`
EnableShowInService bool `gorm:"default: false"`
FailTriggerTasksRaw string `gorm:"default:'[]'"`
RecoverTriggerTasksRaw string `gorm:"default:'[]'"`
FailTriggerTasks []uint64 `gorm:"-" json:"-"` // 失败时执行的触发任务id
Expand Down
5 changes: 5 additions & 0 deletions resource/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@ function addOrEditMonitor(monitor) {
modal.find("select[name=Type]").val(monitor ? monitor.Type : 1);
modal.find("select[name=Cover]").val(monitor ? monitor.Cover : 0);
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) {
modal.find(".ui.nb-notify.checkbox").checkbox("set checked");
} else {
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://lf3-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?v20220423"></script>
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.14/vue.min.js"></script>
<script src="static/main.js?v20240208"></script>
<script src="static/main.js?v20240214"></script>
<script src="static/wallpaper.js?v20220423"></script>
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/clipboard.js/2.0.6/clipboard.min.js"></script>
<script>
Expand Down
8 changes: 7 additions & 1 deletion resource/template/component/monitor.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
<option value="2">ICMP-Ping</option>
</select>
</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">
<label>{{tr "Duration"}}</label>
<input type="number" name="Duration" placeholder="{{tr "Seconds"}}" />
Expand All @@ -45,7 +51,7 @@
</div>
<div class="field">
<label>{{tr "NotificationMethodGroup"}}</label>
<input type="text" name="NotificationTag" placeholder="默认" />
<input type="text" name="NotificationTag" placeholder="default" />
</div>
<div class="field">
<div class="ui nb-notify checkbox">
Expand Down

0 comments on commit f4dce4a

Please sign in to comment.