mirror of
https://github.com/nezhahq/nezha.git
synced 2025-02-02 01:28: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 {
|
||||
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()
|
||||
},
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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 ? '修改<i class="edit icon"></i>' : '添加<i class="add icon"></i>')
|
||||
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="/static/semantic-ui-alerts.min.js"></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>
|
||||
|
||||
</html>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<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="/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" />
|
||||
</head>
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
<th>ID</th>
|
||||
<th>备注</th>
|
||||
<th>密钥</th>
|
||||
<th>最后活跃</th>
|
||||
<th>管理</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -25,9 +26,10 @@
|
||||
<td>{{$server.ID}}</td>
|
||||
<td>{{$server.Name}}</td>
|
||||
<td>{{$server.Secret}}</td>
|
||||
<td>{{$server.LastActive}}</td>
|
||||
<td>
|
||||
<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>
|
||||
</button>
|
||||
<button class="ui button"
|
||||
|
Loading…
Reference in New Issue
Block a user