feat: 完成模板示例内容导入闭环
This commit is contained in:
1 parent
d451c93398
commit
9b1c500c5f
3 files changed
+46
-1
No files matched your search
@@ -36,6 +36,11 @@ export function CapabilitiesPage() {
|
||||
},
|
||||
onError: (error) => message.error(error instanceof Error ? error.message : "更新失败"),
|
||||
});
|
||||
const sampleMutation = useMutation({
|
||||
mutationFn: () => createApiClient().importAdminSampleContent(),
|
||||
onSuccess: (result) => message.success(`已导入 ${result.counts.offerings} 项示例业务`),
|
||||
onError: (error) => message.error(error instanceof Error ? error.message : "导入失败"),
|
||||
});
|
||||
if (query.isLoading) return <QueryState loading />;
|
||||
if (query.isError) return <QueryState error={query.error} />;
|
||||
const items = query.data ?? [];
|
||||
@@ -48,6 +53,13 @@ export function CapabilitiesPage() {
|
||||
message="能力状态会影响公开 Runtime Workspace;停用不会删除历史数据。"
|
||||
style={{ marginBottom: 16 }}
|
||||
/>
|
||||
<Button
|
||||
onClick={() => sampleMutation.mutate()}
|
||||
loading={sampleMutation.isPending}
|
||||
style={{ marginBottom: 16 }}
|
||||
>
|
||||
导入门窗示例内容
|
||||
</Button>
|
||||
<Table
|
||||
rowKey="capabilityKey"
|
||||
dataSource={items}
|
||||
|
||||
Reference in new issue
Block a user