fix : cortex,loki 页面增加 compactor 接口

This commit is contained in:
likexuan
2023-02-03 10:26:25 +08:00
parent 5cf765905c
commit aafeb5bbf7
5 changed files with 73 additions and 2 deletions

View File

@@ -45,6 +45,11 @@
display: none; display: none;
} }
} }
.ring-table{
.el-table__body-wrapper{
border-left: 1px solid $--border-color-light;
}
}
} }
.cortex-service, .cortex-service,

View File

@@ -52,6 +52,7 @@ export default {
await this.getReadyTableData() await this.getReadyTableData()
await this.getIngesterTableData() await this.getIngesterTableData()
await this.getStoreGatewayTableData() await this.getStoreGatewayTableData()
await this.getCompactorTableData()
await this.getConfigTableData() await this.getConfigTableData()
this.getservicesTableData() this.getservicesTableData()
} }
@@ -86,6 +87,12 @@ export default {
this.ringTableData.push(response.data.list) this.ringTableData.push(response.data.list)
} }
}, },
async getCompactorTableData () {
const response = await this.$get('agent/' + this.obj.id + '/cortex/compactor/ring')
if (response.code === 200) {
this.ringTableData.push(response.data.list)
}
},
async getConfigTableData () { async getConfigTableData () {
const response = await this.$get('agent/' + this.obj.id + '/cortex/config?mode=' + this.configMode) const response = await this.$get('agent/' + this.obj.id + '/cortex/config?mode=' + this.configMode)
if (response.code === 200) { if (response.code === 200) {

View File

@@ -15,6 +15,7 @@
<loki-status-table <loki-status-table
v-my-loading="tools.loading" v-my-loading="tools.loading"
:loading="tools.loading" :loading="tools.loading"
:ringTableData='ringTableData'
:configTableData='configTableData' :configTableData='configTableData'
:servicesTableData='servicesTableData' :servicesTableData='servicesTableData'
@configval='configval'> @configval='configval'>
@@ -50,6 +51,7 @@ export default {
async handler (n) { async handler (n) {
await this.getReadyTableData() await this.getReadyTableData()
await this.getConfigTableData() await this.getConfigTableData()
await this.getCompactorTableData()
this.getservicesTableData() this.getservicesTableData()
} }
} }
@@ -60,6 +62,7 @@ export default {
configMode: 'defaults', configMode: 'defaults',
configTableData: [], configTableData: [],
servicesTableData: [], servicesTableData: [],
ringTableData: [],
readyTableData: '' readyTableData: ''
} }
}, },
@@ -76,6 +79,12 @@ export default {
this.configTableData = response.data.content.split(/\n/) this.configTableData = response.data.content.split(/\n/)
} }
}, },
async getCompactorTableData () {
const response = await this.$get('agent/' + this.obj.id + '/loki/compactor/ring')
if (response.code === 200) {
this.ringTableData = response.data.list
}
},
async getReadyTableData () { async getReadyTableData () {
const response = await this.$get('agent/' + this.obj.id + '/loki/ready') const response = await this.$get('agent/' + this.obj.id + '/loki/ready')
if (response.code === 200) { if (response.code === 200) {

View File

@@ -76,7 +76,7 @@
<div class="col-resize-area"></div> <div class="col-resize-area"></div>
</template> </template>
<template slot-scope="scope" :column="item"> <template slot-scope="scope" :column="item">
<span v-if="item.prop === 'name'">{{indexs? $t('cortex.storeGateway'):$t('cortex.ingester')}}</span> <span v-if="item.prop === 'name'">{{indexs==0?$t('cortex.storeGateway'):(indexs==1?$t('cortex.ingester'):$t('cortex.compactor'))}}</span>
<span v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</span> <span v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</span>
<template v-else>-</template> <template v-else>-</template>
</template> </template>

View File

@@ -51,6 +51,39 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<div class="cortex-ring">
<div class="cortex-title">{{$t('cortex.ringStatus')}}</div>
<div class="cortex-ingester">
<el-table
:data="ringTableData"
:border='true'
:class="ringTableData.length == 0?'ring-table':''"
:span-method="(param)=>objectSpanMethod(param,ringTableData)"
>
<el-table-column
v-for="(item, index) in ingesterTitle"
:key="`col-${index}`"
:fixed="item.fixed"
:label="item.label"
:min-width="`${item.minWidth}`"
:prop="item.prop"
:resizable="true"
:width="`${item.width}`"
class="data-column"
>
<template slot="header">
<span class="data-column__span">{{item.label}}</span>
<div class="col-resize-area"></div>
</template>
<template slot-scope="scope" :column="item" class="123">
<span v-if="item.prop === 'name'">{{$t('cortex.compactor')}}</span>
<span v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</span>
<template v-else>-</template>
</template>
</el-table-column>
</el-table>
</div>
</div>
<div class="cortex-config" :style="configTableData.length < 31 ? `height:${configTableData.length * 27 + 102}px` : 'flex:1;min-height: 436px;'"> <div class="cortex-config" :style="configTableData.length < 31 ? `height:${configTableData.length * 27 + 102}px` : 'flex:1;min-height: 436px;'">
<div class="cortex-title">{{$t('overall.configEndpoint')}}</div> <div class="cortex-title">{{$t('overall.configEndpoint')}}</div>
<div class="cortex-config-tab"> <div class="cortex-config-tab">
@@ -87,7 +120,8 @@ export default {
loading: Boolean, loading: Boolean,
configMode: String, configMode: String,
configTableData: Array, configTableData: Array,
servicesTableData: Array servicesTableData: Array,
ringTableData: Array
}, },
mixins: [table], mixins: [table],
components: {}, components: {},
@@ -207,6 +241,22 @@ export default {
mounted () { mounted () {
}, },
methods: { methods: {
// 合并单元格
objectSpanMethod ({ row, column, rowIndex, columnIndex }, items) {
if (columnIndex === 0) {
if (rowIndex % items.length === 0) {
return {
rowspan: items.length,
colspan: 1
}
} else {
return {
rowspan: 0,
colspan: 0
}
}
}
},
configSwitchCheck () { configSwitchCheck () {
if (this.configSwitch == 1) { if (this.configSwitch == 1) {
this.$emit('configval', 'defaults') this.$emit('configval', 'defaults')