From b8705a22bfe389a0e4dc0d624d0848fac84195be Mon Sep 17 00:00:00 2001 From: Jongmin Kim Date: Sun, 16 Jun 2024 21:18:56 +0900 Subject: [PATCH] refactor: refactor metadata generator Signed-off-by: Jongmin Kim --- .../plugin/collector/lib/metadata_generator.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/spaceone/inventory/plugin/collector/lib/metadata_generator.py b/src/spaceone/inventory/plugin/collector/lib/metadata_generator.py index 7b3f248..3618059 100644 --- a/src/spaceone/inventory/plugin/collector/lib/metadata_generator.py +++ b/src/spaceone/inventory/plugin/collector/lib/metadata_generator.py @@ -110,14 +110,15 @@ def _generate_tabs(self, tabs_meta: list) -> dict: new_tabs_metadata.append(dynamic_view) # generate single dynamic view - elif "fields" in tab_meta: + else: dynamic_view = self._generate_default_dynamic_view( name=tab_meta["name"], view_type=tab_meta["type"] ) - dynamic_view["options"]["fields"] = self._generate_fields( - tab_meta["fields"] - ) + if "fields" in tab_meta: + dynamic_view["options"]["fields"] = self._generate_fields( + tab_meta["fields"] + ) if "root_path" in tab_meta: dynamic_view["options"]["root_path"] = tab_meta["root_path"] @@ -436,6 +437,10 @@ def _generate_enum_field(self, field: dict) -> dict: enums[main_key]["name"] = enum["name"] del enum["name"] + if "label" in enum: + enums[main_key]["label"] = enum["label"] + del enum["label"] + if "options" in field: field["options"].update(enums) else: