NEZ-704: 创建 endponit 添加 state参数

This commit is contained in:
zhangyu
2021-06-01 17:24:57 +08:00
parent 3a36dccf18
commit a6dfb7e510
6 changed files with 56 additions and 23 deletions

View File

@@ -133,7 +133,8 @@ const cn = {
batchDel: '批量删除',
tempPrev: '模板预览',
silenceAlert: '告警静默',
quickSilent: '快速静默'
quickSilent: '快速静默',
configEndpoint: '配置'
},
setup: {
step0: '欢迎',
@@ -1298,7 +1299,10 @@ const cn = {
name: '名称',
configs: '配置',
state: '状态',
allselect: '当前页已全部选择'
allselect: '当前页已全部选择',
enable: '开启',
disable: '关闭',
status: 'Endpoint 状态'
},
metrics: {
metrics: '指标',

View File

@@ -138,7 +138,8 @@ const en = {
batchDel: 'Batches delete',
tempPrev: 'Template preview',
silenceAlert: 'silence alert',
quickSilent: 'Quick silent'
quickSilent: 'Quick silent',
configEndpoint: 'Config'
},
pageSize: '/page',
setup: {
@@ -1308,7 +1309,10 @@ const en = {
name: 'Name',
configs: 'Config',
state: 'State',
allselect: 'The current page has all been selected'
allselect: 'The current page has all been selected',
enable: 'Enable',
disable: 'Disable',
status: 'Endpoint status'
},
metrics: {
metrics: 'Metrics', // "指标"

View File

@@ -249,6 +249,7 @@ export default {
endpointNameTmpl: '{{module.name}}-{{asset.name}}',
type: 'http',
port: '',
enabled: 1,
configs: {
walk: [],
snmpCredentialsId: '',
@@ -672,6 +673,9 @@ export default {
this.object = JSON.parse(JSON.stringify(u))
this.object.walk = this.object.configs.walk ? JSON.parse(JSON.stringify(this.object.configs.walk)) : []
this.object.configs.port && (this.object.port = this.object.configs.port)
// if (!this.object.enabled && !isNaN(this.object.enabled)) {
// this.object.enabled = 1
// }
this.rightBox.show = true
},
showRightBox () {
@@ -679,6 +683,9 @@ export default {
this.object = { ...JSON.parse(JSON.stringify(this.blankEndpoint)), projectId: this.currentModule.projectId, moduleId: this.currentModule.id, assetName: '', type: this.currentModule.type }
this.object.walk = this.object.configs.walk ? JSON.parse(JSON.stringify(this.object.configs.walk)) : []
this.object.configs.port && (this.object.port = this.object.configs.port)
// if (!this.object.enabled && !isNaN(this.object.enabled)) {
// this.object.enabled = 1
// }
this.rightBox.show = true
},
editAllEndpoint () {

View File

@@ -91,17 +91,22 @@
</el-select>
</el-form-item>
</span>
<!--module-->
<el-form-item :label='$t("project.endpoint.state")' prop="remark">
<el-select id="module-box-input-state" v-model="editEndpoint.enabled" class="right-box__select" placeholder="" popper-class="right-box-select-dropdown prevent-clickoutside" size="small">
<el-option v-for="item in endpointStateList" :id="'module-'+item.value" :key="item.value" :label="item.name" :value="item.value"></el-option>
</el-select>
</el-form-item>
<!--Enpoint template-->
<div class="right-box-sub-title">{{ $t("overall.endpointTemplate") }}
<el-tooltip effect="light" placement="top">
<div slot="content">
{{$t('project.module.tip.defaultEndpointSet')}}
<div></div>
{{$t('project.module.tip.relation')}}
</div>
<i class="nz-icon nz-icon-info-normal"></i>
</el-tooltip>
<div class="right-box-sub-title">{{ $t("overall.configEndpoint") }}
<!-- <el-tooltip effect="light" placement="top">-->
<!-- <div slot="content">-->
<!-- {{$t('project.module.tip.defaultEndpointSet')}}-->
<!-- <div></div>-->
<!-- {{$t('project.module.tip.relation')}}-->
<!-- </div>-->
<!-- <i class="nz-icon nz-icon-info-normal"></i>-->
<!-- </el-tooltip>-->
</div>
<div class="right-box-line"></div>
@@ -331,6 +336,10 @@ export default {
{ name: this.$t('project.endpoint.authTypeWord'), value: 1 },
{ name: this.$t('project.endpoint.authTypeToken'), value: 2 }
],
endpointStateList: [
{ name: this.$t('project.endpoint.enable'), value: 1 },
{ name: this.$t('project.endpoint.disable'), value: 0 }
],
configsCopyValue: ''
}
},
@@ -782,7 +791,7 @@ export default {
.half-form-item {
width: calc(50% - 30px);
display: inline-block;
padding: 0 18px 0 8px;
padding: 0 0px 0 8px;
}
.half-form-item:nth-child(even){
padding-left: 0;

View File

@@ -787,7 +787,7 @@ export default {
.half-form-item {
width: calc(50% - 21px);
display: inline-block;
padding: 0 18px 0 0px;
padding: 0 0px 0 0px;
}
.half-form-item:nth-child(even){
padding-left: 0;

View File

@@ -86,6 +86,10 @@
</div>
</el-popover>
</template>
<template v-else-if="item.prop === 'enabled'">
<span v-if="scope.row[item.prop] === 1">{{$t('project.endpoint.enable')}}</span>
<span v-else>{{$t('project.endpoint.disable')}}</span>
</template>
<span v-else>{{scope.row[item.prop] ? scope.row[item.prop] : ''}}</span>
</template>
</el-table-column>
@@ -176,6 +180,11 @@ export default {
show: true,
sortable: 'custom'
}
// {
// label: this.$t('project.endpoint.status'),
// prop: 'enabled',
// show: false
// }
]
}
},
@@ -194,24 +203,24 @@ export default {
suspendedStr (status) { // 10进制转为2进制 分别给对应的状态
if (!status || status === 1 || status == 0) { return '' }
const arr = status.toString(2).split('')
while (arr.length < 5) {
while (arr.length < 4) {
arr.unshift('0')
}
arr.pop()
let str = ''
arr.forEach((item, index) => {
if (index === 0) {
str += `<div>DC <div class="active-icon inline-block ${item == '0' ? 'red-bg' : 'green-bg'}"></div></div>`
str += `<div>DC <div class="active-icon inline-block ${item == '0' ? 'red-bg' : 'gray-bg'}"></div></div>`
}
if (index === 1) {
str += `<div>ASSET <div class="active-icon inline-block ${item == '0' ? 'red-bg' : 'green-bg'}"></div></div>`
str += `<div>ASSET <div class="active-icon inline-block ${item == '0' ? 'red-bg' : 'gray-bg'}"></div></div>`
}
if (index === 2) {
str += `<div>ENDPOINT <div class="active-icon inline-block ${item == '0' ? 'red-bg' : 'green-bg'}"></div></div>`
}
if (index === 3) {
str += `<div>PROMETHEUS <div class="active-icon inline-block ${item == '0' ? 'red-bg' : 'green-bg'}"></div></div>`
str += `<div>ENDPOINT <div class="active-icon inline-block ${item == '0' ? 'red-bg' : 'gray-bg'}"></div></div>`
}
// if (index === 3) {
// str += `<div>PROMETHEUS <div class="active-icon inline-block ${item == '0' ? 'red-bg' : 'green-bg'}"></div></div>`
// }
})
return str
}