Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
9321004
:sparkles: [feat] : 로그인 기록 목록 조회 API 연결
seorang42 Feb 1, 2025
73d48ca
:sparkles: [feat] : 작업 기록 목록 조회 API 연결
seorang42 Feb 1, 2025
82f211f
:sparkles: [feat] : 전체 회원 조회 API 임시 연결
seorang42 Feb 2, 2025
39640a3
:bug: [fix] 감사 기록 api 주소 수정
seorang42 Feb 2, 2025
3bfb022
:bug: [fix] 로그인 기록 / 작업 기록 필터 서로 반대로 설정되었던 오류 수정
seorang42 Feb 2, 2025
b6b6e4e
:sparkles: [feat] : 감사 로그 페이지 구분 ENUM 값 수정
seorang42 Feb 3, 2025
76b9d46
:sparkles: [feat] : 감사 로그 페이지 정렬 기능 추가
seorang42 Feb 3, 2025
b7c6598
:recycle: [refactor] : 감사 로그 Params에서 sortBy 제거
seorang42 Feb 3, 2025
82aaf55
:recycle: [refactor] : 회원 관리 Params 변수명 수정
seorang42 Feb 3, 2025
5a1f3e1
:recycle: [refactor] : Role Enum값 적용
seorang42 Feb 4, 2025
1e835ad
:sparkles: [feat] : 회원 목록 조회 임시 연결 및 회원 삭제 로직 구현
seorang42 Feb 4, 2025
de06611
:sparkles: [feat] : 전체 회원 조회 API 연결
seorang42 Feb 4, 2025
d5c5536
:twisted_rightwards_arrows: [fix] : conflict resolved
seorang42 Feb 4, 2025
43e4bcc
:recycle: [refactor] : 환경 변수로 토큰 사용한 부분 제거
seorang42 Feb 4, 2025
b897d33
:recycle: [refactor] : 로그인 기록 성공 시 결과 표시 제외
seorang42 Feb 4, 2025
ba13a75
:recycle: [refactor] : 감사 로그 페이지 ENUM값 적용
seorang42 Feb 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/components/api-logs/ApiLogsFilterBar.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<template>
<div class="flex gap-4">
<div class="flex gap-4 z-30">
<FilterDropdown
title="조회 기간"
:option-list="TERM_LIST"
:value="String(store.params.term)"
@update:value="onParamsChange.onTermChange" />
<FilterDropdown
<FilterDropdownMulti
title="구분"
:option-list="LOGIN_LOGS_DIVISION_LIST"
:value="store.params.division"
@update:value="onParamsChange.onDivisionChange" />
:option-list="API_LOGS_DIVISION_LIST"
:value="store.params.logStatus"
@update:value="onParamsChange.onLogStatusChange" />
<FilterInput
title="아이디"
width="full"
:value="store.params.nickName"
@update:value="onParamsChange.onNickNameChange" />
<FilterIpAddress @update:value="onParamsChange.onIpAddressChange" />
<FilterIpAddress @update:value="onParamsChange.onClientIpChange" />
<FilterDropdown
title="페이지 당 개수"
:option-list="PAGE_SIZE_LIST"
Expand All @@ -29,9 +29,10 @@ import FilterDropdown from '../filters/FilterDropdown.vue'
import FilterInput from '../filters/FilterInput.vue'
import { useLogsParamsStore } from '@/stores/params'
import { PAGE_SIZE_LIST, TERM_LIST } from '@/constants/common'
import { LOGIN_LOGS_DIVISION_LIST } from '@/constants/admin'
import { API_LOGS_DIVISION_LIST } from '@/constants/admin'
import { useLogsParamsChange } from '../hooks/useLogsParamsChange'
import FilterIpAddress from '../filters/FilterIpAddress.vue'
import FilterDropdownMulti from '../filters/FilterDropdownMulti.vue'

const store = useLogsParamsStore()
store.$reset()
Expand Down
35 changes: 27 additions & 8 deletions src/components/api-logs/ApiLogsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

<template #listCards>
<ApiLogsListCard
v-for="info in DUMMY_API_LOGS_LIST_DATA"
v-for="info in data?.content"
:key="info.logId"
:info="info" />
</template>

<template #pagination>
<ListPagination
:page-number="params.page"
:total-page="DUMMY_TOTAL_PAGE"
:page-number="params.page + 1"
:total-page="totalPage || 0"
@update:page-number="onPageChange" />
</template>
</ListContainer>
Expand All @@ -23,16 +23,35 @@
<script setup lang="ts">
import ListPagination from '../lists/ListPagination.vue'
import ListContainer from '../lists/ListContainer.vue'
import { useRequestParamsStore } from '@/stores/params'
import { useLogsParamsStore } from '@/stores/params'
import ApiLogsListBar from './ApiLogsListBar.vue'
import ApiLogsListCard from './ApiLogsListCard.vue'
import { DUMMY_API_LOGS_LIST_DATA } from '@/datas/dummy'
import { axiosInstance } from '@/utils/axios'
import { useQuery } from '@tanstack/vue-query'
import type { ApiLogsResponse } from '@/types/admin'
import { computed } from 'vue'

const { params } = useRequestParamsStore()
const DUMMY_TOTAL_PAGE = 18
const { params } = useLogsParamsStore()
const onPageChange = (value: number) => {
params.page = value
}

// Data Handling
const fetchApiLogsList = async () => {
const response = await axiosInstance.get('/api/managements/logs/general', {
params: {
...params,
logStatus: params.logStatus.join(',')
}
})
return response.data
}

const { data } = useQuery<ApiLogsResponse>({
queryKey: ['apiLogs', params],
queryFn: fetchApiLogsList
})

const totalPage = computed(() => {
return data.value?.totalPages
})
</script>
7 changes: 6 additions & 1 deletion src/components/api-logs/ApiLogsListBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
:content="tab.content"
:width="tab.width"
:sortBy="tab.sortBy"
:current-order-request="params.orderRequest"
:current-order-request="orderRequest"
@toggle-sort-by="toggleSortBy" />
</div>
</template>
Expand All @@ -16,8 +16,13 @@ import { useLogsParamsStore } from '@/stores/params'
import ListBarTab from '../lists/ListBarTab.vue'
import { LOGS_LIST_BAR_TAB } from '@/constants/admin'
import { useLogsParamsChange } from '../hooks/useLogsParamsChange'
import { computed } from 'vue'

const { params } = useLogsParamsStore()
const orderRequest = computed(() => ({
sortBy: 'REQUESTED_AT',
sortDirection: params.sortDirection
}))

const { toggleSortBy } = useLogsParamsChange()
</script>
21 changes: 14 additions & 7 deletions src/components/api-logs/ApiLogsListCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,22 @@
<script setup lang="ts">
import type { ListCardProps } from '@/types/common'
import ListCardTab from '../lists/ListCardTab.vue'
import type { LogsListData } from '@/types/admin'
import type { ApiLogsListData } from '@/types/admin'
import { formatDate } from '@/utils/date'
import { API_LOGS_DIVISION_LIST } from '@/constants/admin'

const { info } = defineProps<{ info: LogsListData }>()
const { info } = defineProps<{ info: ApiLogsListData }>()
const myRequestTabList: ListCardProps[] = [
{ content: info.division, width: 80, isTextXs: true, isTextBody: true },
{ content: info.createdAt, width: 180, isTextXs: true },
{
content: API_LOGS_DIVISION_LIST.find(el => el.value === info.logStatus)?.content,
width: 80,
isTextXs: true,
isTextBody: true
},
{ content: formatDate(info.requestAt), width: 180, isTextXs: true },
{ content: info.nickName, width: 80 },
{ content: info.ipAddress, width: 120, isTextXs: true },
{ content: String(info.status), width: 40, isTextXs: true, isStatusCode: true },
{ content: info.result }
{ content: info.clientIp, width: 120, isTextXs: true },
{ content: String(info.statusCode), width: 40, isTextXs: true, isStatusCode: true },
{ content: '' }
]
</script>
16 changes: 10 additions & 6 deletions src/components/hooks/useLogsParamsChange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,25 @@ import { useLogsParamsStore } from '@/stores/params'
export const useLogsParamsChange = () => {
const { params } = useLogsParamsStore()

const onArrayChange = <Value extends number | string>(array: Value[], value: Value) => {
return array.includes(value) ? array.filter(el => el !== value) : [...array, value]
}

const onTermChange = (value: string) => {
if (value === '') {
params.term = ''
} else {
params.term = Number(value)
}
}
const onDivisionChange = (value: string) => {
params.division = value
const onLogStatusChange = (value: string) => {
params.logStatus = onArrayChange(params.logStatus!, value)
}
const onNickNameChange = (value: string) => {
params.nickName = value
}
const onIpAddressChange = (value: string) => {
params.ipAddress = value
const onClientIpChange = (value: string) => {
params.clientIp = value
}
const onPageSizeChange = (value: string) => {
params.pageSize = Number(value)
Expand All @@ -29,9 +33,9 @@ export const useLogsParamsChange = () => {

return {
onTermChange,
onDivisionChange,
onLogStatusChange,
onNickNameChange,
onIpAddressChange,
onClientIpChange,
onPageSizeChange,
toggleSortBy
}
Expand Down
13 changes: 7 additions & 6 deletions src/components/login-logs/LoginLogsFilterBar.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<template>
<div class="flex gap-4">
<div class="flex gap-4 z-30">
<FilterDropdown
title="조회 기간"
:option-list="TERM_LIST"
:value="String(store.params.term)"
@update:value="onParamsChange.onTermChange" />
<FilterDropdown
<FilterDropdownMulti
title="구분"
:option-list="LOGIN_LOGS_DIVISION_LIST"
:value="store.params.division"
@update:value="onParamsChange.onDivisionChange" />
:value="store.params.logStatus"
@update:value="onParamsChange.onLogStatusChange" />
<FilterInput
title="아이디"
width="full"
:value="store.params.nickName"
@update:value="onParamsChange.onNickNameChange" />
<FilterIpAddress @update:value="onParamsChange.onIpAddressChange" />
<FilterIpAddress @update:value="onParamsChange.onClientIpChange" />
<FilterDropdown
title="페이지 당 개수"
:option-list="PAGE_SIZE_LIST"
Expand All @@ -29,9 +29,10 @@ import FilterDropdown from '../filters/FilterDropdown.vue'
import FilterInput from '../filters/FilterInput.vue'
import { useLogsParamsStore } from '@/stores/params'
import { PAGE_SIZE_LIST, TERM_LIST } from '@/constants/common'
import { LOGIN_LOGS_DIVISION_LIST } from '@/constants/admin'
import { useLogsParamsChange } from '../hooks/useLogsParamsChange'
import FilterIpAddress from '../filters/FilterIpAddress.vue'
import FilterDropdownMulti from '../filters/FilterDropdownMulti.vue'
import { LOGIN_LOGS_DIVISION_LIST } from '@/constants/admin'

const store = useLogsParamsStore()
store.$reset()
Expand Down
37 changes: 29 additions & 8 deletions src/components/login-logs/LoginLogsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@

<template #listCards>
<LoginLogsListCard
v-for="info in DUMMY_LOGIN_LOGS_LIST_DATA"
v-for="info in data?.content"
:key="info.logId"
:info="info" />
<NoContent v-if="data?.content.length === 0" />
</template>

<template #pagination>
<ListPagination
:page-number="params.page"
:total-page="DUMMY_TOTAL_PAGE"
:page-number="params.page + 1"
:total-page="totalPage || 0"
@update:page-number="onPageChange" />
</template>
</ListContainer>
Expand All @@ -23,16 +24,36 @@
<script setup lang="ts">
import ListPagination from '../lists/ListPagination.vue'
import ListContainer from '../lists/ListContainer.vue'
import { DUMMY_LOGIN_LOGS_LIST_DATA } from '@/datas/dummy'
import { useRequestParamsStore } from '@/stores/params'
import { useLogsParamsStore } from '@/stores/params'
import LoginLogsListBar from './LoginLogsListBar.vue'
import LoginLogsListCard from './LoginLogsListCard.vue'
import { axiosInstance } from '@/utils/axios'
import { useQuery } from '@tanstack/vue-query'
import { computed } from 'vue'
import type { LoginLogsResponse } from '@/types/admin'
import NoContent from '../lists/NoContent.vue'

const { params } = useRequestParamsStore()
const DUMMY_TOTAL_PAGE = 18
const { params } = useLogsParamsStore()
const onPageChange = (value: number) => {
params.page = value
}

// Data Handling
const fetchLoginLogsList = async () => {
const response = await axiosInstance.get('/api/managements/logs/login', {
params: {
...params,
logStatus: params.logStatus.join(',')
}
})
return response.data
}

const { data } = useQuery<LoginLogsResponse>({
queryKey: ['loginLogs', params],
queryFn: fetchLoginLogsList
})

const totalPage = computed(() => {
return data.value?.totalPages
})
</script>
7 changes: 6 additions & 1 deletion src/components/login-logs/LoginLogsListBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
:content="tab.content"
:width="tab.width"
:sortBy="tab.sortBy"
:current-order-request="params.orderRequest"
:current-order-request="orderRequest"
@toggle-sort-by="toggleSortBy" />
</div>
</template>
Expand All @@ -16,8 +16,13 @@ import ListBarTab from '../lists/ListBarTab.vue'
import { useLogsParamsStore } from '@/stores/params'
import { LOGS_LIST_BAR_TAB } from '@/constants/admin'
import { useLogsParamsChange } from '../hooks/useLogsParamsChange'
import { computed } from 'vue'

const { params } = useLogsParamsStore()
const orderRequest = computed(() => ({
sortBy: 'REQUESTED_AT',
sortDirection: params.sortDirection
}))

const { toggleSortBy } = useLogsParamsChange()
</script>
30 changes: 23 additions & 7 deletions src/components/login-logs/LoginLogsListCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,31 @@
<script setup lang="ts">
import type { ListCardProps } from '@/types/common'
import ListCardTab from '../lists/ListCardTab.vue'
import type { LogsListData } from '@/types/admin'
import type { LoginLogsListData } from '@/types/admin'
import { formatDate } from '@/utils/date'

const { info } = defineProps<{ info: LogsListData }>()
const logStatus = {
LOGIN: '로그인 시도',
LOGOUT: '로그아웃'
}

const { info } = defineProps<{ info: LoginLogsListData }>()
const myRequestTabList: ListCardProps[] = [
{ content: info.division, width: 80, isTextXs: true, isTextBody: true },
{ content: info.createdAt, width: 180, isTextXs: true },
{
content: logStatus[info.logStatus as keyof typeof logStatus],
width: 80,
isTextXs: true,
isTextBody: true
},
{ content: formatDate(info.requestAt), width: 180, isTextXs: true },
{ content: info.nickName, width: 80 },
{ content: info.ipAddress, width: 120, isTextXs: true },
{ content: String(info.status), width: 40, isTextXs: true, isStatusCode: true },
{ content: info.result }
{ content: info.clientIp, width: 120, isTextXs: true },
{ content: String(info.statusCode), width: 40, isTextXs: true, isStatusCode: true },
{
content:
info.statusCode !== 200 && info.failedAttempts !== 0
? `failedAttempts = ${info.failedAttempts}`
: ''
}
]
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
@update:value="value => (params.nickName = value)" />
<FilterInput
title="부서"
:value="params.department"
@update:value="value => (params.department = value)" />
:value="String(params.departmentName)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기선 오늘 이야기했던 부서 정보가 쓰이는건가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재 input을 통해 부서명으로 검색하고 있는데 일단은 잘 작동하고 있기 때문에,
현재 작업 일정에서는 우선적으로 드롭다운으로 변경하지는 않을 것 같습니다.

이후 시간이 된다면 드롭다운으로 교체해볼까 합니다

@update:value="value => (params.departmentName = value)" />
<FilterInput
title="이메일"
width="full"
Expand Down
Loading