diff --git a/dbm-ui/backend/db_services/mysql/remote_service/handlers.py b/dbm-ui/backend/db_services/mysql/remote_service/handlers.py index e6f84aa978..6415882ddd 100644 --- a/dbm-ui/backend/db_services/mysql/remote_service/handlers.py +++ b/dbm-ui/backend/db_services/mysql/remote_service/handlers.py @@ -147,7 +147,8 @@ def _get_db_table_list(_bk_cloud_id, _address, _cmds, key): ) databases = set(query_dbs_list[query_schema_dbs_sql]) - set(query_dbs_list[query_ignore_schema_dbs_sql]) if not databases: - raise RemoteServiceBaseException(_("不存在可用于闪回的库")) + info.update(message=_("不存在可用于闪回的库")) + continue # 构造查询表的sql语句 db_list = "(" + ",".join([f"'{db}'" for db in databases]) + ")" @@ -170,4 +171,9 @@ def _get_db_table_list(_bk_cloud_id, _address, _cmds, key): query_tbs_list[query_ignore_schema_tables_sql] ) if not databases: - raise RemoteServiceBaseException(_("不存在可用于闪回的表")) + info.update(message=_("不存在可用于闪回的表")) + continue + + info.update(message="") + + return flashback_infos diff --git a/dbm-ui/backend/db_services/mysql/remote_service/mock_data.py b/dbm-ui/backend/db_services/mysql/remote_service/mock_data.py index 58d5fb89a9..c184292f17 100644 --- a/dbm-ui/backend/db_services/mysql/remote_service/mock_data.py +++ b/dbm-ui/backend/db_services/mysql/remote_service/mock_data.py @@ -21,3 +21,23 @@ CHECK_CLUSTER_DATABASE_RESPONSE_DATA = [ {"cluster_id": 63, "db_names": ["db1", "db2"], "check_info": {"db1": False, "db2": True}} ] + +FLASHBACK_CHECK_DATA = [ + { + "cluster_id": 63, + "databases": ["kkjj"], + "databases_ignore": [], + "tables": [], + "tables_ignore": [], + "message": "不存在可用于闪回的库", + }, + { + "cluster_id": 63, + "databases": [], + "databases_ignore": [], + "tables": ["iijkk"], + "tables_ignore": [], + "message": "不存在可用于闪回的表", + }, + {"cluster_id": 63, "databases": [], "databases_ignore": [], "tables": [], "tables_ignore": [], "message": ""}, +] diff --git a/dbm-ui/backend/db_services/mysql/remote_service/serializers.py b/dbm-ui/backend/db_services/mysql/remote_service/serializers.py index ca91aab95d..45a115ceb5 100644 --- a/dbm-ui/backend/db_services/mysql/remote_service/serializers.py +++ b/dbm-ui/backend/db_services/mysql/remote_service/serializers.py @@ -15,6 +15,7 @@ from backend.db_services.mysql.remote_service.mock_data import ( CHECK_CLUSTER_DATABASE_REQUEST_DATA, CHECK_CLUSTER_DATABASE_RESPONSE_DATA, + FLASHBACK_CHECK_DATA, SHOW_DATABASES_REQUEST_DATA, SHOW_DATABASES_RESPONSE_DATA, ) @@ -68,3 +69,8 @@ class FlashbackSerializer(serializers.Serializer): tables_ignore = serializers.ListField(help_text=_("忽略table列表"), child=serializers.CharField()) infos = serializers.ListSerializer(help_text=_("flashback信息"), child=FlashbackSerializer(), allow_empty=False) + + +class CheckFlashbackInfoResponseSerializer(serializers.Serializer): + class Meta: + swagger_schema_fields = {"example": FLASHBACK_CHECK_DATA} diff --git a/dbm-ui/backend/db_services/mysql/remote_service/views.py b/dbm-ui/backend/db_services/mysql/remote_service/views.py index d1a13b1e77..da368a05c9 100644 --- a/dbm-ui/backend/db_services/mysql/remote_service/views.py +++ b/dbm-ui/backend/db_services/mysql/remote_service/views.py @@ -19,6 +19,7 @@ from backend.db_services.mysql.remote_service.serializers import ( CheckClusterDatabaseResponseSerializer, CheckClusterDatabaseSerializer, + CheckFlashbackInfoResponseSerializer, CheckFlashbackInfoSerializer, ShowDatabasesRequestSerializer, ShowDatabasesResponseSerializer, @@ -74,6 +75,7 @@ def check_cluster_database(self, request, bk_biz_id): @common_swagger_auto_schema( operation_summary=_("校验flashback信息是否合法"), request_body=CheckFlashbackInfoSerializer(), + responses={status.HTTP_200_OK: CheckFlashbackInfoResponseSerializer()}, tags=[SWAGGER_TAG], ) @action(methods=["POST"], detail=False, serializer_class=CheckFlashbackInfoSerializer) diff --git a/dbm-ui/backend/ticket/builders/tendbcluster/tendb_full_backup.py b/dbm-ui/backend/ticket/builders/tendbcluster/tendb_full_backup.py index b479efe939..a5ec7a8119 100644 --- a/dbm-ui/backend/ticket/builders/tendbcluster/tendb_full_backup.py +++ b/dbm-ui/backend/ticket/builders/tendbcluster/tendb_full_backup.py @@ -52,7 +52,7 @@ def validate(self, attrs): for cluster in attrs["infos"]["clusters"]: if cluster["backup_local"] == TenDBBackUpLocation.SPIDER_MNT and "spider_mnt_address" not in cluster: - raise serializers.ValidationError(_("备份位置选择spider_mnt时,请提供临时节点的地址")) + raise serializers.ValidationError(_("备份位置选择spider_mnt时,请提供运维节点的地址")) return attrs diff --git a/dbm-ui/backend/ticket/builders/tendbcluster/tendb_mnt_apply.py b/dbm-ui/backend/ticket/builders/tendbcluster/tendb_mnt_apply.py index 4065843beb..160517d02d 100644 --- a/dbm-ui/backend/ticket/builders/tendbcluster/tendb_mnt_apply.py +++ b/dbm-ui/backend/ticket/builders/tendbcluster/tendb_mnt_apply.py @@ -23,9 +23,9 @@ class TendbMNTApplyDetailSerializer(TendbBaseOperateDetailSerializer): class MNTApplySerializer(serializers.Serializer): cluster_id = serializers.IntegerField(help_text=_("集群ID")) bk_cloud_id = serializers.IntegerField(help_text=_("云区域ID")) - spider_ip_list = serializers.ListField(help_text=_("临时节点信息"), child=serializers.DictField()) + spider_ip_list = serializers.ListField(help_text=_("运维节点信息"), child=serializers.DictField()) - infos = serializers.ListField(help_text=_("添加spider临时节点信息"), child=MNTApplySerializer()) + infos = serializers.ListField(help_text=_("添加spider运维节点信息"), child=MNTApplySerializer()) def validate(self, attrs): super().validate(attrs) @@ -49,4 +49,4 @@ def format_ticket_data(self): class TendbMNTApplyFlowBuilder(BaseTendbTicketFlowBuilder): serializer = TendbMNTApplyDetailSerializer inner_flow_builder = TendbMNTApplyParamBuilder - inner_flow_name = _("TendbCluster 添加临时节点") + inner_flow_name = _("TendbCluster 添加运维节点") diff --git a/dbm-ui/backend/ticket/builders/tendbcluster/tendb_mnt_destroy.py b/dbm-ui/backend/ticket/builders/tendbcluster/tendb_mnt_destroy.py index 96e8ab33e0..49fff424ed 100644 --- a/dbm-ui/backend/ticket/builders/tendbcluster/tendb_mnt_destroy.py +++ b/dbm-ui/backend/ticket/builders/tendbcluster/tendb_mnt_destroy.py @@ -22,9 +22,9 @@ class TendbMNTDestroyDetailSerializer(TendbBaseOperateDetailSerializer): class MNTDestroySerializer(serializers.Serializer): cluster_id = serializers.IntegerField(help_text=_("集群ID")) - spider_ip_list = serializers.ListField(help_text=_("临时节点信息"), child=serializers.DictField()) + spider_ip_list = serializers.ListField(help_text=_("运维节点信息"), child=serializers.DictField()) - infos = serializers.ListField(help_text=_("下架spider临时节点信息"), child=MNTDestroySerializer()) + infos = serializers.ListField(help_text=_("下架spider运维节点信息"), child=MNTDestroySerializer()) is_safe = serializers.BooleanField(help_text=_("是否安全模式执行"), required=False, default=True) def validate(self, attrs): @@ -40,4 +40,4 @@ class TendbMNTDestroyParamBuilder(builders.FlowParamBuilder): class TendbMNTDestroyFlowBuilder(BaseTendbTicketFlowBuilder): serializer = TendbMNTDestroyDetailSerializer inner_flow_builder = TendbMNTDestroyParamBuilder - inner_flow_name = _("TendbCluster 下架临时节点") + inner_flow_name = _("TendbCluster 下架运维节点")