Files
Aislo/A00_Common/group_workflow.ts
T
eomsangdonandClaude Opus 5.5 f2e8bd6d5f feat(536-1): E06 암반 평사투영 — Markland 판정 · Hoek-Bray 평면 · 쐐기 안전율 · 스테레오넷 · 절리 입력 · 화면
- 엔진(자체 · NumPy · SciPy): 평면 · 쐐기(교선) · 전도 Markland(측방 한계 20° 기본) · 평면 Hoek-Bray(인장균열 없음 · 임계 · 깊이 · 수압 · kh · 수동 볼트) · 쐐기 SWedge 꼴(미끄럼 방향 8 경우 · 두 면 · 한 면 · 수압 중력식 · kh · 볼트)
- 스테레오넷 좌표(등각 · 등면적 하반구 · 극점 · 대원 · 교선 · 마찰원 · 일광 엔벨로프 · 위험 영역 = 판정 부등식)
- 길: 절리 작업본 E06_StabRock/joints.json(초기값 · 저장 · 초기화) · 해석 = 암 측점 깎기 쪽만 · 파생 저장본 stab_rock · 결과 · 측점 스테레오넷
- 화면: 좌 절리군 표 · 설정 / 가운데 위험 띠 · 스테레오넷 / 우 측점 결과 · 안전율 표 · E 단계 막대에 E06(끝에 덧붙임)
- 시험 test_536_1(Hoek Sau Mau Ping 0.8184 · 1.0655 · Sharma 윗면 무게 · Hoek-Bray 쐐기 계수 · Kumsar · Priest 두 예제 · Markland 경계 · 투영 왕복 · 위험 영역 = 판정) · test_528 E 단계 수 4 → 5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 21:26:37 +09:00

113 lines
4.0 KiB
TypeScript

/* =============================================================================
* group_workflow.ts
* D 예정노선 · E 안정성평가 단계 묶음(요구 345 · PLAN 529-1) — B05~B09 틀(`createWorkflowLayout`)을
* 단계 목록 · 아이콘 · 주소 인자로 그대로 씀. 빈 단계 = 틀 · 좌측 패널([?] [<] [>]) · 단계 막대만.
* 페이지 길 = 각 폴더 `draft/<폴더>_Route.ts` · 본문이 생기면 그 폴더 페이지로 갈아 끼움.
* ========================================================================== */
import {
API_BASE_URL,
CURRENT_PROJECT_ID_KEY,
PLAN_STEP_ROUTES,
STAB_STEP_ROUTES,
type RoutePath,
} from "@config/config_frontend";
import { el, hideLoadingOverlay, showLoadingOverlay, showToast } from "@ui/ui_template_elements";
import { t, type LocaleKey } from "@ui/ui_template_locale";
import { createWorkflowLayout } from "@ui/ui_template_workflow_layout";
import { navigateTo, type PageRenderer } from "./router";
interface GroupFlow {
routes: readonly RoutePath[];
labels: readonly LocaleKey[];
icons: readonly string[];
}
const FLOWS: readonly GroupFlow[] = [
{
routes: PLAN_STEP_ROUTES,
labels: ["DE_Step_PlanBase", "DE_Step_PlanAnalysis", "DE_Step_PlanConfirm"],
icons: ["📍", "🧭", "✅"],
},
{
routes: STAB_STEP_ROUTES,
labels: [
"DE_Step_StabGround",
"DE_Step_StabSection",
"DE_Step_Stab3D",
"DE_Step_StabReport",
"DE_Step_StabRock",
],
icons: ["🪨", "📐", "🧊", "📄", "⛰️"],
},
];
/** 종류별 단계 묶음(대시보드 표 단계 막대 · 528-2) — ROAD · 모르는 종류 = 없음(B 막대 그대로) */
export function groupFlowOf(
kind: string | null | undefined,
): { routes: readonly RoutePath[]; steps: string[]; icons: readonly string[] } | null {
const flow = { PLAN: FLOWS[0], STABILITY: FLOWS[1] }[kind ?? ""];
return flow ? { ...flow, steps: flow.labels.map((key) => t(key)) } : null;
}
/** 단계 틀을 세움 — mainContent · leftPanel 이 없으면 빈 단계 안내 · [?] 줄만 */
export function mountGroupStep(
root: HTMLElement,
route: RoutePath,
parts: { mainContent?: HTMLElement; leftPanel?: HTMLElement } = {},
): void {
const flow = FLOWS.find((f) => f.routes.includes(route));
if (!flow) throw new Error(`단계 묶음 밖 주소: ${route}`);
const active = flow.routes.indexOf(route);
const layout = createWorkflowLayout({
title: t(flow.labels[active]),
steps: flow.labels.map((key) => t(key)),
icons: flow.icons,
activeStep: active,
routes: flow.routes,
leftPanel: parts.leftPanel,
mainContent:
parts.mainContent ?? el("p", { className: "app-placeholder", text: t("DE_Step_Empty") }),
onStepClick: (_index, next) => navigateTo(next as RoutePath),
});
root.append(layout.root);
}
/** 빈 단계 페이지(길 선언의 load 가 부름) */
export const groupStepPage =
(route: RoutePath): PageRenderer =>
(root) =>
mountGroupStep(root, route);
/** 등록 화면 [등록](D01 · E01) — POST → 현재 프로젝트로 기억 → 첫 단계로 · 실패 = 서버 까닭 알림 */
export async function createGroupProject(
path: string,
body: object,
firstStep: RoutePath,
): Promise<void> {
showLoadingOverlay();
try {
const response = await fetch(`${API_BASE_URL}${path}`, {
method: "POST",
headers: { "Content-Type": "application/json" },
credentials: "include",
body: JSON.stringify(body),
});
const data = (await response.json().catch(() => ({}))) as {
project_id?: string;
detail?: unknown;
};
if (!response.ok || !data.project_id) {
const detail = typeof data.detail === "string" ? data.detail : `HTTP ${response.status}`;
throw new Error(detail);
}
localStorage.setItem(CURRENT_PROJECT_ID_KEY, data.project_id);
showToast(t("DE_Reg_Success"), "success");
navigateTo(firstStep);
} catch (error) {
showToast(error instanceof Error ? error.message : t("Common_Status_Error"), "error");
} finally {
hideLoadingOverlay();
}
}