Authored by 王涛

Merge branch 'master-yjp' into 'master'

问题 24,25 ,26,加载阿里云平台和采集协议



See merge request !106
... ... @@ -35,6 +35,7 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm
//绑定检索事件
bindSearchEvent();
var collProtocols = "";
form.render(null, 'biz-reslist-form');
... ... @@ -123,7 +124,8 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm
linkState: $("#biz_reslist_link_state").val(),
state: $("#biz_reslist_state").val(),
// hostState: $("#biz_reslist_host_state").val(),
powerState: $("#biz_reslist_power_state").val()
powerState: $("#biz_reslist_power_state").val(),
collProtocols: collProtocols
}
, height: 'full-165'
... ... @@ -168,6 +170,7 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm
}
//树表格
function renderTreeTable(bizId, resType, reloadFlag) {
... ... @@ -175,7 +178,10 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm
$(".biz_reslist_treetable_search").show();
$("#bizResListTableContent").hide();
$("#bizResTreeTableContent").show();
if (collProtocols) {
xmSelect.get('#collProtocolSelect', true).setValue([]);
collProtocols = '';
}
// 如果是虚拟机或者物理主机,展示电源状态查询条件
if ((resType === 'VIRTUALIZATION_VMWARE_VHOST' || resType === 'VIRTUALIZATION_VMWARE_PHYSICSHOST') && !reloadFlag) {
$('#biz_reslist_treetable_power_state').val('poweredOn');
... ... @@ -222,7 +228,8 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm
state: $("#biz_reslist_treetable_state").val(),
linkState: $('#biz_reslist_treetable_link_state').val(),
powerState: $("#biz_reslist_treetable_power_state").val(),
serverState: $("#biz_reslist_server_state").val()
serverState: $("#biz_reslist_server_state").val(),
collProtocols: collProtocols
}
, done: function (res) {
if (res.code == 0) {
... ... @@ -380,6 +387,10 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm
form.on('select(biz_reslist_res_colony)', function (data) {
reloadTable();
});
//资源池选择事件
form.on('select(aliyun_plantform)', function (data) {
reloadTable();
});
//资源连接状态选择事件
form.on('select(biz_reslist_platform)', function (data) {
... ... @@ -409,11 +420,23 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm
$('#biz_reslist_resStatus').val('');
$('#biz_reslist_res_colony').val('');
$('#biz_reslist_res_cluster').val('');
$("#aliyun_plantform").val('');
if (collProtocols) {
xmSelect.get('#collProtocolSelect', true).setValue([]);
collProtocols = '';
}
form.render('select');
var targetId = '';
var searchType = "";
var optons = "";
//阿里云显示平台
if(/ALI_CLOUD/.test(resType)){
$("#aliyun_plantform").parent().parent().removeClass("hide");
form.render("select");
}else{
$("#aliyun_plantform").parent().parent().addClass("hide");
}
//华为云物理机,加载华为云集群查询条件
if (resType == 'HUAWEI_CLOUD_PHYSICSHOST') {
optons = "<option value=''>=所属集群=</option>"
... ... @@ -428,6 +451,54 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm
} else {
$("#biz_reslist_res_cluster_id").hide();
}
if(/HUAWEI_CLOUD_VIRTUALHOST/.test(resType) || /ALI_CLOUD_ECS/.test(resType) || /VIRTUALIZATION_VMWARE_VHOST/.test(resType)) {
//绑定采集协议
admin.req({
url: common.domainName + '/api-web/manage/protocol/page',
data: {
access_token: accessToken,
startTime: '',
endTime: '',
keyword: '',
hasParam: '',
limit: -1
}
}).done(function (res) {
xmSelect.render({
el: '#collProtocolSelect'
, filterable: true
, tips: '=采集协议='
, name: 'collProtocols'
, prop: {
name: 'protocolName',
value: 'protocolCode',
}
, model: {
label: {
type: 'block',
block: {
//最大显示数量, 0:不限制
showCount: 1,
//是否显示删除图标
showIcon: true,
}
}
}
, data: res.data
, hide: function () {
var selectValue = xmSelect.get('#collProtocolSelect', true).getValue('value');
collProtocols = selectValue.join(',');
form.render()
reloadTable();
if (collProtocols) {
xmSelect.get('#collProtocolSelect', true).setValue([]);
collProtocols = '';
form.render();
}
}
})
})
}
//华为云的集群、虚拟化物理机,查询条件绑定资源池
if (resType == 'HUAWEI_CLOUD_CLUSTER' || resType == 'VIRTUALIZATION_VMWARE_PHYSICSHOST') {
... ... @@ -506,7 +577,9 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm
platform: platform,
subResType: $("#biz_reslist_sub_restype").val(),
powerState: $("#biz_reslist_power_state").val(),
serverState: $("#biz_reslist_server_state").val()
serverState: $("#biz_reslist_server_state").val(),
collProtocols: collProtocols,
platform: $("#aliyun_plantform").val()
}
})
}
... ...
... ... @@ -420,8 +420,8 @@ layui.define(['soulTable', 'commonDetail', 'common', 'laytpl', 'view', 'admin',
templet: '#resindex_resName'
},
{field: 'ip', title: 'IP地址', width: 130, align: 'center', sort: true},
{field: 'cpuRate', title: 'CPU使用率', align: 'center', minWidth: x_130, templet: '#cpuRateTpl', sort: true},
{field: 'memoryRate', title: '内存使用率', align: 'center', minWidth: x_130, templet: '#memoryRateTpl', sort: true},
// {field: 'cpuRate', title: 'CPU使用率', align: 'center', minWidth: x_130, templet: '#cpuRateTpl', sort: true},
// {field: 'memoryRate', title: '内存使用率', align: 'center', minWidth: x_130, templet: '#memoryRateTpl', sort: true},
{field: 'resTypeName', title: '资源类型', width: 101, align: 'center'},
{field: 'adminName', title: '负责人', width: 123, align: 'center', sort: true},
{field: 'adminPhone', title: '负责人电话', width: 118, align: 'center', sort: true},
... ... @@ -437,8 +437,8 @@ layui.define(['soulTable', 'commonDetail', 'common', 'laytpl', 'view', 'admin',
templet: '#resindex_resName'
},
{field: 'ip', title: 'IP地址', width: 130, align: 'center', sort: true},
{field: 'cpuRate', title: 'CPU使用率', align: 'center', minWidth: x_130, templet: '#cpuRateTpl', sort: true},
{field: 'memoryRate', title: '内存使用率', align: 'center', minWidth: x_130, templet: '#memoryRateTpl', sort: true},
// {field: 'cpuRate', title: 'CPU使用率', align: 'center', minWidth: x_130, templet: '#cpuRateTpl', sort: true},
// {field: 'memoryRate', title: '内存使用率', align: 'center', minWidth: x_130, templet: '#memoryRateTpl', sort: true},
{field: 'resTypeName', title: '资源类型', width: 101, align: 'center'},
{field: 'adminName', title: '负责人', width: 123, align: 'center', sort: true},
{field: 'adminPhone', title: '负责人电话', width: 118, align: 'center', sort: true},
... ...
... ... @@ -84,11 +84,11 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect'
return '测试通知'
break;
default:
return '告警通知'
return '系统通知'
break;
}
}else {
return '告警通知'
return '系统通知'
}
}}
, {field: 'way', title: '通知方式', align: 'center', sort: true, width:120,
... ...
... ... @@ -39,9 +39,57 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'upload', 'admin', 'form',
if(bizId!=''){
bizId.substring(0,bizId.length-1);
}
reloadTable();
}
});
var collProtocols = '';
initProtocolSelect()
//获取全部协议
function initProtocolSelect() {
admin.req({
url: domainName + '/api-web/manage/protocol/page',
data: {
access_token: accessToken,
startTime: '',
endTime: '',
keyword: '',
hasParam: '',
limit: -1
}
}).done(function (res) {
xmSelect.render({
el: '#collProtocolSelect'
, filterable: true
, tips: '=采集协议='
, name: 'collProtocols'
, prop: {
name: 'protocolName',
value: 'protocolCode',
}
, model: {
label: {
type: 'block',
block: {
//最大显示数量, 0:不限制
showCount: 1,
//是否显示删除图标
showIcon: true,
}
}
}
, data: res.data
,hide: function () {
var selectValue = xmSelect.get('#collProtocolSelect', true).getValue('value');
collProtocols = selectValue.join(',');
form.render()
reloadTable();
}
})
})
}
function autoHeight(el) {
// var height = el.parents('.layui-card').height();
// el.css('min-height', height - 75);
... ... @@ -794,6 +842,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'upload', 'admin', 'form',
, id: 'resManageTable'
, url: common.domainName + '/api-web/home/res-list/' + resType
, where: {
access_token: accessToken,
editMode: 'true',
resName: $("#resManageIndexForm").find("input[name='resName']").val() ? $("#resManageIndexForm").find("input[name='resName']").val() : searchId,
... ... @@ -803,7 +852,8 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'upload', 'admin', 'form',
busId: $("#resManageIndexForm").find("input[name='busId']").val(),
state: $("#resManageIndexForm").find("select[name='state']").val(),
parentId: $("#resManageIndexForm").find("select[name='parentId']").val(),
collectionState: $("#resManageIndexForm").find("select[name='collectionState']").val()
collectionState: $("#resManageIndexForm").find("select[name='collectionState']").val(),
collProtocols: collProtocols
}
, height: 'full-200'
, cellMinWidth: 80
... ...
... ... @@ -33,7 +33,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
var bizId='';
var busIdSelect;
var busTypeList = [];
var collProtocols = '';
var editFlag = false;
if (data.choose == '1') {
... ... @@ -68,7 +68,49 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
$('#resindex-leftree-shrink').hide();
});
});
//获取全部协议
function initProtocolSelect() {
admin.req({
url: common.domainName + '/api-web/manage/protocol/page',
data: {
access_token: accessToken,
startTime: '',
endTime: '',
keyword: '',
hasParam: '',
limit: -1
}
}).done(function (res) {
xmSelect.render({
el: '#collProtocolSelect'
, filterable: true
, tips: '=采集协议='
, name: 'collProtocols'
, prop: {
name: 'protocolName',
value: 'protocolCode',
}
, model: {
label: {
type: 'block',
block: {
//最大显示数量, 0:不限制
showCount: 1,
//是否显示删除图标
showIcon: true,
}
}
}
, data: res.data
,hide: function () {
var selectValue = xmSelect.get('#collProtocolSelect', true).getValue('value');
collProtocols = selectValue.join(',');
form.render()
reloadTable();
}
})
})
}
//树展开事件
$("#resindex-leftree_btn").on("click",function () {
$("#resindex-leftree_btn").hide();
... ... @@ -312,6 +354,52 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
// form.render("select");
// });
//$('#treetableBizTypes').val('');
//绑定采集协议
admin.req({
url: domainName + '/api-web/manage/protocol/page',
data: {
access_token: accessToken,
startTime: '',
endTime: '',
keyword: '',
hasParam: '',
limit: -1
}
}).done(function (res) {
xmSelect.render({
el: '#collProtocolSelect'
, filterable: true
, tips: '=采集协议='
, name: 'collProtocols'
, prop: {
name: 'protocolName',
value: 'protocolCode',
}
, model: {
label: {
type: 'block',
block: {
//最大显示数量, 0:不限制
showCount: 1,
//是否显示删除图标
showIcon: true,
}
}
}
, data: res.data
,hide: function () {
var selectValue = xmSelect.get('#collProtocolSelect', true).getValue('value');
collProtocols = selectValue.join(',');
form.render()
reloadTable();
if (collProtocols) {
xmSelect.get('#collProtocolSelect', true).setValue([]);
collProtocols='';
form.render();
}
}
})
})
//绑定业务下拉选择数据
admin.req({
url: domainName + '/api-web/home/business/findAllBusType',
... ... @@ -566,6 +654,11 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
// renderList(currentResType);
reloadTable();
});
//阿里云平台选择事件
form.on('select(aliyun_plantform)', function (data) {
// renderList(currentResType);
reloadTable();
});
//厂商选择事件
form.on('select(res_vendor)', function (data) {
// renderList(currentResType);
... ... @@ -645,7 +738,9 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
keyWords: $("#treetable_keyword").val(),
health: $("#treetable_resStatus").val(),
state: $("#treetable_res_state").val(),
resCategory: 'resources'
resCategory: 'resources',
collProtocols : collProtocols
}
, done: function (res) {
layer.close(index);
... ... @@ -1123,11 +1218,12 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
if(xmSelect.get("#resListBizTypes") && xmSelect.get("#resListBizTypes")[0]){
xmSelect.get("#resListBizTypes")[0].setValue([]);
}
$("#aliyun_plantform").val('');
$('#res_colony').val('');
$('#res_cluster').val('');
$('#state').val('');
$('#link_state').val('');
//虚拟化查询条件清空
$("#virtual_platForm_select").val('');
$("#treetable_resStatus").val('');
... ... @@ -1135,6 +1231,9 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
if(xmSelect.get("#treetableBizTypes") && xmSelect.get("#treetableBizTypes")[0]){
xmSelect.get("#treetableBizTypes")[0].setValue([]);
}
// if(xmSelect.get("#collProtocolSelect") && xmSelect.get("#collProtocolSelect")[0]){
// xmSelect.get("#collProtocolSelect")[0].setValue([]);
// }
$("#treetable_keyword").val('');
$("#treetable_state").val('');
... ... @@ -1152,6 +1251,13 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
var targetId = '';
var searchType = "";
var optons = "";
//阿里云显示平台
if(/ALI_CLOUD/.test(resType)){
$("#aliyun_plantform").parent().parent().removeClass("hide");
form.render("select");
}else{
$("#aliyun_plantform").parent().parent().addClass("hide");
}
//华为云物理机,加载华为云集群查询条件
if (resType == 'HUAWEI_CLOUD_PHYSICSHOST') {
optons = "<option value=''>=所属集群=</option>"
... ... @@ -1218,7 +1324,54 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
} else {
$("#res_vendor").parent().parent().addClass("hide");
}
if(/HUAWEI_CLOUD_VIRTUALHOST/.test(resType) || /ALI_CLOUD_ECS/.test(resType) || /VIRTUALIZATION_VMWARE_VHOST/.test(resType)){
//绑定采集协议
admin.req({
url: domainName + '/api-web/manage/protocol/page',
data: {
access_token: accessToken,
startTime: '',
endTime: '',
keyword: '',
hasParam: '',
limit: -1
}
}).done(function (res) {
xmSelect.render({
el: '#collProtocolSelect'
, filterable: true
, tips: '=采集协议='
, name: 'collProtocols'
, prop: {
name: 'protocolName',
value: 'protocolCode',
}
, model: {
label: {
type: 'block',
block: {
//最大显示数量, 0:不限制
showCount: 1,
//是否显示删除图标
showIcon: true,
}
}
}
, data: res.data
, hide: function () {
var selectValue = xmSelect.get('#collProtocolSelect', true).getValue('value');
collProtocols = selectValue.join(',');
form.render()
reloadTable();
if (collProtocols) {
xmSelect.get('#collProtocolSelect', true).setValue([]);
collProtocols = '';
form.render();
}
}
})
})
}
if (resType === 'HOST_MINICOMPUTER_PARTITION') {
$("#res_minicomputer").parent().parent().removeClass("hide");
var minicomputerStr = '';
... ... @@ -1260,9 +1413,11 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
form.render("select");
})
}
if(subflag && !resTypeSelectExclude.includes(resType)){
if(/ALI_CLOUD_/.test(resType) || /HUAWEI_CLOUD_/.test(resType)) {
return
return;
}
$("#res_sub_restype").parent().parent().removeClass("hide");
$(".top-head-info").removeClass("hide");
... ... @@ -1380,7 +1535,9 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
ptId: $("#res_platform").val(),
subResType:$("#res_sub_restype").val(),
provider: $("#res_vendor").val(),
resCategory: 'resources'
resCategory: 'resources',
collProtocols:collProtocols,
platform: $("#aliyun_plantform").val(),
}
})
}
... ...
... ... @@ -52,6 +52,12 @@
</div>
</div>
<div class="layui-inline">
<div class="layui-input-inline layui-input-inline--long" style="width: 180px;">
<div id="collProtocolSelect" class="xm-select">
</div>
</div>
</div>
<div class="layui-inline">
<div class="layui-input-inline">
<select name="parentId" id="slt_res_manage_superior" lay-filter="slt_res_manage_superior">
... ...
... ... @@ -94,6 +94,7 @@
</select>
</div>
</div>
<div class="layui-inline">
<div class="layui-input-inline">
<select name="label" id="biz_reslist_state" lay-filter="biz_reslist_state">
... ... @@ -105,6 +106,20 @@
</select>
</div>
</div>
<div class="layui-inline">
<div class="layui-input-inline layui-input-inline--long" style="width: 180px;">
<div id="collProtocolSelect" class="xm-select">
</div>
</div>
</div>
<div class="layui-inline hide">
<div class="layui-input-inline">
<select name="platform" id="aliyun_plantform" lay-filter="aliyun_plantform">
<option value="">=阿里回迁云平台=</option>
<option value="阿里云">=阿里云平台=</option>
</select>
</div>
</div>
</div>
<!--树表格的检索条件-->
... ...
... ... @@ -153,6 +153,12 @@
</select>
</div>
</div>
<div class="layui-inline">
<div class="layui-input-inline layui-input-inline--long" style="width: 180px;">
<div id="collProtocolSelect" class="xm-select">
</div>
</div>
</div>
<div class="layui-inline hide" >
<div class="layui-input-inline">
<select name="label" id="res_sub_restype" lay-filter="sub_restype">
... ... @@ -174,6 +180,14 @@
</select>
</div>
</div>
<div class="layui-inline hide">
<div class="layui-input-inline">
<select name="platform" id="aliyun_plantform" lay-filter="aliyun_plantform">
<option value="">=阿里回迁云平台=</option>
<option value="阿里云">=阿里云平台=</option>
</select>
</div>
</div>
</div>
</form>
</div>
... ... @@ -228,15 +242,11 @@
</div>
</div>
<div class="layui-inline">
<!-- <div class="layui-input-inline">-->
<!-- <select name="label" id="treetableBizTypes" lay-filter="treetableBizTypes">-->
<!-- <option value="">=所属业务=</option>-->
<!-- </select>-->
<!-- </div>-->
<div class="layui-input-inline layui-input-inline--long">
<div id="treetableBizTypes" class="xm-select-demo"></div>
</div>
</div>
<div class="layui-inline" id="virtual_platform_div_id">
<div class="layui-input-inline">
<select name="label" id="virtual_platForm_select" lay-filter="virtual_platForm_select">
... ...
... ... @@ -4,7 +4,7 @@
<div class="layui-tab layui-tab-card" lay-filter="detail-tab">
<ul class="layui-tab-title">
<li class="layui-this">数据库信息</li>
<li>RAC信息</li>
<!--<li>RAC信息</li>-->
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
... ...