diff --git a/cmdb-api/api/lib/cmdb/value.py b/cmdb-api/api/lib/cmdb/value.py index 215f044..4ac709e 100644 --- a/cmdb-api/api/lib/cmdb/value.py +++ b/cmdb-api/api/lib/cmdb/value.py @@ -275,16 +275,25 @@ class AttributeValueManager(object): if attr.is_list: existed_attrs = value_table.get_by(attr_id=attr.id, ci_id=ci.id, to_dict=False) existed_values = [i.value for i in existed_attrs] - added = set(value) - set(existed_values) - deleted = set(existed_values) - set(value) - for v in added: - value_table.create(ci_id=ci.id, attr_id=attr.id, value=v, flush=False, commit=False) - changed.append((ci.id, attr.id, OperateType.ADD, None, v, ci.type_id)) + # Comparison array starts from which position changes + min_len = min(len(value), len(existed_values)) + index = 0 + while index < min_len: + if value[index] != existed_values[index]: + break + index += 1 + added = value[index:] + deleted = existed_values[index:] + + # Delete first and then add to ensure id sorting for v in deleted: existed_attr = existed_attrs[existed_values.index(v)] existed_attr.delete(flush=False, commit=False) changed.append((ci.id, attr.id, OperateType.DELETE, v, None, ci.type_id)) + for v in added: + value_table.create(ci_id=ci.id, attr_id=attr.id, value=v, flush=False, commit=False) + changed.append((ci.id, attr.id, OperateType.ADD, None, v, ci.type_id)) else: existed_attr = value_table.get_by(attr_id=attr.id, ci_id=ci.id, first=True, to_dict=False) existed_value = existed_attr and existed_attr.value diff --git a/cmdb-api/api/models/cmdb.py b/cmdb-api/api/models/cmdb.py index 4ae31a9..f47ed1a 100644 --- a/cmdb-api/api/models/cmdb.py +++ b/cmdb-api/api/models/cmdb.py @@ -432,6 +432,7 @@ class CITypeHistory(Model): attr_id = db.Column(db.Integer) trigger_id = db.Column(db.Integer) + rc_id = db.Column(db.Integer) unique_constraint_id = db.Column(db.Integer) uid = db.Column(db.Integer, index=True) diff --git a/cmdb-ui/src/modules/cmdb/lang/en.js b/cmdb-ui/src/modules/cmdb/lang/en.js index cbf7934..cfbcf0d 100644 --- a/cmdb-ui/src/modules/cmdb/lang/en.js +++ b/cmdb-ui/src/modules/cmdb/lang/en.js @@ -502,7 +502,8 @@ if __name__ == "__main__": copyFailed: 'Copy failed', noLevel: 'No hierarchical relationship!', batchAddRelation: 'Batch Add Relation', - history: 'History', + history: 'Change Logs', + relITSM: 'Related Tickets', topo: 'Topology', table: 'Table', m2mTips: 'The current CIType relationship is many-to-many, please go to the SerivceTree(relation view) to add or delete', diff --git a/cmdb-ui/src/modules/cmdb/lang/zh.js b/cmdb-ui/src/modules/cmdb/lang/zh.js index ed3661e..de7f701 100644 --- a/cmdb-ui/src/modules/cmdb/lang/zh.js +++ b/cmdb-ui/src/modules/cmdb/lang/zh.js @@ -502,7 +502,8 @@ if __name__ == "__main__": copyFailed: '复制失败!', noLevel: '无层级关系!', batchAddRelation: '批量添加关系', - history: '操作历史', + history: '变更记录', + relITSM: '关联工单', topo: '拓扑', table: '表格', m2mTips: '当前模型关系为多对多,请前往关系视图进行增删操作', diff --git a/cmdb-ui/src/modules/cmdb/router/index.js b/cmdb-ui/src/modules/cmdb/router/index.js index 3ce4419..b31b03d 100644 --- a/cmdb-ui/src/modules/cmdb/router/index.js +++ b/cmdb-ui/src/modules/cmdb/router/index.js @@ -13,7 +13,7 @@ const genCmdbRoutes = async () => { { path: '/cmdb/dashboard', name: 'cmdb_dashboard', - meta: { title: 'dashboard', icon: 'ops-cmdb-dashboard', selectedIcon: 'ops-cmdb-dashboard-selected', keepAlive: false }, + meta: { title: 'dashboard', icon: 'ops-cmdb-dashboard', selectedIcon: 'ops-cmdb-dashboard', keepAlive: false }, component: () => import('../views/dashboard/index_v2.vue') }, { @@ -25,7 +25,7 @@ const genCmdbRoutes = async () => { path: '/cmdb/resourceviews', name: 'cmdb_resource_views', component: RouteView, - meta: { title: 'cmdb.menu.ciTable', icon: 'ops-cmdb-resource', selectedIcon: 'ops-cmdb-resource-selected', keepAlive: true }, + meta: { title: 'cmdb.menu.ciTable', icon: 'ops-cmdb-resource', selectedIcon: 'ops-cmdb-resource', keepAlive: true }, hideChildrenInMenu: false, children: [] }, @@ -33,7 +33,7 @@ const genCmdbRoutes = async () => { path: '/cmdb/tree_views', component: () => import('../views/tree_views'), name: 'cmdb_tree_views', - meta: { title: 'cmdb.menu.ciTree', icon: 'ops-cmdb-tree', selectedIcon: 'ops-cmdb-tree-selected', keepAlive: false }, + meta: { title: 'cmdb.menu.ciTree', icon: 'ops-cmdb-tree', selectedIcon: 'ops-cmdb-tree', keepAlive: false }, hideChildrenInMenu: true, children: [ { @@ -47,13 +47,13 @@ const genCmdbRoutes = async () => { { path: '/cmdb/resourcesearch', name: 'cmdb_resource_search', - meta: { title: 'cmdb.menu.ciSearch', icon: 'ops-cmdb-search', selectedIcon: 'ops-cmdb-search-selected', keepAlive: false }, + meta: { title: 'cmdb.menu.ciSearch', icon: 'ops-cmdb-search', selectedIcon: 'ops-cmdb-search', keepAlive: false }, component: () => import('../views/resource_search/index.vue') }, { path: '/cmdb/adc', name: 'cmdb_auto_discovery_ci', - meta: { title: 'cmdb.menu.adCIs', icon: 'ops-cmdb-adc', selectedIcon: 'ops-cmdb-adc-selected', keepAlive: false }, + meta: { title: 'cmdb.menu.adCIs', icon: 'ops-cmdb-adc', selectedIcon: 'ops-cmdb-adc', keepAlive: false }, component: () => import('../views/discoveryCI/index.vue') }, { @@ -72,19 +72,19 @@ const genCmdbRoutes = async () => { path: '/cmdb/preference', component: () => import('../views/preference/index'), name: 'cmdb_preference', - meta: { title: 'cmdb.menu.preference', icon: 'ops-cmdb-preference', selectedIcon: 'ops-cmdb-preference-selected', keepAlive: false } + meta: { title: 'cmdb.menu.preference', icon: 'ops-cmdb-preference', selectedIcon: 'ops-cmdb-preference', keepAlive: false } }, { path: '/cmdb/batch', component: () => import('../views/batch'), name: 'cmdb_batch', - meta: { 'title': 'cmdb.menu.batchUpload', icon: 'ops-cmdb-batch', selectedIcon: 'ops-cmdb-batch-selected', keepAlive: false } + meta: { 'title': 'cmdb.menu.batchUpload', icon: 'ops-cmdb-batch', selectedIcon: 'ops-cmdb-batch', keepAlive: false } }, { path: '/cmdb/ci_types', name: 'ci_type', component: () => import('../views/ci_types/index'), - meta: { title: 'cmdb.menu.citypeManage', icon: 'ops-cmdb-citype', selectedIcon: 'ops-cmdb-citype-selected', keepAlive: false, permission: ['cmdb_admin', 'admin'] } + meta: { title: 'cmdb.menu.citypeManage', icon: 'ops-cmdb-citype', selectedIcon: 'ops-cmdb-citype', keepAlive: false, permission: ['cmdb_admin', 'admin'] } }, { path: '/cmdb/disabled3', @@ -166,7 +166,7 @@ const genCmdbRoutes = async () => { path: `/cmdb/relationviews/${item[1]}`, name: `cmdb_relation_views_${item[1]}`, component: () => import('../views/relation_views/index'), - meta: { title: item[0], icon: 'ops-cmdb-relation', selectedIcon: 'ops-cmdb-relation-selected', keepAlive: false, name: item[0] }, + meta: { title: item[0], icon: 'ops-cmdb-relation', selectedIcon: 'ops-cmdb-relation', keepAlive: false, name: item[0] }, } }) routes.children.splice(2, 0, ...relationViews) diff --git a/cmdb-ui/src/modules/cmdb/views/ci/index.vue b/cmdb-ui/src/modules/cmdb/views/ci/index.vue index 9908b49..55bb81c 100644 --- a/cmdb-ui/src/modules/cmdb/views/ci/index.vue +++ b/cmdb-ui/src/modules/cmdb/views/ci/index.vue @@ -673,7 +673,7 @@ export default { message: this.$t('warning'), description: errorMsg, duration: 0, - style: { whiteSpace: 'break-spaces', overflow: 'auto', height: this.windowHeight - 80 + 'px' }, + style: { whiteSpace: 'break-spaces', overflow: 'auto', maxHeight: this.windowHeight - 80 + 'px' }, }) errorNum += 1 }) diff --git a/docker-compose.yml b/docker-compose.yml index 1d02a90..397527f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -45,7 +45,7 @@ services: - redis cmdb-api: - image: registry.cn-hangzhou.aliyuncs.com/veops/cmdb-api:2.4.3 + image: registry.cn-hangzhou.aliyuncs.com/veops/cmdb-api:2.4.4 # build: # context: . # target: cmdb-api @@ -84,7 +84,7 @@ services: - cmdb-api cmdb-ui: - image: registry.cn-hangzhou.aliyuncs.com/veops/cmdb-ui:2.4.3 + image: registry.cn-hangzhou.aliyuncs.com/veops/cmdb-ui:2.4.4 # build: # context: . # target: cmdb-ui