ERP-node/frontend/components/dataflow/node-editor/sidebar/nodePaletteConfig.ts

157 lines
3.8 KiB
TypeScript

/**
* 노드 팔레트 설정
*/
import type { NodePaletteItem } from "@/types/node-editor";
export const NODE_PALETTE: NodePaletteItem[] = [
// ========================================================================
// 데이터 소스
// ========================================================================
{
type: "tableSource",
label: "테이블",
icon: "",
description: "내부 데이터베이스 테이블에서 데이터를 읽어옵니다",
category: "source",
color: "#3B82F6", // 파란색
},
{
type: "externalDBSource",
label: "외부 DB",
icon: "",
description: "외부 데이터베이스에서 데이터를 읽어옵니다",
category: "source",
color: "#F59E0B", // 주황색
},
{
type: "restAPISource",
label: "REST API",
icon: "",
description: "REST API를 호출하여 데이터를 가져옵니다",
category: "source",
color: "#10B981", // 초록색
},
{
type: "referenceLookup",
label: "참조 조회",
icon: "",
description: "다른 테이블에서 데이터를 조회합니다 (내부 DB 전용)",
category: "source",
color: "#A855F7", // 보라색
},
// ========================================================================
// 변환/조건
// ========================================================================
{
type: "condition",
label: "조건 분기",
icon: "",
description: "조건에 따라 데이터 흐름을 분기합니다",
category: "transform",
color: "#EAB308", // 노란색
},
{
type: "dataTransform",
label: "데이터 변환",
icon: "",
description: "데이터를 변환하거나 가공합니다",
category: "transform",
color: "#06B6D4", // 청록색
},
// ========================================================================
// 액션
// ========================================================================
{
type: "insertAction",
label: "INSERT",
icon: "",
description: "데이터를 삽입합니다",
category: "action",
color: "#22C55E", // 초록색
},
{
type: "updateAction",
label: "UPDATE",
icon: "",
description: "데이터를 수정합니다",
category: "action",
color: "#3B82F6", // 파란색
},
{
type: "deleteAction",
label: "DELETE",
icon: "",
description: "데이터를 삭제합니다",
category: "action",
color: "#EF4444", // 빨간색
},
{
type: "upsertAction",
label: "UPSERT",
icon: "",
description: "데이터를 삽입하거나 수정합니다",
category: "action",
color: "#8B5CF6", // 보라색
},
// ========================================================================
// 유틸리티
// ========================================================================
{
type: "comment",
label: "주석",
icon: "",
description: "주석을 추가합니다",
category: "utility",
color: "#6B7280", // 회색
},
{
type: "log",
label: "로그",
icon: "",
description: "로그를 출력합니다",
category: "utility",
color: "#6B7280", // 회색
},
];
export const NODE_CATEGORIES = [
{
id: "source",
label: "데이터 소스",
icon: "",
},
{
id: "transform",
label: "변환/조건",
icon: "",
},
{
id: "action",
label: "액션",
icon: "",
},
{
id: "utility",
label: "유틸리티",
icon: "",
},
] as const;
/**
* 노드 타입별 팔레트 아이템 조회
*/
export function getNodePaletteItem(type: string): NodePaletteItem | undefined {
return NODE_PALETTE.find((item) => item.type === type);
}
/**
* 카테고리별 노드 목록 조회
*/
export function getNodesByCategory(category: string): NodePaletteItem[] {
return NODE_PALETTE.filter((item) => item.category === category);
}