From 9490f5c309efe81903040053cefaf2efd49df36b Mon Sep 17 00:00:00 2001 From: zhangyu Date: Sun, 25 Apr 2021 14:58:03 +0800 Subject: [PATCH 1/9] =?UTF-8?q?feat=EF=BC=9A=E4=BF=AE=E6=94=B9=20panel?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=20pageSize=E6=9C=AA=E4=BC=A0=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20=E4=BB=A5=E5=8F=8AchartTemp=E7=9A=84?= =?UTF-8?q?=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/assets/stylus/main.scss | 8 +- .../src/components/charts/chart-list.vue | 32 +- .../src/components/charts/chartTempData.js | 980 ++++++++++++++++++ .../components/common/bottomBox/bottomBox.vue | 7 + .../bottomBox/tabs/chartTempPreview.vue | 622 +++++++++++ .../common/bottomBox/tabs/panelTabNew.vue | 100 +- .../src/components/common/js/constants.js | 3 +- .../common/rightBox/addEndpointBox.vue | 6 +- .../common/rightBox/batchModifyEndpoint.vue | 6 +- .../common/rightBox/editEndpointBoxNew.vue | 9 +- .../components/common/rightBox/moduleBox.vue | 9 +- .../components/common/rightBox/projectBox.vue | 9 +- .../common/table/settings/chartTmplTable.vue | 5 + .../page/config/template/chartTemp.vue | 5 +- .../components/page/dashboard/chartBox.vue | 4 +- .../page/monitor/project/project.vue | 5 - 16 files changed, 1703 insertions(+), 107 deletions(-) create mode 100644 nezha-fronted/src/components/charts/chartTempData.js create mode 100644 nezha-fronted/src/components/common/bottomBox/tabs/chartTempPreview.vue diff --git a/nezha-fronted/src/assets/stylus/main.scss b/nezha-fronted/src/assets/stylus/main.scss index 6ea3c0064..5361c2ff9 100644 --- a/nezha-fronted/src/assets/stylus/main.scss +++ b/nezha-fronted/src/assets/stylus/main.scss @@ -2169,13 +2169,13 @@ li{ height: 70px; justify-content: space-around; } -.right-box-form>.el-form-item.half-form-item-other{ +.right-box-form .half-form-item-other{ display: inline-block; - width: calc(50% - 15px); + width: calc(50% - 30px); } -.right-box-form>.el-form-item.half-form-item-other-two{ +.right-box-form .half-form-item-other-two{ display: inline-block; - width: calc(50% - 15px); + width: calc(50% - 30px); margin-left: 0; } .right-box .right-box-form-add,.right-box .right-box-form-minus-box{ diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index 7d0be3dfa..0e320c972 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -230,6 +230,8 @@ import textChart from './text-chart' import chartPie from './chart-pie' import chartBarStatis from './chart-bar-statistics' import chartGroup from './chart-group' +import { fromRoute } from '@/components/common/js/constants' +import chartTempData from "@/components/charts/chartTempData"; // import visNetwork from './visNetwork' export default { name: 'chartList', @@ -240,7 +242,8 @@ export default { detail: Object, from: { type: String }, panelLock: { type: Boolean, default: false }, - hasGroup: { type: Boolean, default: true } + hasGroup: { type: Boolean, default: true }, + panelDataList: Array }, components: { @@ -283,6 +286,12 @@ export default { // showShadow:false, } }, + watch: { + panelDataList (n) { + console.log(n) + this.getData(this.filter) + } + }, methods: { dropmenuChange (id, show) { if (show) { @@ -662,9 +671,25 @@ export default { }) return } + if (param.from == this.$CONSTANTS.fromRoute.chartTemp) { + console.log(this.panelDataList) + this.dataList = this.panelDataList + this.$nextTick(() => { + this.dataList.forEach((item, index) => { + this.$set(item, 'from', params.from) + this.setChartSize(item, index)// 设置该图表宽度 + const chartBox = document.getElementById('chart-' + item.id) + this.handleElementInViewport(chartBox, 0, item, index) + if (item.type === 'group') { + this.$refs['editChart' + item.id][0].$refs.listGroup.getData(params) + } + }) + }) + return + } if (!param.query) delete param.query // 根据panelId获得panel下的所有图表 - this.$get('visual/panel/chart?panelId=' + params.panelId).then(response => { + this.$get('visual/panel/chart?panelId=' + params.panelId + '&pageSize=-1').then(response => { if (response.code === 200) { response.data.list.forEach((item, index) => { item.isLoaded = false @@ -918,6 +943,9 @@ export default { // if(chartInfo.type === 'table'&&chartInfo.param&&chartInfo.param.last == 1){ // return this.$get('/prom/api/v1/query_range?query=' + query + "&start=" + this.$stringTimeParseToUnix(endTime) + "&end=" + this.$stringTimeParseToUnix(endTime) + '&step=' + step); // } + if (this.from === fromRoute.chartTemp) { + return chartTempData + } return this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step) }) // 一个图表的所有element单独获取数据 diff --git a/nezha-fronted/src/components/charts/chartTempData.js b/nezha-fronted/src/components/charts/chartTempData.js new file mode 100644 index 000000000..cec3ca506 --- /dev/null +++ b/nezha-fronted/src/components/charts/chartTempData.js @@ -0,0 +1,980 @@ +const chartTempData = { + data: { + result: [ + { + metric: { + + }, + values: [ + [ + 1619326641, + '67234.52306889734' + ], + [ + 1619326656, + '84768.45245026101' + ], + [ + 1619326671, + '129634.01007646995' + ], + [ + 1619326686, + '156542.62882642742' + ], + [ + 1619326701, + '135705.9448148899' + ], + [ + 1619326716, + '115572.40233875904' + ], + [ + 1619326731, + '97737.31879742522' + ], + [ + 1619326746, + '83827.90092416394' + ], + [ + 1619326761, + '99792.76711425022' + ], + [ + 1619326776, + '141957.65742923907' + ], + [ + 1619326791, + '169193.0479737079' + ], + [ + 1619326806, + '155332.39710062867' + ], + [ + 1619326821, + '129349.45882305052' + ], + [ + 1619326836, + '108301.37872333173' + ], + [ + 1619326851, + '90034.99368171557' + ], + [ + 1619326866, + '80273.24280781174' + ], + [ + 1619326881, + '71427.56847681744' + ], + [ + 1619326896, + '65009.655216768355' + ], + [ + 1619326911, + '56202.051900505874' + ], + [ + 1619326926, + '49175.99200440523' + ], + [ + 1619326941, + '51675.252768933875' + ], + [ + 1619326956, + '60142.6817538732' + ], + [ + 1619326971, + '58492.28986291914' + ], + [ + 1619326986, + '88647.97630420537' + ], + [ + 1619327001, + '129227.8284375646' + ], + [ + 1619327016, + '119235.93213991504' + ], + [ + 1619327031, + '101160.05700432547' + ], + [ + 1619327046, + '87795.44901362302' + ], + [ + 1619327061, + '87315.15463300308' + ], + [ + 1619327076, + '92489.18937959624' + ], + [ + 1619327091, + '93086.80666954032' + ], + [ + 1619327106, + '112996.24939570608' + ], + [ + 1619327121, + '125622.50409516145' + ], + [ + 1619327136, + '124043.75671756931' + ], + [ + 1619327151, + '125915.23892405373' + ], + [ + 1619327166, + '131860.94148401526' + ], + [ + 1619327181, + '131323.512587253' + ], + [ + 1619327196, + '130202.84054319662' + ], + [ + 1619327211, + '131137.2998550472' + ], + [ + 1619327226, + '140011.84069068846' + ], + [ + 1619327241, + '144761.03094652962' + ], + [ + 1619327256, + '140896.2234628107' + ], + [ + 1619327271, + '144939.9521471322' + ], + [ + 1619327286, + '146854.00264563446' + ], + [ + 1619327301, + '143528.7608647803' + ], + [ + 1619327316, + '136391.16570184118' + ], + [ + 1619327331, + '134939.63766213963' + ], + [ + 1619327346, + '130734.90194389559' + ], + [ + 1619327361, + '136434.88336788653' + ], + [ + 1619327376, + '145092.16210718406' + ], + [ + 1619327391, + '152065.04153079912' + ], + [ + 1619327406, + '156798.09185927216' + ], + [ + 1619327421, + '158674.77766447523' + ], + [ + 1619327436, + '161096.58445758978' + ], + [ + 1619327451, + '158761.11021276534' + ], + [ + 1619327466, + '163004.29606041766' + ], + [ + 1619327481, + '167314.9710412085' + ], + [ + 1619327496, + '165583.65723135485' + ], + [ + 1619327511, + '150599.88881636693' + ], + [ + 1619327526, + '136263.16856828984' + ], + [ + 1619327541, + '127531.12022245591' + ], + [ + 1619327556, + '112626.2854714918' + ], + [ + 1619327571, + '109748.6926587426' + ], + [ + 1619327586, + '103216.89749119896' + ], + [ + 1619327601, + '120054.0931496599' + ], + [ + 1619327616, + '124397.01189137285' + ], + [ + 1619327631, + '121693.36886313172' + ], + [ + 1619327646, + '124263.5185058619' + ], + [ + 1619327661, + '129370.31776538865' + ], + [ + 1619327676, + '133191.73551700043' + ], + [ + 1619327691, + '144078.4064984659' + ], + [ + 1619327706, + '139893.47544839772' + ], + [ + 1619327721, + '139218.28627794381' + ], + [ + 1619327736, + '135077.997911198' + ], + [ + 1619327751, + '137188.8500959387' + ], + [ + 1619327766, + '136302.6625400467' + ], + [ + 1619327781, + '135333.82845756598' + ], + [ + 1619327796, + '141334.01284001715' + ], + [ + 1619327811, + '137118.18506250918' + ], + [ + 1619327826, + '131834.77580904771' + ], + [ + 1619327841, + '125440.56107015046' + ], + [ + 1619327856, + '129950.61479606191' + ], + [ + 1619327871, + '132228.4300026117' + ], + [ + 1619327886, + '126695.44097770381' + ], + [ + 1619327901, + '140958.99289731166' + ], + [ + 1619327916, + '145497.2801943425' + ], + [ + 1619327931, + '132973.074348475' + ], + [ + 1619327946, + '137179.44736553708' + ], + [ + 1619327961, + '143180.66659914295' + ], + [ + 1619327976, + '137765.40360422112' + ], + [ + 1619327991, + '129042.39839074464' + ], + [ + 1619328006, + '121699.96972642104' + ], + [ + 1619328021, + '126221.42670726098' + ], + [ + 1619328036, + '129724.29089390681' + ], + [ + 1619328051, + '136616.86970395234' + ], + [ + 1619328066, + '139008.3170592644' + ], + [ + 1619328081, + '147551.30851143942' + ], + [ + 1619328096, + '155084.9733920894' + ], + [ + 1619328111, + '161961.05584908125' + ], + [ + 1619328126, + '162768.42434900918' + ], + [ + 1619328141, + '156259.98260298115' + ], + [ + 1619328156, + '154439.53586441962' + ], + [ + 1619328171, + '156135.37586396653' + ], + [ + 1619328186, + '155884.24195870038' + ], + [ + 1619328201, + '158386.6374126683' + ], + [ + 1619328216, + '153855.1064273622' + ], + [ + 1619328231, + '154296.20722794015' + ], + [ + 1619328246, + '156068.06042940164' + ], + [ + 1619328261, + '152266.96251924452' + ], + [ + 1619328276, + '158288.5803709968' + ], + [ + 1619328291, + '162867.9908155629' + ], + [ + 1619328306, + '170007.72483388087' + ], + [ + 1619328321, + '170739.98543400207' + ], + [ + 1619328336, + '165015.94268824425' + ], + [ + 1619328351, + '164295.23424811324' + ], + [ + 1619328366, + '167809.8241459832' + ], + [ + 1619328381, + '163713.7187657755' + ], + [ + 1619328396, + '170231.75566899288' + ], + [ + 1619328411, + '169801.47429921135' + ], + [ + 1619328426, + '168025.86124235595' + ], + [ + 1619328441, + '173188.72482130752' + ], + [ + 1619328456, + '174727.4231324348' + ], + [ + 1619328471, + '175981.6730451862' + ], + [ + 1619328486, + '159560.41549215658' + ], + [ + 1619328501, + '147907.8587575518' + ], + [ + 1619328516, + '135063.16044782364' + ], + [ + 1619328531, + '125265.4855367947' + ], + [ + 1619328546, + '131484.32374593205' + ], + [ + 1619328561, + '128506.35314877935' + ], + [ + 1619328576, + '135645.2532736919' + ], + [ + 1619328591, + '144056.59948014285' + ], + [ + 1619328606, + '154336.59859408153' + ], + [ + 1619328621, + '166894.53898574616' + ], + [ + 1619328636, + '169942.55611799294' + ], + [ + 1619328651, + '162718.33839203947' + ], + [ + 1619328666, + '166353.4185642925' + ], + [ + 1619328681, + '154666.30677592353' + ], + [ + 1619328696, + '151539.86711566127' + ], + [ + 1619328711, + '147111.77171292162' + ], + [ + 1619328726, + '145664.07148119409' + ], + [ + 1619328741, + '148277.06701275433' + ], + [ + 1619328756, + '148253.63143962697' + ], + [ + 1619328771, + '152678.93662904084' + ], + [ + 1619328786, + '149142.12352995639' + ], + [ + 1619328801, + '146774.93188005552' + ], + [ + 1619328816, + '150737.78019044892' + ], + [ + 1619328831, + '151467.35529243143' + ], + [ + 1619328846, + '186328.82006624647' + ], + [ + 1619328861, + '222879.0034326688' + ], + [ + 1619328876, + '211274.86995717912' + ], + [ + 1619328891, + '195136.61403361673' + ], + [ + 1619328906, + '192917.71153120717' + ], + [ + 1619328921, + '200290.90163374666' + ], + [ + 1619328936, + '246708.293331658' + ], + [ + 1619328951, + '263882.25419267954' + ], + [ + 1619328966, + '245958.13180563593' + ], + [ + 1619328981, + '233169.2019982923' + ], + [ + 1619328996, + '223366.11067840818' + ], + [ + 1619329011, + '215535.62372111296' + ], + [ + 1619329026, + '211956.30837713985' + ], + [ + 1619329041, + '206075.45873981708' + ], + [ + 1619329056, + '194453.3574888578' + ], + [ + 1619329071, + '190628.31905188566' + ], + [ + 1619329086, + '176952.97563925944' + ], + [ + 1619329101, + '161969.5509223355' + ], + [ + 1619329116, + '163276.4684482879' + ], + [ + 1619329131, + '157353.2552160069' + ], + [ + 1619329146, + '146882.99531941232' + ], + [ + 1619329161, + '152258.4560985092' + ], + [ + 1619329176, + '156959.18525475552' + ], + [ + 1619329191, + '159649.51546564006' + ], + [ + 1619329206, + '167908.55714451114' + ], + [ + 1619329221, + '172948.33807402014' + ], + [ + 1619329236, + '182685.45218821947' + ], + [ + 1619329251, + '187030.35202671902' + ], + [ + 1619329266, + '190079.30323855148' + ], + [ + 1619329281, + '192971.9526461216' + ], + [ + 1619329296, + '196336.89160028717' + ], + [ + 1619329311, + '198904.32225845434' + ], + [ + 1619329326, + '217357.3580010716' + ], + [ + 1619329341, + '234419.8015930916' + ], + [ + 1619329356, + '211699.108503841' + ], + [ + 1619329371, + '194296.97437986446' + ], + [ + 1619329386, + '177526.51953365305' + ], + [ + 1619329401, + '174123.3153590256' + ], + [ + 1619329416, + '174236.0884374152' + ], + [ + 1619329431, + '175881.42654414504' + ], + [ + 1619329446, + '181180.89650041307' + ], + [ + 1619329461, + '179659.1297273033' + ], + [ + 1619329476, + '166824.4538851082' + ], + [ + 1619329491, + '167211.34500916823' + ], + [ + 1619329506, + '157478.16192696424' + ], + [ + 1619329521, + '166798.5784502148' + ], + [ + 1619329536, + '158308.49615751408' + ], + [ + 1619329551, + '157600.86333199075' + ], + [ + 1619329566, + '143876.78396160837' + ], + [ + 1619329581, + '142125.21240294934' + ], + [ + 1619329596, + '134845.72705098847' + ], + [ + 1619329611, + '136348.216869971' + ], + [ + 1619329626, + '128227.58563619448' + ], + [ + 1619329641, + '127366.85129458207' + ], + [ + 1619329656, + '144952.86329025935' + ], + [ + 1619329671, + '146120.8645811903' + ], + [ + 1619329686, + '138372.3693190331' + ], + [ + 1619329701, + '137356.03166965354' + ], + [ + 1619329716, + '135886.32810594278' + ], + [ + 1619329731, + '137777.51698661354' + ], + [ + 1619329746, + '139546.60952125024' + ], + [ + 1619329761, + '143152.12746029842' + ], + [ + 1619329776, + '132632.79505347987' + ], + [ + 1619329791, + '132902.87719231608' + ], + [ + 1619329806, + '121644.84048351011' + ], + [ + 1619329821, + '127381.36242802144' + ], + [ + 1619329836, + '133454.34768905598' + ], + [ + 1619329851, + '118548.5648224194' + ], + [ + 1619329866, + '103759.37104672648' + ], + [ + 1619329881, + '92858.28975097225' + ], + [ + 1619329896, + '79393.33731962508' + ], + [ + 1619329911, + '68176.01390834473' + ], + [ + 1619329926, + '83274.89339599916' + ], + [ + 1619329941, + '105078.4121009993' + ], + [ + 1619329956, + '121687.38734146685' + ], + [ + 1619329971, + '173787.31134659174' + ], + [ + 1619329986, + '218940.57387272274' + ], + [ + 1619330001, + '252832.37563365034' + ], + [ + 1619330016, + '250250.00475681957' + ], + [ + 1619330031, + '222391.40952185704' + ], + [ + 1619330046, + '201470.72138033944' + ], + [ + 1619330061, + '188387.77045423904' + ], + [ + 1619330076, + '173486.26445006474' + ], + [ + 1619330091, + '176695.15924696584' + ], + [ + 1619330106, + '161362.67228012058' + ], + [ + 1619330121, + '156280.2942065875' + ], + [ + 1619330136, + '147856.53518165532' + ], + [ + 1619330151, + '142447.18670247635' + ], + [ + 1619330166, + '147411.2790305058' + ], + [ + 1619330181, + '154897.85213886894' + ], + [ + 1619330196, + '165502.40762979828' + ], + [ + 1619330211, + '186345.75300514325' + ], + [ + 1619330226, + '225214.8040061793' + ], + [ + 1619330241, + '212569.63634406356' + ] + ] + } + ], + resultType: 'matrix' + }, + status: 'success' +} +export default chartTempData diff --git a/nezha-fronted/src/components/common/bottomBox/bottomBox.vue b/nezha-fronted/src/components/common/bottomBox/bottomBox.vue index b87481e18..06109cc53 100644 --- a/nezha-fronted/src/components/common/bottomBox/bottomBox.vue +++ b/nezha-fronted/src/components/common/bottomBox/bottomBox.vue @@ -49,6 +49,8 @@ + + @@ -127,6 +129,11 @@ export default { { prop: 'endpointQuery', name: 'Query' }, { prop: 'endpointAlertMessage', name: 'Alerts' } ] + }, + chartTemp: { + chartTempTabTitle: [ + { prop: 'panel', name: 'Template preview' } + ] } } } diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/chartTempPreview.vue b/nezha-fronted/src/components/common/bottomBox/tabs/chartTempPreview.vue new file mode 100644 index 000000000..89550a9c8 --- /dev/null +++ b/nezha-fronted/src/components/common/bottomBox/tabs/chartTempPreview.vue @@ -0,0 +1,622 @@ + + + + + diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue b/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue index f647f9b9f..c5d8a11c8 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue @@ -15,7 +15,7 @@
+ @on-refresh-time="refreshTime" @on-remove-chart="delChart" ref="chartList" :panel-lock="panelLock" :panel-data-list="panelData">
@@ -161,47 +161,7 @@ export default { confirmButtonText: this.$t('tip.yes'), cancelButtonText: this.$t('tip.no'), type: 'warning' - }).then(() => { - this.$delete('panel/' + this.showPanel.id + '/charts?ids=' + data.id).then(response => { - if (response.code === 200) { - this.$message({ - duration: 2000, - type: 'success', - message: this.$t('tip.deleteSuccess') - }) - this.rightBox.show = false - const chartList = this.$refs.chartList.dataList - let nextChart = null; let prevChart = null - for (let i = 0; i < chartList.length; i++) { - if (chartList[i].id === data.id) { - chartList.splice(i, 1) - } - if (data.next != -1) { - if (chartList[i].id === data.next) { - nextChart = chartList[i] - } - } - if (data.prev != 0) { - if (chartList[i].id === data.prev) { - prevChart = chartList[i] - } - } - } - this.$refs.chartList.loadChartData(this.scrollbarWrap.scrollTop) - if (nextChart && prevChart) { // 删除图表为中间位置 - prevChart.next = nextChart.id - nextChart.prev = prevChart.id - } else { - if (!nextChart) prevChart.next = -1 - if (!prevChart) nextChart.prev = 0 - } - // this.getTableData(this.obj.id); //删除相关图表后,刷新面板数据 - } else { - console.error(response.msg) - this.$message.error(response.msg) - } - }) - }) + }).then(() => {}) }, delChartOk () { this.getData(this.filter) @@ -265,31 +225,41 @@ export default { if (this.from == this.$CONSTANTS.fromRoute.rule || this.from == this.$CONSTANTS.fromRoute.endpoint) { this.getData(this.filter) } else { - this.$get('panel', { type: this.from, link: linkId }).then(response => { - if (response.code === 200) { - this.panelData = response.data.list - if (this.panelData.length > 0) { - this.showPanel.id = this.filter.panelId = this.panelData[0].id - this.getData(this.filter) - } - } else { - if (response.msg) { - console.error(response.msg) - this.$message.error(response.msg) - } else if (response.error) { - console.error(response.error) - this.$message.error(response.error) + if (this.from == this.$CONSTANTS.fromRoute.chartTemp) { + console.log(this.obj) + this.panelData = [this.obj] + console.log(this.panelData) + if (this.panelData.length > 0) { + this.showPanel.id = this.filter.panelId = this.panelData[0].id + this.getData(this.filter) + } + } else { + this.$get('panel', { type: this.from, link: linkId }).then(response => { + if (response.code === 200) { + this.panelData = response.data.list + if (this.panelData.length > 0) { + this.showPanel.id = this.filter.panelId = this.panelData[0].id + this.getData(this.filter) + } } else { - console.error(response) - this.$message.error(response) + if (response.msg) { + console.error(response.msg) + this.$message.error(response.msg) + } else if (response.error) { + console.error(response.error) + this.$message.error(response.error) + } else { + console.error(response) + this.$message.error(response) + } } - } - }).catch((error) => { - if (error) { - console.error(error) - this.$message.error(error.toString()) - } - }) + }).catch((error) => { + if (error) { + console.error(error) + this.$message.error(error.toString()) + } + }) + } } }, // 定期刷新 diff --git a/nezha-fronted/src/components/common/js/constants.js b/nezha-fronted/src/components/common/js/constants.js index 7aea1d0d9..c6fab7242 100644 --- a/nezha-fronted/src/components/common/js/constants.js +++ b/nezha-fronted/src/components/common/js/constants.js @@ -232,5 +232,6 @@ export const fromRoute = { menus: 'menus', notify: 'notify', link: 'link', - apiKey: 'apiKey' + apiKey: 'apiKey', + chartTemp: 'chartTemp' } diff --git a/nezha-fronted/src/components/common/rightBox/addEndpointBox.vue b/nezha-fronted/src/components/common/rightBox/addEndpointBox.vue index fd974ef6c..15b469efa 100644 --- a/nezha-fronted/src/components/common/rightBox/addEndpointBox.vue +++ b/nezha-fronted/src/components/common/rightBox/addEndpointBox.vue @@ -4,9 +4,9 @@
{{$t("overall.createEndpoint")}}
- -
- +
+ +
diff --git a/nezha-fronted/src/components/common/rightBox/batchModifyEndpoint.vue b/nezha-fronted/src/components/common/rightBox/batchModifyEndpoint.vue index 9940f4a29..e038c9157 100644 --- a/nezha-fronted/src/components/common/rightBox/batchModifyEndpoint.vue +++ b/nezha-fronted/src/components/common/rightBox/batchModifyEndpoint.vue @@ -4,9 +4,9 @@
{{$t("overall.batchEndpoint")}}
- -
- +
+ +
diff --git a/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue b/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue index 9b54e8d24..66627e049 100644 --- a/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue +++ b/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue @@ -14,14 +14,9 @@ - -
- +
+
-
diff --git a/nezha-fronted/src/components/common/rightBox/moduleBox.vue b/nezha-fronted/src/components/common/rightBox/moduleBox.vue index 7d7c267b5..50396bf50 100644 --- a/nezha-fronted/src/components/common/rightBox/moduleBox.vue +++ b/nezha-fronted/src/components/common/rightBox/moduleBox.vue @@ -4,14 +4,9 @@
{{editModule.id ? $t("project.module.editModule") + " ID:" + editModule.id : $t("project.module.createModule")}}
- -
- +
+
-
diff --git a/nezha-fronted/src/components/common/rightBox/projectBox.vue b/nezha-fronted/src/components/common/rightBox/projectBox.vue index 52af4aa2c..db1fd9839 100644 --- a/nezha-fronted/src/components/common/rightBox/projectBox.vue +++ b/nezha-fronted/src/components/common/rightBox/projectBox.vue @@ -5,14 +5,9 @@
{{editProject.id ? $t("project.project.editProject") + " ID:" + editProject.id : $t("overall.createProject")}}
- -
- +
+
-
diff --git a/nezha-fronted/src/components/common/table/settings/chartTmplTable.vue b/nezha-fronted/src/components/common/table/settings/chartTmplTable.vue index a090996d9..e4543a11c 100644 --- a/nezha-fronted/src/components/common/table/settings/chartTmplTable.vue +++ b/nezha-fronted/src/components/common/table/settings/chartTmplTable.vue @@ -34,6 +34,7 @@ @@ -76,6 +77,10 @@ export default { label: this.$t('config.exprTemp.name'), prop: 'name', show: true + }, { + label: this.$t('config.exprTemp.type'), + prop: 'type', + show: true }, { label: this.$t('config.exprTemp.varType'), prop: 'varType', diff --git a/nezha-fronted/src/components/page/config/template/chartTemp.vue b/nezha-fronted/src/components/page/config/template/chartTemp.vue index ab3085349..4c8856235 100644 --- a/nezha-fronted/src/components/page/config/template/chartTemp.vue +++ b/nezha-fronted/src/components/page/config/template/chartTemp.vue @@ -5,7 +5,7 @@ :api="url" :layout="['searchInput', 'elementSet']" :custom-table-title.sync="tools.customTableTitle" - :from="fromRoute.expressionTemplate" + :from="fromRoute.chartTemp" :search-msg="searchMsg"> diff --git a/nezha-fronted/src/components/common/table/settings/moduleTable.vue b/nezha-fronted/src/components/common/table/settings/moduleTable.vue index c8c296478..9547edf49 100644 --- a/nezha-fronted/src/components/common/table/settings/moduleTable.vue +++ b/nezha-fronted/src/components/common/table/settings/moduleTable.vue @@ -44,7 +44,7 @@ @@ -146,6 +146,9 @@ export default { .color23BF9A{ color: #23BF9A; } + .color969dea{ + color: #969dea; + } .endpoint-num, .alert-num{ cursor: pointer; } diff --git a/nezha-fronted/src/components/page/asset/asset.vue b/nezha-fronted/src/components/page/asset/asset.vue index 1cde5cd54..7e7828f2b 100644 --- a/nezha-fronted/src/components/page/asset/asset.vue +++ b/nezha-fronted/src/components/page/asset/asset.vue @@ -170,7 +170,7 @@ export default { disabled: false }, { id: 23, - name: this.$t('asset.tableTitle.cabinet'), + name: this.$t('asset.cabinet'), type: 'input', label: 'cabinetName', disabled: false From 43436e5cbe948da6d78a9d04f861bed716d50c9c Mon Sep 17 00:00:00 2001 From: zhangyu Date: Sun, 25 Apr 2021 18:35:35 +0800 Subject: [PATCH 5/9] =?UTF-8?q?feat=EF=BC=9AAdd=20chart=20by=20Temp=20?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=2050%=20fix=EF=BC=9A=E4=BF=AE=E6=94=B9endpoi?= =?UTF-8?q?ntList=20=E5=87=BA=E7=8E=B0=E4=B8=8B=E5=BC=B9=E7=AA=97=E6=97=B6?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E9=94=99=E4=B9=B1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/charts/chart-alert-list.vue | 2 +- .../charts/chart-bar-statistics.vue | 2 +- .../src/components/charts/chart-group.vue | 2 +- .../src/components/charts/chart-pie.vue | 2 +- .../components/charts/chart-single-stat.vue | 2 +- .../src/components/charts/chart-table.vue | 2 +- .../src/components/charts/chart-url.vue | 2 +- .../components/charts/line-chart-block.vue | 2 +- .../src/components/charts/text-chart.vue | 2 +- .../src/components/common/language/cn.js | 21 +- .../src/components/common/language/en.js | 42 +- .../src/components/common/mixin/dataList.js | 1 + .../components/common/project/topologyL5.vue | 2 +- .../common/project/topologyPrev.vue | 3220 ++++++++--------- .../common/rightBox/chartTempBox.vue | 262 ++ .../src/components/page/dashboard/panel.vue | 26 +- .../page/monitor/endpoint/endpointList.vue | 2 +- .../page/monitor/project/projectList.vue | 39 + nezha-fronted/src/main.js | 1 + 19 files changed, 1997 insertions(+), 1637 deletions(-) create mode 100644 nezha-fronted/src/components/common/rightBox/chartTempBox.vue diff --git a/nezha-fronted/src/components/charts/chart-alert-list.vue b/nezha-fronted/src/components/charts/chart-alert-list.vue index 3f4c7c4f5..9dc39422c 100644 --- a/nezha-fronted/src/components/charts/chart-alert-list.vue +++ b/nezha-fronted/src/components/charts/chart-alert-list.vue @@ -24,7 +24,7 @@ {{chartData.name}} - + diff --git a/nezha-fronted/src/components/charts/chart-bar-statistics.vue b/nezha-fronted/src/components/charts/chart-bar-statistics.vue index 21a7179c9..03a458296 100644 --- a/nezha-fronted/src/components/charts/chart-bar-statistics.vue +++ b/nezha-fronted/src/components/charts/chart-bar-statistics.vue @@ -24,7 +24,7 @@ {{chartData.name}} - + diff --git a/nezha-fronted/src/components/charts/chart-group.vue b/nezha-fronted/src/components/charts/chart-group.vue index fb5bf5b2f..333994f7a 100644 --- a/nezha-fronted/src/components/charts/chart-group.vue +++ b/nezha-fronted/src/components/charts/chart-group.vue @@ -18,7 +18,7 @@ {{chartData.name}} ({{chartData.children.length}} charts) - + diff --git a/nezha-fronted/src/components/charts/chart-pie.vue b/nezha-fronted/src/components/charts/chart-pie.vue index f43ad09f6..e6f22092d 100644 --- a/nezha-fronted/src/components/charts/chart-pie.vue +++ b/nezha-fronted/src/components/charts/chart-pie.vue @@ -24,7 +24,7 @@ {{chartData.name}} - + diff --git a/nezha-fronted/src/components/charts/chart-single-stat.vue b/nezha-fronted/src/components/charts/chart-single-stat.vue index ce005fa16..fdfaa2b84 100644 --- a/nezha-fronted/src/components/charts/chart-single-stat.vue +++ b/nezha-fronted/src/components/charts/chart-single-stat.vue @@ -24,7 +24,7 @@ {{chartData.name}} - + diff --git a/nezha-fronted/src/components/charts/chart-table.vue b/nezha-fronted/src/components/charts/chart-table.vue index 9e01cbd63..5f7a4022d 100644 --- a/nezha-fronted/src/components/charts/chart-table.vue +++ b/nezha-fronted/src/components/charts/chart-table.vue @@ -25,7 +25,7 @@ {{chartData.name}} - + diff --git a/nezha-fronted/src/components/charts/chart-url.vue b/nezha-fronted/src/components/charts/chart-url.vue index 31bee50da..a59d4010c 100644 --- a/nezha-fronted/src/components/charts/chart-url.vue +++ b/nezha-fronted/src/components/charts/chart-url.vue @@ -12,7 +12,7 @@ {{chartData.name}} - + diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index ede15e67d..ab1cd9ae5 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.vue +++ b/nezha-fronted/src/components/charts/line-chart-block.vue @@ -38,7 +38,7 @@ {{chartData.name}} - + diff --git a/nezha-fronted/src/components/charts/text-chart.vue b/nezha-fronted/src/components/charts/text-chart.vue index 08114c064..bf57174f1 100644 --- a/nezha-fronted/src/components/charts/text-chart.vue +++ b/nezha-fronted/src/components/charts/text-chart.vue @@ -12,7 +12,7 @@ {{chartData.name}} - + diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index aa2286d27..f2c5842a0 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -336,7 +336,8 @@ const cn = { moreTitle: '仅显示 20 个时间序列。', moreTitleOther: '仅显示 10 条数据。', showAll: '全部显示 ', - showAllOther: '全部数据 ' + showAllOther: '全部数据 ', + addChartTemp: 'addChartTemp' }, metric: { name: '指标名称', @@ -563,7 +564,23 @@ const cn = { usernamePrompt: '用户名提示', passwordPrompt: '密码提示', snmpCredential: 'SNMP凭证', - authProtocol: '认证协议' + authProtocol: '认证协议', + id: 'ID', + device: 'SN', + assetState: '状态', + modules: 'Endpoint', + alerts: '告警信息', + dataCenter: '数据中心', + manufacturer: '厂商', + procurementDate: '购买日期', + principalTel: '电话', + option: '操作', + assetPing: 'Ping', + lastReply: 'Ping最后应答', + vendor: '厂商', + name: 'Name', + dc: '数据中心', + type: '主机地址' }, config: { config: '设置', diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index f25ed0a2c..99fbd86af 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -345,7 +345,8 @@ const en = { moreTitle: 'Showing only 20 time series. ', moreTitleOther: 'Showing only 10 the data. ', showAll: 'Show all ', - showAllOther: 'All Data' + showAllOther: 'All Data', + addChartTemp: 'addChartTemp' }, metric: { name: 'Metric name', // "指标名称" @@ -571,7 +572,22 @@ const en = { usernamePrompt: 'Username prompt', passwordPrompt: 'Password prompt', snmpCredential: 'SNMP credential', - authProtocol: 'Auth protocol' + authProtocol: 'Auth protocol', + id: 'ID', // ID + device: 'SN', // SN + assetState: 'State', // '状态' + assetPing: 'Ping', + lastReply: 'Ping last reply', + modules: 'Endpoint', // '组件' + alerts: 'Alerts', // '告警信息' + dataCenter: 'Data center', // DC + vendor: 'Vendor', // '厂商' + procurementDate: 'Purchase date', // '购买日期' + principalTel: 'Telephone', // '电话' + option: 'Operation', // "操作" + name: 'Name', + dc: 'DataCenter', + type: 'Types', }, config: { config: 'Settings', // "设置" @@ -682,9 +698,9 @@ const en = { latitude: 'Latitude', lnglat: 'Coordinate' }, - cabinet:{ - editCabinet:'Edit Cabinet', - createCabinet:'Create Cabinet', + cabinet: { + editCabinet: 'Edit Cabinet', + createCabinet: 'Create Cabinet' }, model: { model: 'Asset model', @@ -752,11 +768,11 @@ const en = { replay: 'Replay', skipTip: 'Skip no operation time' }, - loginHost:'Login host', - loginUser:'Login user', - sourceIp:'Source IP', - sourceUser:'Source user', - SessionId:'Session ID', + loginHost: 'Login host', + loginUser: 'Login user', + sourceIp: 'Source IP', + sourceUser: 'Source user', + SessionId: 'Session ID' }, operationlog: { operationlog: 'Operation log', @@ -831,8 +847,8 @@ const en = { defaultCabinetUsize: 'Cabinet U size', second: 'second', day: 'day', - sessionTimeout:'Session timeout', - minute:'minute', + sessionTimeout: 'Session timeout', + minute: 'minute', maxSeries: 'Query max series', unsaved: 'Unsaved prompt', mapConfig: 'Map center', @@ -1016,7 +1032,7 @@ const en = { expressionError: 'Please fill in the "expression" value' }, chartTemp: { - chartTemp: 'Chart template', + chartTemp: 'Chart template' } }, alert: { diff --git a/nezha-fronted/src/components/common/mixin/dataList.js b/nezha-fronted/src/components/common/mixin/dataList.js index 6a3778cb2..e565280bc 100644 --- a/nezha-fronted/src/components/common/mixin/dataList.js +++ b/nezha-fronted/src/components/common/mixin/dataList.js @@ -20,6 +20,7 @@ export default { customTableTitle: [] // 自定义列工具的数据 }, mainTableHeight: this.$tableHeight.normal, // 主列表table高度 + searchTableHeight: this.$tableHeight.search, // 主列表table高度 batchDeleteObjs: [], object: {}, diff --git a/nezha-fronted/src/components/common/project/topologyL5.vue b/nezha-fronted/src/components/common/project/topologyL5.vue index d680b5c1a..acc05ad19 100644 --- a/nezha-fronted/src/components/common/project/topologyL5.vue +++ b/nezha-fronted/src/components/common/project/topologyL5.vue @@ -529,7 +529,7 @@ export default { deep: true, immediate: true, handler (n) { - if (n.id) { + if (n && n.id) { if (getTopology(this.topologyIndex)) { getTopology(this.topologyIndex).destroy() setTopology(this.topologyIndex, null) diff --git a/nezha-fronted/src/components/common/project/topologyPrev.vue b/nezha-fronted/src/components/common/project/topologyPrev.vue index 6a3fe3843..586a29ad4 100644 --- a/nezha-fronted/src/components/common/project/topologyPrev.vue +++ b/nezha-fronted/src/components/common/project/topologyPrev.vue @@ -3,13 +3,13 @@ @import "./L5/css/props.css"; diff --git a/nezha-fronted/src/components/page/dashboard/panel.vue b/nezha-fronted/src/components/page/dashboard/panel.vue index d182c6e0e..c90a8a4a7 100644 --- a/nezha-fronted/src/components/page/dashboard/panel.vue +++ b/nezha-fronted/src/components/page/dashboard/panel.vue @@ -91,6 +91,7 @@ +
@@ -107,6 +108,9 @@ + + + @@ -121,6 +125,7 @@ import pickTime from '../../common/pickTime' import exportXLSX from '../../common/exportXLSX' import selectPanel from '../../common/popBox/selectPanel' import panelBox from '@/components/common/rightBox/panelBox' +import chartTempBox from '@/components/common/rightBox/chartTempBox' export default { name: 'panel', @@ -131,6 +136,7 @@ export default { visible: false, rightBox: { // 面板弹出框相关 chart: { show: false }, + chartTemp: { show: false }, panel: { show: false } }, tableHover: false, @@ -166,6 +172,12 @@ export default { pageSize: -1, // 此处获取所有数据,所以设置一个较大的值 total: 0 }, + blankChartTemp: { + varType: 1, + pid: '', + panelId: '', + varIds: [] + }, chartsData: [], // 中间部分图表相关数据 panelData: [], panelDataDragTmp: [], @@ -204,7 +216,8 @@ export default { 'pick-time': pickTime, 'export-excel': exportXLSX, selectPanel, - 'panel-box': panelBox + 'panel-box': panelBox, + chartTempBox }, methods: { // 刷新 @@ -290,6 +303,11 @@ export default { this.chart.panelName = this.showPanel.name this.rightBox.chart.show = true }, + addChartByTemp () { + this.chart = Object.assign({},this.blankChartTemp) + this.chart.panelId = this.showPanel.id + this.rightBox.chartTemp.show = true + }, addGroupItem (groupId) { this.chart = this.newChart() this.chart.groupId = groupId @@ -317,6 +335,12 @@ export default { } */ }, + closeChartTempBox () { + this.rightBox.chartTemp.show = false + /* if (refresh) { + + } */ + }, closePanelBox (refresh) { this.rightBox.panel.show = false /* if (refresh) { diff --git a/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue b/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue index 81666cfa8..64c00eb0f 100644 --- a/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue +++ b/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue @@ -44,7 +44,7 @@ v-loading="slotProps.loading" :api="url" :custom-table-title="tools.customTableTitle" - :height="mainTableHeight" + :height="searchTableHeight" :table-data="tableData" :tableId="tableId" @del="del" diff --git a/nezha-fronted/src/components/page/monitor/project/projectList.vue b/nezha-fronted/src/components/page/monitor/project/projectList.vue index b982d3007..81332b1bd 100644 --- a/nezha-fronted/src/components/page/monitor/project/projectList.vue +++ b/nezha-fronted/src/components/page/monitor/project/projectList.vue @@ -89,10 +89,49 @@ export default { } }, methods: { + getTableData (params) { + if (params && Object.keys(params).length > 0) { + for (const key in params) { + this.$set(this.searchLabel, key, params[key]) + } + } + this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo) + this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize) + this.tools.loading = true + this.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => { + this.tools.loading = false + if (response.code === 200) { + for (let i = 0; i < response.data.list.length; i++) { + response.data.list[i].status = response.data.list[i].status + '' + } + if (!this.$store.state.currentProject.id) { + this.$store.commit('currentProjectChange', response.data.list[0]) + } + this.tableData = response.data.list + this.pageObj.total = response.data.total + if (!this.scrollbarWrap) { + this.$nextTick(() => { + this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper + this.toTopBtnHandler(this.scrollbarWrap) + }) + } + } + }) + } }, computed: { }, + created () { + console.log(this.$store.state.currentProject) + }, mounted () { + }, + destroyed () { + this.$store.commit('currentProjectChange', { + id: '', + name: '', + remark: '' + }) } } diff --git a/nezha-fronted/src/main.js b/nezha-fronted/src/main.js index 8e3ffafd1..d4d22406a 100644 --- a/nezha-fronted/src/main.js +++ b/nezha-fronted/src/main.js @@ -52,6 +52,7 @@ Vue.prototype.$chartResizeTool = chartResizeTool Vue.prototype.$tableSet = tableSet Vue.prototype.$tableHeight = { // 列表页表格的高度 normal: 'calc(100% - 48px)', // 常规高度,特例在下方定义 + search: 'calc(100% - 240px)', // 常规高度,特例在下方定义 openSubList: { // 打开二级列表后的高度 mainList: 'calc(100% - 60px)', subList: 'calc(100% - 38px)', From da40c519fa8d2a64506a01d04a1b8aea5a507001 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Sun, 25 Apr 2021 20:17:14 +0800 Subject: [PATCH 6/9] =?UTF-8?q?feat=EF=BC=9Aendpoint=20=E6=A0=B9=E6=8D=AEs?= =?UTF-8?q?tate=20=E6=98=BE=E7=A4=BA=E7=9B=B8=E5=85=B3=E7=9A=84=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=20=E6=98=AF=E5=90=A6=E5=BC=80=E5=90=AF=E5=85=B3?= =?UTF-8?q?=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/common/language/en.js | 2 +- .../components/common/table/nzDataList.vue | 2 +- .../common/table/settings/chartTmplTable.vue | 49 ++++++++++++++++- .../common/table/settings/endpointTable.vue | 44 ++++++++++++++- .../common/table/special/endpointQueryTab.vue | 55 ++++++++++--------- 5 files changed, 122 insertions(+), 30 deletions(-) diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 99fbd86af..886d62558 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -250,7 +250,7 @@ const en = { label: 'Text' }, group: { - label: 'group' + label: 'Group' } }, statisticsVal: { diff --git a/nezha-fronted/src/components/common/table/nzDataList.vue b/nezha-fronted/src/components/common/table/nzDataList.vue index 53423e8a4..795f4e1f4 100644 --- a/nezha-fronted/src/components/common/table/nzDataList.vue +++ b/nezha-fronted/src/components/common/table/nzDataList.vue @@ -6,7 +6,7 @@
-
+
diff --git a/nezha-fronted/src/components/common/table/settings/chartTmplTable.vue b/nezha-fronted/src/components/common/table/settings/chartTmplTable.vue index 2de77da13..14c15a506 100644 --- a/nezha-fronted/src/components/common/table/settings/chartTmplTable.vue +++ b/nezha-fronted/src/components/common/table/settings/chartTmplTable.vue @@ -34,7 +34,9 @@ @@ -90,7 +92,50 @@ export default { prop: 'remark', show: true } - ] + ], + chartTypeList: [ + { + id: 'line', + name: this.$t('dashboard.panel.chartForm.typeVal.line.label') + }, + { + id: 'stackArea', + name: this.$t('dashboard.panel.chartForm.typeVal.stackArea.label') + }, + { + id: 'bar', + name: this.$t('dashboard.panel.chartForm.typeVal.bar.label') + }, + { + id: 'singleStat', + name: this.$t('dashboard.panel.chartForm.typeVal.singleStat.label') + }, + { + id: 'pie', + name: this.$t('dashboard.panel.chartForm.typeVal.pie.label') + }, + { + id: 'table', + name: this.$t('dashboard.panel.chartForm.typeVal.table.label') + }, + { + id: 'alertList', + name: this.$t('dashboard.panel.chartForm.typeVal.alertList.label') + }, + { + id: 'text', + name: this.$t('dashboard.panel.chartForm.typeVal.text.label') + }, + { + id: 'url', + name: this.$t('dashboard.panel.chartForm.typeVal.url.label') + }, + { + id: 'group', + name: this.$t('dashboard.panel.chartForm.typeVal.group.label') + } + + ], } }, methods: { diff --git a/nezha-fronted/src/components/common/table/settings/endpointTable.vue b/nezha-fronted/src/components/common/table/settings/endpointTable.vue index 3db1251e5..5817b460e 100644 --- a/nezha-fronted/src/components/common/table/settings/endpointTable.vue +++ b/nezha-fronted/src/components/common/table/settings/endpointTable.vue @@ -66,7 +66,22 @@ {{scope.row[item.prop] ? scope.row[item.prop] : ''}} @@ -157,6 +172,30 @@ export default { const creatDom = document.getElementById('creatDom') creatDom.parentNode.removeChild(creatDom) this.$message.success(this.$t('overall.copySuccess')) + }, + suspendedStr (status) { // 10进制转为2进制 分别给对应的状态 + const arr = status.toString(2).split('') + while (arr.length < 5) { + arr.unshift('0') + } + arr.pop() + let str = '' + arr.forEach((item, index) => { + if (index === 0) { + str += `
DC
` + } + if (index === 1) { + str += `
ASSET
` + } + if (index === 2) { + str += `
ENDPOINT
` + } + if (index === 3) { + str += `
PROMETHEUS
` + } + }) + console.log(arr, str) + return str } }, computed: {} @@ -190,6 +229,9 @@ export default { .endpoint-num, .alert-num{ cursor: pointer; } + .inline-block{ + display: inline-block; + }