Authored by 鲁尚清

【无】weblogic控制台的详情页面迁移

@@ -3351,6 +3351,8 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'echarts', 'sessions', 'xmSele @@ -3351,6 +3351,8 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'echarts', 'sessions', 'xmSele
3351 } else if (res.resType === 'NETSAFE_FIREWALL') { 3351 } else if (res.resType === 'NETSAFE_FIREWALL') {
3352 var str = 'NETSAFE_FIREWALL_' + res.provider; 3352 var str = 'NETSAFE_FIREWALL_' + res.provider;
3353 url = common.detailPath(str, res.resId) 3353 url = common.detailPath(str, res.resId)
  3354 + } else if (res.resType == "MIDDLEWARE_WEBLOGIC" && !res.parentId) {
  3355 + url = common.detailPath("MIDDLEWARE_WEBLOGICCONSOLE");
3354 } else { 3356 } else {
3355 url = common.detailPath(res.resType, res.resId, protocol,res); 3357 url = common.detailPath(res.resType, res.resId, protocol,res);
3356 } 3358 }
  1 +layui.define(['tree', 'laypage', 'laytpl', 'commonDetail', 'common', 'table', 'sessions', 'commonCols'], function (exports) {
  2 + var commonDetail = layui.commonDetail;
  3 + var common = layui.common;
  4 + var table = layui.table;
  5 + var commonCols = layui.commonCols;
  6 + //对外暴露的接口
  7 + exports('middleware_weblogicconsole', function (data) {
  8 + var sessions = layui.sessions;
  9 + var access_token = sessions.getToken().access_token;
  10 +
  11 + var resid = '';
  12 + var showFlag = common.getUrlParam("show");
  13 + if (showFlag && showFlag == '0') {
  14 + resid = common.getUrlParam("resId");
  15 + } else {
  16 + resid = data.resId;
  17 + }
  18 + commonDetail.bindTips();
  19 + // 控制台基本信息
  20 + var consolejbxxkpiId = "KPIE13DD9A3,KPIF74D9D2B";
  21 +
  22 + reloadConsoleInfo();
  23 +
  24 + //渲染控制台页面
  25 + function reloadConsoleInfo() {
  26 + commonDetail.renderResServerState("weblogicconsole_health_state", resid, "KPI4DA976AF");
  27 + //基本信息
  28 + commonDetail.renderText("weblogicconsole_jbxx", resid, consolejbxxkpiId);
  29 + //活动告警
  30 + commonDetail.renderActiveAlarms("weblogicconsole_alarmTable", resid);
  31 + // 服务列表
  32 + var sortKey = '';
  33 + var cols = commonCols.resTypeCls['MIDDLEWARE_WEBLOGIC'];
  34 +
  35 + // logInfo('logInfoViewConsole',5);
  36 +
  37 + //获取配置的列
  38 + common.getTableCols({
  39 + domId: 'indexResListTable',
  40 + moduleId: 'indexReslist',
  41 + resType: 'MIDDLEWARE_WEBLOGIC'
  42 + }, function (retCols) {
  43 + if (retCols) {
  44 + cols = retCols;
  45 + }
  46 + table.render({
  47 + elem: '#weblogicconsole_childrenTable'
  48 + , url: common.domainName + '/api-web/home/res-list/MIDDLEWARE_WEBLOGIC'
  49 + , where: {
  50 + access_token: access_token,
  51 + parentId: resid
  52 + }
  53 + , height: 'auto'
  54 + , cellMinWidth: 50
  55 + , page: {
  56 + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
  57 + , theme: '#1E9FFF'
  58 + }
  59 + , autoSort: false
  60 + , limit: 5
  61 + , limits: [5, 10, 20, 30, 40, 50]
  62 + , cols: [cols]
  63 + , done: function (res) {
  64 + commonCols.colsClickEvent();
  65 + table.on('sort(weblogicconsole_childrenTable)', function (obj) {
  66 + //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
  67 + if (obj.type != null) {
  68 + sortKey = obj.field + ' ' + obj.type;
  69 + } else {
  70 + sortKey = '';
  71 + }
  72 + reloadTable();
  73 + });
  74 + }
  75 + });
  76 +
  77 + function reloadTable() {
  78 + table.reload('weblogicconsole_childrenTable', {
  79 + page: {
  80 + curr: 1
  81 + }
  82 + , where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
  83 + access_token: access_token,
  84 + sortKey: sortKey,
  85 + parentId: resid
  86 + }
  87 + })
  88 + }
  89 + });
  90 +
  91 + //日志查看,内容取自ES
  92 + function logInfo(target,size) {
  93 + table.render({
  94 + elem: '#' + target
  95 + , url: common.domainName + '/api-web/log/getLogInfo'
  96 + , where: {
  97 + access_token: access_token,
  98 + resId: resid,
  99 + startTime: '',
  100 + endTime: ''
  101 + },
  102 + parseData: function (res) {
  103 + if (res && res.data && res.data.length === 0) {
  104 + $('#' + target).parent().parent().hide();
  105 + }
  106 + }
  107 + , height: 'auto'
  108 + , cellMinWidth: 50
  109 + , page: false
  110 + , autoSort: false
  111 + , limit: size
  112 + , cols: [[
  113 + {field: 'dbTimeStr', title: '时间戳', width: 200, align: 'center'},
  114 + {field: 'severityLabel', title: '日志级别', width: 150, align: 'center'},
  115 + {field: 'message', title: '日志内容', minWidth: 350, align: 'left'},
  116 + {field: 'timestamp', title: '采集时间', width: 200, align: 'center'},
  117 + ]]
  118 + });
  119 +
  120 + //更多日志
  121 + $("#logInfoViewConsoleMore").unbind("click").on("click", function () {
  122 + layer.open({
  123 + title: ['更多日志', 'font-size:18px;'],
  124 + type: 1,
  125 + area: ['90%','690px'],
  126 + content: $('#logViewPgaeConsoleMore').html(),
  127 + success: function () {
  128 + logInfo('logViewPageConsole',100);
  129 + }
  130 + });
  131 + });
  132 + }
  133 +
  134 + }
  135 +
  136 + //定时任务
  137 + var timer = setInterval(function () {
  138 + reloadConsoleInfo();
  139 + }, commonDetail.timerTime);
  140 + commonDetail.detailTimer.push(timer);
  141 +
  142 + });
  143 +});
  1 +<!--weblogic中间件详细页面-->
  2 +<style>
  3 + .detail-chart-left .chart-left-box {
  4 + border: 1px solid #eaeaea;
  5 + text-align: center;
  6 + margin-top: 15px;
  7 + margin-left: 19px;
  8 + }
  9 + .detail-chart-left .chart-left-box:last-child{
  10 + margin-bottom: 5px;
  11 + }
  12 + .detail-chart-left .chart-left-box p:first-child{
  13 + font-size: 15px;
  14 + font-weight: bold;
  15 + line-height: 31px;
  16 + }
  17 + .detail-chart-left .chart-left-box p:last-child{
  18 + line-height: 18px;
  19 + }
  20 + .chart-bottom-infobox{
  21 + text-align: center;
  22 + width: 84%;
  23 + float: left;
  24 + /*text-decoration: underline;*/
  25 + }
  26 +</style>
  27 +<article class="page-container template">
  28 + <div class="page-panel">
  29 + <div class="main">
  30 + <div class="layui-card">
  31 + <div class="layui-card-body">
  32 + <div class="lay-row">
  33 + <div class="lay-row-item">
  34 + <h5 class="lay-row-title">基本信息<i data-id="weblogicconsole_jbxx" class="iconfont detail_base_info">&#xe61e;</i></h5>
  35 + <ul class="info-table" id="weblogicconsole_jbxx" style="height: auto"></ul>
  36 + </div>
  37 + </div>
  38 + <div class="lay-row">
  39 + <div class="lay-row-item">
  40 + <h5 class="lay-row-title">服务列表</h5>
  41 + <div id="weblogicconsole_childrenTable" lay-filter="weblogicconsole_childrenTable"></div>
  42 + </div>
  43 + </div>
  44 + <!--<div class="lay-row logInfo">
  45 + <div class="lay-row-item">
  46 + <h5 class="lay-row-title">日志信息<span id="logInfoViewConsoleMore" class="layui-table-link">更多</span></h5>
  47 + <div id="logInfoViewConsole"></div>
  48 + </div>
  49 + </div>-->
  50 + <div class="lay-row">
  51 + <div class="lay-row-item">
  52 + <h5 class="lay-row-title">实时告警动态</h5>
  53 + <div id="weblogicconsole_alarmTable"></div>
  54 + </div>
  55 + </div>
  56 + </div>
  57 + </div>
  58 + </div>
  59 + </div>
  60 +</article>
  61 +
  62 +<script type="text/html" id="logViewPgaeConsoleMore">
  63 + <article class="page-container">
  64 + <div class="page-panel">
  65 + <div class="main">
  66 + <div class="layui-card">
  67 + <div class="layui-card-body moreLog">
  68 + <table id="logViewPageConsole"></table>
  69 + </div>
  70 + </div>
  71 + </div>
  72 + </div>
  73 + </article>
  74 +</script>
  75 +
  76 +<textarea id="middleware_weblogicconsole_param_id" style="display: none;">{{d}}</textarea>
  77 +<script>
  78 + layui.use('middleware_weblogicconsole', function (fn) {
  79 + var $ = layui.$;
  80 + var parm = $("#middleware_weblogicconsole_param_id").val();
  81 + if(parm.indexOf('{{d') != -1){
  82 + fn();
  83 + }else{
  84 + fn(JSON.parse(parm));
  85 + }
  86 + });
  87 +</script>