fix: allow deleting system default sync channel with immediate heal

Remove hard ban that returned 400 with no UI feedback; delete then Ensure+rebinding, and show confirm/toast on SyncPage.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
whm
2026-08-06 09:03:41 +08:00
parent 362dcee242
commit 75622a728e
4 changed files with 56 additions and 16 deletions

View File

@@ -586,9 +586,35 @@ export function SyncPage(props: {
<Button
size="small"
danger
onClick={async () => {
await deleteSyncChannel(session, r.id);
await refresh();
onClick={() => {
Modal.confirm({
title: `删除通道「${r.name || r.id}」?`,
content: r.is_system_default
? "这是公司默认同步通道。删除后将自动重建并重挂库绑定,账号落点不会丢失。"
: "删除后,仍挂在此通道上的绑定会自动改挂公司默认同步通道。",
okText: "确认删除",
okType: "danger",
cancelText: "取消",
onOk: async () => {
setBusy(true);
try {
const res = await deleteSyncChannel(session, r.id);
if (res.heal_error) {
message.warning(`通道已删,自愈未完成:${res.heal_error}`);
} else if (res.recreated_default) {
message.success("已删除;公司默认同步通道已自动重建并重挂绑定");
} else {
message.success("已删除");
}
await refresh();
} catch (e: any) {
message.error(e.message || String(e));
throw e;
} finally {
setBusy(false);
}
},
});
}}
>