Merge branch 'main' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs_cs
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import type {
|
||||
LoginlogInfo,
|
||||
LoginlogList,
|
||||
LoginlogParams,
|
||||
LoginlogService,
|
||||
} from "../model/loginlog-interface";
|
||||
|
||||
export class LoginlogApiService implements LoginlogService {
|
||||
public async getLoginlogList(params: LoginlogParams): Promise<LoginlogList> {
|
||||
const response = await client.get<LoginlogList>(
|
||||
`${ENDPOINT.USER_SERVICE.LOGINLOG}`,
|
||||
{ params },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getLoginlogInfo(lgnSn: string): Promise<LoginlogInfo> {
|
||||
const response = await client.get<LoginlogInfo>(
|
||||
`${ENDPOINT.USER_SERVICE.LOGINLOG}/${lgnSn}`,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
export const LoginlogApi = new LoginlogApiService();
|
||||
@@ -0,0 +1,5 @@
|
||||
export { LoginlogApiService } from "./api/loginlog-service";
|
||||
export type {
|
||||
Loginlog,
|
||||
LoginlogParams,
|
||||
} from "./model/loginlog-interface";
|
||||
@@ -0,0 +1,37 @@
|
||||
import type { PageableList, PageableParams } from "@/shared/model";
|
||||
|
||||
export interface LoginlogParams extends PageableParams {
|
||||
lgnSn?: string;
|
||||
userId?: string;
|
||||
siteId?: string;
|
||||
}
|
||||
|
||||
export interface Loginlog {
|
||||
lgnSn: string;
|
||||
lgnDt: string;
|
||||
userId: string;
|
||||
lgnIp: string;
|
||||
lgnMethodCd: string;
|
||||
errOcrnYn: string;
|
||||
lgnErrCd: string;
|
||||
siteId: string;
|
||||
}
|
||||
|
||||
export interface LoginlogInfo {
|
||||
lgnSn: string;
|
||||
lgnDt: string;
|
||||
userId: string;
|
||||
lgnIp: string;
|
||||
lgnMethodCd: string;
|
||||
errOcrnYn: string;
|
||||
lgnErrCd: string;
|
||||
siteId: string;
|
||||
}
|
||||
|
||||
export type LoginlogList = PageableList<Loginlog>;
|
||||
|
||||
export interface LoginlogService {
|
||||
getLoginlogList: (params: LoginlogParams) => Promise<LoginlogList>;
|
||||
getLoginlogInfo: (lgnSn: string) => Promise<LoginlogInfo>;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import dayjs from "dayjs";
|
||||
import type { ColumnDef } from "@tanstack/react-table";
|
||||
import type { Loginlog } from "@/entities/loginlog";
|
||||
|
||||
|
||||
export const columns: ColumnDef<Loginlog>[] = [
|
||||
{
|
||||
id: "no",
|
||||
header: "NO",
|
||||
cell: ({ row, table }) => {
|
||||
const totalRows = table.getRowCount();
|
||||
const { pageIndex, pageSize } = table.getState().pagination;
|
||||
return totalRows - (pageIndex * pageSize + row.index);
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "lgnDt",
|
||||
header: "등록일",
|
||||
cell: ({ row }) => {
|
||||
const date = dayjs(row.original.lgnDt);
|
||||
return date.format("YYYY-MM-DD HH24:mi:ss");
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "userId",
|
||||
header: "사용자ID",
|
||||
},
|
||||
{
|
||||
accessorKey: "로그인IP",
|
||||
header: "remoteIp",
|
||||
},
|
||||
{
|
||||
accessorKey: "lgnMthd",
|
||||
header: "접속방식",
|
||||
},
|
||||
{
|
||||
accessorKey: "오류여부",
|
||||
header: "errOcrnYn",
|
||||
},
|
||||
{
|
||||
accessorKey: "오류코드",
|
||||
header: "lgnErrCd",
|
||||
},
|
||||
{
|
||||
accessorKey: "사이트ID",
|
||||
header: "siteId",
|
||||
}
|
||||
];
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { keepPreviousData, useQuery } from "@tanstack/react-query";
|
||||
import {
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
type PaginationState,
|
||||
} from "@tanstack/react-table";
|
||||
import { Button, DataTable, Input, Label } from "@common/components";
|
||||
import { LoginlogApi} from "../../../entities/loginlog/api/loginlog-service";
|
||||
import { type LoginlogParams} from "../../../entities/loginlog/model/loginlog-interface";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { columns } from "../model/table-columns";
|
||||
|
||||
type LoginlogPageProps = {
|
||||
lgnSn?: string;
|
||||
};
|
||||
|
||||
function LoginlogPage({ }: LoginlogPageProps) {
|
||||
const [loginlogQuery, setLoginlogQuery] = useState<LoginlogParams>({
|
||||
userId: "",
|
||||
siteId: "",
|
||||
});
|
||||
const [pagination, setPagination] = useState<PaginationState>({
|
||||
pageIndex: 0,
|
||||
pageSize: 10,
|
||||
});
|
||||
|
||||
const { data: loginlogList, refetch } = useQuery({
|
||||
queryKey: [ENDPOINT.USER_SERVICE.LOGINLOG, , pagination],
|
||||
queryFn: () =>
|
||||
LoginlogApi.getLoginlogList({
|
||||
...loginlogQuery,
|
||||
page: pagination.pageIndex,
|
||||
size: pagination.pageSize,
|
||||
}),
|
||||
placeholderData: keepPreviousData,
|
||||
});
|
||||
|
||||
const table = useReactTable({
|
||||
data: loginlogList?.content ?? [],
|
||||
columns,
|
||||
rowCount: loginlogList?.totalElements ?? 0,
|
||||
state: { pagination },
|
||||
manualPagination: true,
|
||||
enableMultiRowSelection: false,
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
onPaginationChange: setPagination,
|
||||
});
|
||||
|
||||
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
refetch();
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex-1">
|
||||
<div className="card card-border">
|
||||
<form onSubmit={handleSubmit} className="flex items-center gap-2 p-2">
|
||||
<Label htmlFor="" className="mr-2 text-label">
|
||||
로그인로그
|
||||
</Label>
|
||||
<Input
|
||||
className="h-[3.2rem] w-[20rem] rounded-sm !text-[1.3rem]"
|
||||
value={loginlogQuery.userId}
|
||||
onChange={(e) =>
|
||||
setLoginlogQuery({
|
||||
...loginlogQuery,
|
||||
userId: e.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<Button className="h-[3.2rem]" type="submit">
|
||||
조회
|
||||
</Button>
|
||||
</form>
|
||||
</div>
|
||||
<div className="card card-border">
|
||||
<div className="card-header">
|
||||
<h3 className="text-2xl font-medium text-label">로그인로그 목록</h3>
|
||||
</div>
|
||||
<div className="card !m-4 h-[calc(100vh-35rem)] overflow-auto !p-0">
|
||||
<DataTable table={table} viewPagination />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export { LoginlogPage };
|
||||
@@ -19,6 +19,7 @@ export const ENDPOINT = {
|
||||
AUTHORIZATIONS: "/user-service/api/v1/authorizations",
|
||||
ROLE_AUTHORIZATIONS: "/user-service/api/v1/role-authorizations",
|
||||
ROLES: "/user-service/api/v1/roles",
|
||||
LOGINLOG: "/user-service//api/v1/login-logs",
|
||||
},
|
||||
CMS_SERVICE: {
|
||||
SITES: "/cms-service/api/v1/sites",
|
||||
@@ -45,7 +46,6 @@ export const ENDPOINT = {
|
||||
SURVEY_QUESTION: "/cms-service/api/v1/srvy-qitem",
|
||||
SURVEY_ARTICLE: "/cms-service/api/v1/srvy-artcl",
|
||||
ZIPS: "/cms-service/api/v1/zips",
|
||||
LOGINLOG: "/cms-service/api/v1/loginlog",
|
||||
GROUPS: "/cms-service/api/v1/groups",
|
||||
GROUP_USERS: "/cms-service/api/v1/group-users",
|
||||
MANAGER_IP: "/cms-service/api/v1/mgrip",
|
||||
|
||||
Reference in New Issue
Block a user