From 1dedafc7bc41a9a62bc855243ad84d24725c83fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B9=9B=E5=85=AE?= Date: Fri, 12 Jun 2026 03:53:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E9=80=9A=E7=9F=A5=20?= =?UTF-8?q?outbox=20=E9=87=8D=E5=8F=91=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/devopsApi.ts | 8 ++++++ src/stores/platform.ts | 11 ++++++++ src/views/SettingsView.vue | 55 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) diff --git a/src/services/devopsApi.ts b/src/services/devopsApi.ts index e29d019..c43dffa 100644 --- a/src/services/devopsApi.ts +++ b/src/services/devopsApi.ts @@ -424,6 +424,14 @@ export const devopsApi = { return Array.isArray(data) ? data.map(sanitizeNotificationOutboxMessage) : [] }, + async retryNotificationOutboxMessage(id: string): Promise { + const { data } = await http.post( + `/notification-outbox/${id}/retry`, + ) + lastDataSource = 'backend' + return sanitizeNotificationOutboxMessage(data) + }, + async getAgentCards(): Promise { return agentCards }, diff --git a/src/stores/platform.ts b/src/stores/platform.ts index 814a6d7..c5521d7 100644 --- a/src/stores/platform.ts +++ b/src/stores/platform.ts @@ -135,6 +135,16 @@ export const usePlatformStore = defineStore('platform', () => { return notificationOutbox.value } + async function retryNotificationOutboxMessage(id: string) { + const message = await devopsApi.retryNotificationOutboxMessage(id) + notificationOutbox.value = [ + message, + ...notificationOutbox.value.filter((item) => item.id !== message.id), + ] + dataSource.value = devopsApi.getLastDataSource() + return message + } + function upsertRun(run: ReleaseRun) { runs.value = [run, ...runs.value.filter((item) => item.id !== run.id)] } @@ -163,5 +173,6 @@ export const usePlatformStore = defineStore('platform', () => { loadProjectRefs, loadAuditLogs, loadNotificationOutbox, + retryNotificationOutboxMessage, } }) diff --git a/src/views/SettingsView.vue b/src/views/SettingsView.vue index e1c9e6a..c77176f 100644 --- a/src/views/SettingsView.vue +++ b/src/views/SettingsView.vue @@ -23,6 +23,7 @@ const session = useSessionStore() const agentConfigLoading = ref(false) const agentConfigTesting = ref(false) const agentConfig = ref(null) +const retryingOutboxIds = ref>(new Set()) const agentConfigForm = reactive({ key: '', baseURL: '', @@ -135,6 +136,26 @@ function outboxStatusType( return outboxStatusMeta[status]?.type ?? 'info' } +function canRetryOutbox(record: NotificationOutboxMessage): boolean { + return record.status === 'failed' || record.status === 'dead' +} + +function isRetryingOutbox(id: string): boolean { + return retryingOutboxIds.value.has(id) +} + +function setRetryingOutbox(id: string, loading: boolean) { + const nextIds = new Set(retryingOutboxIds.value) + + if (loading) { + nextIds.add(id) + } else { + nextIds.delete(id) + } + + retryingOutboxIds.value = nextIds +} + function variableGroups(item: IntegrationConfigItem): VariableGroup[] { return [ { @@ -246,6 +267,20 @@ async function refreshNotificationOutbox() { } } +async function retryNotificationOutbox(record: NotificationOutboxMessage) { + setRetryingOutbox(record.id, true) + + try { + await platform.retryNotificationOutboxMessage(record.id) + await platform.loadAuditLogs() + ElMessage.success('通知 outbox 已提交重发') + } catch (error) { + ElMessage.error(error instanceof Error ? error.message : '通知 outbox 重发失败') + } finally { + setRetryingOutbox(record.id, false) + } +} + function applyAgentConfig(config: AgentConfigSummary) { agentConfig.value = config agentConfigForm.baseURL = config.baseURL @@ -469,6 +504,21 @@ function applyAgentConfig(config: AgentConfigSummary) { + + +