添加服务器 & 展示服务器

This commit is contained in:
奶爸
2019-12-08 23:18:29 +08:00
parent d8c4364653
commit 1b18e7103e
13 changed files with 149 additions and 38 deletions

View File

@@ -1,4 +1,9 @@
{{define "common/footer"}}
<div class="ui inverted vertical footer segment">
<div class="ui center aligned text container">
本系统由 <a href="https://github.com/p14yground/nezha" target="_blank">哪吒面板</a> 强力驱动
</div>
</div>
<script src="https://cdnjs.loli.net/ajax/libs/jquery/3.4.1/jquery.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>

View File

@@ -5,6 +5,9 @@
<img src="/static/logo.png">
</div>
<a class="item{{if eq .MatchedPath "/"}} active{{end}}" href="/">首页</a>
{{if .Admin}}
<a class="item{{if eq .MatchedPath "/server"}} active{{end}}" href="/server">服务器</a>
{{end}}
<div class="right menu">
<a class="item" href="https://github.com/p14yground/nezha/issues" target="_blank">反馈</a>
<div class="item">

View File

@@ -0,0 +1,18 @@
{{define "component/server"}}
<div class="ui tiny server modal transition hidden">
<div class="header">添加服务器</div>
<div class="content">
<form id="serverForm" class="ui form">
<div class="field">
<label>备注</label>
<input type="text" name="name" placeholder="爱因斯坦-光速1号">
</div>
</form>
</div>
<div class="actions">
<div class="ui negative button">取消</div>
<button class="ui positive right labeled icon button">绑定<i class="checkmark icon"></i>
</button>
</div>
</div>
{{end}}

View File

@@ -3,7 +3,23 @@
{{template "common/menu" .}}
<div class="nb-container">
<div class="ui container">
{{.Admin}}
<div class="ui four cards">
{{range $server := .Servers}}
<div class="card">
<div class="content">
<div class="header">{{.Name}}</div>
<div class="description">
<div class="ui active progress">
<div class="bar">
<div class="progress"></div>
</div>
<div class="label">CPU</div>
</div>
</div>
</div>
</div>
{{end}}
</div>
</div>
</div>
{{template "common/footer" .}}

View File

@@ -0,0 +1,30 @@
{{define "page/server"}}
{{template "common/header" .}}
{{template "common/menu" .}}
<div class="nb-container">
<div class="ui container">
<button class="ui right labeled positive icon button" onclick="addServer()"><i class="add icon"></i> 添加服务器
</button>
<table class="ui very basic table">
<thead>
<tr>
<th>ID</th>
<th>备注</th>
<th>密钥</th>
</tr>
</thead>
<tbody>
{{range $server := .Servers}}
<tr>
<td>{{$server.ID}}</td>
<td>{{$server.Name}}</td>
<td>{{$server.Secret}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</div>
{{template "component/server"}}
{{template "common/footer" .}}
{{end}}