feat(delivery): restore active MySQL tasks

This commit is contained in:
mac
2026-07-27 15:20:03 +08:00
parent e0ee36cadb
commit 6ddba9aa03
2 changed files with 343 additions and 60 deletions
+32 -3
View File
@@ -16,15 +16,32 @@ export interface CreateMySQLDeliveryPayload {
namespace: string
instance_name: string
mysql_version: string
cpu_milli: number
memory_mi: number
storage_gi: number
topology: string
mysql_port?: number
data_disk: string
cpu_cores: number
memory_gb: number
storage_gb: number
param_template: string
timezone: string
lower_case_table_names: number
character_set: string
collation: string
max_connections: string | number
innodb_redo_log_capacity: string
innodb_flush_log_at_trx_commit: number
sync_binlog: number
innodb_io_capacity: number
long_query_time: number
binlog_expire_logs_seconds: number
max_binlog_size: string
}
export interface DeliveryTask {
id: string
business_line_id: number
requested_by: number
component: string
target_type: string
target_id: number
namespace: string
@@ -45,6 +62,8 @@ export interface TaskEvent {
task_id: string
from_state: string
to_state: string
stage?: string
event_status?: string
message: string
created_at: string
}
@@ -66,6 +85,16 @@ export const deliveryApi = {
return data.task
},
async listTasks(params: { businessLineId?: number; component?: string; active?: boolean } = {}): Promise<DeliveryTask[]> {
const search = new URLSearchParams()
if (params.businessLineId) search.set('business_line_id', String(params.businessLineId))
if (params.component) search.set('component', params.component)
if (params.active) search.set('active', 'true')
const query = search.toString()
const data = await authRequest(`/auth/api/v1/delivery/tasks${query ? `?${query}` : ''}`)
return Array.isArray(data.items) ? data.items : []
},
async getTask(taskId: string): Promise<{ task: DeliveryTask; events: TaskEvent[] }> {
const data = await authRequest(`/auth/api/v1/delivery/tasks/${encodeURIComponent(taskId)}`)
return {