mirror of
https://github.com/nezhahq/nezha.git
synced 2025-02-12 22:18:13 -05:00
🐛 fix #9
This commit is contained in:
parent
620d2ca68f
commit
8e30f48395
@ -27,12 +27,6 @@ func ServeWeb(port uint) {
|
|||||||
"stf": func(s uint64) string {
|
"stf": func(s uint64) string {
|
||||||
return time.Unix(int64(s), 0).Format("2006年1月2号 15:04")
|
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 {
|
"sf": func(duration uint64) string {
|
||||||
return time.Duration(time.Duration(duration) * time.Second).String()
|
return time.Duration(time.Duration(duration) * time.Second).String()
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
pb "github.com/naiba/nezha/proto"
|
pb "github.com/naiba/nezha/proto"
|
||||||
@ -19,3 +20,7 @@ type Server struct {
|
|||||||
Stream pb.NezhaService_HeartbeatServer `gorm:"-" json:"-"`
|
Stream pb.NezhaService_HeartbeatServer `gorm:"-" json:"-"`
|
||||||
StreamClose chan<- error `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)
|
||||||
|
}
|
||||||
|
@ -72,6 +72,9 @@ function showFormModal(modelSelector, formID, URL, getData) {
|
|||||||
|
|
||||||
function addOrEditServer(server) {
|
function addOrEditServer(server) {
|
||||||
const modal = $('.server.modal')
|
const modal = $('.server.modal')
|
||||||
|
if (server) {
|
||||||
|
server = JSON.parse(server)
|
||||||
|
}
|
||||||
modal.children('.header').text((server ? '修改' : '添加') + '服务器')
|
modal.children('.header').text((server ? '修改' : '添加') + '服务器')
|
||||||
modal.find('.positive.button').html(server ? '修改<i class="edit icon"></i>' : '添加<i class="add icon"></i>')
|
modal.find('.positive.button').html(server ? '修改<i class="edit icon"></i>' : '添加<i class="add icon"></i>')
|
||||||
modal.find('input[name=id]').val(server ? server.ID : null)
|
modal.find('input[name=id]').val(server ? server.ID : null)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<script src="https://cdnjs.loli.net/ajax/libs/semantic-ui/2.4.1/semantic.min.js"></script>
|
<script src="https://cdnjs.loli.net/ajax/libs/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://cdn.jsdelivr.net/npm/vue"></script>
|
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
|
||||||
<script src="/static/main.js?t_={{fs}}"></script>
|
<script src="/static/main.js?v202012091024"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<title>{{.Title}}</title>
|
<title>{{.Title}}</title>
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.loli.net/ajax/libs/semantic-ui/2.4.1/semantic.min.css">
|
<link rel="stylesheet" type="text/css" href="https://cdnjs.loli.net/ajax/libs/semantic-ui/2.4.1/semantic.min.css">
|
||||||
<link rel="stylesheet" type="text/css" href="/static/semantic-ui-alerts.min.css">
|
<link rel="stylesheet" type="text/css" href="/static/semantic-ui-alerts.min.css">
|
||||||
<link rel="stylesheet" type="text/css" href="/static/main.css?t_={{fs}}">
|
<link rel="stylesheet" type="text/css" href="/static/main.css?v202012091024">
|
||||||
<link rel="shortcut icon" type="image/png" href="/static/logo.png" />
|
<link rel="shortcut icon" type="image/png" href="/static/logo.png" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
<th>备注</th>
|
<th>备注</th>
|
||||||
<th>密钥</th>
|
<th>密钥</th>
|
||||||
|
<th>最后活跃</th>
|
||||||
<th>管理</th>
|
<th>管理</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -25,9 +26,10 @@
|
|||||||
<td>{{$server.ID}}</td>
|
<td>{{$server.ID}}</td>
|
||||||
<td>{{$server.Name}}</td>
|
<td>{{$server.Name}}</td>
|
||||||
<td>{{$server.Secret}}</td>
|
<td>{{$server.Secret}}</td>
|
||||||
|
<td>{{$server.LastActive}}</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="ui mini icon buttons">
|
<div class="ui mini icon buttons">
|
||||||
<button class="ui button" onclick="addOrEditServer({{$server}})">
|
<button class="ui button" onclick="addOrEditServer({{$server.Marshal}})">
|
||||||
<i class="edit icon"></i>
|
<i class="edit icon"></i>
|
||||||
</button>
|
</button>
|
||||||
<button class="ui button"
|
<button class="ui button"
|
||||||
|
Loading…
Reference in New Issue
Block a user