Enhance batch management functionality by adding node flow execution support and improving batch configuration creation. Introduce new API endpoint for retrieving node flows and update existing batch services to handle execution types. Update frontend components to support new scheduling options and node flow selection.

This commit is contained in:
DDD1542
2026-03-19 15:07:07 +09:00
parent 7f781b0177
commit 43cf91e748
41 changed files with 4020 additions and 3155 deletions

View File

@@ -1,76 +1,66 @@
"use client";
import { useState } from "react";
import { useRouter } from "next/navigation";
import DataFlowList from "@/components/dataflow/DataFlowList";
import { FlowEditor } from "@/components/dataflow/node-editor/FlowEditor";
import { useAuth } from "@/hooks/useAuth";
import { toast } from "sonner";
import { showErrorToast } from "@/lib/utils/toastUtils";
import { Button } from "@/components/ui/button";
import { ScrollToTop } from "@/components/common/ScrollToTop";
import { ArrowLeft } from "lucide-react";
type Step = "list" | "editor";
export default function DataFlowPage() {
const { user } = useAuth();
const router = useRouter();
const [currentStep, setCurrentStep] = useState<Step>("list");
const [loadingFlowId, setLoadingFlowId] = useState<number | null>(null);
// 플로우 불러오기 핸들러
const handleLoadFlow = async (flowId: number | null) => {
if (flowId === null) {
// 새 플로우 생성
setLoadingFlowId(null);
setCurrentStep("editor");
return;
}
try {
// 기존 플로우 불러오기
setLoadingFlowId(flowId);
setCurrentStep("editor");
toast.success("플로우를 불러왔습니다.");
toast.success("플로우를 불러왔어요");
} catch (error: any) {
console.error("플로우 불러오기 실패:", error);
showErrorToast("플로우 목록을 불러오는 데 실패했습니다", error, { guidance: "네트워크 연결을 확인해 주세요." });
console.error("플로우 불러오기 실패:", error);
showErrorToast("플로우 불러오는 데 실패했어요", error, {
guidance: "네트워크 연결을 확인해 주세요.",
});
}
};
// 목록으로 돌아가기
const handleBackToList = () => {
setCurrentStep("list");
setLoadingFlowId(null);
};
// 에디터 모드일 때는 전체 화면 사용
const isEditorMode = currentStep === "editor";
// 에디터 모드일 때는 레이아웃 없이 전체 화면 사용
if (isEditorMode) {
if (currentStep === "editor") {
return (
<div className="bg-background fixed inset-0 z-50">
<div className="flex h-full flex-col">
{/* 에디터 헤더 */}
<div className="bg-background flex items-center gap-4 border-b p-4">
<Button variant="outline" size="sm" onClick={handleBackToList} className="flex items-center gap-2">
<div className="bg-background flex items-center gap-4 border-b px-5 py-3">
<Button
variant="ghost"
size="sm"
onClick={handleBackToList}
className="text-muted-foreground hover:text-foreground flex items-center gap-2 text-sm"
>
<ArrowLeft className="h-4 w-4" />
</Button>
<div>
<h1 className="text-2xl font-bold tracking-tight"> </h1>
<p className="text-muted-foreground mt-1 text-sm">
</p>
</div>
</div>
{/* 플로우 에디터 */}
<div className="flex-1 overflow-hidden">
<FlowEditor key={loadingFlowId || "new"} initialFlowId={loadingFlowId} />
<FlowEditor
key={loadingFlowId || "new"}
initialFlowId={loadingFlowId}
/>
</div>
</div>
</div>
@@ -78,20 +68,10 @@ export default function DataFlowPage() {
}
return (
<div className="bg-background flex min-h-screen flex-col">
<div className="space-y-6 p-4 sm:p-6">
{/* 페이지 헤더 */}
<div className="space-y-2 border-b pb-4">
<h1 className="text-3xl font-bold tracking-tight"> </h1>
<p className="text-muted-foreground text-sm"> </p>
</div>
{/* 플로우 목록 */}
<div className="h-full overflow-y-auto">
<div className="mx-auto w-full max-w-[1400px] space-y-6 p-4 sm:p-6 pb-20">
<DataFlowList onLoadFlow={handleLoadFlow} />
</div>
{/* Scroll to Top 버튼 */}
<ScrollToTop />
</div>
);
}