NEZ-1734 fix:页面 国际化的问题

This commit is contained in:
zhangyu
2022-03-24 15:59:05 +08:00
parent 5b6c728d6b
commit fae3c0ab0c
7 changed files with 96 additions and 49 deletions

View File

@@ -169,32 +169,32 @@ export default {
panel: [ panel: [
{ prop: 'panelTab', name: this.$t('overall.detail'), active: true }, { prop: 'panelTab', name: this.$t('overall.detail'), active: true },
{ prop: 'alertMessageTab', name: this.$t('overall.alert'), active: false }, { prop: 'alertMessageTab', name: this.$t('overall.alert'), active: false },
{ prop: 'endpointTab', name: 'Endpoint', active: false }, { prop: 'endpointTab', name: this.$t('asset.endpoint'), active: false },
{ prop: 'log', name: 'Log', active: false } { prop: 'log', name: this.$t('overall.logs'), active: false }
], ],
alertMessage: [ alertMessage: [
{ prop: 'panelTab', name: this.$t('overall.detail'), active: false }, { prop: 'panelTab', name: this.$t('overall.detail'), active: false },
{ prop: 'alertMessageTab', name: this.$t('overall.alert'), active: true }, { prop: 'alertMessageTab', name: this.$t('overall.alert'), active: true },
{ prop: 'endpointTab', name: 'Endpoint', active: false }, { prop: 'endpointTab', name: this.$t('asset.endpoint'), active: false },
{ prop: 'log', name: 'Log', active: false } { prop: 'log', name: this.$t('overall.logs'), active: false }
], ],
endpoint: [ endpoint: [
{ prop: 'panelTab', name: this.$t('overall.detail'), active: false }, { prop: 'panelTab', name: this.$t('overall.detail'), active: false },
{ prop: 'alertMessageTab', name: this.$t('overall.alert'), active: false }, { prop: 'alertMessageTab', name: this.$t('overall.alert'), active: false },
{ prop: 'endpointTab', name: 'Endpoint', active: true }, { prop: 'endpointTab', name: this.$t('asset.endpoint'), active: true },
{ prop: 'log', name: 'Log', active: false } { prop: 'log', name: this.$t('overall.logs'), active: false }
], ],
log: [ log: [
{ prop: 'panelTab', name: this.$t('overall.detail'), active: false }, { prop: 'panelTab', name: this.$t('overall.detail'), active: false },
{ prop: 'alertMessageTab', name: this.$t('overall.alert'), active: false }, { prop: 'alertMessageTab', name: this.$t('overall.alert'), active: false },
{ prop: 'endpointTab', name: 'Endpoint', active: false }, { prop: 'endpointTab', name: this.$t('asset.endpoint'), active: false },
{ prop: 'log', name: 'Log', active: true } { prop: 'log', name: this.$t('overall.logs'), active: true }
], ],
alertMessageSub: [ alertMessageSub: [
{ prop: 'panelTab', name: this.$t('overall.detail'), active: false }, { prop: 'panelTab', name: this.$t('overall.detail'), active: false },
{ prop: 'alertMessageTab', name: this.$t('overall.alert'), active: false }, { prop: 'alertMessageTab', name: this.$t('overall.alert'), active: false },
{ prop: 'endpointTab', name: 'Endpoint', active: false }, { prop: 'endpointTab', name: this.$t('asset.endpoint'), active: false },
{ prop: 'log', name: 'Log', active: false }, { prop: 'log', name: this.$t('overall.logs'), active: false },
{ prop: 'assetSubTab', name: this.$t('overall.assetSubTab'), active: true } { prop: 'assetSubTab', name: this.$t('overall.assetSubTab'), active: true }
] ]
}, },
@@ -209,8 +209,8 @@ export default {
endpointTabTitle: [ endpointTabTitle: [
{ prop: 'panelTab', name: this.$t('overall.detail') }, { prop: 'panelTab', name: this.$t('overall.detail') },
{ prop: 'endpointAlertMessage', name: this.$t('overall.alert') }, { prop: 'endpointAlertMessage', name: this.$t('overall.alert') },
{ prop: 'Metrics', name: 'Metrics' }, { prop: 'Metrics', name: this.$t('project.metrics.metrics') },
{ prop: 'log', name: 'Log' } { prop: 'log', name: this.$t('overall.logs') }
] ]
}, },
chartTemp: { chartTemp: {
@@ -261,10 +261,10 @@ export default {
const tabs = [ const tabs = [
{ prop: 'panelTab', name: this.$t('overall.detail') }, { prop: 'panelTab', name: this.$t('overall.detail') },
{ prop: 'endpointAlertMessage', name: this.$t('overall.alert') }, { prop: 'endpointAlertMessage', name: this.$t('overall.alert') },
{ prop: 'Metrics', name: 'Metrics' } { prop: 'Metrics', name: this.$t('project.metrics.metrics') }
] ]
if (hasLog) { if (hasLog) {
tabs.push({ prop: 'log', name: 'Log' }) tabs.push({ prop: 'log', name: this.$t('overall.logs') })
} }
return tabs return tabs
} }

View File

@@ -450,7 +450,7 @@
</span> </span>
</el-form-item> </el-form-item>
<div @click="addThresholds" class="thresholds-add"> <div @click="addThresholds" class="thresholds-add">
Add thresholds {{$t('overall.addThresholds')}}
</div> </div>
</el-row> </el-row>
</transition> </transition>
@@ -486,13 +486,13 @@
<transition-group appear tag="div" name="el-zoom-in-top"> <transition-group appear tag="div" name="el-zoom-in-top">
<el-row class="thresholds-item" v-show="item.show" :key="1"> <el-row class="thresholds-item" v-show="item.show" :key="1">
<div> <div>
<div class='mapping-display'>Title</div> <div class='mapping-display'>{{$t('project.topology.title')}}</div>
</div> </div>
<el-form-item :prop="'param.columns.' + index + '.title'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item" style="flex: 1"> <el-form-item :prop="'param.columns.' + index + '.title'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item" style="flex: 1">
<el-input size="small" v-model="item.title" @change="change('columns',index)"></el-input> <el-input size="small" v-model="item.title" @change="change('columns',index)"></el-input>
</el-form-item> </el-form-item>
<div> <div>
<div class='mapping-display'>Unit</div> <div class='mapping-display'>{{$t('dashboard.panel.chartForm.unit')}}</div>
</div> </div>
<el-cascader :id="'columns-unit' + index" v-model="item.unit" :options="unitOptions" :props="{ expandTrigger: 'hover',emitPath:false }" :show-all-levels="false" filterable <el-cascader :id="'columns-unit' + index" v-model="item.unit" :options="unitOptions" :props="{ expandTrigger: 'hover',emitPath:false }" :show-all-levels="false" filterable
placeholder="" placeholder=""
@@ -505,7 +505,7 @@
</el-row> </el-row>
<el-row class="thresholds-item" v-show="item.show" :key="2"> <el-row class="thresholds-item" v-show="item.show" :key="2">
<div> <div>
<div class='mapping-display'>Display</div> <div class='mapping-display'>{{$t('dashboard.panel.chartForm.display')}}</div>
</div> </div>
<el-form-item :prop="'param.columns.' + index + '.display'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item"> <el-form-item :prop="'param.columns.' + index + '.display'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item">
<el-input v-model="item.display" style="margin-right: 10px" size="small" @change="change('columns',index)"/> <el-input v-model="item.display" style="margin-right: 10px" size="small" @change="change('columns',index)"/>
@@ -514,7 +514,7 @@
</transition-group> </transition-group>
</div> </div>
<div @click="addColumns" class="thresholds-add"> <div @click="addColumns" class="thresholds-add">
Add Colums {{$t('overall.addColumns')}}
</div> </div>
</div> </div>
@@ -583,7 +583,7 @@
<el-option <el-option
v-for="item in mappingTypeList" v-for="item in mappingTypeList"
:value="item.value" :value="item.value"
:label="item.label" :label="$t(item.label)"
:key="item.value"/> :key="item.value"/>
</el-select> </el-select>
</div> </div>
@@ -645,13 +645,13 @@
</el-row> </el-row>
<el-row v-show="item.show" :key="2" class="thresholds-item"> <el-row v-show="item.show" :key="2" class="thresholds-item">
<div v-if="isTable(chartConfig.type)"> <div v-if="isTable(chartConfig.type)">
<div class='mapping-display'>Columns</div> <div class='mapping-display'>{{$t('dashboard.panel.chartForm.columns')}}</div>
</div> </div>
<el-form-item v-if="isTable(chartConfig.type)" :prop="'param.valueMapping.' + index + '.column'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item"> <el-form-item v-if="isTable(chartConfig.type)" :prop="'param.valueMapping.' + index + '.column'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item">
<el-input v-model="item.column" style="margin-right: 10px" :placeholder="$t('placeholder.chart.column')" size="small" @change="change('valueMapping', index)"/> <el-input v-model="item.column" style="margin-right: 10px" :placeholder="$t('placeholder.chart.column')" size="small" @change="change('valueMapping', index)"/>
</el-form-item> </el-form-item>
<div> <div>
<div class='mapping-display'>Display</div> <div class='mapping-display'>{{$t('dashboard.panel.chartForm.display')}}</div>
</div> </div>
<el-form-item :prop="'param.valueMapping.' + index + '.display'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item"> <el-form-item :prop="'param.valueMapping.' + index + '.display'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item">
<el-input v-model="item.display" style="margin-right: 10px" :placeholder="$t('placeholder.chart.display')" size="small" @change="change('valueMapping', index)"/> <el-input v-model="item.display" style="margin-right: 10px" :placeholder="$t('placeholder.chart.display')" size="small" @change="change('valueMapping', index)"/>
@@ -661,7 +661,7 @@
</transition-group> </transition-group>
</div> </div>
<div @click="addMapping" class="thresholds-add"> <div @click="addMapping" class="thresholds-add">
Add valueMapping {{$t('overall.addMapping')}}
</div> </div>
</el-row> </el-row>
</transition> </transition>

View File

@@ -69,16 +69,16 @@
<span>{{$t('dashboard.panel.chartForm.dataConfig')}}</span> <span>{{$t('dashboard.panel.chartForm.dataConfig')}}</span>
</div> </div>
<el-tabs v-model="editChart.datasource" @tab-click="datasourceChange" type="card"> <el-tabs v-model="editChart.datasource" @tab-click="datasourceChange" type="card">
<el-tab-pane label="Metrics" name="metrics"> <el-tab-pane :label="$t('project.metrics.metrics')" name="metrics">
<chart-config ref="childrenFrommetrics" :type="'metrics'" v-if="editChart.datasource == 'metrics'" :params.sync="editChart" @change="editChartChange"/> <chart-config ref="childrenFrommetrics" :type="'metrics'" v-if="editChart.datasource == 'metrics'" :params.sync="editChart" @change="editChartChange"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="Logs" name="logs"> <el-tab-pane :label="$t('overall.logs')" name="logs">
<chart-config ref="childrenFromlogs" :type="'log'" v-if="editChart.datasource == 'logs'" :params.sync="editChart" @change="editChartChange"/> <chart-config ref="childrenFromlogs" :type="'log'" v-if="editChart.datasource == 'logs'" :params.sync="editChart" @change="editChartChange"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="System" name="system"> <el-tab-pane :label="$t('overall.system')" name="system">
<system-chart-config ref="childrenFromsystem" v-if="editChart.datasource == 'system'" :params.sync="editChart" @change="editChartChange"/> <system-chart-config ref="childrenFromsystem" v-if="editChart.datasource == 'system'" :params.sync="editChart" @change="editChartChange"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="Misc" name="misc"> <el-tab-pane :label="$t('overall.misc')" name="misc">
<other-chart-config ref="childrenFrommisc" v-if="editChart.datasource == 'misc'" :params.sync="editChart" @change="editChartChange"/> <other-chart-config ref="childrenFrommisc" v-if="editChart.datasource == 'misc'" :params.sync="editChart" @change="editChartChange"/>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>

View File

@@ -48,13 +48,13 @@ export default {
], ],
mappingTypeList: [ mappingTypeList: [
{ {
label: 'Value', label: this.$t('overall.value'),
value: 'value' value: 'value'
}, { }, {
label: 'Range', label: this.$t('dashboard.panel.chartForm.valMapping.range'),
value: 'range' value: 'range'
}, { }, {
label: 'Regx', label: this.$t('dashboard.panel.chartForm.valMapping.regx'),
value: 'regx' value: 'regx'
} }
], ],

View File

@@ -372,7 +372,54 @@
</el-form-item> </el-form-item>
</div> </div>
</transition> </transition>
<!--thresholdConfig-->
<div class="form__sub-title">
<span>{{$t('dashboard.panel.chartForm.threshold')}}</span>
<el-switch
v-model="chartConfig.param.enable.thresholds"
size="small"
@change="thresholdShowChange"
></el-switch>
</div> </div>
<transition name="el-zoom-in-top">
<el-row v-if="chartConfig.param.enable.thresholds">
<el-form-item
v-for="(item,index) in chartConfig.param.thresholds"
:key="index"
class="thresholds-item"
:prop="'param.thresholds.' + index + '.value'"
:rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}"
>
<nezhaColor
:value-arr="[{name:'thresholds',value:item.color}]"
:show-text="false"
:color-val="item.color"
@colorChange="(color,key)=>{colorChange(color,key,index)}"
/>
<el-input-number
size="small"
style="margin-top: 2px"
:placeholder="$t('placeholder.chart.threshold')"
v-model.number="item.value"
:controls="false"
@blur="sortThresholds"
@change="change"
/>
<span
@click="delThresholds(index)"
class="del-thresholds-icon"
>
<i class="nz-icon nz-icon-delete" />
</span>
</el-form-item>
<div @click="addThresholds" class="thresholds-add">
{{$t('overall.addThresholds')}}
</div>
</el-row>
</transition>
</div>
<!-- table column--> <!-- table column-->
<div v-if="isTable(chartConfig.type)"> <div v-if="isTable(chartConfig.type)">
<div class="form__sub-title"> <div class="form__sub-title">
@@ -403,13 +450,13 @@
<transition-group appear tag="div" name="el-zoom-in-top"> <transition-group appear tag="div" name="el-zoom-in-top">
<el-row class="thresholds-item" v-show="item.show" :key="1"> <el-row class="thresholds-item" v-show="item.show" :key="1">
<div> <div>
<div class='mapping-display'>Title</div> <div class='mapping-display'>{{$t('project.topology.title')}}</div>
</div> </div>
<el-form-item :prop="'param.columns.' + index + '.title'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item" style="flex: 1"> <el-form-item :prop="'param.columns.' + index + '.title'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item" style="flex: 1">
<el-input size="small" v-model="item.title" @change="change('columns',index)"></el-input> <el-input size="small" v-model="item.title" @change="change('columns',index)"></el-input>
</el-form-item> </el-form-item>
<div> <div>
<div class='mapping-display'>Unit</div> <div class='mapping-display'>{{$t('dashboard.panel.chartForm.unit')}}</div>
</div> </div>
<el-cascader :id="'columns-unit' + index" v-model="item.unit" :options="unitOptions" :props="{ expandTrigger: 'hover',emitPath:false }" :show-all-levels="false" filterable <el-cascader :id="'columns-unit' + index" v-model="item.unit" :options="unitOptions" :props="{ expandTrigger: 'hover',emitPath:false }" :show-all-levels="false" filterable
placeholder="" placeholder=""
@@ -422,7 +469,7 @@
</el-row> </el-row>
<el-row class="thresholds-item" v-show="item.show" :key="2"> <el-row class="thresholds-item" v-show="item.show" :key="2">
<div> <div>
<div class='mapping-display'>Display</div> <div class='mapping-display'>{{$t('dashboard.panel.chartForm.display')}}</div>
</div> </div>
<el-form-item :prop="'param.columns.' + index + '.display'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item"> <el-form-item :prop="'param.columns.' + index + '.display'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item">
<el-input v-model="item.display" style="margin-right: 10px" size="small" @change="change('columns',index)"/> <el-input v-model="item.display" style="margin-right: 10px" size="small" @change="change('columns',index)"/>
@@ -431,7 +478,7 @@
</transition-group> </transition-group>
</div> </div>
<div @click="addColumns" class="thresholds-add"> <div @click="addColumns" class="thresholds-add">
Add Colums {{$t('overall.addColumns')}}
</div> </div>
</div> </div>
@@ -500,7 +547,7 @@
<el-option <el-option
v-for="item in mappingTypeList" v-for="item in mappingTypeList"
:value="item.value" :value="item.value"
:label="item.label" :label="$t(item.label)"
:key="item.value"/> :key="item.value"/>
</el-select> </el-select>
</div> </div>
@@ -562,13 +609,13 @@
</el-row> </el-row>
<el-row v-show="item.show" :key="2" class="thresholds-item"> <el-row v-show="item.show" :key="2" class="thresholds-item">
<div v-if="isTable(chartConfig.type)"> <div v-if="isTable(chartConfig.type)">
<div class='mapping-display'>Columns</div> <div class='mapping-display'>{{$t('dashboard.panel.chartForm.columns')}}</div>
</div> </div>
<el-form-item v-if="isTable(chartConfig.type)" :prop="'param.valueMapping.' + index + '.column'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item"> <el-form-item v-if="isTable(chartConfig.type)" :prop="'param.valueMapping.' + index + '.column'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item">
<el-input v-model="item.column" style="margin-right: 10px" :placeholder="$t('placeholder.chart.column')" size="small" @change="change('valueMapping', index)"/> <el-input v-model="item.column" style="margin-right: 10px" :placeholder="$t('placeholder.chart.column')" size="small" @change="change('valueMapping', index)"/>
</el-form-item> </el-form-item>
<div> <div>
<div class='mapping-display'>Display</div> <div class='mapping-display'>{{$t('dashboard.panel.chartForm.display')}}</div>
</div> </div>
<el-form-item :prop="'param.valueMapping.' + index + '.display'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item"> <el-form-item :prop="'param.valueMapping.' + index + '.display'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item">
<el-input v-model="item.display" style="margin-right: 10px" :placeholder="$t('placeholder.chart.display')" size="small" @change="change('valueMapping', index)"/> <el-input v-model="item.display" style="margin-right: 10px" :placeholder="$t('placeholder.chart.display')" size="small" @change="change('valueMapping', index)"/>
@@ -578,7 +625,7 @@
</transition-group> </transition-group>
</div> </div>
<div @click="addMapping" class="thresholds-add"> <div @click="addMapping" class="thresholds-add">
Add valueMapping {{$t('overall.addMapping')}}
</div> </div>
</el-row> </el-row>
</transition> </transition>

View File

@@ -18,7 +18,7 @@ const searchSelectInfo = { // value: 传给后台的值label显示给用
promType: [ // promServer类型 promType: [ // promServer类型
{ {
value: 1, value: 1,
label: 'Global' label: i18n.t('overall.global')
}, },
{ {
value: 2, value: 2,
@@ -54,22 +54,22 @@ const searchSelectInfo = { // value: 传给后台的值label显示给用
endpointState: [ endpointState: [
{ {
value: 1, value: 1,
label: 'UP' label: i18n.t('config.agent.up')
}, { }, {
value: 0, value: 0,
label: 'DOWN' label: i18n.t('config.agent.down')
}, { }, {
value: 2, value: 2,
label: 'SUSPENDED' label: i18n.t('cconfig.dc.suspended')
} }
], ],
promState: [ promState: [
{ {
value: 1, value: 1,
label: 'UP' label: i18n.t('config.agent.up')
}, { }, {
value: '0,-1', value: '0,-1',
label: 'DOWN' label: i18n.t('config.agent.down')
} }
], ],
pingStatus: [ pingStatus: [
@@ -240,17 +240,17 @@ const searchSelectInfo = { // value: 传给后台的值label显示给用
searchMetrics: [ searchMetrics: [
{ {
id: 1, id: 1,
name: 'Metrics', name: i18n.t('project.metrics.metrics'),
searchType: 'alertTypes' searchType: 'alertTypes'
}, },
{ {
id: 2, id: 2,
name: 'Logs', name: i18n.t('overall.logs'),
searchType: 'alertTypes' searchType: 'alertTypes'
}, },
{ {
id: 3, id: 3,
name: 'SNMP trap', name: i18n.t('overall.SNMPTrap'),
searchType: 'alertTypes' searchType: 'alertTypes'
} }
] ]

View File

@@ -274,12 +274,12 @@ export default {
minWidth: 110, minWidth: 110,
sortable: 'custom' sortable: 'custom'
}, { }, {
label: 'SN', label: this.$t('asset.sn'),
prop: 'sn', prop: 'sn',
show: true, show: true,
minWidth: 110 minWidth: 110
}, { }, {
label: 'Talon', label: this.$t('asset.talon'),
// prop: 'clientState', // prop: 'clientState',
prop: 'talon', prop: 'talon',
show: true, show: true,