NEZ-1572 feat: agent 页面增加 name

This commit is contained in:
zhangyu
2022-02-17 15:07:24 +08:00
parent 7b06f5b4eb
commit c0919ffdf1
4 changed files with 31 additions and 6 deletions

View File

@@ -11,7 +11,7 @@
:tabs="tabs" :tabs="tabs"
@changeTab="changeTab" @changeTab="changeTab"
> >
<template v-slot:title><span :title="obj.name">{{obj.dc.name}}</span></template> <template v-slot:title><span :title="obj.name || obj.dc.name">{{obj.name || obj.dc.name}}</span></template>
<template v-slot:top-tool-right> <template v-slot:top-tool-right>
<div class="top-tool-right"> <div class="top-tool-right">
<div style="margin-right: 15px;"> <div style="margin-right: 15px;">

View File

@@ -22,7 +22,10 @@
</el-select> </el-select>
</div> </div>
</el-form-item> </el-form-item>
<!-- name-->
<el-form-item :label='$t("overall.name")' prop="name">
<el-input placeholder="" maxlength="64" show-word-limit v-model="editPromServer.name" size="small" id="agent-box-input-name"></el-input>
</el-form-item>
<!--host--> <!--host-->
<el-form-item :label="$t('config.agent.host')" prop="host"> <el-form-item :label="$t('config.agent.host')" prop="host">
<el-input id="prom-box-input-host" maxlength="64" show-word-limit v-model="editPromServer.host" placeholder="" size="small" type="text"></el-input> <el-input id="prom-box-input-host" maxlength="64" show-word-limit v-model="editPromServer.host" placeholder="" size="small" type="text"></el-input>
@@ -85,7 +88,7 @@
</div> </div>
</template> </template>
<script> <script>
import { host, port } from '../../common/js/validate' import { host, noSpecialChar, port } from '../../common/js/validate'
import { agent2 } from '@/components/common/js/constants' import { agent2 } from '@/components/common/js/constants'
import editRigthBox from '../mixin/editRigthBox' import editRigthBox from '../mixin/editRigthBox'
export default { export default {
@@ -102,6 +105,10 @@ export default {
'dc.name': [ 'dc.name': [
{ required: true, message: this.$t('validate.required'), trigger: 'change' } { required: true, message: this.$t('validate.required'), trigger: 'change' }
], ],
name: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' },
{ validator: noSpecialChar, trigger: 'blur' }
],
host: [ host: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }, { required: true, message: this.$t('validate.required'), trigger: 'blur' },
{ validator: host, trigger: 'blur' } { validator: host, trigger: 'blur' }
@@ -204,7 +211,11 @@ export default {
deep: true, deep: true,
handler (n) { handler (n) {
this.isEdit = true this.isEdit = true
this.editPromServer = JSON.parse(JSON.stringify(n)) const editPromServer = JSON.parse(JSON.stringify(n))
if (!editPromServer.name) {
editPromServer.name = ''
}
this.editPromServer = editPromServer
} }
}, },
'editPromServer.dc': function (n, o) { 'editPromServer.dc': function (n, o) {

View File

@@ -42,8 +42,9 @@
<span v-else-if="item.prop === 'checkTime'">{{utcTimeToTimezoneStr(scope.row[item.prop])}}</span> <span v-else-if="item.prop === 'checkTime'">{{utcTimeToTimezoneStr(scope.row[item.prop])}}</span>
<span v-else-if="item.prop === 'status'"> <span v-else-if="item.prop === 'status'">
<el-popover :content="$t('asset.assetStatPre')+(scope.row.checkTime?utcTimeToTimezoneStr(scope.row.checkTime):$t('asset.assetStatDown'))" placement="right" trigger="hover" width="200"> <el-popover :content="$t('asset.assetStatPre')+(scope.row.checkTime?utcTimeToTimezoneStr(scope.row.checkTime):$t('asset.assetStatDown'))" placement="right" trigger="hover" width="200">
<div slot="reference" style="width: 20px"> <div slot="reference" style="width: 60px">
<div :class="{'active-icon green-bg':scope.row[item.prop] == '1','active-icon red-bg':scope.row[item.prop] == '0' || scope.row[item.prop] == '-1' || scope.row[item.prop] == '-2'}"></div> <span :class="{'active-icon green-bg':scope.row[item.prop] == '1','active-icon red-bg':scope.row[item.prop] == '0' || scope.row[item.prop] == '-1' || scope.row[item.prop] == '-2'}"></span>
<span>{{scope.row[item.prop] == '1' ? 'UP' : 'Down'}}</span>
</div> </div>
</el-popover> </el-popover>
</span> </span>
@@ -102,6 +103,12 @@ export default {
show: true, show: true,
width: 80, width: 80,
sortable: 'custom' sortable: 'custom'
}, {
label: this.$t('overall.name'),
prop: 'name',
show: true,
minWidth: 200,
sortable: 'custom'
}, { }, {
label: this.$t('config.agent.dataCenter'), label: this.$t('config.agent.dataCenter'),
prop: 'dc', prop: 'dc',

View File

@@ -126,6 +126,7 @@ export default {
tableId: 'promTable', // 需要分页的table的id用于记录每页数量 tableId: 'promTable', // 需要分页的table的id用于记录每页数量
blankObject: { blankObject: {
id: '', id: '',
name: '',
host: '', host: '',
port: 10090, port: 10090,
dc: { id: '', name: '', location: '' }, dc: { id: '', name: '', location: '' },
@@ -141,6 +142,12 @@ export default {
type: 'input', type: 'input',
label: 'ids', label: 'ids',
disabled: false disabled: false
},
{
name: this.$t('overall.name'),
type: 'input',
label: 'name',
disabled: false
}, { }, {
name: this.$t('dashboard.overview.dataCenter.dataCenter'), name: this.$t('dashboard.overview.dataCenter.dataCenter'),
type: 'dc', type: 'dc',