From 9339d95793c13566ea94a4dfa41c7fed82ec86b8 Mon Sep 17 00:00:00 2001 From: seolmin Date: Tue, 17 Dec 2024 01:30:20 +0900 Subject: [PATCH] fix: add error logic when DataTable is UNAVAILABLE during load Signed-off-by: seolmin --- src/spaceone/dashboard/error/data_table.py | 4 ++++ src/spaceone/dashboard/service/public_data_table_service.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/spaceone/dashboard/error/data_table.py b/src/spaceone/dashboard/error/data_table.py index 4adea0b..9b29440 100644 --- a/src/spaceone/dashboard/error/data_table.py +++ b/src/spaceone/dashboard/error/data_table.py @@ -13,6 +13,10 @@ class ERROR_NOT_SUPPORTED_OPERATOR(ERROR_INVALID_ARGUMENT): _message = "Data table does not support operator. (operator = {operator})" +class ERROR_UNAVAILABLE_DATA_TABLE(ERROR_INVALID_ARGUMENT): + _message = "Data table is not available. (data_table_id = {data_table_id})" + + class ERROR_DUPLICATED_DATA_FIELDS(ERROR_INVALID_ARGUMENT): _message = "Data fields for join are duplicated. (fields = {fields})" diff --git a/src/spaceone/dashboard/service/public_data_table_service.py b/src/spaceone/dashboard/service/public_data_table_service.py index a51926e..910207f 100644 --- a/src/spaceone/dashboard/service/public_data_table_service.py +++ b/src/spaceone/dashboard/service/public_data_table_service.py @@ -4,6 +4,7 @@ from spaceone.core.service import * from spaceone.core.error import * +from spaceone.dashboard.error.data_table import ERROR_UNAVAILABLE_DATA_TABLE from spaceone.dashboard.manager.public_data_table_manager import PublicDataTableManager from spaceone.dashboard.manager.public_widget_manager import PublicWidgetManager from spaceone.dashboard.manager.data_table_manager.data_source_manager import ( @@ -393,6 +394,11 @@ def load(self, params: PublicDataTableLoadRequest) -> dict: ) ) + if pub_data_table_vo.state == "UNAVAILABLE": + raise ERROR_UNAVAILABLE_DATA_TABLE( + data_table_id=pub_data_table_vo.data_table_id + ) + if pub_data_table_vo.data_type == "ADDED": ds_mgr = DataSourceManager( "PUBLIC",