|
|
layui.define(['tree', 'laypage', 'laytpl', 'commonDetail', 'common', 'table', 'sessions', 'commonCols'], function (exports) {
|
|
|
var commonDetail = layui.commonDetail;
|
|
|
var common = layui.common;
|
|
|
var table = layui.table;
|
|
|
var commonCols = layui.commonCols;
|
|
|
//对外暴露的接口
|
|
|
exports('middleware_weblogicconsole', function (data) {
|
|
|
var sessions = layui.sessions;
|
|
|
var access_token = sessions.getToken().access_token;
|
|
|
|
|
|
var resid = '';
|
|
|
var showFlag = common.getUrlParam("show");
|
|
|
if (showFlag && showFlag == '0') {
|
|
|
resid = common.getUrlParam("resId");
|
|
|
} else {
|
|
|
resid = data.resId;
|
|
|
}
|
|
|
commonDetail.bindTips();
|
|
|
// 控制台基本信息
|
|
|
var consolejbxxkpiId = "KPIE13DD9A3,KPIF74D9D2B";
|
|
|
|
|
|
reloadConsoleInfo();
|
|
|
|
|
|
//渲染控制台页面
|
|
|
function reloadConsoleInfo() {
|
|
|
commonDetail.renderResServerState("weblogicconsole_health_state", resid, "KPI4DA976AF");
|
|
|
//基本信息
|
|
|
commonDetail.renderText("weblogicconsole_jbxx", resid, consolejbxxkpiId);
|
|
|
//活动告警
|
|
|
commonDetail.renderActiveAlarms("weblogicconsole_alarmTable", resid);
|
|
|
// 服务列表
|
|
|
var sortKey = '';
|
|
|
var cols = commonCols.resTypeCls['MIDDLEWARE_WEBLOGIC'];
|
|
|
|
|
|
// logInfo('logInfoViewConsole',5);
|
|
|
|
|
|
//获取配置的列
|
|
|
common.getTableCols({
|
|
|
domId: 'indexResListTable',
|
|
|
moduleId: 'indexReslist',
|
|
|
resType: 'MIDDLEWARE_WEBLOGIC'
|
|
|
}, function (retCols) {
|
|
|
if (retCols) {
|
|
|
cols = retCols;
|
|
|
}
|
|
|
table.render({
|
|
|
elem: '#weblogicconsole_childrenTable'
|
|
|
, url: common.domainName + '/api-web/home/res-list/MIDDLEWARE_WEBLOGIC'
|
|
|
, where: {
|
|
|
access_token: access_token,
|
|
|
parentId: resid
|
|
|
}
|
|
|
, height: 'auto'
|
|
|
, cellMinWidth: 50
|
|
|
, page: {
|
|
|
layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
|
|
|
, theme: '#1E9FFF'
|
|
|
}
|
|
|
, autoSort: false
|
|
|
, limit: 5
|
|
|
, limits: [5, 10, 20, 30, 40, 50]
|
|
|
, cols: [cols]
|
|
|
, done: function (res) {
|
|
|
commonCols.colsClickEvent();
|
|
|
table.on('sort(weblogicconsole_childrenTable)', function (obj) {
|
|
|
//有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
|
|
|
if (obj.type != null) {
|
|
|
sortKey = obj.field + ' ' + obj.type;
|
|
|
} else {
|
|
|
sortKey = '';
|
|
|
}
|
|
|
reloadTable();
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
function reloadTable() {
|
|
|
table.reload('weblogicconsole_childrenTable', {
|
|
|
page: {
|
|
|
curr: 1
|
|
|
}
|
|
|
, where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
|
|
access_token: access_token,
|
|
|
sortKey: sortKey,
|
|
|
parentId: resid
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//日志查看,内容取自ES
|
|
|
function logInfo(target,size) {
|
|
|
table.render({
|
|
|
elem: '#' + target
|
|
|
, url: common.domainName + '/api-web/log/getLogInfo'
|
|
|
, where: {
|
|
|
access_token: access_token,
|
|
|
resId: resid,
|
|
|
startTime: '',
|
|
|
endTime: ''
|
|
|
},
|
|
|
parseData: function (res) {
|
|
|
if (res && res.data && res.data.length === 0) {
|
|
|
$('#' + target).parent().parent().hide();
|
|
|
}
|
|
|
}
|
|
|
, height: 'auto'
|
|
|
, cellMinWidth: 50
|
|
|
, page: false
|
|
|
, autoSort: false
|
|
|
, limit: size
|
|
|
, cols: [[
|
|
|
{field: 'dbTimeStr', title: '时间戳', width: 200, align: 'center'},
|
|
|
{field: 'severityLabel', title: '日志级别', width: 150, align: 'center'},
|
|
|
{field: 'message', title: '日志内容', minWidth: 350, align: 'left'},
|
|
|
{field: 'timestamp', title: '采集时间', width: 200, align: 'center'},
|
|
|
]]
|
|
|
});
|
|
|
|
|
|
//更多日志
|
|
|
$("#logInfoViewConsoleMore").unbind("click").on("click", function () {
|
|
|
layer.open({
|
|
|
title: ['更多日志', 'font-size:18px;'],
|
|
|
type: 1,
|
|
|
area: ['90%','690px'],
|
|
|
content: $('#logViewPgaeConsoleMore').html(),
|
|
|
success: function () {
|
|
|
logInfo('logViewPageConsole',100);
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//定时任务
|
|
|
var timer = setInterval(function () {
|
|
|
reloadConsoleInfo();
|
|
|
}, commonDetail.timerTime);
|
|
|
commonDetail.detailTimer.push(timer);
|
|
|
|
|
|
});
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|