|
|
|
@ -53,31 +53,48 @@ function dPostCallbak(method, version, args,callback){ |
|
|
|
|
},'json');
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function dockerConList(){ |
|
|
|
|
|
|
|
|
|
var con = '<div class="safe bgw">\ |
|
|
|
|
<button onclick="" title="" class="btn btn-success btn-sm" type="button" style="margin-right: 5px;">创建容器</button>\ |
|
|
|
|
<span style="float:right"> \ |
|
|
|
|
<button batch="true" style="float: right;display: none;margin-left:10px;" onclick="delDbBatch();" title="删除选中项" class="btn btn-default btn-sm">删除选中</button>\ |
|
|
|
|
</span>\ |
|
|
|
|
<div class="divtable mtb10">\ |
|
|
|
|
<div class="tablescroll">\ |
|
|
|
|
<table id="con_list" class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0" style="border: 0 none;">\ |
|
|
|
|
<thead><tr>\ |
|
|
|
|
<th>名称</th>\ |
|
|
|
|
<th>镜像</th>\ |
|
|
|
|
<th>创建时间</th>\ |
|
|
|
|
<th>状态</th>\ |
|
|
|
|
<th style="text-align:right;">操作</th></tr></thead>\ |
|
|
|
|
<tbody>\ |
|
|
|
|
' + '</tbody></table>\ |
|
|
|
|
</div>\ |
|
|
|
|
<div id="databasePage" class="dataTables_paginate paging_bootstrap page"></div>\ |
|
|
|
|
</div>\ |
|
|
|
|
</div>'; |
|
|
|
|
function logsCon(id){ |
|
|
|
|
dPost('docker_con_log','',{Hostname:id},function(rdata){ |
|
|
|
|
var rdata = $.parseJSON(rdata.data); |
|
|
|
|
if(!rdata.status) { |
|
|
|
|
layer.msg(rdata.msg,{icon:2}); |
|
|
|
|
return; |
|
|
|
|
}; |
|
|
|
|
layer.open({ |
|
|
|
|
type:1, |
|
|
|
|
title:'Docker日志', |
|
|
|
|
area: '600px', |
|
|
|
|
closeBtn: 2, |
|
|
|
|
content:'<div class="bt-form">' |
|
|
|
|
+'<pre class="crontab-log" style="overflow: auto; \ |
|
|
|
|
border: 0px none; line-height:23px;padding: 15px; \ |
|
|
|
|
margin: 0px; white-space: pre-wrap; height: 405px; \ |
|
|
|
|
background-color: rgb(51,51,51);color:#f1f1f1;\ |
|
|
|
|
border-radius:0px;">'+ (rdata.msg == '' ? 'No logs':rdata.msg) +'</pre>' |
|
|
|
|
+'</div>', |
|
|
|
|
success:function(index,layers){ |
|
|
|
|
$(".crontab-log").scrollTop(1000000); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$(".soft-man-con").html(con); |
|
|
|
|
function deleteCon(Hostname){ |
|
|
|
|
// 删除容器
|
|
|
|
|
safeMessage('删除容器 ', '删除容器 ['+Hostname+'], 确定?',function(){ |
|
|
|
|
dPost('docker_remove_con','',{Hostname:Hostname},function(rdata){ |
|
|
|
|
var rdata = $.parseJSON(rdata.data); |
|
|
|
|
showMsg(rdata.msg,function(){ |
|
|
|
|
if(rdata.status) { |
|
|
|
|
dockerConListRender(); |
|
|
|
|
} |
|
|
|
|
},{icon:rdata.status?1:2}); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function dockerConListRender(){ |
|
|
|
|
dPost('con_list', '', {}, function(rdata){ |
|
|
|
|
// console.log(rdata);
|
|
|
|
|
var rdata = $.parseJSON(rdata.data); |
|
|
|
@ -99,8 +116,8 @@ function dockerConList(){ |
|
|
|
|
|
|
|
|
|
var op = ''; |
|
|
|
|
op += '<a href="javascript:;" onclick="pullImages(\''+rlist[i]['RepoTags']+'\',\''+rlist[i]['Id']+'\')" class="btlink">终端</a> | '; |
|
|
|
|
op += '<a href="javascript:;" onclick="pullImages(\''+rlist[i]['RepoTags']+'\',\''+rlist[i]['Id']+'\')" class="btlink">日志</a> | '; |
|
|
|
|
op += '<a href="javascript:;" onclick="deleteImages(\''+rlist[i]['RepoTags']+'\',\''+rlist[i]['Id']+'\')" class="btlink">删除</a>'; |
|
|
|
|
op += '<a href="javascript:;" onclick="logsCon(\''+rlist[i]['Id']+'\')" class="btlink">日志</a> | '; |
|
|
|
|
op += '<a href="javascript:;" onclick="deleteCon(\''+rlist[i]['Config']['Hostname']+'\')" class="btlink">删除</a>'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
list += '<tr>'; |
|
|
|
@ -114,6 +131,33 @@ function dockerConList(){ |
|
|
|
|
|
|
|
|
|
$('#con_list tbody').html(list); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
function dockerConList(){ |
|
|
|
|
|
|
|
|
|
var con = '<div class="safe bgw">\ |
|
|
|
|
<button onclick="" title="" class="btn btn-success btn-sm" type="button" style="margin-right: 5px;">创建容器</button>\ |
|
|
|
|
<span style="float:right"> \ |
|
|
|
|
<button batch="true" style="float: right;display: none;margin-left:10px;" onclick="delDbBatch();" title="删除选中项" class="btn btn-default btn-sm">删除选中</button>\ |
|
|
|
|
</span>\ |
|
|
|
|
<div class="divtable mtb10">\ |
|
|
|
|
<div class="tablescroll">\ |
|
|
|
|
<table id="con_list" class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0" style="border: 0 none;">\ |
|
|
|
|
<thead><tr>\ |
|
|
|
|
<th>名称</th>\ |
|
|
|
|
<th>镜像</th>\ |
|
|
|
|
<th>创建时间</th>\ |
|
|
|
|
<th>状态</th>\ |
|
|
|
|
<th style="text-align:right;">操作</th></tr></thead>\ |
|
|
|
|
<tbody>\ |
|
|
|
|
' + '</tbody></table>\ |
|
|
|
|
</div>\ |
|
|
|
|
<div id="databasePage" class="dataTables_paginate paging_bootstrap page"></div>\ |
|
|
|
|
</div>\ |
|
|
|
|
</div>'; |
|
|
|
|
|
|
|
|
|
$(".soft-man-con").html(con); |
|
|
|
|
|
|
|
|
|
dockerConListRender(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|