Skip to content

Commit

Permalink
fix(api): get citype
Browse files Browse the repository at this point in the history
  • Loading branch information
yong.huang committed Feb 10, 2025
1 parent e35efea commit fb19353
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cmdb-api/api/views/cmdb/ci_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,13 @@ def get(self, type_id=None, type_name=None):
ci_type['unique_name'] = ci_type['unique_id'] and AttributeCache.get(ci_type['unique_id']).name
ci_types.append(ci_type)
elif type_name is not None:
ci_type = CITypeCache.get(type_name).to_dict()
ci_type['parent_ids'] = CITypeInheritanceManager.get_parents(ci_type['id'])
ci_types = [ci_type]
ci_type = CITypeCache.get(type_name)
if ci_type is not None:
ci_type = ci_type.to_dict()
ci_type['parent_ids'] = CITypeInheritanceManager.get_parents(ci_type['id'])
ci_types = [ci_type]
else:
ci_types = []
else:
ci_types = CITypeManager().get_ci_types(q)
count = len(ci_types)
Expand Down

0 comments on commit fb19353

Please sign in to comment.