mirror of
https://github.com/netcccyun/dnsmgr.git
synced 2026-02-21 07:17:22 +08:00
233 lines
7.6 KiB
HTML
233 lines
7.6 KiB
HTML
{extend name="common/layout" /}
|
|
{block name="title"}容灾切换策略{/block}
|
|
{block name="main"}
|
|
<style>
|
|
tbody tr>td:nth-child(3){overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width:180px;}
|
|
tbody tr>td:nth-child(4){overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width:200px;}
|
|
</style>
|
|
<div class="row">
|
|
<div class="col-xs-12 center-block" style="float: none;">
|
|
<div class="panel panel-default panel-intro">
|
|
<div class="panel-body">
|
|
|
|
<form onsubmit="return searchSubmit()" method="GET" class="form-inline" id="searchToolbar">
|
|
<div class="form-group">
|
|
<label>搜索</label>
|
|
<div class="form-group">
|
|
<select name="type" class="form-control"><option value="1">域名</option><option value="3">解析记录</option><option value="4">备用解析记录</option><option value="2">解析记录ID</option><option value="5">备注</option></select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<input type="text" class="form-control" name="kw" placeholder="">
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="form-group">
|
|
<select name="status" class="form-control"><option value="">健康状况</option><option value="0">正常</option><option value="1">异常</option></select>
|
|
</div>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary"><i class="fa fa-search"></i> 搜索</button>
|
|
<a href="javascript:searchClear()" class="btn btn-default" title="刷新域名账户列表"><i class="fa fa-refresh"></i> 刷新</a>
|
|
<a href="/dmonitor/task/add" class="btn btn-success"><i class="fa fa-plus"></i> 添加</a>
|
|
<div class="btn-group" role="group">
|
|
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">批量操作 <span class="caret"></span></button>
|
|
<ul class="dropdown-menu"><li><a href="javascript:operation('open')">开启运行</a></li><li><a href="javascript:operation('close')">停止运行</a></li><li><a href="javascript:operation('retry')">立即重试</a></li><li><a href="javascript:operation('delete')">删除</a></li></ul>
|
|
</div>
|
|
</form>
|
|
|
|
<table id="listTable">
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{/block}
|
|
{block name="script"}
|
|
<script src="/static/js/layer/layer.js"></script>
|
|
<script src="/static/js/bootstrap-table-1.21.4.min.js"></script>
|
|
<script src="/static/js/bootstrap-table-page-jump-to-1.21.4.min.js"></script>
|
|
<script src="/static/js/custom.js"></script>
|
|
<script>
|
|
$(document).ready(function(){
|
|
updateToolbar();
|
|
const defaultPageSize = 15;
|
|
const pageNumber = typeof window.$_GET['pageNumber'] != 'undefined' ? parseInt(window.$_GET['pageNumber']) : 1;
|
|
const pageSize = typeof window.$_GET['pageSize'] != 'undefined' ? parseInt(window.$_GET['pageSize']) : defaultPageSize;
|
|
|
|
$("#listTable").bootstrapTable({
|
|
url: '/dmonitor/task/data',
|
|
pageNumber: pageNumber,
|
|
pageSize: pageSize,
|
|
classes: 'table table-striped table-hover table-bordered',
|
|
columns: [
|
|
{
|
|
field: '',
|
|
checkbox: true
|
|
},
|
|
{
|
|
field: 'id',
|
|
title: 'ID'
|
|
},
|
|
{
|
|
field: 'rr',
|
|
title: '域名',
|
|
formatter: function(value, row, index) {
|
|
return '<span title="'+row.remark+'" data-toggle="tooltip" data-placement="right">' + value + '.' + row.domain + '</span>';
|
|
}
|
|
},
|
|
{
|
|
field: 'main_value',
|
|
title: '解析记录',
|
|
formatter: function(value, row, index) {
|
|
return value;
|
|
}
|
|
},
|
|
{
|
|
field: 'type',
|
|
title: '切换设置',
|
|
formatter: function(value, row, index) {
|
|
if(value == 1) {
|
|
return '暂停解析';
|
|
} else if(value == 2) {
|
|
return '<span title="" data-toggle="tooltip" data-placement="bottom" data-original-title="备用:'+row.backup_value+'" class="tips">切换备用</span>';
|
|
} else if(value == 3) {
|
|
return '<span title="" data-toggle="tooltip" data-placement="bottom" data-original-title="同域名正常数量<='+row.cycle+'" class="tips">条件开启</span>';
|
|
} else {
|
|
return '无操作';
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'checktype',
|
|
title: '检测协议',
|
|
formatter: function(value, row, index) {
|
|
if(row.type <= 2){
|
|
if(value == 1) {
|
|
return '<span title="" data-toggle="tooltip" data-placement="bottom" data-original-title="'+row.tcpport+'端口" class="tips">TCP</span>';
|
|
} else if(value == 2) {
|
|
return '<span title="" data-toggle="tooltip" data-placement="bottom" data-original-title="'+row.checkurl+'" class="tips">HTTP(S)</span>';
|
|
} else {
|
|
return 'PING';
|
|
}
|
|
} else {
|
|
return '无';
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'frequency',
|
|
title: '检测间隔',
|
|
formatter: function(value, row, index) {
|
|
return value + '秒';
|
|
}
|
|
},
|
|
{
|
|
field: 'status',
|
|
title: '健康状况',
|
|
formatter: function(value, row, index) {
|
|
if(value == 0) {
|
|
return '<span class="label label-success">正常</span>';
|
|
} else {
|
|
return '<span class="label label-danger">异常</span>';
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'active',
|
|
title: '运行开关',
|
|
formatter: function(value, row, index) {
|
|
if(value == 1){
|
|
return '<div class="material-switch"><input id="active'+row.id+'" type="checkbox" checked onchange="setActive('+row.id+',0)"/><label for="active'+row.id+'" class="label-primary"></label></div>';
|
|
}else{
|
|
return '<div class="material-switch"><input id="active'+row.id+'" type="checkbox" onchange="setActive('+row.id+',1)"/><label for="active'+row.id+'" class="label-primary"></label></div>';
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'checktimestr',
|
|
title: '上次检测时间'
|
|
},
|
|
{
|
|
field: 'addtimestr',
|
|
title: '添加时间',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'remark',
|
|
title: '备注',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'action',
|
|
title: '操作',
|
|
formatter: function(value, row, index) {
|
|
var html = '<a href="/dmonitor/task/info/'+row.id+'" class="btn btn-info btn-xs">切换日志</a> ';
|
|
html += '<a href="/dmonitor/task/edit?id='+row.id+'" class="btn btn-primary btn-xs">修改</a> ';
|
|
html += '<a href="/record/'+row.did+'?subdomain='+row.rr+'" class="btn btn-default btn-xs" target="_blank">解析</a> ';
|
|
html += '<a href="javascript:delItem(\''+row.id+'\')" class="btn btn-danger btn-xs">删除</a> ';
|
|
return html;
|
|
}
|
|
},
|
|
],
|
|
onLoadSuccess: function(data) {
|
|
$('[data-toggle="tooltip"]').tooltip()
|
|
}
|
|
})
|
|
})
|
|
function setActive(id, active){
|
|
$.post('/dmonitor/task/setactive', {id: id, active: active}, function(data){
|
|
if(data.code == 0) {
|
|
layer.msg('修改成功', {icon: 1, time:800});
|
|
$('#listTable').bootstrapTable('refresh');
|
|
} else {
|
|
layer.msg(data.msg, {icon: 2});
|
|
}
|
|
}, 'json');
|
|
}
|
|
function delItem(id){
|
|
layer.confirm('确定要删除此切换策略吗?', {
|
|
btn: ['确定','取消']
|
|
}, function(){
|
|
$.post('/dmonitor/task/del', {id: id}, function(data){
|
|
if(data.code == 0) {
|
|
layer.msg('删除成功', {icon: 1, time:800});
|
|
$('#listTable').bootstrapTable('refresh');
|
|
} else {
|
|
layer.msg(data.msg, {icon: 2});
|
|
}
|
|
}, 'json');
|
|
});
|
|
}
|
|
function operation(action){
|
|
var rows = $("#listTable").bootstrapTable('getSelections');
|
|
if(rows.length == 0){
|
|
layer.msg('请选择要操作的策略');
|
|
return;
|
|
}
|
|
var ids = [];
|
|
for(var i in rows){
|
|
ids.push(rows[i].id);
|
|
}
|
|
if(action == 'delete'){
|
|
if(!confirm('确定要删除所选策略吗?')) return;
|
|
}
|
|
|
|
var ii = layer.load(2);
|
|
$.ajax({
|
|
type : 'POST',
|
|
url : '/dmonitor/task/operation',
|
|
data : {act: action, ids: ids},
|
|
dataType : 'json',
|
|
success : function(data) {
|
|
layer.close(ii);
|
|
if(data.code == 0){
|
|
layer.closeAll();
|
|
layer.alert(data.msg, {icon: 1});
|
|
searchRefresh();
|
|
}else{
|
|
layer.alert(data.msg, {icon: 2});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
{/block} |