From be3fc417556cfca2dd52b1b47800092859b1b149 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=88=91=E8=8B=A5=E4=B8=BA=E7=8E=8B?= <807190135@qq.com>
Date: Tue, 12 Jan 2021 14:09:25 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=87=E7=AD=BE?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
cmd/dashboard/controller/member_api.go | 2 +
model/server.go | 8 +-
resource/template/component/server.html | 4 +
resource/template/dashboard/server.html | 2 +
resource/template/theme-default/home.html | 196 ++++++++++++++--------
5 files changed, 135 insertions(+), 77 deletions(-)
diff --git a/cmd/dashboard/controller/member_api.go b/cmd/dashboard/controller/member_api.go
index 438a104..8d72f70 100644
--- a/cmd/dashboard/controller/member_api.go
+++ b/cmd/dashboard/controller/member_api.go
@@ -87,6 +87,7 @@ type serverForm struct {
Name string `binding:"required"`
DisplayIndex int
Secret string
+ Tag string
}
func (ma *memberAPI) addOrEditServer(c *gin.Context) {
@@ -102,6 +103,7 @@ func (ma *memberAPI) addOrEditServer(c *gin.Context) {
s.Secret = sf.Secret
s.DisplayIndex = sf.DisplayIndex
s.ID = sf.ID
+ s.Tag = sf.Tag
if sf.ID == 0 {
s.Secret = com.MD5(fmt.Sprintf("%s%s%d", time.Now(), sf.Name, admin.ID))
s.Secret = s.Secret[:10]
diff --git a/model/server.go b/model/server.go
index de87d14..e4eeacd 100644
--- a/model/server.go
+++ b/model/server.go
@@ -14,10 +14,10 @@ type Server struct {
Name string
DisplayIndex int // 展示权重,越大越靠前
Secret string `json:"-"`
-
- Host *Host `gorm:"-"`
- State *State `gorm:"-"`
- LastActive time.Time
+ Tag string
+ Host *Host `gorm:"-"`
+ State *State `gorm:"-"`
+ LastActive time.Time
Stream pb.NezhaService_HeartbeatServer `gorm:"-" json:"-"`
StreamClose chan<- error `gorm:"-" json:"-"`
diff --git a/resource/template/component/server.html b/resource/template/component/server.html
index cb22edb..9a73595 100644
--- a/resource/template/component/server.html
+++ b/resource/template/component/server.html
@@ -8,6 +8,10 @@
+
+
+
+