feat(481-2 B08 · B09 저장 후 이동): 단계 이동 = 보이는 화면 저장 성공 뒤 · 실패면 머묾
- B08 = 왼쪽 옵션(옵션 · 이정 캐시) → 지금 탭(자재 · 수리 · 떠난 탭 host.isConnected 거짓이면 안 부름) · 캐시 없으면 요청 없이 - 저장 함수(옵션 · 자재 · 수리 · B09 run) 성공 여부 돌려줌 · B09 = 불러오기 전 · 고침 없음이면 요청 없이 이동 - 시험 test_481_2_save_move 새로 · 121 · 122 원본 줄 기대 갱신 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -275,15 +275,15 @@ export function renderB09Estimation(root: HTMLElement): void {
|
||||
show(current);
|
||||
};
|
||||
|
||||
// keep = 화면 캐시 그대로(296 [업데이트] — 지운 줄 · 고친 칸을 안 되살림)
|
||||
// keep = 화면 캐시 그대로(296 [업데이트] — 지운 줄 · 고친 칸을 안 되살림) · 참 = 성공
|
||||
const run = async (
|
||||
path: string,
|
||||
method: string,
|
||||
done: string,
|
||||
init?: Row,
|
||||
keep = false,
|
||||
): Promise<void> => {
|
||||
if (!projectId) return;
|
||||
): Promise<boolean> => {
|
||||
if (!projectId) return false;
|
||||
showLoadingOverlay();
|
||||
try {
|
||||
const next = await request<Row>(`/projects/${projectId}${path}`, {
|
||||
@@ -293,18 +293,18 @@ export function renderB09Estimation(root: HTMLElement): void {
|
||||
if (!keep) clearState("b09-estimation", projectId);
|
||||
apply(next, !keep);
|
||||
showToast(done, "success");
|
||||
return true;
|
||||
} catch (error) {
|
||||
showToast(`하지 못했습니다 — ${String(error)}`, "error");
|
||||
return false;
|
||||
} finally {
|
||||
hideLoadingOverlay();
|
||||
}
|
||||
};
|
||||
|
||||
const save = createButton({
|
||||
label: "저장",
|
||||
variant: "filled",
|
||||
onClick: () => void run("/estimation", "PUT", "원가 사용자 값을 저장했습니다.", { user }),
|
||||
});
|
||||
const saveUser = (): Promise<boolean> =>
|
||||
run("/estimation", "PUT", "원가 사용자 값을 저장했습니다.", { user });
|
||||
const save = createButton({ label: "저장", variant: "filled", onClick: () => void saveUser() });
|
||||
save.dataset.b09Save = "";
|
||||
const refresh = createButton({
|
||||
label: "업데이트",
|
||||
@@ -352,8 +352,13 @@ export function renderB09Estimation(root: HTMLElement): void {
|
||||
mainContent: body,
|
||||
leftPanel: left,
|
||||
routes: WORKFLOW_STEP_ROUTES,
|
||||
// 481-2 단계 이동 = 고친 값 저장 성공 뒤 · 실패면 머묾 · 불러오기 전 · 고침 없음 = 요청 없이
|
||||
onStepClick: (stepIndex: number) => {
|
||||
if (projectId) goToWorkflowStage(projectId, WORKFLOW_STEP_ROUTES[stepIndex]);
|
||||
if (!projectId) return;
|
||||
const changed = payload && readState("b09-estimation", projectId);
|
||||
void (changed ? saveUser() : Promise.resolve(true)).then(
|
||||
(ok) => ok && goToWorkflowStage(projectId, WORKFLOW_STEP_ROUTES[stepIndex]),
|
||||
);
|
||||
},
|
||||
});
|
||||
root.append(layout.root);
|
||||
|
||||
Reference in New Issue
Block a user