diff --git a/nezha-fronted/src/assets/stylus/main.scss b/nezha-fronted/src/assets/stylus/main.scss index 6ea3c0064..8e57fa1d6 100644 --- a/nezha-fronted/src/assets/stylus/main.scss +++ b/nezha-fronted/src/assets/stylus/main.scss @@ -1290,11 +1290,11 @@ li{ } .right-box-form .one-third-form-item-left{ display: inline-block; - width: 170px; + width: calc(50% - 5px); } .right-box-form .one-third-form-item-right{ display: inline-block; - width: 170px; + width: calc(50% - 5px); .el-form-item__label{ width: 20px !important; } @@ -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-alert-list.vue b/nezha-fronted/src/components/charts/chart-alert-list.vue index a19ab3f6f..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 b40abc3f8..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-detail.vue b/nezha-fronted/src/components/charts/chart-detail.vue index d07a35dfb..3054b35ee 100644 --- a/nezha-fronted/src/components/charts/chart-detail.vue +++ b/nezha-fronted/src/components/charts/chart-detail.vue @@ -319,23 +319,23 @@ export default { oldSearchTime: [], assetKey: { - host: this.$t('asset.tableTitle.host'), + host: this.$t('asset.host'), id: 'Id', - assetType: this.$t('asset.tableTitle.assetType'), - sn: this.$t('asset.tableTitle.device'), - state: this.$t('asset.tableTitle.assetState'), - pingRtt: this.$t('asset.tableTitle.assetPing'), - dataCenter: this.$t('asset.tableTitle.dataCenter'), - cabinet: this.$t('asset.tableTitle.cabinet'), - model: this.$t('asset.tableTitle.model'), - vendor: this.$t('asset.tableTitle.vendor'), - purchaseDate: this.$t('asset.tableTitle.procurementDate'), - principal: this.$t('asset.tableTitle.principal'), - tel: this.$t('asset.tableTitle.principalTel'), - pingStatus: this.$t('asset.tableTitle.assetPing'), - pingLastReply: this.$t('asset.tableTitle.lastReply'), - endpoint: this.$t('asset.tableTitle.modules'), - alert: this.$t('asset.tableTitle.alerts'), + assetType: this.$t('asset.assetType'), + sn: this.$t('asset.device'), + state: this.$t('asset.assetState'), + pingRtt: this.$t('asset.assetPing'), + dataCenter: this.$t('asset.dataCenter'), + cabinet: this.$t('asset.cabinet'), + model: this.$t('asset.model'), + vendor: this.$t('asset.vendor'), + purchaseDate: this.$t('asset.procurementDate'), + principal: this.$t('asset.principal'), + tel: this.$t('asset.principalTel'), + pingStatus: this.$t('asset.assetPing'), + pingLastReply: this.$t('asset.lastReply'), + endpoint: this.$t('asset.modules'), + alert: this.$t('asset.alerts'), tags: this.$t('overall.tag') }, projectKey: { diff --git a/nezha-fronted/src/components/charts/chart-group.vue b/nezha-fronted/src/components/charts/chart-group.vue index 446417008..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-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index 7d0be3dfa..6252aeb86 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,11 @@ export default { // showShadow:false, } }, + watch: { + panelDataList (n) { + this.getData(this.filter) + } + }, methods: { dropmenuChange (id, show) { if (show) { @@ -662,9 +670,24 @@ export default { }) return } + if (param.from == this.$CONSTANTS.fromRoute.chartTemp) { + 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 @@ -737,7 +760,6 @@ export default { }) }, loadChartData (scrollTop) { - console.log(scrollTop) if (this.dataList.length > 0) { this.dataList.forEach((item, index) => { if (!item.isLoaded) { @@ -918,6 +940,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单独获取数据 @@ -1723,7 +1748,6 @@ export default { }, // 懒加载,判断网页区域,加载可见区的prom数据 handleElementInViewport (ele, scrollTop, item, index, isSearch) { - console.log(ele, scrollTop, item, index) /* 网页被卷去的高:document.body.scrollTop 网页正文全文高:document.body.scrollHeight diff --git a/nezha-fronted/src/components/charts/chart-pie.vue b/nezha-fronted/src/components/charts/chart-pie.vue index 2fd9878ce..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 46a7808a8..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 a07150099..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 86ec47e23..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/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/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index 421b67d2a..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 b2cc884d5..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/bottomBox/bottomBox.vue b/nezha-fronted/src/components/common/bottomBox/bottomBox.vue index a2cbc2c86..d201561ed 100644 --- a/nezha-fronted/src/components/common/bottomBox/bottomBox.vue +++ b/nezha-fronted/src/components/common/bottomBox/bottomBox.vue @@ -51,6 +51,8 @@ + + @@ -70,7 +72,7 @@ import terminalLogMonitorTab from './tabs/terminalLogMonitorTab' import terminalLogCMDTab from './tabs/terminalLogCMDTab' import operationLogTab from './tabs/operationLogTab' import terminalLogTab from './tabs/terminalLogTab' -import assetTab from "@/components/common/bottomBox/tabs/assetTab"; +import assetTab from '@/components/common/bottomBox/tabs/assetTab' import { fromRoute } from '@/components/common/js/constants' export default { @@ -120,7 +122,7 @@ export default { }, module: { moduleTabTitle: [ - { prop: 'endpoint', name: this.$t('asset.tableTitle.endpoint') }, + { prop: 'endpoint', name: this.$t('asset.endpoint') }, { prop: 'moduleAlertMessage', name: 'Alerts' }, { prop: 'panel', name: 'Detail' } ] @@ -132,12 +134,17 @@ export default { { prop: 'endpointAlertMessage', name: 'Alerts' } ] }, + chartTemp: { + chartTempTabTitle: [ + { prop: 'panel', name: 'Template preview' } + ] + }, dc: { cabinet: [ { prop: 'asset', name: this.$t('asset.assets'), active: false }, { prop: 'cabinet', name: this.$t('config.dc.cabinets'), active: true } ], - asset:[ + asset: [ { prop: 'asset', name: this.$t('asset.assets'), active: true }, { prop: 'cabinet', name: this.$t('config.dc.cabinets'), active: false } ] diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue index 58151e96a..db493664b 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue @@ -3,8 +3,8 @@
{{obj.name}}
-
{{$t("asset.tableTitle.modules")}}
-
{{$t("asset.tableTitle.alerts")}}
+
{{$t("asset.modules")}}
+
{{$t("asset.alerts")}}
@@ -13,8 +13,8 @@
{{$t("overall.detail")}}
{{$t("asset.tableTitle.alerts")}}
{{$t("asset.tableTitle.modules")}}
+ class="sub-list-tab sub-list-tab-active">{{$t("asset.alerts")}}
{{$t("asset.modules")}}
{{$t("overall.query")}}
diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/assetTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/assetTab.vue index d592839cb..8968c79d8 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/assetTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/assetTab.vue @@ -98,7 +98,7 @@ export default { disabled: false }, { id: 23, - name: this.$t('asset.tableTitle.cabinet'), + name: this.$t('asset.cabinet'), type: 'input', label: 'cabinetName', disabled: false 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/endpointQueryTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/endpointQueryTab.vue index 2982b1950..891063900 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/endpointQueryTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/endpointQueryTab.vue @@ -22,7 +22,7 @@
{{$t("project.endpoint.endpointId")}}: {{currentEndpoint ? currentEndpoint.id : ''}}
{{$t("overall.detail")}}
-
{{$t("asset.tableTitle.alerts")}}
+
{{$t("asset.alerts")}}
{{$t("overall.query")}}
diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/endpointTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/endpointTab.vue index bb00172e6..f3730dc9f 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/endpointTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/endpointTab.vue @@ -4,13 +4,13 @@
{{obj.host}}
{{$t("overall.detail")}}
-
{{$t("asset.tableTitle.alerts")}}
-
{{$t("asset.tableTitle.modules")}}
+
{{$t("asset.alerts")}}
+
{{$t("asset.modules")}}
{{obj.name}}
-
{{$t("asset.tableTitle.modules")}}
-
{{$t("asset.tableTitle.alerts")}}
+
{{$t("asset.modules")}}
+
{{$t("asset.alerts")}}
{{$t("dashboard.panel.title")}}
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 1bf74d5d5..5a1200a2f 100644 --- a/nezha-fronted/src/components/common/js/constants.js +++ b/nezha-fronted/src/components/common/js/constants.js @@ -230,5 +230,6 @@ export const fromRoute = { menus: 'menus', notify: 'notify', link: 'link', - apiKey: 'apiKey' + apiKey: 'apiKey', + chartTemp: 'chartTemp' } diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index 00b6c7f92..7e06b0621 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -278,7 +278,11 @@ const cn = { content: '内容', tooltip: 'Tooltip', displayChart: '图表', - aggregation: 'Aggregation' + aggregation: 'Aggregation', + varType: 'Vartype', + pid: 'Chart 模板', + selectAsset: '请选择Asset', + selectEndpoint: '请选择Endpoint' }, chartTableColumn: { metric: '指标', @@ -336,7 +340,8 @@ const cn = { moreTitle: '仅显示 20 个时间序列。', moreTitleOther: '仅显示 10 条数据。', showAll: '全部显示 ', - showAllOther: '全部数据 ' + showAllOther: '全部数据 ', + addChartTemp: 'addChartTemp' }, metric: { name: '指标名称', @@ -545,6 +550,7 @@ const cn = { principal: '负责人', tel: '电话', featureTitle: '属性', + endpoint: 'Endpoint', endpointUpNum: '代表正常的数量', endpointNum: '代表总的数量', active: '存活', // "存活", @@ -562,7 +568,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 d55c9ab60..d8e6c61cf 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: { @@ -288,7 +288,11 @@ const en = { content: 'Content', tooltip: 'Tooltip', displayChart: 'Display chart', - aggregation: 'Aggregation' + aggregation: 'Aggregation', + varType: 'Vartype', + pid: 'Chart template', + selectAsset: 'Please select the Asset', + selectEndpoint: 'Please select the Endpoint' }, chartTableColumn: { metric: 'Metric', // '指标' @@ -345,7 +349,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', // "指标名称" @@ -552,6 +557,7 @@ const en = { principal: 'Administrator', // '负责人' tel: 'Telephone', // '电话' featureTitle: 'Attribute', + endpoint: 'Endpoint', endpointUpNum: 'It\'s a normal number', endpointNum: 'Represents the total quantity', active: 'Alive', // "存活", @@ -570,7 +576,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', // "设置" @@ -681,9 +702,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', @@ -753,11 +774,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', @@ -832,8 +853,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', @@ -1017,7 +1038,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/nzTransfer.vue b/nezha-fronted/src/components/common/nzTransfer.vue index 2ada5bea8..7f3268b60 100644 --- a/nezha-fronted/src/components/common/nzTransfer.vue +++ b/nezha-fronted/src/components/common/nzTransfer.vue @@ -28,14 +28,12 @@ width="36"> - - - - + +
@@ -79,14 +77,12 @@ width="36"> - - - - + + @@ -131,6 +127,9 @@ export default { }, pageObj: { type: Object + }, + tableTitle: { + type: Array, } }, data () { diff --git a/nezha-fronted/src/components/common/pickTime.vue b/nezha-fronted/src/components/common/pickTime.vue index 0be120aa2..2ee8b2805 100644 --- a/nezha-fronted/src/components/common/pickTime.vue +++ b/nezha-fronted/src/components/common/pickTime.vue @@ -9,6 +9,7 @@ +
+
- 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/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 a090996d9..14c15a506 100644 --- a/nezha-fronted/src/components/common/table/settings/chartTmplTable.vue +++ b/nezha-fronted/src/components/common/table/settings/chartTmplTable.vue @@ -34,6 +34,9 @@ @@ -76,6 +79,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', @@ -85,7 +92,64 @@ 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: { + typeIcon (row) { + let str = 'nz-icon' + switch (row.type) { + case 'line': + str += 'nz-icon-multitext' + break + default : + str += 'nz-icon-multitext' + break + } + return str } } } diff --git a/nezha-fronted/src/components/common/table/settings/endpointTable.vue b/nezha-fronted/src/components/common/table/settings/endpointTable.vue index 3db1251e5..82fc1f27e 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,29 @@ 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
` + } + }) + return str } }, computed: {} @@ -190,6 +228,9 @@ export default { .endpoint-num, .alert-num{ cursor: pointer; } + .inline-block{ + display: inline-block; + }