1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
| /**
| * 日志监控的
| * @author weidy
| * @date 2020-12-06
| */
| layui.define(['layer','element','form' ],function(exports){
| var Class = function(){
| this.MODELNAME = "platform/developer/logs/VciLogMonitor";
| this.moduleKey = "VciLogMonitor";
| this.id = "VciLogMonitor";
| this.backPath = configData.compatibility?path:configData.adminServicePath;
| this.getContent=function(){
| var that = this;
| var html = "";
| html = [
| '<div class="layui-layout" style="display:block;overflow-y: hidden">',
| '<div class="layui-layout-border" style="display:block;margin-top:0px; " id="border_',that.id,'">',
| '<div class="layui-center" style="overflow-y:auto;">',
| '<div class="layui-tab" >',
| '<ul class="layui-tab-title" lay-allowClose="false">',
| '<li class="layui-this">日志文件查看(最多一万行)</li>',
| // '<li>日志链路追踪</li>',
| '</ul>',
| '<ul class="layui-tab-content">',
| '<li class="layui-tab-item layui-show">' ,
| '<form id="form_',that.id, '" lay-filter="' ,that.id,'" class="layui-form" style="margin-top:5px" ></form>',
| '<button class="layui-btn layui-btn-sm" id="',that.id,'_query"><i class="layui-icon layui-icon-search"></i>查看日志内容</button>',
| '<button class="layui-btn layui-btn-sm" id="',that.id,'_downloadfile"><i class="layui-icon layui-icon-search"></i>下载日志文件</button>',
| '<div style="display:block;width:100%;background-color:#ffedee" id="logContent_',that.id,'"></div>',
| '</li>',
| '<li class="layui-tab-item">',
| '<input class="layui-btn layui-btn-sm layui-btn-primary" type="text" id="TRACEID',that.id,'" placeholder="请输入日志链路的值后查询" style="width: 260px">',
| '<div style="display:block;margin-top:30px;" id="traceIdContent_',that.id,'"></div>',
| '</li>',
| '</ul>',
| '</div>',
| '</div>',
| '</div>',
| '</div>'
| ].join("");
| return html;
| };
| this.init = function(){
| var that = this;
| $webUtil.copyConfig(that,that.moduleKey);
| var form = layui.form;
| //添加表单
| var formItems= [{
| type:'combox',
| name:'serviceId',
| text:'选择服务名称',
| url:"/vciServiceController/comboxService",
| comboxKey:'logService'
| },{
| type:'combox',
| name:'logLevel',
| text:'日志等级',
| data:[{
| key:"error",
| value:"错误"
| },{
| key:"info",
| value:"信息"
| },{
| key:"warn",
| value:"警告"
| },{
| key:"all",
| value:"全部"
| }],
| comboxKey:'logLevel'
| }];
| form.addItems(that.id,formItems,
| function(){
| },{},{defaultColumnOneRow:2,inputWidth:200});
| var height = window.innerHeight;
| var logContent = $("#logContent_" +that.id);
| logContent.height(height-300);
| $("#"+that.id+"_query").unbind('click').click(function (e){
| var values = form.getValues(that.id);
| $webUtil.get("/vciServiceController/getLogContent",values,function (result){
| if(result.success){
| logContent.html(result.obj);
| }else{
| logContent.html(result.msg);
| }
| },function (error,xhr){
| $webUtil.showErrorMsg("服务链接不上");
| },that.backPath);
| layui.stope(e);
| });
| $("#"+that.id+"_downloadfile").unbind('click').click(function (e){
| var values = form.getValues(that.id);
| $webUtil.fileDownload(that.backPath + "/vciServiceController/downloadLogFile?serviceId=" + values['serviceId'] + "&logLevel=" + values['logLevel']);
| layui.stope(e);
| });
| };
| };
| var cs = new Class();
| exports(cs.MODELNAME,cs);
| });
|
|