fix : cortex 二级页面 config 参数更改

This commit is contained in:
likexuan
2023-01-13 16:35:44 +08:00
parent cb93b22561
commit cb90b6ddd9
3 changed files with 26 additions and 10 deletions

View File

@@ -72,7 +72,8 @@
.config-tab {
overflow: hidden;
.el-table__body-wrapper {
height: 100%;
height: calc(100% - 40px);
overflow-x: hidden;
tbody {
tr:hover > td {
background-color: $--background-color-empty;

View File

@@ -17,7 +17,8 @@
:loading="tools.loading"
:ringTableData='ringTableData'
:configTableData='configTableData'
:servicesTableData='servicesTableData'>
:servicesTableData='servicesTableData'
@configval='configval'>
</cortexDetailTable>
</template>
</nz-bottom-data-list>
@@ -59,6 +60,7 @@ export default {
data () {
return {
tableId: 'cortexDetail',
configMode: 'defaults',
configTableData: [],
servicesTableData: [],
ringTableData: [],
@@ -68,6 +70,10 @@ export default {
mounted () {
},
methods: {
configval (val) {
this.configMode = val
this.getConfigTableData()
},
async getIngesterTableData () {
const response = await this.$get('agent/' + this.obj.id + '/cortex/ingester/ring')
if (response.code === 200) {
@@ -81,7 +87,7 @@ export default {
}
},
async getConfigTableData () {
const response = await this.$get('agent/' + this.obj.id + '/cortex/config?mode=defaults')
const response = await this.$get('agent/' + this.obj.id + '/cortex/config?mode=' + this.configMode)
if (response.code === 200) {
this.configTableData = response.data.conent.split(/\n/)
this.configTableData.unshift('{')

View File

@@ -78,8 +78,8 @@
</template>
<template slot-scope="scope" :column="item">
<span v-if="item.prop === 'name'">{{indexs? $t('cortex.storeGateway'):$t('cortex.ingester')}}</span>
<span v-else-if="item.prop === 'registeredAt'">{{scope.row[item.prop]?momentTz(scope.row[item.prop]):'-'}}</span>
<span v-else-if="item.prop === 'heartbeat'">{{scope.row[item.prop]?momentTz(scope.row[item.prop]):'-'}}</span>
<!-- <span v-else-if="item.prop === 'registeredAt'">{{scope.row[item.prop]?momentTz(scope.row[item.prop]):'-'}}</span> -->
<!-- <span v-else-if="item.prop === 'heartbeat'">{{scope.row[item.prop]?momentTz(scope.row[item.prop]):'-'}}</span> -->
<span v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</span>
<template v-else>-</template>
</template>
@@ -90,9 +90,10 @@
</div>
<div class="cortex-config">
<div class="cortex-title">{{$t('overall.configEndpoint')}}</div>
<div :class="`${configSwitch ? 'cortex-config-tab' : ''}`">
<div class="cortex-config-tab">
<!-- <div :class="`${configSwitch ? 'cortex-config-tab' : ''}`"> -->
<!-- v-if="configSwitch" -->
<el-table
v-if="configSwitch"
:data="configTableData"
class="config-tab">
<el-table-column
@@ -105,14 +106,14 @@
>
<template #header>
<span style="padding-right: 7px;">{{$t('cortex.IncludeDefault')}}</span>
<el-switch v-model="configSwitch" :active-value="1" :inactive-value="0" size="small" style="padding-right: 11px;"></el-switch>
<el-switch v-model="configSwitch" :active-value="1" :inactive-value="0" @change="configSwitchCheck" size="small" style="padding-right: 11px;"></el-switch>
</template>
<template slot-scope="scope">
<span><pre>{{scope.row}}</pre></span>
</template>
</el-table-column>
</el-table>
<el-table v-else class="config-switch-tab">
<!-- <el-table v-else class="config-switch-tab">
<el-table-column
type="index">
</el-table-column>
@@ -125,7 +126,7 @@
<el-switch v-model="configSwitch" :active-value="1" :inactive-value="0" size="small"></el-switch>
</template>
</el-table-column>
</el-table>
</el-table> -->
</div>
</div>
</template>
@@ -148,6 +149,7 @@ export default {
name: 'cortexDetailTable',
props: {
loading: Boolean,
configMode: String,
ingesterTableData: Array,
storeGatewayTableData: Array,
configTableData: Array,
@@ -300,6 +302,13 @@ export default {
}
}
}
},
configSwitchCheck () {
if (this.configSwitch == 1) {
this.$emit('configval', 'defaults')
} else {
this.$emit('configval', 'diff')
}
}
}
}