From a8ab28ca178f3b69e5389b7330c107a4f9fde499 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Tue, 29 Sep 2026 20:41:51 +0900 Subject: [PATCH] =?UTF-8?q?refactor(B05):=20Page=5FActions=20=EC=9D=98=20[?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=ED=99=94]=20=EB=B3=B8=EB=AC=B8=EC=9D=84=20?= =?UTF-8?q?=EC=98=9B=20=EC=9E=90=EB=A6=AC=EB=A1=9C=20=EB=90=98=EB=8F=8C?= =?UTF-8?q?=EB=A6=BC(sub4=20=EC=A0=80=EC=9E=A5=20=ED=95=9C=20=EC=A4=84?= =?UTF-8?q?=EA=B8=B0=EC=99=80=20=EC=B6=A9=EB=8F=8C=20=ED=94=BC=ED=95=A8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - resetDesignAction 은 sub4 판 위에서 design_reset 호출로 다시 바꿈(다음 커밋) - B06 [초기화]는 design_reset 을 그대로 부름 Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01EauA2ATmqNRbeV48s9CcBr --- B05_Profile/B05_Profile_UI_Page_Actions.ts | 50 ++++++++++++++++++---- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/B05_Profile/B05_Profile_UI_Page_Actions.ts b/B05_Profile/B05_Profile_UI_Page_Actions.ts index 6d1c8aee..8b822cad 100644 --- a/B05_Profile/B05_Profile_UI_Page_Actions.ts +++ b/B05_Profile/B05_Profile_UI_Page_Actions.ts @@ -7,10 +7,22 @@ * 세션에 쌓인 조작은 [저장]·[확정]에서만 정본으로 나간다). * ========================================================================== */ +import { ROUTES } from "@config/config_frontend"; import { currentLanguageIndex, ui_locales } from "@ui/ui_template_locale"; -import { hideLoadingOverlay, showLoadingOverlay, showToast } from "@ui/ui_template_elements"; -import { resetDesign } from "../A00_Common/design/design_reset"; -import { confirmRoute, solveRoute, type RouteLatestResponse } from "./B05_Profile_Api_Fetch"; +import { + hideLoadingOverlay, + showConfirmDialog, + showLoadingOverlay, + showToast, +} from "@ui/ui_template_elements"; +import { navigateTo } from "../A00_Common/router"; +import { + clearRouteLatestCache, + confirmRoute, + resetRouteDesign, + solveRoute, + type RouteLatestResponse, +} from "./B05_Profile_Api_Fetch"; import { flushCulvertOptions } from "../B06_Section/B06_Section_Api_Culvert_Options"; import { flushPendingPipes } from "./B05_Profile_Api_Pipes_Draft"; import { stateKey } from "../A00_Common/b_page_state"; @@ -18,8 +30,10 @@ import { invalidateSectionDetail, saveCachedCrossPatches, } from "../B06_Section/B06_Section_Section_Store"; +import { clearDrafts } from "../A00_Common/b_page_state"; import { saveCorridorIfDirty } from "./B05_Profile_UI_Corridor"; import { circlePoint, routePoint } from "./B05_Profile_UI_Page_Helpers"; +import { clearAlignmentDrafts } from "./B05_Profile_UI_Profile_Edit"; import type { createRoutePanel } from "./B05_Profile_UI_Panel"; import type { createRouteProfilePanel } from "./B05_Profile_UI_Profile_Panel"; import type { createStructuresBridge } from "./B05_Profile_UI_Page_Structures"; @@ -183,10 +197,30 @@ export async function tempSaveAction(ctx: PageActionContext): Promise { } } -/** [초기화] — 두 보기가 같은 함수를 부른다(`design_reset` · 계획서 24-2b). 페이지만 아는 - * 상단측 변경분만 여기서 비운다. */ +/** [초기화] — 사용자 편집 전부 폐기, 계획노선 CSV 기본값으로 B05·B06 재계산 후 재진입. + * 네이티브 confirm은 공용 헤드 브라우저가 자동 취소해 버튼이 죽은 듯 보였다 + * (2026-08-19 진단) — 화면 안 모달로 확인받는다. */ export async function resetDesignAction(ctx: PageActionContext): Promise { - await resetDesign(ctx.projectId, ctx.latest()?.route?.id ?? null, () => - ctx.uphillOverrides.clear(), - ); + if (!(await showConfirmDialog(L("B05_Route_Reset_Confirm"), "초기화"))) return; + showLoadingOverlay(); + try { + await resetRouteDesign(ctx.projectId); + // 옛 경로 기준 캐시를 전부 비우고 페이지를 새로 그린다 — 초기 계산본이 정본이 된다. + clearRouteLatestCache(ctx.projectId); + invalidateSectionDetail(ctx.projectId); + // 사용자 조작(② 초안)은 **등록표 한 곳**에서 통째로 버린다(2026-09-06 일원화). + // 예전에는 파일마다 따로 지워 새 값이 늘 때 빠뜨리기 쉬웠다. 노선 범위 초안은 + // 노선이 바뀌면 키가 달라져 자연히 딸려 오지 않는다. + clearDrafts(ctx.projectId, ctx.latest()?.route?.id ?? null); + ctx.uphillOverrides.clear(); + // 계획선 편집 초안도 함께 버린다 — 남기면 초기값 위에 옛 편집이 다시 얹혀 계획선이 + // 측점에서 원지반선과 만나지 않는다(2026-09-04 실측: 새로고침 후 최대 6.0m 어긋남). + clearAlignmentDrafts(); + showToast(L("B05_Route_Reset_Success"), "success"); + navigateTo(ROUTES.B05_PROFILE); + } catch (error) { + showToast(error instanceof Error ? error.message : L("B05_Route_Reset_Failed"), "error"); + } finally { + hideLoadingOverlay(); + } }