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.상세구분, }), ], }),