mirror of
https://github.com/veops/cmdb.git
synced 2025-08-07 12:50:50 +08:00
feat: dynamic attribute (#534)
This commit is contained in:
@@ -200,7 +200,9 @@ const cmdb_en = {
|
||||
show: 'show attribute',
|
||||
setAsShow: 'Set as show attribute',
|
||||
cancelSetAsShow: 'Cancel show attribute',
|
||||
showTips: 'The names of nodes in the service tree and topology view'
|
||||
showTips: 'The names of nodes in the service tree and topology view',
|
||||
isDynamic: 'Dynamic',
|
||||
dynamicTips: 'For example, for monitoring data and frequently updated data, it is recommended to set it as a dynamic attribute, so that the change history of the attribute will not be recorded.',
|
||||
},
|
||||
components: {
|
||||
unselectAttributes: 'Unselected',
|
||||
@@ -538,7 +540,7 @@ if __name__ == "__main__":
|
||||
rollbackSuccess: 'Rollback successfully',
|
||||
rollbackingTips: 'Rollbacking',
|
||||
batchRollbacking: 'Deleting {total} items in total, {successNum} items successful, {errorNum} items failed',
|
||||
baselineTips: 'Changes at this point in time will also be rollbacked, Unique ID and password attributes do not support',
|
||||
baselineTips: 'Changes at this point in time will also be rollbacked, Unique ID, password and dynamic attributes do not support',
|
||||
},
|
||||
serviceTree: {
|
||||
remove: 'Remove',
|
||||
|
@@ -78,7 +78,7 @@ const cmdb_zh = {
|
||||
password: '密码',
|
||||
link: '链接',
|
||||
list: '多值',
|
||||
listTips: '字段的值是1个或者多个,接口返回的值的类型是list',
|
||||
listTips: '属性的值是1个或者多个,接口返回的值的类型是list',
|
||||
computeForAllCITips: '所有CI触发计算',
|
||||
confirmcomputeForAllCITips: '确认触发所有CI的计算?',
|
||||
isUnique: '是否唯一',
|
||||
@@ -89,7 +89,7 @@ const cmdb_zh = {
|
||||
isSortable: '可排序',
|
||||
isIndex: '是否索引',
|
||||
index: '索引',
|
||||
indexTips: '字段可被用于检索,加速查询',
|
||||
indexTips: '属性可被用于全文检索,加速查询',
|
||||
confirmDelete: '确认删除【{name}】?',
|
||||
confirmDelete2: '确认删除?',
|
||||
computeSuccess: '触发成功!',
|
||||
@@ -200,7 +200,9 @@ const cmdb_zh = {
|
||||
show: '展示属性',
|
||||
setAsShow: '设置为展示属性',
|
||||
cancelSetAsShow: '取消设置为展示属性',
|
||||
showTips: '服务树和拓扑视图里节点的名称'
|
||||
showTips: '服务树和拓扑视图里节点的名称',
|
||||
isDynamic: '动态属性',
|
||||
dynamicTips: '譬如监控类的数据, 频繁更新的数据, 建议设置为动态属性, 则不会记录该属性的变更历史',
|
||||
},
|
||||
components: {
|
||||
unselectAttributes: '未选属性',
|
||||
@@ -538,7 +540,7 @@ if __name__ == "__main__":
|
||||
rollbackSuccess: '回滚成功',
|
||||
rollbackingTips: '正在批量回滚中',
|
||||
batchRollbacking: '正在回滚,共{total}个,成功{successNum}个,失败{errorNum}个',
|
||||
baselineTips: '该时间点的变更也会被回滚, 唯一标识、密码属性不支持回滚',
|
||||
baselineTips: '该时间点的变更也会被回滚, 唯一标识、密码属性、动态属性不支持回滚',
|
||||
},
|
||||
serviceTree: {
|
||||
remove: '移除',
|
||||
|
@@ -163,6 +163,12 @@ export default {
|
||||
width: 110,
|
||||
help: this.$t('cmdb.ci.tips10'),
|
||||
},
|
||||
{
|
||||
field: 'is_dynamic',
|
||||
title: this.$t('cmdb.ciType.isDynamic'),
|
||||
width: 110,
|
||||
help: this.$t('cmdb.ciType.dynamicTips'),
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
|
@@ -180,6 +180,10 @@ export default {
|
||||
label: this.$t('cmdb.ciType.isIndex'),
|
||||
property: 'is_index',
|
||||
},
|
||||
{
|
||||
label: this.$t('cmdb.ciType.isDynamic'),
|
||||
property: 'is_dynamic',
|
||||
},
|
||||
]
|
||||
},
|
||||
inherited() {
|
||||
|
@@ -157,33 +157,6 @@
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="6">
|
||||
<a-form-item
|
||||
:label-col="horizontalFormItemLayout.labelCol"
|
||||
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||
:label="$t('required')"
|
||||
>
|
||||
<a-switch
|
||||
@change="(checked) => onChange(checked, 'is_required')"
|
||||
name="is_required"
|
||||
v-decorator="['is_required', { rules: [], valuePropName: 'checked' }]"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6" v-if="currentValueType !== '6' && currentValueType !== '7'">
|
||||
<a-form-item
|
||||
:label-col="{ span: 8 }"
|
||||
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||
:label="$t('cmdb.ciType.unique')"
|
||||
>
|
||||
<a-switch
|
||||
:disabled="isShowComputedArea"
|
||||
@change="onChange"
|
||||
name="is_unique"
|
||||
v-decorator="['is_unique', { rules: [], valuePropName: 'checked' }]"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="currentValueType === '2' ? 6 : 0" v-if="currentValueType !== '6'">
|
||||
<a-form-item
|
||||
:hidden="currentValueType === '2' ? false : true"
|
||||
@@ -196,7 +169,7 @@
|
||||
>{{ $t('cmdb.ciType.index') }}
|
||||
<a-tooltip :title="$t('cmdb.ciType.indexTips')">
|
||||
<a-icon
|
||||
style="position:absolute;top:3px;left:-17px;color:#2f54eb;"
|
||||
style="position:absolute;top:2px;left:-17px;color:#2f54eb;"
|
||||
type="question-circle"
|
||||
theme="filled"
|
||||
@click="
|
||||
@@ -217,10 +190,37 @@
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-col :span="6" v-if="currentValueType !== '6' && currentValueType !== '7'">
|
||||
<a-form-item
|
||||
:label-col="currentValueType === '2' ? { span: 8 } : horizontalFormItemLayout.labelCol"
|
||||
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||
:label="$t('cmdb.ciType.unique')"
|
||||
>
|
||||
<a-switch
|
||||
:disabled="isShowComputedArea"
|
||||
@change="onChange"
|
||||
name="is_unique"
|
||||
v-decorator="['is_unique', { rules: [], valuePropName: 'checked' }]"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-form-item
|
||||
:label-col="['2', '6', '7'].findIndex(i => currentValueType === i) === -1 ? { span: 8 } : horizontalFormItemLayout.labelCol"
|
||||
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||
:label="$t('required')"
|
||||
>
|
||||
<a-switch
|
||||
@change="(checked) => onChange(checked, 'is_required')"
|
||||
name="is_required"
|
||||
v-decorator="['is_required', { rules: [], valuePropName: 'checked' }]"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-form-item
|
||||
:label-col="currentValueType === '2' ? { span: 12 } : horizontalFormItemLayout.labelCol"
|
||||
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||
>
|
||||
<template slot="label">
|
||||
<span
|
||||
@@ -228,7 +228,7 @@
|
||||
>{{ $t('cmdb.ciType.defaultShow') }}
|
||||
<a-tooltip :title="$t('cmdb.ciType.defaultShowTips')">
|
||||
<a-icon
|
||||
style="position:absolute;top:3px;left:-17px;color:#2f54eb;"
|
||||
style="position:absolute;top:2px;left:-17px;color:#2f54eb;"
|
||||
type="question-circle"
|
||||
theme="filled"
|
||||
@click="
|
||||
@@ -295,6 +295,37 @@
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col span="6">
|
||||
<a-form-item
|
||||
:label-col="['2', '6', '7'].findIndex(i => currentValueType === i) === -1 ? { span: 12 } : horizontalFormItemLayout.labelCol"
|
||||
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||
>
|
||||
<template slot="label">
|
||||
<span
|
||||
style="position:relative;white-space:pre;"
|
||||
>{{ $t('cmdb.ciType.isDynamic') }}
|
||||
<a-tooltip :title="$t('cmdb.ciType.dynamicTips')">
|
||||
<a-icon
|
||||
style="position:absolute;top:3px;left:-17px;color:#2f54eb;"
|
||||
type="question-circle"
|
||||
theme="filled"
|
||||
@click="
|
||||
(e) => {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
}
|
||||
"
|
||||
/>
|
||||
</a-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
<a-switch
|
||||
@change="(checked) => onChange(checked, 'is_dynamic')"
|
||||
name="is_dynamic"
|
||||
v-decorator="['is_dynamic', { rules: [], valuePropName: 'checked' }]"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-divider style="font-size:14px;margin-top:6px;">{{ $t('cmdb.ciType.advancedSettings') }}</a-divider>
|
||||
<a-row>
|
||||
<a-col :span="24" v-if="!['6'].includes(currentValueType)">
|
||||
@@ -534,6 +565,7 @@ export default {
|
||||
is_index: _record.is_index,
|
||||
is_sortable: _record.is_sortable,
|
||||
is_computed: _record.is_computed,
|
||||
is_dynamic: _record.is_dynamic,
|
||||
})
|
||||
}
|
||||
console.log(_record)
|
||||
|
@@ -150,42 +150,19 @@
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-col :span="6">
|
||||
<a-col :span="currentValueType === '2' ? 6 : 0" v-if="currentValueType !== '6'">
|
||||
<a-form-item
|
||||
:hidden="currentValueType === '2' ? false : true"
|
||||
:label-col="horizontalFormItemLayout.labelCol"
|
||||
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||
:label="$t('required')"
|
||||
>
|
||||
<a-switch
|
||||
@change="(checked) => onChange(checked, 'is_required')"
|
||||
name="is_required"
|
||||
v-decorator="['is_required', { rules: [], valuePropName: 'checked' }]"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6" v-if="currentValueType !== '6' && currentValueType !== '7'">
|
||||
<a-form-item
|
||||
:label-col="{ span: 8 }"
|
||||
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||
:label="$t('cmdb.ciType.unique')"
|
||||
>
|
||||
<a-switch
|
||||
:disabled="isShowComputedArea"
|
||||
@change="onChange"
|
||||
name="is_unique"
|
||||
v-decorator="['is_unique', { rules: [], valuePropName: 'checked' }]"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6" v-if="currentValueType === '2'">
|
||||
<a-form-item :label-col="horizontalFormItemLayout.labelCol" :wrapper-col="horizontalFormItemLayout.wrapperCol">
|
||||
<template slot="label">
|
||||
<span
|
||||
style="position:relative;white-space:pre;"
|
||||
>{{ $t('cmdb.ciType.index') }}
|
||||
<a-tooltip :title="$t('cmdb.ciType.indexTips')">
|
||||
<a-icon
|
||||
style="position:absolute;top:3px;left:-17px;color:#2f54eb;"
|
||||
style="position:absolute;top:2px;left:-17px;color:#2f54eb;"
|
||||
type="question-circle"
|
||||
theme="filled"
|
||||
@click="
|
||||
@@ -206,10 +183,37 @@
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-col :span="6" v-if="currentValueType !== '6' && currentValueType !== '7'">
|
||||
<a-form-item
|
||||
:label-col="currentValueType === '2' ? { span: 8 } : horizontalFormItemLayout.labelCol"
|
||||
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||
:label="$t('cmdb.ciType.unique')"
|
||||
>
|
||||
<a-switch
|
||||
:disabled="isShowComputedArea"
|
||||
@change="onChange"
|
||||
name="is_unique"
|
||||
v-decorator="['is_unique', { rules: [], valuePropName: 'checked' }]"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-form-item
|
||||
:label-col="['2', '6', '7'].findIndex(i => currentValueType === i) === -1 ? { span: 8 } : horizontalFormItemLayout.labelCol"
|
||||
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||
:label="$t('required')"
|
||||
>
|
||||
<a-switch
|
||||
@change="(checked) => onChange(checked, 'is_required')"
|
||||
name="is_required"
|
||||
v-decorator="['is_required', { rules: [], valuePropName: 'checked' }]"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-form-item
|
||||
:label-col="currentValueType === '2' ? { span: 12 } : horizontalFormItemLayout.labelCol"
|
||||
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||
>
|
||||
<template slot="label">
|
||||
<span
|
||||
@@ -217,7 +221,7 @@
|
||||
>{{ $t('cmdb.ciType.defaultShow') }}
|
||||
<a-tooltip :title="$t('cmdb.ciType.defaultShowTips')">
|
||||
<a-icon
|
||||
style="position:absolute;top:3px;left:-17px;color:#2f54eb;"
|
||||
style="position:absolute;top:2px;left:-17px;color:#2f54eb;"
|
||||
type="question-circle"
|
||||
theme="filled"
|
||||
@click="
|
||||
@@ -284,6 +288,37 @@
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col span="6">
|
||||
<a-form-item
|
||||
:label-col="['2', '6', '7'].findIndex(i => currentValueType === i) === -1 ? { span: 12 } : horizontalFormItemLayout.labelCol"
|
||||
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||
>
|
||||
<template slot="label">
|
||||
<span
|
||||
style="position:relative;white-space:pre;"
|
||||
>{{ $t('cmdb.ciType.isDynamic') }}
|
||||
<a-tooltip :title="$t('cmdb.ciType.dynamicTips')">
|
||||
<a-icon
|
||||
style="position:absolute;top:3px;left:-17px;color:#2f54eb;"
|
||||
type="question-circle"
|
||||
theme="filled"
|
||||
@click="
|
||||
(e) => {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
}
|
||||
"
|
||||
/>
|
||||
</a-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
<a-switch
|
||||
@change="(checked) => onChange(checked, 'is_dynamic')"
|
||||
name="is_dynamic"
|
||||
v-decorator="['is_dynamic', { rules: [], valuePropName: 'checked', initialValue: currentValueType === '6' ? true: false }]"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-divider style="font-size:14px;margin-top:6px;">{{ $t('cmdb.ciType.advancedSettings') }}</a-divider>
|
||||
<a-row>
|
||||
<a-col :span="24" v-if="!['6'].includes(currentValueType)">
|
||||
@@ -404,8 +439,8 @@ export default {
|
||||
}
|
||||
|
||||
console.log(values)
|
||||
const { is_required, default_show, default_value } = values
|
||||
const data = { is_required, default_show }
|
||||
const { is_required, default_show, default_value, is_dynamic } = values
|
||||
const data = { is_required, default_show, is_dynamic }
|
||||
delete values.is_required
|
||||
delete values.default_show
|
||||
if (values.value_type === '0' && default_value) {
|
||||
|
@@ -7,15 +7,15 @@
|
||||
<a-tab-pane key="2" :tab="$t('cmdb.ciType.relation')">
|
||||
<RelationTable :CITypeId="CITypeId" :CITypeName="CITypeName"></RelationTable>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="3" :tab="$t('cmdb.ciType.trigger')">
|
||||
<TriggerTable ref="triggerTable" :CITypeId="CITypeId"></TriggerTable>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="4" :tab="$t('cmdb.ciType.attributeAD')">
|
||||
<a-tab-pane key="3" :tab="$t('cmdb.ciType.attributeAD')">
|
||||
<AttrAD :CITypeId="CITypeId"></AttrAD>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="5" :tab="$t('cmdb.ciType.relationAD')">
|
||||
<a-tab-pane key="4" :tab="$t('cmdb.ciType.relationAD')">
|
||||
<RelationAD :CITypeId="CITypeId"></RelationAD>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="5" :tab="$t('cmdb.ciType.trigger')">
|
||||
<TriggerTable ref="triggerTable" :CITypeId="CITypeId"></TriggerTable>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="6" :tab="$t('cmdb.ciType.grant')">
|
||||
<GrantComp :CITypeId="CITypeId" resourceType="CIType" :resourceTypeName="CITypeName"></GrantComp>
|
||||
<div class="citype-detail-title">{{ $t('cmdb.components.relationGrant') }}</div>
|
||||
@@ -67,7 +67,7 @@ export default {
|
||||
if (activeKey === '1') {
|
||||
this.$refs.attributesTable.getCITypeGroupData()
|
||||
}
|
||||
if (activeKey === '3') {
|
||||
if (activeKey === '5') {
|
||||
this.$refs.triggerTable.getTableData()
|
||||
}
|
||||
})
|
||||
|
@@ -91,7 +91,7 @@
|
||||
show-search
|
||||
>
|
||||
<a-select-option
|
||||
v-for="attr in commonAttributes.filter((attr) => !attr.is_password)"
|
||||
v-for="attr in commonAttributes.filter((attr) => !attr.is_password && attr.value_type !== '6')"
|
||||
:key="attr.id"
|
||||
:value="attr.id"
|
||||
>{{ attr.alias || attr.name }}</a-select-option
|
||||
|
Reference in New Issue
Block a user