261019_01_ENH: 리스트 비동기 작업 동시 실행 제한 및 진행 상태 UI 개선, 미사용 참조 정리

This commit is contained in:
2026-10-19 14:22:07 +09:00
parent 4e51530922
commit d2e826702e
46 changed files with 1398 additions and 406 deletions

View File

@@ -15,6 +15,7 @@ import {
import { KriSingleSelect } from '@/components/common/KriAutoComplete'
import ApplyFilterOption, { validateApplyFilterTarget } from './ListDialogOption/ApplyFilterOption'
import { useDialog } from '@/hooks/useDialog'
import { ListJobGatePanel, useListJobGate } from '@/components/list/ListJobGate'
import type { DialogId } from '@/store/jotai/dialog'
import type { FilterValueOption, ListFilterTarget } from '@/types/list'
import { type ProjectSurvey, type ResultCode, ResultCodeType } from '@/types/project'
@@ -47,6 +48,7 @@ export type BatchEditPayload = {
}
export type ListBatchEditDialogProps = {
prjctIdx: number
dialogId?: DialogId
open?: boolean
onOpenChange?: (open: boolean) => void
@@ -75,6 +77,7 @@ const resultCodeGroups: { type: Exclude<ResultCodeType, ResultCodeType.SURVEY>;
]
const ListBatchEditDialog = ({
prjctIdx,
dialogId = 'listBatchEditDialog',
open,
onOpenChange,
@@ -98,6 +101,7 @@ const ListBatchEditDialog = ({
const rowInputRefs = useRef<Map<string, HTMLInputElement>>(new Map())
const resolvedOpen = open ?? isDialogOpen(dialogId)
const gate = useListJobGate({ prjctIdx, jobType: 'LIST_UPDATE', active: resolvedOpen })
const defaultHeaderId = headerOptions[0]?.id ?? 0
const isFileHeader = (headerId: number) => headerOptions.find((option) => option.id === headerId)?.listHderTy === ListHeaderConst.FILE
@@ -168,6 +172,7 @@ const ListBatchEditDialog = ({
}
const handleConfirm = async () => {
if (gate.submitBlocked || submitting) return
setInvalidRowId(null)
if (!validateApplyFilterTarget(target, { selectedCount: selectedSids.length, filterSummary })) return
@@ -203,7 +208,6 @@ const ListBatchEditDialog = ({
setSubmitting(true)
try {
await onConfirm({ rows: normalized, resultCodes: resultCodeSelections, surveyResultCodes, target })
handleOpenChange(false)
} finally {
setSubmitting(false)
}
@@ -214,19 +218,23 @@ const ListBatchEditDialog = ({
open={resolvedOpen}
onOpenChange={handleOpenChange}
title={<span className="text-2xl font-bold">일괄 수정</span>}
contentClassName="sm:max-w-[900px]"
contentClassName="sm:max-w-[900px] max-h-[90vh] overflow-y-auto"
bodyClassName="space-y-4"
footer={
<>
<Button type="button" variant="outline" onClick={() => handleOpenChange(false)} disabled={submitting}>
취소
</Button>
<Button type="button" onClick={handleConfirm} disabled={submitting}>
적용
{gate.hasCurrentJob ? '닫기' : '취소'}
</Button>
{!gate.hasCurrentJob && (
<Button type="button" onClick={handleConfirm} disabled={submitting || gate.submitBlocked}>
적용
</Button>
)}
</>
}
>
<ListJobGatePanel gate={gate} acknowledgeLabel="새 작업" />
{!gate.hasCurrentJob && <>
<div className="rounded-md border p-4 space-y-4">
<p className="text-lg font-semibold">적용 대상</p>
<ApplyFilterOption
@@ -399,6 +407,7 @@ const ListBatchEditDialog = ({
<Plus className="w-4 h-4" />
행 추가
</Button>
</>}
</KriDialog>
)
}