mirror of https://github.com/veops/cmdb.git
feat: update auto discovery
This commit is contained in:
parent
341fb410f2
commit
4e441ee7a9
|
@ -9,7 +9,7 @@
|
|||
@clickCategory="setCurrentCate"
|
||||
/>
|
||||
<template v-else>
|
||||
<a-select v-if="isCloud" :style="{ marginBottom: '10px', minWidth: '120px' }" v-model="currentCate">
|
||||
<a-select v-if="isCloud" :style="{ marginBottom: '10px', minWidth: '200px' }" v-model="currentCate">
|
||||
<a-select-option v-for="cate in categoriesSelect" :key="cate" :value="cate">{{ cate }}</a-select-option>
|
||||
</a-select>
|
||||
<AttrMapTable
|
||||
|
@ -70,6 +70,10 @@ export default {
|
|||
uniqueKey: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
currentAdt: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -136,7 +140,7 @@ export default {
|
|||
})
|
||||
this.categoriesSelect = categoriesSelect
|
||||
if (this.isEdit && categoriesSelect?.length) {
|
||||
this.currentCate = categoriesSelect[0]
|
||||
this.currentCate = this?.currentAdt?.extra_option?.category || categoriesSelect[0]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -159,19 +163,24 @@ export default {
|
|||
|
||||
if (_findADT?.attributes?.[item.name]) {
|
||||
item.attr = _findADT.attributes[item.name]
|
||||
} else {
|
||||
const _find = this.ciTypeAttributes.find((ele) => ele.name === item.name)
|
||||
if (_find) {
|
||||
item.attr = _find.name
|
||||
}
|
||||
}
|
||||
|
||||
const attrMapName = this.httpAttrMap?.[item?.name]
|
||||
|
||||
if (
|
||||
this.isEdit &&
|
||||
!item.attr &&
|
||||
this.httpAttrMap?.[item.name]
|
||||
attrMapName &&
|
||||
this.ciTypeAttributes.some((ele) => ele.name === attrMapName)
|
||||
) {
|
||||
item.attr = this.httpAttrMap[item.name]
|
||||
item.attr = attrMapName
|
||||
}
|
||||
|
||||
if (!item.attr) {
|
||||
const _find = this.ciTypeAttributes.find((ele) => ele.name === item.name)
|
||||
if (_find) {
|
||||
item.attr = _find.name
|
||||
}
|
||||
}
|
||||
|
||||
return item
|
||||
|
|
|
@ -259,6 +259,11 @@ const cmdb_en = {
|
|||
account: 'Account',
|
||||
insecure: 'Certificate Validation',
|
||||
vcenterName: 'Platform Name',
|
||||
resourceSearchTip1: 'Please use conditional filtering for CI filtering and copy and paste the filter expression into the fill-in box in the previous step.',
|
||||
resourceSearchTip2: 'Note 1: Please use the green button to the right of the expression to copy it',
|
||||
resourceSearchTip3: 'Note 2: If you do not need to filter, please click the grey button to copy and paste directly to configure for all nodes',
|
||||
enable: 'Enable',
|
||||
enableTip: 'Confirm switching on?',
|
||||
},
|
||||
components: {
|
||||
unselectAttributes: 'Unselected',
|
||||
|
|
|
@ -259,6 +259,11 @@ const cmdb_zh = {
|
|||
account: '账号',
|
||||
insecure: '是否证书验证',
|
||||
vcenterName: '虚拟平台名',
|
||||
resourceSearchTip1: '请使用条件过滤进行CI筛选,并将过滤表达式复制粘贴到上一步填写框中。',
|
||||
resourceSearchTip2: '注1:请使用表达式右侧的绿色按钮进行复制',
|
||||
resourceSearchTip3: '注2:如不需要筛选,请直接点击灰色按钮进行复制粘贴,即可配置为所有节点',
|
||||
enable: '开启',
|
||||
enableTip: '确定切换开启状态吗',
|
||||
},
|
||||
components: {
|
||||
unselectAttributes: '未选属性',
|
||||
|
|
|
@ -14,7 +14,22 @@
|
|||
<span>{{ $t('edit') }}</span>
|
||||
</a-space>
|
||||
</a>
|
||||
<div class="attr-ad-header">{{ $t('cmdb.ciType.attributeMap') }}</div>
|
||||
<div class="attr-ad-header attr-ad-header_between">
|
||||
{{ $t('cmdb.ciType.attributeMap') }}
|
||||
<div class="attr-ad-open">
|
||||
<span class="attr-ad-open-label">{{ $t('cmdb.ciType.enable') }}</span>
|
||||
<a-switch v-model="form.enabled" v-if="isClient" />
|
||||
<a-popconfirm
|
||||
v-else
|
||||
:title="$t('cmdb.ciType.enableTip')"
|
||||
:ok-text="$t('confirm')"
|
||||
:cancel-text="$t('cancel')"
|
||||
@confirm="changeEnabled"
|
||||
>
|
||||
<a-switch :checked="form.enabled" />
|
||||
</a-popconfirm>
|
||||
</div>
|
||||
</div>
|
||||
<div class="attr-ad-attributemap-main">
|
||||
<AttrMapTable
|
||||
v-if="adrType === 'agent'"
|
||||
|
@ -34,6 +49,7 @@
|
|||
:adCITypeList="adCITypeList"
|
||||
:currentTab="adr_id"
|
||||
:uniqueKey="uniqueKey"
|
||||
:currentAdt="currentAdt"
|
||||
:style="{ marginBottom: '20px' }"
|
||||
/>
|
||||
</div>
|
||||
|
@ -234,6 +250,7 @@ export default {
|
|||
agent_id: '',
|
||||
auto_accept: false,
|
||||
query_expr: '',
|
||||
enabled: true,
|
||||
},
|
||||
form2: {
|
||||
key: '',
|
||||
|
@ -263,7 +280,8 @@ export default {
|
|||
uniqueKey: '',
|
||||
isPrivateCloud: false,
|
||||
privateCloudName: '',
|
||||
PRIVATE_CLOUD_NAME
|
||||
PRIVATE_CLOUD_NAME,
|
||||
isClient: false, // 是否前端新增临时数据
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -316,6 +334,7 @@ export default {
|
|||
const _find = this.adrList.find((item) => Number(item.id) === Number(this.adr_id))
|
||||
const _findADT = this.adCITypeList.find((item) => Number(item.id) === Number(this.currentAdt.id))
|
||||
this.uniqueKey = _find?.unique_key ?? ''
|
||||
this.isClient = _findADT?.isClient ?? false
|
||||
|
||||
if (this.adrType === 'http') {
|
||||
const {
|
||||
|
@ -391,6 +410,7 @@ export default {
|
|||
auto_accept: _findADT?.auto_accept || false,
|
||||
agent_id: _findADT?.agent_id && _findADT?.agent_id !== '0x0000' ? _findADT.agent_id : '',
|
||||
query_expr: _findADT.query_expr || '',
|
||||
enabled: _findADT?.enabled ?? true,
|
||||
}
|
||||
if (_findADT.query_expr) {
|
||||
this.agent_type = 'query_expr'
|
||||
|
@ -562,6 +582,17 @@ export default {
|
|||
hideCron() {
|
||||
this.cronVisible = false
|
||||
},
|
||||
changeEnabled() {
|
||||
if (!this.isClient) {
|
||||
putCITypeDiscovery(this.currentAdt.id, {
|
||||
enabled: !this.form.enabled
|
||||
}).then((res) => {
|
||||
this.form.enabled = !this.form.enabled
|
||||
this.$message.success(this.$t('saveSuccess'))
|
||||
this.$emit('handleSave', res.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -572,6 +603,26 @@ export default {
|
|||
overflow-x: hidden;
|
||||
position: relative;
|
||||
|
||||
.attr-ad-header_between {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.attr-ad-open {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
padding: 0px 20px;
|
||||
|
||||
&-label {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
margin-right: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
.attr-ad-attributemap-main {
|
||||
margin-left: 17px;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,11 @@
|
|||
>{{ $t('download') }}</a-button
|
||||
>
|
||||
</div>
|
||||
<div v-if="fromCronJob" class="resource-search-tip">
|
||||
<div class="resource-search-tip-item">{{ $t('cmdb.ciType.resourceSearchTip1') }}</div>
|
||||
<div class="resource-search-tip-item">{{ $t('cmdb.ciType.resourceSearchTip2') }}</div>
|
||||
<div class="resource-search-tip-item">{{ $t('cmdb.ciType.resourceSearchTip3') }}</div>
|
||||
</div>
|
||||
<SearchForm
|
||||
ref="search"
|
||||
:type="type"
|
||||
|
@ -44,7 +49,7 @@
|
|||
size="small"
|
||||
row-id="_id"
|
||||
:loading="loading"
|
||||
:height="fromCronJob ? windowHeight - 180 : windowHeight - 240"
|
||||
:height="fromCronJob ? windowHeight - 280 : windowHeight - 240"
|
||||
show-header-overflow
|
||||
highlight-hover-row
|
||||
:data="instanceList"
|
||||
|
@ -568,5 +573,14 @@ export default {
|
|||
background-color: #fff;
|
||||
padding: 20px;
|
||||
border-radius: @border-radius-box;
|
||||
|
||||
&-tip {
|
||||
margin-bottom: 16px;
|
||||
|
||||
&-item {
|
||||
font-size: 12px;
|
||||
color: @text-color_4
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue