Skip to content

Commit

Permalink
fix(backend): 修复集群记录列表展示问题 #8723
Browse files Browse the repository at this point in the history
  • Loading branch information
iSecloud committed Dec 19, 2024
1 parent 0352875 commit 5dd6018
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
6 changes: 6 additions & 0 deletions dbm-ui/backend/ticket/builders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ def __init__(self, ticket: Ticket):
self.ticket_data = copy.deepcopy(ticket.details)
self.params = {"pause_type": None}

@property
def operators(self):
"""当前单据指定处理人"""
return []

def format(self):
"""
这里可以为params添加更多参数
Expand All @@ -180,6 +185,7 @@ def format(self):

def get_params(self):
self.format()
self.params.update(operators=self.operators)
self.params = super().inject_callback_in_params(params=self.params)
return self.params

Expand Down
5 changes: 3 additions & 2 deletions dbm-ui/backend/ticket/builders/mysql/mysql_data_repair.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ class MySQLDataRepairFlowParamBuilder(builders.FlowParamBuilder):
class MySQLDataRepairPauseParamBuilder(builders.PauseParamBuilder):
"""MySQL 数据校验暂停参数"""

def format(self):
@property
def operators(self):
# 数据修复目前都是自动发起,确认人加上业务主备DBA
dba = DBAdministrator.get_biz_db_type_admins(self.ticket.bk_biz_id, self.ticket.group)[:2]
self.params.update(operators=dba)
return dba


@builders.BuilderFactory.register(TicketType.MYSQL_DATA_REPAIR)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from backend.ticket import builders
from backend.ticket.builders.mysql.mysql_dump_data import (
MySQLDumpDataDetailSerializer,
MySQLDumpDataFlowBuilder,
MySQLDumpDataFlowParamBuilder,
MySQLDumpDataItsmFlowParamsBuilder,
)
Expand All @@ -34,7 +35,7 @@ class TendbClusterDumpDataItsmFlowParamsBuilder(MySQLDumpDataItsmFlowParamsBuild


@builders.BuilderFactory.register(TicketType.TENDBCLUSTER_DUMP_DATA)
class TendbClusterDumpDataFlowBuilder(BaseTendbTicketFlowBuilder):
class TendbClusterDumpDataFlowBuilder(BaseTendbTicketFlowBuilder, MySQLDumpDataFlowBuilder):
serializer = TendbClusterDumpDataDetailSerializer
itsm_flow_builder = TendbClusterDumpDataItsmFlowParamsBuilder
inner_flow_builder = TendbClusterDumpDataFlowParamBuilder
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/backend/ticket/flow_manager/pause.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def _run(self) -> Union[int, str]:
# 创建待办
from backend.ticket.todos.pause_todo import PauseTodoContext

operators = list({self.ticket.creator, *self.flow_obj.details.get("operators", [])})
operators = self.flow_obj.details.get("operators", [])
Todo.objects.create(
name=_("【{}】流程待确认,是否继续?").format(self.ticket.get_ticket_type_display()),
flow=self.flow_obj,
Expand Down
4 changes: 2 additions & 2 deletions dbm-ui/backend/ticket/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def get_tickets_count(self, request, *args, **kwargs):
filter_class=ClusterOpRecordListFilter,
)
def get_cluster_operate_records(self, request, *args, **kwargs):
op_records_page_qs = self.paginate_queryset(self.filter_queryset(self.queryset))
op_records_page_qs = self.paginate_queryset(super().filter_queryset(self.queryset))
op_records_page_data = self.serializer_class(op_records_page_qs, many=True).data
return self.get_paginated_response(data=op_records_page_data)

Expand All @@ -499,7 +499,7 @@ def get_cluster_operate_records(self, request, *args, **kwargs):
filter_class=InstanceOpRecordListFilter,
)
def get_instance_operate_records(self, request, *args, **kwargs):
op_records_page_qs = self.paginate_queryset(self.filter_queryset(self.queryset))
op_records_page_qs = self.paginate_queryset(super().filter_queryset(self.queryset))
op_records_page_data = self.serializer_class(op_records_page_qs, many=True).data
return self.get_paginated_response(data=op_records_page_data)

Expand Down

0 comments on commit 5dd6018

Please sign in to comment.