feat: 增加模板版本回滚能力
This commit is contained in:
1 parent
74feb3579c
commit
4191ba8df5
3 files changed
+50
No files matched your search
@@ -73,6 +73,14 @@ export function WorkspacePage() {
|
||||
void queryClient.invalidateQueries({ queryKey: ["admin-template-preview"] });
|
||||
},
|
||||
});
|
||||
const rollback = useMutation({
|
||||
mutationFn: () => client.rollbackAdminTemplate(),
|
||||
onSuccess: () => {
|
||||
message.success("模板版本已回滚,现有内容未删除");
|
||||
void queryClient.invalidateQueries({ queryKey: ["admin-workspace"] });
|
||||
void queryClient.invalidateQueries({ queryKey: ["admin-template-preview"] });
|
||||
},
|
||||
});
|
||||
const createForm = useMutation({
|
||||
mutationFn: (values: { name: string; fieldsSnapshot: unknown[] }) =>
|
||||
client.createAdminInquiryForm(values),
|
||||
@@ -162,8 +170,14 @@ export function WorkspacePage() {
|
||||
) : (
|
||||
<Tag color="green">已是最新版本</Tag>
|
||||
)}
|
||||
{templatePreview.data?.canRollback && (
|
||||
<Button danger onClick={() => rollback.mutate()} loading={rollback.isPending}>
|
||||
回滚到上一版本
|
||||
</Button>
|
||||
)}
|
||||
<MutationError error={templatePreview.error} />
|
||||
<MutationError error={upgrade.error} />
|
||||
<MutationError error={rollback.error} />
|
||||
</Space>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user