From 37986c015a59cbdd0a045f567c139b6acb7128b1 Mon Sep 17 00:00:00 2001 From: seolmin Date: Tue, 5 Nov 2024 15:46:06 +0900 Subject: [PATCH] feat: modify logic of options expressions when using add method Signed-off-by: seolmin --- src/spaceone/dashboard/service/private_data_table_service.py | 5 +++++ src/spaceone/dashboard/service/public_data_table_service.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/spaceone/dashboard/service/private_data_table_service.py b/src/spaceone/dashboard/service/private_data_table_service.py index 7e89cbb..30dd0cf 100644 --- a/src/spaceone/dashboard/service/private_data_table_service.py +++ b/src/spaceone/dashboard/service/private_data_table_service.py @@ -78,6 +78,8 @@ def add_data_table(self, params_dict: dict) -> dict: user_id, ) + raw_filter = copy.deepcopy(options.get("filter")) + if source_type == "COST": if plugin_id := options.get("COST", {}).get("plugin_id"): data_source_id = self._get_data_source_id_from_plugin_id(plugin_id) @@ -106,6 +108,9 @@ def add_data_table(self, params_dict: dict) -> dict: params_dict["state"] = ds_mgr.state params_dict["error_message"] = ds_mgr.error_message + if raw_filter: + params_dict["options"]["filter"] = raw_filter + pri_data_table_vo = self.pri_data_table_mgr.create_private_data_table( params_dict ) diff --git a/src/spaceone/dashboard/service/public_data_table_service.py b/src/spaceone/dashboard/service/public_data_table_service.py index 73b095b..80332e5 100644 --- a/src/spaceone/dashboard/service/public_data_table_service.py +++ b/src/spaceone/dashboard/service/public_data_table_service.py @@ -79,6 +79,8 @@ def add_data_table(self, params_dict: dict) -> dict: user_projects, ) + raw_filter = copy.deepcopy(options.get("filter")) + if source_type == "COST": if plugin_id := options.get("COST", {}).get("plugin_id"): data_source_id = self._get_data_source_id_from_plugin_id(plugin_id) @@ -110,6 +112,9 @@ def add_data_table(self, params_dict: dict) -> dict: params_dict["state"] = ds_mgr.state params_dict["error_message"] = ds_mgr.error_message + if raw_filter: + params_dict["options"]["filter"] = raw_filter + pub_data_table_vo = self.pub_data_table_mgr.create_public_data_table( params_dict )