Merge branch 'dev' of http://39.117.244.52:3000/kjs/ERP-node into feature/screen-management
This commit is contained in:
@@ -43,6 +43,11 @@ export default function DataFlowEditPage() {
|
||||
router.push("/admin/dataflow");
|
||||
};
|
||||
|
||||
// 관계도 이름 업데이트 핸들러
|
||||
const handleDiagramNameUpdate = (newDiagramName: string) => {
|
||||
setDiagramName(newDiagramName);
|
||||
};
|
||||
|
||||
if (!diagramId || !diagramName) {
|
||||
return (
|
||||
<div className="flex h-64 items-center justify-center">
|
||||
@@ -74,7 +79,12 @@ export default function DataFlowEditPage() {
|
||||
|
||||
{/* 데이터플로우 디자이너 */}
|
||||
<div className="rounded-lg border border-gray-200 bg-white">
|
||||
<DataFlowDesigner selectedDiagram={diagramName} diagramId={diagramId} onBackToList={handleBackToList} />
|
||||
<DataFlowDesigner
|
||||
selectedDiagram={diagramName}
|
||||
diagramId={diagramId}
|
||||
onBackToList={handleBackToList}
|
||||
onDiagramNameUpdate={handleDiagramNameUpdate}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,63 @@ import { apiClient, ApiResponse } from "./client";
|
||||
|
||||
// 테이블 간 데이터 관계 설정 관련 타입 정의
|
||||
|
||||
// 조건부 연결 관련 타입들
|
||||
export interface ConditionControl {
|
||||
triggerType: "insert" | "update" | "delete" | "insert_update";
|
||||
conditionTree: ConditionNode | ConditionNode[] | null;
|
||||
}
|
||||
|
||||
export interface ConditionNode {
|
||||
id: string; // 고유 ID
|
||||
type: "condition" | "group-start" | "group-end";
|
||||
field?: string;
|
||||
operator_type?: "=" | "!=" | ">" | "<" | ">=" | "<=" | "LIKE";
|
||||
value?: string | number | boolean;
|
||||
dataType?: string;
|
||||
logicalOperator?: "AND" | "OR"; // 다음 조건과의 논리 연산자
|
||||
groupId?: string; // 그룹 ID (group-start와 group-end가 같은 groupId를 가짐)
|
||||
groupLevel?: number; // 중첩 레벨 (0, 1, 2, ...)
|
||||
}
|
||||
|
||||
export interface ConnectionCategory {
|
||||
type: "simple-key" | "data-save" | "external-call" | "conditional-link";
|
||||
rollbackOnError?: boolean;
|
||||
enableLogging?: boolean;
|
||||
maxRetryCount?: number;
|
||||
}
|
||||
|
||||
export interface ExecutionPlan {
|
||||
sourceTable: string;
|
||||
targetActions: TargetAction[];
|
||||
}
|
||||
|
||||
export interface TargetAction {
|
||||
id: string;
|
||||
actionType: "insert" | "update" | "delete" | "upsert";
|
||||
targetTable: string;
|
||||
enabled: boolean;
|
||||
fieldMappings: FieldMapping[];
|
||||
conditions?: Array<{
|
||||
field: string;
|
||||
operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "LIKE";
|
||||
value: string;
|
||||
logicalOperator?: "AND" | "OR"; // 다음 조건과의 논리 연산자
|
||||
}>;
|
||||
splitConfig?: {
|
||||
sourceField: string;
|
||||
delimiter: string;
|
||||
targetField: string;
|
||||
};
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface FieldMapping {
|
||||
sourceField: string;
|
||||
targetField: string;
|
||||
transformFunction?: string;
|
||||
defaultValue?: string;
|
||||
}
|
||||
|
||||
export interface ColumnInfo {
|
||||
columnName: string;
|
||||
columnLabel?: string;
|
||||
@@ -45,8 +102,7 @@ export interface TableRelationship {
|
||||
from_column_name: string;
|
||||
to_table_name: string;
|
||||
to_column_name: string;
|
||||
relationship_type: "one-to-one" | "one-to-many" | "many-to-one" | "many-to-many";
|
||||
connection_type: "simple-key" | "data-save" | "external-call";
|
||||
connection_type: "simple-key" | "data-save" | "external-call" | "conditional-link";
|
||||
settings?: Record<string, unknown>;
|
||||
company_code: string;
|
||||
is_active?: string;
|
||||
@@ -98,6 +154,11 @@ export interface DataFlowDiagram {
|
||||
relationshipCount: number;
|
||||
tables: string[];
|
||||
companyCode: string; // 회사 코드 추가
|
||||
|
||||
// 조건부 연결 관련 필드
|
||||
control?: ConditionControl; // 조건 설정
|
||||
category?: ConnectionCategory; // 연결 종류
|
||||
plan?: ExecutionPlan; // 실행 계획
|
||||
createdAt: Date;
|
||||
createdBy: string;
|
||||
updatedAt: Date;
|
||||
@@ -134,6 +195,7 @@ export interface JsonDataFlowDiagram {
|
||||
tables: string[];
|
||||
};
|
||||
node_positions?: NodePositions;
|
||||
category?: string; // 연결 종류 ("simple-key", "data-save", "external-call")
|
||||
company_code: string;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
@@ -148,9 +210,8 @@ export interface JsonRelationship {
|
||||
toTable: string;
|
||||
fromColumns: string[];
|
||||
toColumns: string[];
|
||||
relationshipType: string;
|
||||
connectionType: string;
|
||||
settings?: any;
|
||||
connectionType: "simple-key" | "data-save" | "external-call";
|
||||
settings?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface CreateDiagramRequest {
|
||||
@@ -160,6 +221,48 @@ export interface CreateDiagramRequest {
|
||||
tables: string[];
|
||||
};
|
||||
node_positions?: NodePositions;
|
||||
// 🔥 수정: 각 관계별 정보를 배열로 저장
|
||||
category?: Array<{
|
||||
id: string;
|
||||
category: "simple-key" | "data-save" | "external-call";
|
||||
}>;
|
||||
// 🔥 전체 실행 조건 - relationships의 id와 동일한 id 사용
|
||||
control?: Array<{
|
||||
id: string; // relationships의 id와 동일
|
||||
triggerType: "insert" | "update" | "delete";
|
||||
conditions?: Array<{
|
||||
field: string;
|
||||
operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "LIKE";
|
||||
value: unknown;
|
||||
logicalOperator?: "AND" | "OR";
|
||||
}>;
|
||||
}>;
|
||||
// 🔥 저장 액션 - relationships의 id와 동일한 id 사용
|
||||
plan?: Array<{
|
||||
id: string; // relationships의 id와 동일
|
||||
sourceTable: string;
|
||||
actions: Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
actionType: "insert" | "update" | "delete" | "upsert";
|
||||
fieldMappings: Array<{
|
||||
sourceTable?: string;
|
||||
sourceField: string;
|
||||
targetTable?: string;
|
||||
targetField: string;
|
||||
defaultValue?: string;
|
||||
transformFunction?: string;
|
||||
}>;
|
||||
conditions?: Array<{
|
||||
id: string;
|
||||
type: string;
|
||||
field: string;
|
||||
operator_type: string;
|
||||
value: unknown;
|
||||
logicalOperator?: string;
|
||||
}>;
|
||||
}>;
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface JsonDataFlowDiagramsResponse {
|
||||
@@ -241,7 +344,7 @@ export class DataFlowAPI {
|
||||
* 테이블 관계 생성
|
||||
*/
|
||||
static async createRelationship(
|
||||
relationship: any, // 백엔드 API 형식 (camelCase)
|
||||
relationship: Omit<TableRelationship, "relationship_id">, // 백엔드 API 형식 (camelCase)
|
||||
): Promise<TableRelationship> {
|
||||
try {
|
||||
const response = await apiClient.post<ApiResponse<TableRelationship>>(
|
||||
@@ -526,8 +629,7 @@ export class DataFlowAPI {
|
||||
to_table_name: rel.toTable,
|
||||
from_column_name: rel.fromColumns.join(","),
|
||||
to_column_name: rel.toColumns.join(","),
|
||||
relationship_type: rel.relationshipType as "one-to-one" | "one-to-many" | "many-to-one" | "many-to-many",
|
||||
connection_type: rel.connectionType as "simple-key" | "data-save" | "external-call",
|
||||
connection_type: (jsonDiagram.category as "simple-key" | "data-save" | "external-call") || "simple-key", // 관계도의 category 사용
|
||||
company_code: companyCode, // 실제 사용자 회사 코드 사용
|
||||
settings: rel.settings || {},
|
||||
created_at: jsonDiagram.created_at,
|
||||
|
||||
Reference in New Issue
Block a user