This commit is contained in:
root
2020-03-01 15:05:26 +08:00
parent 0865c98a7f
commit 0897f84a04
59 changed files with 13628 additions and 25877 deletions

115
web/views/index/hlist.html Executable file → Normal file
View File

@@ -4,7 +4,7 @@
<div class="col-lg-12">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>host list</h5>
<h5 langtag="page-hostlist"></h5>
<div class="ibox-tools">
<a class="collapse-link">
@@ -18,9 +18,8 @@
<div class="content">
<div class="table-responsive">
<div id="toolbar">
<a href="{{.web_base_url}}/index/addhost?vkey={{.task_id}}&client_id={{.client_id}}"
class="btn btn-primary dim"
type="button" langtag="info-new">新增</a>
<a href="{{.web_base_url}}/index/addhost?vkey={{.task_id}}&client_id={{.client_id}}" class="btn btn-primary dim">
<i class="fa fa-fw fa-lg fa-plus"></i> <span langtag="word-add"></span></a>
</div>
<table id="taskList_table" class="table-striped table-hover"
data-mobile-responsive="true"></table>
@@ -61,118 +60,102 @@
pageList: [5, 10, 20, 50],//分页步进值
detailView: true,
smartDisplay: true, // 智能显示 pagination 和 cardview 等
onExpandRow: function () {$('body').setLang ('.detail-view');},
onPostBody: function (data) { if ($(this)[0].locale != undefined ) $('body').setLang ('#table'); },
detailFormatter: function (index, row, element) {
return '<b langtag="info-export-flow">出口流量</b>' + change(row.Flow.ExportFlow) + `&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp`
+ '<b langtag="info-inlet-flow">入口流量</b>' + change(row.Flow.InletFlow) + `&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp`
+ '<b langtag="info-crypt">加密</b>' + row.Client.Cnf.Crypt + `&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp`
+ '<b langtag="info-compress">压缩</b>' + row.Client.Cnf.Compress + `&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp` + "<br/><br>"
+ '<b langtag="info-web-auth-username">basic权限认证用户名</b>' + row.Client.Cnf.U + `&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp`
+ '<b langtag="info-web-auth-password">basic权限认证密码</b>' + row.Client.Cnf.P + `&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp` + "<br/><br>"
+ '<b langtag="info-https-cert">cert file路径</b>' + row.CertFilePath + `&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp`
+ '<b langtag="info-https-key">key file路径</b>' + row.KeyFilePath + `&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp` + "<br/><br>"
+ '<b langtag="info-header-change">request header修改</b>' + row.HeaderChange + `&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp` + "<br/><br>"
+ '<b langtag="info-host-change">request host 修改</b>' + row.HostChange + `&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp`
return '<b langtag="word-exportflow"></b>: ' + changeunit(row.Flow.ExportFlow) + '&emsp;'
+ '<b langtag="word-inletflow"></b>: ' + changeunit(row.Flow.InletFlow) + '&emsp;'
+ '<b langtag="word-crypt"></b>: ' + row.Client.Cnf.Crypt + '&emsp;'
+ '<b langtag="word-compress"></b>: ' + row.Client.Cnf.Compress + '&emsp;'
+ '<b langtag="word-basicusername"></b>: ' + row.Client.Cnf.U + '&emsp;'
+ '<b langtag="word-basicpassword"></b>: ' + row.Client.Cnf.P + '&emsp;<br/><br>'
+ '<b langtag="word-httpscert"></b>: ' + row.CertFilePath + '&emsp;'
+ '<b langtag="word-httpskey"></b>: ' + row.KeyFilePath + '&emsp;<br/><br>'
+ '<b langtag="word-requestheader"></b>: ' + row.HeaderChange + '&emsp;<br/><br>'
+ '<b langtag="word-requesthost"></b>: ' + row.HostChange + '&emsp;'
},
//表格的列
columns: [
{
field: 'Id',//域值
title: 'id',//标题
visible: true,//false表示不显示
title: '<span langtag="word-id"></span>',//标题
halign: 'center',
visible: true//false表示不显示
},
{
field: 'Id',//域值
title: 'client id',//标题
title: '<span langtag="word-clientid"></span>',//标题
halign: 'center',
visible: true,//false表示不显示
formatter: function (value, row, index) {
return row.Client.Id
}
},
{
field: 'Remark',//域值
title: 'remark',//标题
visible: true,//false表示不显示
title: '<span langtag="word-remark"></span>',//标题
halign: 'center',
visible: true//false表示不显示
},
{
field: 'Host',//域值
title: 'host',//标题
visible: true,//false表示不显示
title: '<span langtag="word-host"></span>',//标题
halign: 'center',
visible: true//false表示不显示
},
{
field: 'Scheme',//域值
title: 'scheme',//标题
title: '<span langtag="word-scheme"></span>',//标题
halign: 'center',
visible: true,//false表示不显示
formatter: function (value, row, index) {
return '<span langtag="word-' +value+ '"></span>'
}
},
{
field: 'Target',//域值
title: 'target',//标题
title: '<span langtag="word-target"></span>',//标题
halign: 'center',
visible: true,//false表示不显示
formatter: function (value, row, index) {
return row.Target.TargetStr
}
},
{
field: 'Location',//域值
title: 'location',//标题
visible: true,//false表示不显示
title: '<span langtag="word-location"></span>',//标题
halign: 'center',
visible: true//false表示不显示
},
{
field: '',//域值
title: 'client status',//内容
title: '<span langtag="word-clientstatus"></span>',//内容
align: 'center',
halign: 'center',
visible: true,//false表示不显示
formatter: function (value, row, index) {
if (row.Client.IsConnect) {
return '<span class="badge badge-primary">online</span>'
return '<span class="badge badge-primary" langtag="word-online"></span>'
} else {
return '<span class="badge badge-badge">offline</span>'
return '<span class="badge badge-badge" langtag="word-offline"></span>'
}
}
},
{
field: 'option',//域值
title: 'option',//内容
title: '<span langtag="word-option"></span>',//内容
align: 'center',
halign: 'center',
visible: true,//false表示不显示
formatter: function (value, row, index) {
btn_group = '<div class="btn-group">'
btn = `<button onclick="del(` + row.Id + `)" class="btn-danger"><i class="fa fa-trash"></i></button><button onclick="edit(` + row.Id + `)" class="btn-primary"><i class="fa fa-edit"></i></button></div>`
return btn_group + btn
btn_group += "<a onclick=\"submitform('delete', '{{.web_base_url}}/index/delhost', {'id':" + row.Id
btn_group += '})" class="btn btn-outline btn-danger"><i class="fa fa-trash"></i></a>'
btn_group += '<a href="{{.web_base_url}}/index/edithost?id=' + row.Id
btn_group += '" class="btn btn-outline btn-success"><i class="fa fa-edit"></i></a></div>'
return btn_group
}
}
]
});
</script>
<script type="text/javascript">
function del(id) {
if (confirm("Are you sure you want to delete it")) {
$.ajax({
type: "POST",
url: "{{.web_base_url}}/index/delhost",
data: {"id": id},
success: function (res) {
alert(res.msg)
if (res.status) {
document.location.reload();
}
}
})
}
}
function edit(id) {
window.location.href = "{{.web_base_url}}/index/edithost?id=" + id
}
</script>