Skip to content

Commit

Permalink
chore: release v2.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
pycook committed Apr 29, 2024
1 parent 994a28d commit 9ead4e7
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 19 deletions.
19 changes: 14 additions & 5 deletions cmdb-api/api/lib/cmdb/value.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,25 @@ def create_or_update_attr_value(self, ci, ci_dict, key2attr, ticket_id=None):
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
Expand Down
1 change: 1 addition & 0 deletions cmdb-api/api/models/cmdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion cmdb-ui/src/modules/cmdb/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion cmdb-ui/src/modules/cmdb/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,8 @@ if __name__ == "__main__":
copyFailed: '复制失败!',
noLevel: '无层级关系!',
batchAddRelation: '批量添加关系',
history: '操作历史',
history: '变更记录',
relITSM: '关联工单',
topo: '拓扑',
table: '表格',
m2mTips: '当前模型关系为多对多,请前往关系视图进行增删操作',
Expand Down
18 changes: 9 additions & 9 deletions cmdb-ui/src/modules/cmdb/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
},
{
Expand All @@ -25,15 +25,15 @@ 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: []
},
{
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: [
{
Expand All @@ -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')
},
{
Expand All @@ -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',
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmdb-ui/src/modules/cmdb/views/ci/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9ead4e7

Please sign in to comment.