-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathhost_list.html
129 lines (124 loc) · 7.2 KB
/
host_list.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
{{template "page_top" .}}
{{template "nav_cat_bar" .}}
{{$Uname := .Uname}}
{{$Auth := .Auth}}
{{if eq .Auth 1}}
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-sm-12">
<div class="ibox float-e-margins">
<div class="ibox-content">
<div class="">
{{if and (eq .Auth 1) (eq .Uname "netop")}}
<a href="/asset/host/add" class="btn btn-sm btn-primary " {{if ne $Uname "netop"}}disabled="disabled"{{end}}> 添加主机 </a>
<a id="del_btn" class="btn btn-sm btn-danger" {{if ne $Uname "netop"}}disabled="disabled"{{end}}> 删除所选 </a>
{{end}}
{{if .IsSearch}}
<a href="/asset/host/list" class="btn btn-white pull-right"> 返回列表 </a>
{{else}}
<form id="search_form" method="get" action="/asset/host/search" class="form-inline pull-right">
<div class="input-group">
<select name="idc" class="form-control">
<option value="" selected>---请选择机房---</option>
<option value="Ucloud">Ucloud</option>
<option value="网宿机房">网宿机房</option>
<option value="腾讯云">腾讯云</option>
<option value="阿里云">阿里云</option>
<option value="青云">青云</option>
<option value="AWS">AWS</option>
<option value="微软云">微软云</option>
<option value="百度云">百度云</option>
<option value="金山云">金山云</option>
<option value="亚太">亚太</option>
<option value="人民中">人民中</option>
<option value="新滘西">新滘西</option>
</select>
</div>
<div class="input-group">
<input type="text" class="form-control" id="search_input" name="keyword" placeholder="按主机名称搜索...">
<div class="input-group-btn">
<button id='search_btn' type="submit" class="btn btn-sm btn-primary">
-搜索-
</button>
</div>
</div>
</form>
{{end}}
</div>
<table class="table table-striped table-bordered table-hover " id="editable" >
<thead>
<tr>
<th class="text-center">
<input type="checkbox" id="check_all" onclick="checkAll('check_all', 'checked')">
</th>
<th class="text-center">系统服务名</th>
<th class="text-center">主机名</th>
<th class="text-center">IP地址</th>
<th class="text-center">所属机房</th>
<th class="text-center">远程登陆</th>
<th class="text-center">操作</th>
</tr>
</thead>
<tbody>
{{range .Hosts}}
<tr class="gradeX">
<td class="text-center">
<input type="checkbox" name="checked" value="{{.Id}}">
</td>
<td class="text-center">{{.Service_name}}</td>
<td class="text-center"><a href="http://grafana.plateno.cc/dashboard/db/falconprod_sheng-chan-huan-jing?refresh=1m&orgId=1&var-falconprod={{.Name}}" target="_blank">{{.Name}}</td>
<td class="text-center"><a href="#">{{.Ip}}</a></td>
<td class="text-center">{{.Idc}}</td>
<td class="text-center">
<a href="/asset/host/webconsole?ip={{.Ip}}&id={{.Id}}&user={{.Root}}&role=1" target="_black" class="btn btn-xs btn-danger" {{if ne $Uname "netop"}}disabled="disabled"{{end}}>ROOT用户</a>
<a href="/asset/host/webconsole?ip={{.Ip}}&id={{.Id}}&user={{.Read}}&role=2" target="_black" class="btn btn-xs btn btn-success" {{if ne $Uname "netop"}}disabled="disabled"{{end}}>只读用户</a>
</td>
<td class="text-center">
<a href="/asset/host/detail?id={{.Id}}" class="btn btn-xs btn-success" >详情</a>
<a href="/asset/host/add?id={{.Id}}" class="btn btn-xs btn-info" {{if ne $Uname "netop"}}disabled="disabled"{{end}}>编辑</a>
<a href="/asset/host/del?id={{.Id}}" class="btn btn-xs btn-warning" {{if ne $Uname "netop"}}disabled="disabled"{{end}} onclick="if(confirm('确定回收?')==false)return false;">回收</a>
</td>
</tr>
{{end}}
</tbody>
</table>
<div class="row">
<div class="col-sm-6">
<div class="dataTables_info" id="editable_info" role="status" aria-live="polite">
Total {{.totals}} entries
</div>
</div>
{{template "paginator" .}}
</div>
</div>
</div>
</div>
</div>
</div>
{{else}}
<div><span style="font-size:18px;color:red;">没有相关权限!</span></div>
{{end}}
<script src="/static/js/jquery.shiftcheckbox.js"></script>
<script>
$(document).ready(function(){
$('#del_btn').click(function(){
var check_array = [];
if (confirm("确定回收")) {
$(".gradeX input:checked").each(function() {
check_array.push($(this).attr("value"))
});
console.log(check_array.join(","));
$.post("/asset/host/bitchDel",
{ids: check_array.join(",")},
function(data){
//console.log(data);
//$(".gradeX input:checked").closest("tr").remove();
window.location.href="/asset/host/list"
//alert(data);
}
)
}
});
});
</script>
{{template "page_buttom"}}