From ceacc0ab152fc968f43e686d9b01acd130d8d533 Mon Sep 17 00:00:00 2001 From: EvanSung Date: Thu, 24 Aug 2023 14:16:12 +0800 Subject: [PATCH 1/3] perf(ad_ci_relation): optimize ad_ci relation --- cmdb-api/api/lib/cmdb/auto_discovery/auto_discovery.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmdb-api/api/lib/cmdb/auto_discovery/auto_discovery.py b/cmdb-api/api/lib/cmdb/auto_discovery/auto_discovery.py index 052d970..c211394 100644 --- a/cmdb-api/api/lib/cmdb/auto_discovery/auto_discovery.py +++ b/cmdb-api/api/lib/cmdb/auto_discovery/auto_discovery.py @@ -453,10 +453,12 @@ class AutoDiscoveryCICRUD(DBMixin): relation_adts = AutoDiscoveryCIType.get_by(type_id=adt.type_id, adr_id=None, to_dict=False) for r_adt in relation_adts: - if r_adt.relation and ci_id is not None: - ad_key, cmdb_key = None, {} - for ad_key in r_adt.relation: - cmdb_key = r_adt.relation[ad_key] + if not r_adt.relation or ci_id is None: + continue + for ad_key in r_adt.relation: + if not adc.instance.get(ad_key): + continue + cmdb_key = r_adt.relation[ad_key] query = "_type:{},{}:{}".format(cmdb_key.get('type_name'), cmdb_key.get('attr_name'), adc.instance.get(ad_key)) s = search(query) From 95d3b0233a14b7df86a6ee52cbe34fe65894d422 Mon Sep 17 00:00:00 2001 From: wang-liang0615 Date: Fri, 25 Aug 2023 10:08:04 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix=20=E6=96=B0=E5=A2=9E=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=9B=9E=E8=BD=A6=E9=94=AE=E5=8F=91=E9=80=81=E4=B8=A4=E6=AC=A1?= =?UTF-8?q?=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/cmdb/views/relation_type/index.vue | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/cmdb-ui/src/modules/cmdb/views/relation_type/index.vue b/cmdb-ui/src/modules/cmdb/views/relation_type/index.vue index d621437..36bdf9e 100644 --- a/cmdb-ui/src/modules/cmdb/views/relation_type/index.vue +++ b/cmdb-ui/src/modules/cmdb/views/relation_type/index.vue @@ -1,7 +1,7 @@