1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0c230b"],{"48f7":function(t,e,a){"use strict";a.r(e);var o=function(){var t=this,e=t._self._c;return e("a-skeleton",{attrs:{active:"",loading:t.loading,paragraph:{rows:17}}},[e("a-card",{attrs:{bordered:!1}},[e("a-alert",{attrs:{type:"info",showIcon:!0}},[e("div",{attrs:{slot:"message"},slot:"message"},[t._v("\n 上次更新时间:"+t._s(this.time)+"\n "),e("a-divider",{attrs:{type:"vertical"}}),e("a",{on:{click:t.handleClickUpdate}},[t._v("立即更新")])],1)]),e("a-table",{staticStyle:{"margin-top":"20px"},attrs:{rowKey:"id",size:"middle",columns:t.columns,dataSource:t.dataSource,pagination:!1,loading:t.tableLoading},scopedSlots:t._u([{key:"param",fn:function(a,o){return[e("a-tag",{attrs:{color:t.textInfo[o.param].color}},[t._v(t._s(a))])]}},{key:"text",fn:function(e,a){return[t._v("\n "+t._s(t.textInfo[a.param].text)+"\n ")]}},{key:"value",fn:function(e,a){return[t._v("\n "+t._s(e)+" "+t._s(t.textInfo[a.param].unit)+"\n ")]}}])})],1)],1)},n=[],r=a("c1df"),c=a.n(r),s=a("0fea");c.a.locale("zh-cn");var u={data:function(){return{time:"",loading:!0,tableLoading:!0,columns:[{title:"参数",width:"30%",dataIndex:"param",scopedSlots:{customRender:"param"}},{title:"描述",width:"40%",dataIndex:"text",scopedSlots:{customRender:"text"}},{title:"当前值",width:"30%",dataIndex:"value",scopedSlots:{customRender:"value"}}],dataSource:[],textInfo:{"system.cpu.count":{color:"green",text:"CPU 数量",unit:"核"},"system.cpu.usage":{color:"green",text:"系统 CPU 使用率",unit:"%"},"process.start.time":{color:"purple",text:"应用启动时间点",unit:""},"process.uptime":{color:"purple",text:"应用已运行时间",unit:"秒"},"process.cpu.usage":{color:"purple",text:"当前应用 CPU 使用率",unit:"%"}},moreInfo:{}}},mounted:function(){this.loadTomcatInfo()},methods:{handleClickUpdate:function(){this.loadTomcatInfo()},loadTomcatInfo:function(){var t=this;this.tableLoading=!0,this.time=c()().format("YYYY年MM月DD日 HH时mm分ss秒"),Promise.all([Object(s["c"])("actuator/metrics/system.cpu.count"),Object(s["c"])("actuator/metrics/system.cpu.usage"),Object(s["c"])("actuator/metrics/process.start.time"),Object(s["c"])("actuator/metrics/process.uptime"),Object(s["c"])("actuator/metrics/process.cpu.usage")]).then((function(e){var a=[];e.forEach((function(e,o){var n=t.moreInfo[e.name];n instanceof Array||(n=[""]),n.forEach((function(n,r){var c=e.name+n,s=e.measurements[r].value;"system.cpu.usage"!==c&&"process.cpu.usage"!==c||(s=t.convert(s,Number)),"process.start.time"===c&&(s=t.convert(s,Date)),a.push({id:c+o,param:c,text:"false value",value:s})}))})),t.dataSource=a})).catch((function(e){t.$message.error("获取服务器信息失败")})).finally((function(){t.loading=!1,t.tableLoading=!1}))},convert:function(t,e){return e===Number?Number(100*t).toFixed(2):e===Date?c()(1e3*t).format("YYYY-MM-DD HH:mm:ss"):t}}},i=u,l=a("2877"),m=Object(l["a"])(i,o,n,!1,null,null,null);e["default"]=m.exports}}]);
|