From eb30b3f16a1547b161a8bfaa69ec80004b8304e7 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Fri, 2 Oct 2026 07:42:59 +0900 Subject: [PATCH] =?UTF-8?q?refactor(m02-df):=20=EB=8B=A4=EB=A5=B8=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=9E=85=EB=A0=A5=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=82=B4=20=EC=8B=9C=ED=97=98=20=ED=9D=90=EB=A6=84=EB=8F=84(DF?= =?UTF-8?q?-)=20=EB=AC=B4=EB=A6=AC=20=C2=B7=20cfList=20=C2=B7=20cfGet=20?= =?UTF-8?q?=EC=A7=80=EC=9B=80=20=E2=80=94=20=EA=B3=A0=EB=A5=BC=20=EB=8C=80?= =?UTF-8?q?=EC=83=81=EC=9D=80=20=EB=A7=88=EC=8A=A4=ED=84=B0=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=EB=A7=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_019ACSGaHdLgnkEkoA4LDtMU --- .../DataFlow/M02_DF_InputPanel_Logic.ts | 39 +++++-------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/M02_MasterTemplete/DataFlow/M02_DF_InputPanel_Logic.ts b/M02_MasterTemplete/DataFlow/M02_DF_InputPanel_Logic.ts index d23404fed..ef6b708dd 100644 --- a/M02_MasterTemplete/DataFlow/M02_DF_InputPanel_Logic.ts +++ b/M02_MasterTemplete/DataFlow/M02_DF_InputPanel_Logic.ts @@ -1,6 +1,6 @@ /* ============================================================================= * M02_DF_InputPanel_Logic.ts - * 입력 판 — 입력 갈래 「다른 로직」: 마스터 로직 전체(원문 · 장 · 찾기 · 쪽)와 내가 만든 흐름도 로직 가운데 하나를 고르면 + * 입력 판 — 입력 갈래 「다른 로직」: 마스터 로직 전체(원문 · 장 · 찾기 · 쪽) 가운데 하나를 고르면 * 그 로직의 출력 = 내보내는 알약 · 설계 때 정할 것 = 받는 알약(이어 주지 않으면 그 로직의 예시값) · 값은 서버 계산 길 * 옛 로직은 서버가 흐름도로 바꿔 읽음(`GET /api/m01/logic/flow` · 파일은 안 바뀜) · 자기 자신 · 돌고 도는 로직은 못 고름 * 글 [한, 영] 짝은 아래 TEXT · 단추는 공용 작은 크기 @@ -19,7 +19,7 @@ import { fetchLogic, fetchLogics, } from "../../M01_MasterData/M01_MasterData_UI_Logic_Api"; -import { cfGet, cfList, cfLogicFlow, cfLogicValue, cfPlain } from "./M02_DF_Api"; +import { cfLogicFlow, cfLogicValue, cfPlain } from "./M02_DF_Api"; import type { CfLogic, CfLogicRef } from "./M02_DF_Model"; import { filterLogics, @@ -37,7 +37,7 @@ import { const TEXT = { Help: [ - "마스터 로직이나 내가 만든 흐름도 로직을 불러와 그 결과를 이 상자의 알약으로 씀", + "마스터 로직을 불러와 그 결과를 이 상자의 알약으로 씀", "Use any master logic or a logic of mine as an input", ], Search: ["로직 이름 · 번호 찾기 — 띄어 쓰면 모두 들어간 것", "Search — all words must match"], @@ -49,7 +49,6 @@ const TEXT = { Total: ["전체 {n} 개 중 {a}~{b} · {p} / {m} 쪽", "{a}-{b} of {n} · page {p} / {m}"], Prev: ["이전", "Prev"], Next: ["다음", "Next"], - Mine: ["내가 만든 것", "Mine"], Blocked: ["읽을 수 없음", "Unreadable"], Chosen: ["고른 로직", "Chosen logic"], Converted: [ @@ -97,38 +96,20 @@ const plain = (e: unknown): string => { }; const PAGE = 12; -const MINE = "흐름도"; -/** 마스터 로직 목록 한 번 + 내 흐름도 로직(견본은 뺌) */ +/** 마스터 로직 목록 — 한 번 받아 둠(M01 `fetchLogics`) */ let cache: Promise | null = null; const loadAll = (): Promise => - (cache ??= Promise.all([fetchLogics(), cfList().catch(() => [])]) - .then(([master, mine]) => [ - ...mine - .filter((i) => !i.sample) - .map((i): MasterLogicBrief => ({ - file: MINE, - 구분: MINE, - 상세구분: t("Mine"), - 키: i.key, - 원문번호: "", - 이름: i.name, - 결과단위: i.resultUnit, - })), - ...master, - ]) - .catch((e: unknown) => ((cache = null), Promise.reject(e)))); + (cache ??= fetchLogics().catch((e: unknown) => ((cache = null), Promise.reject(e)))); /** 고른 로직에서 읽은 것 — 옛 로직을 바꿔 읽었나 · 못 옮긴 곳(화면에만 · 저장 안 함) */ const readNotes = new Map(); -/** 로직 하나를 읽어 흐름도로 — 내 흐름도 로직 = 서버 저장 그대로 · 마스터 = 흐름 받기 길 */ -async function flowOf( +/** 마스터 로직 하나를 읽어 흐름도로 — 흐름 받기 길(흐름이 없으면 옛 로직을 바꿔 읽음) */ +const flowOf = ( item: Pick, -): Promise<{ flow: CfLogic; converted: boolean; notes: string[] }> { - if (item.file === MINE) return { flow: await cfGet(item.키), converted: false, notes: [] }; - return cfLogicFlow(item.file, item.키); -} +): Promise<{ flow: CfLogic; converted: boolean; notes: string[] }> => + cfLogicFlow(item.file, item.키); /** 다른 로직 입력 판 */ export function renderLogicInput( @@ -214,7 +195,7 @@ export function renderLogicInput( el("span", { className: "m02-dfip__muted", text: ` ${i.원문번호}` }), el("span", { className: "m02-dfip__tag", - text: i.blocked ? t("Blocked") : i.file === MINE ? t("Mine") : i.상세구분, + text: i.blocked ? t("Blocked") : i.상세구분, }), ], }),