2020-12-09 06:05:40 -05:00
|
|
|
|
{{define "dashboard/server"}}
|
2019-12-08 10:18:29 -05:00
|
|
|
|
{{template "common/header" .}}
|
|
|
|
|
{{template "common/menu" .}}
|
|
|
|
|
<div class="nb-container">
|
|
|
|
|
<div class="ui container">
|
2020-03-22 08:55:27 -04:00
|
|
|
|
<div class="ui grid">
|
|
|
|
|
<div class="right floated right aligned twelve wide column">
|
2021-08-05 23:48:34 -04:00
|
|
|
|
<button class="ui right labeled nezha-primary-btn icon button" onclick="addOrEditServer()"><i
|
2021-09-29 07:58:02 -04:00
|
|
|
|
class="add icon"></i> 添加主机
|
2020-03-22 08:55:27 -04:00
|
|
|
|
</button>
|
2021-11-04 00:06:20 -04:00
|
|
|
|
<button class="ui right labeled nezha-primary-btn icon button" onclick="forceUpdate()"><i
|
|
|
|
|
class="arrow alternate circle up outline icon"></i> 强制更新
|
|
|
|
|
</button>
|
2020-03-22 08:55:27 -04:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2019-12-08 10:18:29 -05:00
|
|
|
|
<table class="ui very basic table">
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
2021-11-04 00:06:20 -04:00
|
|
|
|
<th><button onclick="checkAllServer()" class="ui mini nezha-primary-btn button">全选</button></th>
|
2021-01-30 04:10:51 -05:00
|
|
|
|
<th>ID(排序)</th>
|
2021-01-29 22:22:59 -05:00
|
|
|
|
<th>名称</th>
|
2021-01-20 06:24:59 -05:00
|
|
|
|
<th>分组</th>
|
2021-01-08 08:04:50 -05:00
|
|
|
|
<th>IP</th>
|
2021-06-21 09:30:42 -04:00
|
|
|
|
<th>版本号</th>
|
2019-12-08 10:18:29 -05:00
|
|
|
|
<th>密钥</th>
|
2021-08-10 08:04:58 -04:00
|
|
|
|
<th>一键安装</th>
|
2021-01-29 22:22:59 -05:00
|
|
|
|
<th>备注</th>
|
2019-12-20 10:58:09 -05:00
|
|
|
|
<th>管理</th>
|
2019-12-08 10:18:29 -05:00
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
{{range $server := .Servers}}
|
|
|
|
|
<tr>
|
2021-11-04 00:06:20 -04:00
|
|
|
|
<td><input type="checkbox" class="nezha-servers" value="{{$server.ID}}" /></td>
|
2021-01-30 04:10:51 -05:00
|
|
|
|
<td>{{$server.ID}}({{$server.DisplayIndex}})</td>
|
2019-12-08 10:18:29 -05:00
|
|
|
|
<td>{{$server.Name}}</td>
|
2021-01-12 01:09:25 -05:00
|
|
|
|
<td>{{$server.Tag}}</td>
|
2021-01-08 08:04:50 -05:00
|
|
|
|
<td>{{$server.Host.IP}}</td>
|
2021-06-21 09:30:42 -04:00
|
|
|
|
<td>{{$server.Host.Version}}</td>
|
2019-12-08 10:18:29 -05:00
|
|
|
|
<td>{{$server.Secret}}</td>
|
2021-08-10 08:04:58 -04:00
|
|
|
|
<td>
|
|
|
|
|
<button class="ui icon green mini button"
|
2021-11-10 23:49:54 -05:00
|
|
|
|
data-clipboard-text="{{if $.Conf.GRPCHost}}curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh install_agent {{$.Conf.GRPCHost}} {{if $.Conf.ProxyGRPCPort}}{{$.Conf.ProxyGRPCPort}}{{else}}{{$.Conf.GRPCPort}}{{end}} {{$server.Secret}}{{if $.Conf.TLS}} --tls{{end}}{{else}}请先在设置页面配置 未接入CDN的面板服务器域名/IP{{end}}"
|
2021-08-10 08:04:58 -04:00
|
|
|
|
data-tooltip="点击复制安装命令">
|
|
|
|
|
<i class="linux icon"></i>
|
|
|
|
|
</button>
|
2022-04-28 15:24:52 -04:00
|
|
|
|
<button class="ui icon green mini button"
|
|
|
|
|
data-clipboard-text="{{if $.Conf.GRPCHost}}set-ExecutionPolicy RemoteSigned;Invoke-WebRequest https://raw.githubusercontent.com/naiba/nezha/master/script/install.ps1 -OutFile C:\install.ps1;powershell.exe C:\install.ps1 {{$.Conf.GRPCHost}}:{{if $.Conf.ProxyGRPCPort}}{{$.Conf.ProxyGRPCPort}}{{else}}{{$.Conf.GRPCPort}}{{end}} {{$server.Secret}}{{if $.Conf.TLS}} --tls{{end}}{{else}}请先在设置页面配置 未接入CDN的面板服务器域名/IP{{end}}"
|
|
|
|
|
data-tooltip="点击复制安装命令">
|
2021-08-10 08:04:58 -04:00
|
|
|
|
<i class="windows icon"></i>
|
|
|
|
|
</button>
|
|
|
|
|
<button class="ui icon mini button" data-tooltip="尚未支持,请下载release手动安装">
|
|
|
|
|
<i class="apple icon"></i>
|
|
|
|
|
</button>
|
|
|
|
|
</td>
|
2021-01-20 06:24:59 -05:00
|
|
|
|
<td style="word-break: break-word;">{{$server.Note}}</td>
|
2019-12-20 10:58:09 -05:00
|
|
|
|
<td>
|
|
|
|
|
<div class="ui mini icon buttons">
|
2021-08-17 23:56:54 -04:00
|
|
|
|
<button class="ui button" onclick="connectToServer({{$server.ID}})">
|
|
|
|
|
<i class="terminal icon"></i>
|
|
|
|
|
</button>
|
2021-08-10 08:04:58 -04:00
|
|
|
|
<button class="ui button" onclick="addOrEditServer({{$server.Marshal}})">
|
2019-12-20 10:58:09 -05:00
|
|
|
|
<i class="edit icon"></i>
|
|
|
|
|
</button>
|
2020-03-22 08:55:27 -04:00
|
|
|
|
<button class="ui button"
|
2021-09-29 07:58:02 -04:00
|
|
|
|
onclick="showConfirm('删除主机','确认删除此主机?',deleteRequest,'/api/server/'+{{$server.ID}})">
|
2021-01-20 06:24:59 -05:00
|
|
|
|
<i class="trash alternate outline icon"></i>
|
2019-12-20 10:58:09 -05:00
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
2019-12-08 10:18:29 -05:00
|
|
|
|
</tr>
|
|
|
|
|
{{end}}
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-08-10 08:04:58 -04:00
|
|
|
|
{{template "component/server" .}}
|
2019-12-08 10:18:29 -05:00
|
|
|
|
{{template "common/footer" .}}
|
2021-08-10 08:04:58 -04:00
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>
|
|
|
|
|
<script>
|
|
|
|
|
var clipboard = new ClipboardJS('.ui.icon.green.mini.button');
|
2021-11-04 00:06:20 -04:00
|
|
|
|
const checkBoxList = document.querySelectorAll('tbody > tr > td > input.nezha-servers[type=checkbox]')
|
|
|
|
|
function checkAllServer() {
|
|
|
|
|
checkBoxList.forEach(cb => {
|
|
|
|
|
cb.checked = true
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
function forceUpdate() {
|
|
|
|
|
const servers = []
|
|
|
|
|
checkBoxList.forEach(cb => {
|
|
|
|
|
if (cb.checked) {
|
|
|
|
|
servers.push(parseInt(cb.value))
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (servers.length == 0) {
|
|
|
|
|
$.suiAlert({
|
|
|
|
|
title: '当前没有选中的服务器',
|
|
|
|
|
description: '',
|
|
|
|
|
type: 'warning',
|
|
|
|
|
time: '2',
|
|
|
|
|
position: 'top-center',
|
|
|
|
|
});
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
$.post('/api/force-update', JSON.stringify(servers))
|
|
|
|
|
.then((resp) => {
|
|
|
|
|
if (resp.code == 200) {
|
|
|
|
|
$.suiAlert({
|
|
|
|
|
title: '执行结果',
|
|
|
|
|
description: resp.message,
|
|
|
|
|
type: 'success',
|
|
|
|
|
time: '3',
|
|
|
|
|
position: 'top-center',
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
$.suiAlert({
|
|
|
|
|
title: '',
|
|
|
|
|
description: resp.message,
|
|
|
|
|
type: 'error',
|
|
|
|
|
time: '3',
|
|
|
|
|
position: 'top-center',
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
$.suiAlert({
|
|
|
|
|
title: '',
|
|
|
|
|
description: err,
|
|
|
|
|
type: 'error',
|
|
|
|
|
time: '3',
|
|
|
|
|
position: 'top-center',
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
}
|
2021-08-10 08:04:58 -04:00
|
|
|
|
</script>
|
2022-04-28 15:24:52 -04:00
|
|
|
|
{{end}}
|