ESlint 문법 에러 수정
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
import dayjs from "dayjs";
|
||||
import { createColumnHelper } from "@tanstack/react-table";
|
||||
import { type Link } from "@/entities/link";
|
||||
import { Button } from "@common/components";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { LinkApi } from "@/entities/link";
|
||||
import { useAlertStore } from "@/shared/lib/use-alert-store";
|
||||
import QuickStartButton from "../ui/QuickStartButton";
|
||||
|
||||
const columnHelper = createColumnHelper<Link>();
|
||||
|
||||
@@ -83,30 +80,7 @@ const columns = [
|
||||
id: 'quick_start_btn',
|
||||
header: '즉시 실행',
|
||||
cell: (info) => {
|
||||
const row = info.row.original;
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
|
||||
const { mutateAsync: updateQuickStart } = useMutation({
|
||||
mutationFn: (linkSn: string) => LinkApi.linkQuickStart(linkSn),
|
||||
onSuccess: (resut) => {
|
||||
if (resut === 'succ') {
|
||||
alert('즉시 실행 요청이 완료되었습니다.');
|
||||
} else {
|
||||
alert('기존 요청이 실행 대기중입니다.');
|
||||
}
|
||||
},
|
||||
onError: () => {
|
||||
alert('즉시 실행 요청을 실패했습니다.');
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<Button color="sky" onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
updateQuickStart(row.link_sn);
|
||||
}
|
||||
}>즉시 실행</Button>
|
||||
)
|
||||
return <QuickStartButton linkSn={info.row.original.link_sn} />
|
||||
}
|
||||
})
|
||||
];
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { LinkApi } from "@/entities/link";
|
||||
import { useAlertStore } from "@/shared/lib/use-alert-store";
|
||||
import { Button } from "@common/components";
|
||||
|
||||
const QuickStartButton: React.FC<{ linkSn: string }> = ({ linkSn }) => {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
|
||||
const { mutateAsync: updateQuickStart } = useMutation({
|
||||
mutationFn: (linkSn: string) => LinkApi.linkQuickStart(linkSn),
|
||||
onSuccess: (result) => {
|
||||
if (result === 'succ') {
|
||||
alert('즉시 실행 요청이 완료되었습니다.');
|
||||
} else {
|
||||
alert('기존 요청이 실행 대기중입니다.');
|
||||
}
|
||||
},
|
||||
onError: () => {
|
||||
alert('즉시 실행 요청을 실패했습니다.');
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<Button
|
||||
color="sky"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
updateQuickStart(linkSn);
|
||||
}}
|
||||
>
|
||||
즉시 실행
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
||||
export default QuickStartButton;
|
||||
@@ -50,7 +50,11 @@ const LinkForm = ({ form, linkSn, updateLinkInfo, handleInsertLink, deleteLink,
|
||||
await handleConfirm(async () => {
|
||||
|
||||
if (await confirm(confirmMsg)) {
|
||||
!!linkSn ? updateLinkInfo?.(data) : handleInsertLink?.(data);
|
||||
if (linkSn) {
|
||||
updateLinkInfo?.(data);
|
||||
} else {
|
||||
handleInsertLink?.(data);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -578,7 +582,7 @@ const LinkForm = ({ form, linkSn, updateLinkInfo, handleInsertLink, deleteLink,
|
||||
</div>
|
||||
</form>
|
||||
</Form>
|
||||
<ConfirmDialog open={onConfirm} />
|
||||
<ConfirmDialog isOpen={onConfirm} />
|
||||
</>
|
||||
)
|
||||
};
|
||||
|
||||
@@ -4,8 +4,8 @@ import "@common/assets/styles/grid.css";
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { Button, DataTable, Input, Label, LoadingWithAnimation } from "@common/components";
|
||||
import { getCoreRowModel, useReactTable } from "@tanstack/react-table";
|
||||
import { Button, Input, Label, LoadingWithAnimation } from "@common/components";
|
||||
import { getCoreRowModel } from "@tanstack/react-table";
|
||||
import { LinkApi, type Link, type LinkSearchParam } from "@/entities/link";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { columns } from "../model/table-columns";
|
||||
|
||||
@@ -58,7 +58,7 @@ function ModifyLinkPage({ linkSn }: { linkSn: string }) {
|
||||
}
|
||||
});
|
||||
|
||||
const fetchUserInfo = async (id: string) => {
|
||||
const fetchUserInfo = async () => {
|
||||
const userData = await getUserInfo();
|
||||
return userData.userName;
|
||||
};
|
||||
@@ -74,7 +74,7 @@ function ModifyLinkPage({ linkSn }: { linkSn: string }) {
|
||||
let newData = { ...linkInfo };
|
||||
|
||||
if (linkInfo.mdfr) {
|
||||
const userName = await fetchUserInfo(linkInfo.mdfr);
|
||||
const userName = await fetchUserInfo();
|
||||
newData = {
|
||||
...linkInfo,
|
||||
mdfr: userName,
|
||||
|
||||
@@ -41,7 +41,7 @@ function RegistLinkPage() {
|
||||
});
|
||||
|
||||
const handleInsertLink = (data: LinkFormData) => {
|
||||
let insertData = {
|
||||
const insertData = {
|
||||
...data,
|
||||
link_clsf_cd: data.link_clsf_cd !== 'none' ? data.link_clsf_cd : null,
|
||||
next_link_excn_dt: dayjs().add(Number(data.link_batch_time), 'minute').format('YYYY-MM-DD HH:mm:ss'),
|
||||
|
||||
@@ -55,12 +55,12 @@ function LinkParamsDialog({ selectedLink, form, insertLinkVrbl, dialogOpen, onOp
|
||||
setOnConfirm(false);
|
||||
};
|
||||
|
||||
function replaceEmptyWithNull<T extends Record<string, any>>(data: T): T {
|
||||
function replaceEmptyWithNull<T extends Record<string, unknown>>(data: T): T {
|
||||
const result = {} as T;
|
||||
for (const [key, value] of Object.entries(data)) {
|
||||
result[key as keyof T] = value === '' ? null : value;
|
||||
(result as Record<string, unknown>)[key] = value === '' ? null : value;
|
||||
}
|
||||
return result;
|
||||
return result as T;
|
||||
};
|
||||
|
||||
const handleSubmit = async (data: LinkVrblFormData) => {
|
||||
@@ -70,7 +70,11 @@ function LinkParamsDialog({ selectedLink, form, insertLinkVrbl, dialogOpen, onOp
|
||||
const cleanData = replaceEmptyWithNull(data);
|
||||
|
||||
if (await confirm(confirmMsg)) {
|
||||
isModifyMode ? updateLinkVrbl(isToday ? { ...cleanData, link_vrbl_vl: checkNowMonth } : cleanData) : insertLinkVrbl(isToday ? { ...cleanData, link_vrbl_vl: checkNowMonth } : cleanData);
|
||||
if (isModifyMode) {
|
||||
updateLinkVrbl(isToday ? { ...cleanData, link_vrbl_vl: checkNowMonth } : cleanData);
|
||||
} else {
|
||||
insertLinkVrbl(isToday ? { ...cleanData, link_vrbl_vl: checkNowMonth } : cleanData);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -205,7 +205,7 @@ function LinkParamsPage() {
|
||||
});
|
||||
};
|
||||
|
||||
const fetchUserInfo = async (id: string) => {
|
||||
const fetchUserInfo = async () => {
|
||||
const userData = await getUserInfo();
|
||||
return userData.userName;
|
||||
};
|
||||
@@ -229,7 +229,7 @@ function LinkParamsPage() {
|
||||
let newData = { ...linkVrblInfo };
|
||||
|
||||
if (linkVrblInfo.mdfr) {
|
||||
const userName = await fetchUserInfo(linkVrblInfo.mdfr);
|
||||
const userName = await fetchUserInfo();
|
||||
newData = {
|
||||
...linkVrblInfo,
|
||||
mdfr: userName,
|
||||
|
||||
@@ -279,8 +279,8 @@ function LinkStatsPage() {
|
||||
endDate: dayjs().format('YYYY-MM-DD'),
|
||||
});
|
||||
setEndDate(dayjs().format('YYYY-MM-DD'));
|
||||
setStartDate(dayjs().format('YYYY-MM-DD')),
|
||||
setLinkStatsList(data);
|
||||
setStartDate(dayjs().format('YYYY-MM-DD'));
|
||||
setLinkStatsList(data);
|
||||
setLinkSearchParam({
|
||||
...linkSearchParam,
|
||||
startDate: dayjs().format('YYYY-MM-DD'),
|
||||
|
||||
@@ -58,17 +58,19 @@ function LinkTableDialog({ dialogOpen, onOpenChange, form, tableInfo, insertLink
|
||||
|
||||
await handleConfirm(async () => {
|
||||
if (await confirm(confirmMsg)) {
|
||||
!isModifyMode
|
||||
? insertLinkTableCol({
|
||||
...data,
|
||||
link_sn: tableInfo.link_sn,
|
||||
tbl_sn: tableInfo.tbl_sn,
|
||||
})
|
||||
: updateLinkTableCol({
|
||||
if (!isModifyMode) {
|
||||
insertLinkTableCol({
|
||||
...data,
|
||||
link_sn: tableInfo.link_sn,
|
||||
tbl_sn: tableInfo.tbl_sn,
|
||||
});
|
||||
} else {
|
||||
updateLinkTableCol({
|
||||
...data,
|
||||
link_sn: tableInfo.link_sn,
|
||||
tbl_sn: tableInfo.tbl_sn,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -492,7 +494,7 @@ function LinkTableDialog({ dialogOpen, onOpenChange, form, tableInfo, insertLink
|
||||
</DialogFooter>
|
||||
</form>
|
||||
</Form>
|
||||
<ConfirmDialog open={onConfirm} />
|
||||
<ConfirmDialog isOpen={onConfirm} />
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
)
|
||||
|
||||
@@ -281,7 +281,7 @@ function LinkTablePage() {
|
||||
let newData = { ...colInfo };
|
||||
|
||||
if (colInfo.mdfr) {
|
||||
const userName = await fetchUserInfo(colInfo.mdfr);
|
||||
const userName = await fetchUserInfo();
|
||||
newData = {
|
||||
...colInfo,
|
||||
mdfr: userName,
|
||||
@@ -294,7 +294,7 @@ function LinkTablePage() {
|
||||
setDialogOpen(true)
|
||||
};
|
||||
|
||||
const fetchUserInfo = async (id: string) => {
|
||||
const fetchUserInfo = async () => {
|
||||
const userData = await getUserInfo();
|
||||
return userData.userName;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user