diff --git a/cmd/dashboard/controller/controller.go b/cmd/dashboard/controller/controller.go
index bff034e..95485b9 100644
--- a/cmd/dashboard/controller/controller.go
+++ b/cmd/dashboard/controller/controller.go
@@ -27,12 +27,6 @@ func ServeWeb(port uint) {
"stf": func(s uint64) string {
return time.Unix(int64(s), 0).Format("2006年1月2号 15:04")
},
- "fs": func() string {
- if !dao.Conf.Debug {
- return ""
- }
- return fmt.Sprintf("%d", time.Now().UnixNano())
- },
"sf": func(duration uint64) string {
return time.Duration(time.Duration(duration) * time.Second).String()
},
diff --git a/model/server.go b/model/server.go
index c5790d3..643d1ea 100644
--- a/model/server.go
+++ b/model/server.go
@@ -1,6 +1,7 @@
package model
import (
+ "fmt"
"time"
pb "github.com/naiba/nezha/proto"
@@ -19,3 +20,7 @@ type Server struct {
Stream pb.NezhaService_HeartbeatServer `gorm:"-" json:"-"`
StreamClose chan<- error `gorm:"-" json:"-"`
}
+
+func (s Server) Marshal() string {
+ return fmt.Sprintf(`{"ID":%d,"Name":"%s","Secret":"%s"}`, s.ID, s.Name, s.Secret)
+}
diff --git a/resource/static/main.js b/resource/static/main.js
index 8435d92..1353053 100644
--- a/resource/static/main.js
+++ b/resource/static/main.js
@@ -72,6 +72,9 @@ function showFormModal(modelSelector, formID, URL, getData) {
function addOrEditServer(server) {
const modal = $('.server.modal')
+ if (server) {
+ server = JSON.parse(server)
+ }
modal.children('.header').text((server ? '修改' : '添加') + '服务器')
modal.find('.positive.button').html(server ? '修改' : '添加')
modal.find('input[name=id]').val(server ? server.ID : null)
diff --git a/resource/template/common/footer.html b/resource/template/common/footer.html
index 45b394a..7aade5d 100644
--- a/resource/template/common/footer.html
+++ b/resource/template/common/footer.html
@@ -8,7 +8,7 @@
-
+