diff --git a/nezha-fronted/src/components/common/js/constants.js b/nezha-fronted/src/components/common/js/constants.js index 548b8a02b..0f8841a51 100644 --- a/nezha-fronted/src/components/common/js/constants.js +++ b/nezha-fronted/src/components/common/js/constants.js @@ -32,10 +32,56 @@ export const staticMenus = { }; export const promServer = { - typeData: [ - {value: 1, label: 'Global'}, - {value: 2, label: 'Per-Datacenter'} - ], + theData:[ + { + label:'Federation', + value:'federation', + children:[ + { + label:'Global', + value:1, + text:'Global', + }, + { + label:'Per-datacenter', + value:2, + text:'Per-datacenter', + } + ] + }, + { + label:'Thanos', + value:'Thanos', + children:[ + { + label:'query', + value:3, + text:'Thanos-query' + }, + { + label:'rule', + value:4, + text:'Thanos-rule' + }, + { + label:'sidecar', + value:5, + text:'Thanos-sidecar' + }, + { + label:'store', + value:6, + text:'Thanos-store' + }, + { + label:'compactor', + value:7, + text:'Thanos-compactor' + } + ] + } + ] + }; export const asset = { diff --git a/nezha-fronted/src/components/common/rightBox/promServerBox.vue b/nezha-fronted/src/components/common/rightBox/promServerBox.vue index 39934aed2..0f225eef4 100644 --- a/nezha-fronted/src/components/common/rightBox/promServerBox.vue +++ b/nezha-fronted/src/components/common/rightBox/promServerBox.vue @@ -39,9 +39,15 @@ - - - + diff --git a/nezha-fronted/src/components/page/config/promServer.vue b/nezha-fronted/src/components/page/config/promServer.vue index 49c9784b0..f2200232b 100644 --- a/nezha-fronted/src/components/page/config/promServer.vue +++ b/nezha-fronted/src/components/page/config/promServer.vue @@ -44,8 +44,9 @@ {{scope.row[item.prop]?scope.row[item.prop].name:'-'}} - {{scope.row[item.prop] == '1' ? 'Global' : ''}} - {{scope.row[item.prop] == '2' ? 'Per-Datacenter' : ''}} + + {{findServerType(scope.row[item.prop]).text}} @@ -214,6 +215,7 @@ }], }, searchLabel: {}, //搜索参数 + promServerType:null, } }, methods: { @@ -372,6 +374,17 @@ this.$set(this.searchLabel, "orderBy", orderBy); this.getTableData(); }, + findServerType(type){ + if(!this.promServerType){ + this.promServerType=[]; + this.$CONSTANTS.promServer.theData.forEach(item=>{ + this.promServerType=this.promServerType.concat(item.children) + }) + } + return this.promServerType.find(item=>{ + return item.value == type + }) + } }, mounted() { //初始化数据