perf: add notification toasts

This commit is contained in:
Junyan Qin
2025-05-09 22:36:13 +08:00
parent 337090e7cb
commit df700ec7c2
17 changed files with 131 additions and 71 deletions
@@ -18,7 +18,7 @@ import {
FormLabel,
FormMessage,
} from "@/components/ui/form"
import { toast } from "sonner"
export default function PipelineFormComponent({
initValues,
@@ -142,6 +142,9 @@ export default function PipelineFormComponent({
httpClient.createPipeline(pipeline).then((resp) => {
onFinish();
onNewPipelineCreated(resp.uuid);
toast.success("创建成功 请编辑流水线详细参数");
}).catch((err) => {
toast.error("创建失败:" + err.message);
});
}
@@ -165,7 +168,12 @@ export default function PipelineFormComponent({
// uuid: pipelineId || '',
// is_default: false,
};
httpClient.updatePipeline(pipelineId || '', pipeline).then(() => onFinish());
httpClient.updatePipeline(pipelineId || '', pipeline).then(() => {
onFinish();
toast.success("保存成功");
}).catch((err) => {
toast.error("保存失败:" + err.message);
});
}
function renderDynamicForms(stage: PipelineConfigStage, formName: keyof FormValues) {
+2 -2
View File
@@ -16,7 +16,7 @@ import {
DialogTrigger,
} from "@/components/ui/dialog"
import { Button } from '@/components/ui/button';
import { toast } from "sonner"
export default function PluginConfigPage() {
const [modalOpen, setModalOpen] = useState<boolean>(false);
const [isEditForm, setIsEditForm] = useState(false);
@@ -57,8 +57,8 @@ export default function PluginConfigPage() {
setPipelineList(pipelineList);
})
.catch((error) => {
// TODO toast
console.log(error);
toast.error("获取流水线列表失败:" + error.message);
});
}