NEZ-887:当用户未创建 dashboard panel 时,chart 查询错误数据的问题

This commit is contained in:
zhangyu
2021-07-29 16:23:15 +08:00
parent 335ede10b7
commit 614a9c183f
10 changed files with 63 additions and 7 deletions

View File

@@ -656,6 +656,7 @@ export default {
if (!param.query) delete param.query if (!param.query) delete param.query
// 根据panelId获得panel下的所有图表 // 根据panelId获得panel下的所有图表
// const groupId = true ? '&groupId=0' : '' // const groupId = true ? '&groupId=0' : ''
if (!params.panelId) { return } // 没有panelId不调用接口
this.$get('visual/panel/chart?panelId=' + params.panelId + '&groupId=0' + '&pageSize=-1').then(response => { this.$get('visual/panel/chart?panelId=' + params.panelId + '&groupId=0' + '&pageSize=-1').then(response => {
if (response.code === 200) { if (response.code === 200) {
response.data.list.forEach((item, index) => { response.data.list.forEach((item, index) => {

View File

@@ -37,20 +37,20 @@
<operation-log-tab v-if="from === fromRoute.user && targetTab === 'operationLogTab'" :from="from" :obj="obj" :tabs="tabs.user.operationLog" @changeTab="changeTab"></operation-log-tab> <operation-log-tab v-if="from === fromRoute.user && targetTab === 'operationLogTab'" :from="from" :obj="obj" :tabs="tabs.user.operationLog" @changeTab="changeTab"></operation-log-tab>
<terminal-log-tab v-if="from === fromRoute.user && targetTab === 'terminalLogTab'" :from="from" :obj="obj" :tabs="tabs.user.terminalLog" @changeTab="changeTab"></terminal-log-tab> <terminal-log-tab v-if="from === fromRoute.user && targetTab === 'terminalLogTab'" :from="from" :obj="obj" :tabs="tabs.user.terminalLog" @changeTab="changeTab"></terminal-log-tab>
<!-- asset列表的3个 --> <!-- asset列表的3个 -->
<panel-tab-new :paramsType="'asset'" v-if="from === fromRoute.asset && targetTab === 'panelTab'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.asset.panel" :targetTab.sync="targetTab" @changeTab="changeTab"></panel-tab-new> <panel-tab-new @getTableData="getTableData" :paramsType="'asset'" v-if="from === fromRoute.asset && targetTab === 'panelTab'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.asset.panel" :targetTab.sync="targetTab" @changeTab="changeTab"></panel-tab-new>
<alertMessageTabNew v-if="from === fromRoute.asset && targetTab === 'alertMessageTab'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.asset.alertMessage" :targetTab="targetTab" @changeTab="changeTab"></alertMessageTabNew> <alertMessageTabNew v-if="from === fromRoute.asset && targetTab === 'alertMessageTab'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.asset.alertMessage" :targetTab="targetTab" @changeTab="changeTab"></alertMessageTabNew>
<endpointTabNew v-if="from === fromRoute.asset && targetTab === 'endpointTab'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.asset.endpoint" :targetTab="targetTab" @changeTab="changeTab"></endpointTabNew> <endpointTabNew v-if="from === fromRoute.asset && targetTab === 'endpointTab'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.asset.endpoint" :targetTab="targetTab" @changeTab="changeTab"></endpointTabNew>
<assetSubTab v-if="from === fromRoute.asset && targetTab === 'assetSubTab' && obj.childrenNum" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.asset.alertMessageSub" :targetTab="targetTab" @changeTab="changeTab"></assetSubTab> <assetSubTab v-if="from === fromRoute.asset && targetTab === 'assetSubTab' && obj.childrenNum" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.asset.alertMessageSub" :targetTab="targetTab" @changeTab="changeTab"></assetSubTab>
<!--module列表的tab--> <!--module列表的tab-->
<endpointTabNew v-if="from === fromRoute.module && targetTab === 'endpoint'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.module.moduleTabTitle" :targetTab="targetTab" @changeTab="changeTab"></endpointTabNew> <endpointTabNew v-if="from === fromRoute.module && targetTab === 'endpoint'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.module.moduleTabTitle" :targetTab="targetTab" @changeTab="changeTab"></endpointTabNew>
<alertMessageTabNew v-if="from === fromRoute.module && targetTab === 'moduleAlertMessage'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.module.moduleTabTitle" @changeTab="changeTab" :targetTab="targetTab"></alertMessageTabNew> <alertMessageTabNew v-if="from === fromRoute.module && targetTab === 'moduleAlertMessage'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.module.moduleTabTitle" @changeTab="changeTab" :targetTab="targetTab"></alertMessageTabNew>
<panel-tab-new :paramsType="'module'" v-if="from === fromRoute.module && targetTab === 'panel'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.module.moduleTabTitle" :targetTab.sync="targetTab" @changeTab="changeTab"></panel-tab-new> <panel-tab-new @getTableData="getTableData" :paramsType="'module'" v-if="from === fromRoute.module && targetTab === 'panel'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.module.moduleTabTitle" :targetTab.sync="targetTab" @changeTab="changeTab"></panel-tab-new>
<!--endpoint列表的tab--> <!--endpoint列表的tab-->
<panel-tab-new :paramsType="'endpoint'" v-if="from === fromRoute.endpoint && targetTab === 'panelTab'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.endpoint.endpointTabTitle" :targetTab.sync="targetTab" @changeTab="changeTab"></panel-tab-new> <panel-tab-new @getTableData="getTableData" :paramsType="'endpoint'" v-if="from === fromRoute.endpoint && targetTab === 'panelTab'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.endpoint.endpointTabTitle" :targetTab.sync="targetTab" @changeTab="changeTab"></panel-tab-new>
<endpointQuery v-if="from === fromRoute.endpoint && targetTab === 'endpointQuery'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.endpoint.endpointTabTitle" @changeTab="changeTab" :targetTab="targetTab"></endpointQuery> <endpointQuery v-if="from === fromRoute.endpoint && targetTab === 'endpointQuery'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.endpoint.endpointTabTitle" @changeTab="changeTab" :targetTab="targetTab"></endpointQuery>
<alertMessageTabNew v-if="from === fromRoute.endpoint && targetTab === 'endpointAlertMessage'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.endpoint.endpointTabTitle" @changeTab="changeTab" :targetTab="targetTab"></alertMessageTabNew> <alertMessageTabNew v-if="from === fromRoute.endpoint && targetTab === 'endpointAlertMessage'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.endpoint.endpointTabTitle" @changeTab="changeTab" :targetTab="targetTab"></alertMessageTabNew>
<!--chartTemp的Tab--> <!--chartTemp的Tab-->
<panel-tab-new :paramsType="'template'" v-if="from === fromRoute.chartTemp && targetTab === 'panel'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.chartTemp.chartTempTabTitle" :targetTab.sync="targetTab" @changeTab="changeTab"></panel-tab-new> <panel-tab-new @getTableData="getTableData" :paramsType="'template'" v-if="from === fromRoute.chartTemp && targetTab === 'panel'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.chartTemp.chartTempTabTitle" :targetTab.sync="targetTab" @changeTab="changeTab"></panel-tab-new>
<!--alertRule Tab--> <!--alertRule Tab-->
<alertMessageTabNew v-if="from === fromRoute.alertRule && targetTab === 'alertRuleAlertMessage'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.alertRule.alertRule" @changeTab="changeTab" :targetTab="targetTab"></alertMessageTabNew> <alertMessageTabNew v-if="from === fromRoute.alertRule && targetTab === 'alertRuleAlertMessage'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="tabs.alertRule.alertRule" @changeTab="changeTab" :targetTab="targetTab"></alertMessageTabNew>
<!--model 下滑--> <!--model 下滑-->
@@ -250,6 +250,9 @@ export default {
this.$refs.reminalLogRecordTab.consoleResize() this.$refs.reminalLogRecordTab.consoleResize()
}, 600) }, 600)
} }
},
getTableData () {
this.$emit('getTableData')
} }
} }
} }

View File

@@ -272,6 +272,7 @@ export default {
this.getData(this.filter) this.getData(this.filter)
} }
}) })
this.$emit('getTableData')
} }
} }
}, },

View File

@@ -17,6 +17,11 @@ export const agent = {
label: 'Per-datacenter', label: 'Per-datacenter',
value: 2, value: 2,
text: 'Per-datacenter' text: 'Per-datacenter'
},
{
label: 'Loki',
value: 11,
text: 'Loki'
} }
] ]
}, },
@@ -65,6 +70,38 @@ export const agent2 = {
label: 'Per-datacenter', label: 'Per-datacenter',
value: 2, value: 2,
text: 'Per-datacenter' text: 'Per-datacenter'
},
{
label: 'Loki',
value: 11,
text: 'Loki'
}
],
theDataGroup: [
{
label: 'Metrics',
option: [
{
label: 'Global',
value: 1,
text: 'Global'
},
{
label: 'Per-datacenter',
value: 2,
text: 'Per-datacenter'
}
]
},
{
label: 'Logs',
option: [
{
label: 'Loki',
value: 11,
text: 'Loki'
}
]
} }
] ]

View File

@@ -556,6 +556,8 @@ export default {
if (this.endpointTableData.length === 0) { if (this.endpointTableData.length === 0) {
this.endpointTouch = true this.endpointTouch = true
this.$refs.addEndpoint.validate() this.$refs.addEndpoint.validate()
this.prevent_opt.save = false
this.showError = true
return false return false
} }
// 对endpointList进行处理避免携带过多无用数据 // 对endpointList进行处理避免携带过多无用数据

View File

@@ -43,9 +43,14 @@
<!-- :props="{ multiple: false, checkStrictly: false ,emitPath:false}"--> <!-- :props="{ multiple: false, checkStrictly: false ,emitPath:false}"-->
<!-- clearable></el-cascader>--> <!-- clearable></el-cascader>-->
<el-select v-model="editPromServer.type" :disabled="editPromServer.id != null&& editPromServer.id != ''" placeholder="" class="right-box__select" popper-class="right-box-select-dropdown prevent-clickoutside" size="small" value-key="value"> <el-select v-model="editPromServer.type" :disabled="editPromServer.id != null&& editPromServer.id != ''" placeholder="" class="right-box__select" popper-class="right-box-select-dropdown prevent-clickoutside" size="small" value-key="value">
<el-option v-for="item in agent2.theData" :key="item.value" :label="item.label" :value="item.value" :disabled="federationEnabled && item.value == 2"> <el-option-group
<span class="panel-dropdown-label-txt" >{{item.label}}</span> v-for="group in agent2.theDataGroup"
</el-option> :key="group.label"
:label="group.label">
<el-option v-for="item in group.option" :key="item.value" :label="item.label" :value="item.value" :disabled="federationEnabled && item.value == 2">
<span class="panel-dropdown-label-txt" >{{item.label}}</span>
</el-option>
</el-option-group>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="Token" prop="token"> <el-form-item label="Token" prop="token">

View File

@@ -47,6 +47,7 @@
</div> </div>
<transition name="el-zoom-in-bottom"> <transition name="el-zoom-in-bottom">
<bottom-box v-if="bottomBox.showSubList" <bottom-box v-if="bottomBox.showSubList"
@getTableData = 'getTableData'
ref="bottomBox" ref="bottomBox"
:from="from" :from="from"
:is-full-screen="bottomBox.isFullScreen" :is-full-screen="bottomBox.isFullScreen"
@@ -137,6 +138,9 @@ export default {
}, },
search (searchObj) { search (searchObj) {
this.$emit('search', searchObj) this.$emit('search', searchObj)
},
getTableData () {
this.$emit('getTableData')
} }
}, },
watch: { watch: {

View File

@@ -8,6 +8,7 @@
:layout="dataListLayout" :layout="dataListLayout"
:search-msg="searchMsg" :search-msg="searchMsg"
@search="search" @search="search"
@getTableData="getTableData"
> >
<template v-slot:top-tool-right> <template v-slot:top-tool-right>
<button id="asset-filter" :class="{ 'is-focus': dataListLayout.indexOf('clickSearch') > -1 }" class="top-tool-btn margin-r-10" @click.stop="showClickSearch"> <button id="asset-filter" :class="{ 'is-focus': dataListLayout.indexOf('clickSearch') > -1 }" class="top-tool-btn margin-r-10" @click.stop="showClickSearch">

View File

@@ -8,6 +8,7 @@
:from="fromRoute.chartTemp" :from="fromRoute.chartTemp"
:search-msg="searchMsg" :search-msg="searchMsg"
@search="search" @search="search"
@getTableData="getTableData"
> >
<template v-slot:top-tool-left> <template v-slot:top-tool-left>
<div id="module-type-1" class="nz-tab-item-box" @click="clickTab([],'exprTemp')"><!--v-has="'snmp_browser_view'"--> <div id="module-type-1" class="nz-tab-item-box" @click="clickTab([],'exprTemp')"><!--v-has="'snmp_browser_view'"-->

View File

@@ -8,6 +8,7 @@
:layout="dataListLayout" :layout="dataListLayout"
:search-msg="searchMsg" :search-msg="searchMsg"
@search="search" @search="search"
@getTableData="getTableData"
> >
<template v-slot:top-tool-right> <template v-slot:top-tool-right>
<button id="asset-filter" :class="{ 'is-focus': dataListLayout.indexOf('clickSearch') > -1 }" class="top-tool-btn margin-r-10" @click.stop="showClickSearch"> <button id="asset-filter" :class="{ 'is-focus': dataListLayout.indexOf('clickSearch') > -1 }" class="top-tool-btn margin-r-10" @click.stop="showClickSearch">