Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
proxy-manager-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
aolda
proxy-manager-frontend
Commits
c548c6ce
Commit
c548c6ce
authored
1 month ago
by
한동현
Browse files
Options
Downloads
Patches
Plain Diff
refactor: 로그 관련 레이블 객체 분리
parent
06993c49
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/pages/Home.tsx
+3
-15
3 additions, 15 deletions
src/pages/Home.tsx
src/pages/log/List.tsx
+12
-24
12 additions, 24 deletions
src/pages/log/List.tsx
src/pages/routing/Edit.tsx
+2
-0
2 additions, 0 deletions
src/pages/routing/Edit.tsx
src/types/log.ts
+14
-2
14 additions, 2 deletions
src/types/log.ts
with
31 additions
and
41 deletions
src/pages/Home.tsx
+
3
−
15
View file @
c548c6ce
...
...
@@ -8,7 +8,7 @@ import { Skeleton } from '@/components/ui/skeleton';
import
{
Badge
}
from
'
@/components/ui/badge
'
;
import
{
Card
,
CardHeader
,
CardTitle
,
CardContent
,
CardFooter
,
CardDescription
}
from
'
@/components/ui/card
'
;
import
{
Table
,
TableBody
,
TableCell
,
TableHead
,
TableHeader
,
TableRow
}
from
'
@/components/ui/table
'
;
import
{
Log
,
LogListResponse
}
from
'
@/types/log
'
;
import
{
Log
,
LogListResponse
,
ActionLabels
,
TypeLabels
}
from
'
@/types/log
'
;
interface
ProjectInfo
{
routing
:
number
;
...
...
@@ -16,18 +16,6 @@ interface ProjectInfo {
certificate
:
number
;
}
const
ACTION
=
{
CREATE
:
'
생성
'
,
UPDATE
:
'
수정
'
,
DELETE
:
'
삭제
'
,
};
const
TYPE
=
{
ROUTING
:
'
라우팅
'
,
CERTIFICATE
:
'
인증서
'
,
FORWARDING
:
'
포워딩
'
,
};
export
default
function
Home
()
{
const
{
authFetch
,
selectedProject
}
=
useAuthStore
();
const
[
logs
,
setLogs
]
=
useState
<
Log
[]
|
null
>
(
null
);
...
...
@@ -184,8 +172,8 @@ export default function Home() {
<
TableCell
>
{
log
.
createdAt
}
</
TableCell
>
<
TableCell
>
<
div
className
=
"flex items-center gap-2"
>
<
Badge
variant
=
"default"
>
{
T
YPE
[
log
.
type
]
}
</
Badge
>
<
Badge
variant
=
"secondary"
>
{
A
CTION
[
log
.
action
]
}
</
Badge
>
<
Badge
variant
=
"default"
>
{
T
ypeLabels
[
log
.
type
]
}
</
Badge
>
<
Badge
variant
=
"secondary"
>
{
A
ctionLabels
[
log
.
action
]
}
</
Badge
>
<
div
>
{
log
.
description
.
split
(
'
\n
'
).
join
(
'
/
'
)
}
</
div
>
</
div
>
</
TableCell
>
...
...
This diff is collapsed.
Click to expand it.
src/pages/log/List.tsx
+
12
−
24
View file @
c548c6ce
...
...
@@ -28,7 +28,7 @@ import {
DropdownMenuTrigger
,
}
from
'
@/components/ui/dropdown-menu
'
;
import
{
cn
}
from
'
@/lib/utils
'
;
import
{
Log
,
LogListResponse
,
Action
,
Type
}
from
'
@/types/log
'
;
import
{
Log
,
LogListResponse
,
Action
,
Type
,
ActionLabels
,
TypeLabels
}
from
'
@/types/log
'
;
interface
PageInfo
{
first
:
boolean
;
...
...
@@ -37,18 +37,6 @@ interface PageInfo {
totalPages
:
number
;
}
const
ACTION
=
{
CREATE
:
'
생성
'
,
UPDATE
:
'
수정
'
,
DELETE
:
'
삭제
'
,
};
const
TYPE
=
{
ROUTING
:
'
라우팅
'
,
CERTIFICATE
:
'
인증서
'
,
FORWARDING
:
'
포워딩
'
,
};
export
default
function
LogList
()
{
const
{
authFetch
,
selectedProject
}
=
useAuthStore
();
const
[
searchParams
,
setSearchParams
]
=
useSearchParams
();
...
...
@@ -63,7 +51,7 @@ export default function LogList() {
useEffect
(()
=>
{
setLogs
(
null
);
authFetch
(
`/api/logs?projectId=
${
selectedProject
?.
id
}
&page=
${
page
-
1
}
&
${
searchParams
.
toString
()
.
toLowerCase
()
}
`
)
authFetch
(
`/api/logs?projectId=
${
selectedProject
?.
id
}
&page=
${
page
-
1
}
&
${
searchParams
.
toString
()}
`
)
.
then
((
response
):
Promise
<
LogListResponse
>
=>
{
if
(
!
response
.
ok
)
throw
new
Error
(
`로그 목록 조회 실패: (
${
response
.
status
}
)`
);
...
...
@@ -114,9 +102,9 @@ export default function LogList() {
})
}
>
<
DropdownMenuRadioItem
value
=
"
ROUTING
"
>
라우팅
</
DropdownMenuRadioItem
>
<
DropdownMenuRadioItem
value
=
"
FORWARDING
"
>
포워딩
</
DropdownMenuRadioItem
>
<
DropdownMenuRadioItem
value
=
"
CERTIFICATE
"
>
인증서
</
DropdownMenuRadioItem
>
<
DropdownMenuRadioItem
value
=
"
routing
"
>
라우팅
</
DropdownMenuRadioItem
>
<
DropdownMenuRadioItem
value
=
"
forwarding
"
>
포워딩
</
DropdownMenuRadioItem
>
<
DropdownMenuRadioItem
value
=
"
certificate
"
>
인증서
</
DropdownMenuRadioItem
>
</
DropdownMenuRadioGroup
>
<
DropdownMenuSeparator
/>
<
DropdownMenuLabel
>
설정 내용
</
DropdownMenuLabel
>
...
...
@@ -131,9 +119,9 @@ export default function LogList() {
})
}
>
<
DropdownMenuRadioItem
value
=
"
CREATE
"
>
생성
</
DropdownMenuRadioItem
>
<
DropdownMenuRadioItem
value
=
"
UPDATE
"
>
수정
</
DropdownMenuRadioItem
>
<
DropdownMenuRadioItem
value
=
"
DELETE
"
>
삭제
</
DropdownMenuRadioItem
>
<
DropdownMenuRadioItem
value
=
"
create
"
>
생성
</
DropdownMenuRadioItem
>
<
DropdownMenuRadioItem
value
=
"
update
"
>
수정
</
DropdownMenuRadioItem
>
<
DropdownMenuRadioItem
value
=
"
delete
"
>
삭제
</
DropdownMenuRadioItem
>
</
DropdownMenuRadioGroup
>
</
DropdownMenuContent
>
</
DropdownMenu
>
...
...
@@ -163,7 +151,7 @@ export default function LogList() {
})
}
>
{
T
YPE
[
type
]
}
{
T
ypeLabels
[
type
]
}
<
X
className
=
"cursor-pointer"
/>
</
Badge
>
)
}
...
...
@@ -179,7 +167,7 @@ export default function LogList() {
})
}
>
{
A
CTION
[
action
]
}
{
A
ctionLabels
[
action
]
}
<
X
className
=
"cursor-pointer"
/>
</
Badge
>
)
}
...
...
@@ -234,8 +222,8 @@ export default function LogList() {
<
TableCell
>
{
log
.
createdAt
}
</
TableCell
>
<
TableCell
>
<
div
className
=
"flex items-center gap-2"
>
<
Badge
variant
=
"default"
>
{
T
YPE
[
log
.
type
]
}
</
Badge
>
<
Badge
variant
=
"secondary"
>
{
A
CTION
[
log
.
action
]
}
</
Badge
>
<
Badge
variant
=
"default"
>
{
T
ypeLabels
[
log
.
type
]
}
</
Badge
>
<
Badge
variant
=
"secondary"
>
{
A
ctionLabels
[
log
.
action
]
}
</
Badge
>
<
div
>
{
log
.
description
.
split
(
'
\n
'
).
join
(
'
/
'
)
}
</
div
>
</
div
>
</
TableCell
>
...
...
This diff is collapsed.
Click to expand it.
src/pages/routing/Edit.tsx
+
2
−
0
View file @
c548c6ce
...
...
@@ -151,6 +151,8 @@ export default function RoutingEdit() {
if
(
code
==
'
DUPLICATED_DOMAIN_NAME
'
)
{
form
.
setError
(
'
domain
'
,
{
type
:
'
custom
'
});
toast
.
error
(
'
이미 사용중인 도메인입니다
'
);
}
else
if
(
code
==
'
NOT_FOUND_FORWARDING
'
)
{
toast
.
error
(
'
서버 오류가 발생했습니다. 관리자에게 문의하세요.
'
);
}
else
{
toast
.
error
(
'
라우팅 설정 수정에 실패하였습니다
'
);
}
...
...
This diff is collapsed.
Click to expand it.
src/types/log.ts
+
14
−
2
View file @
c548c6ce
export
type
Action
=
'
CREATE
'
|
'
UPDATE
'
|
'
DELETE
'
;
export
type
Type
=
'
ROUTING
'
|
'
CERTIFICATE
'
|
'
FORWARDING
'
;
export
type
Action
=
'
create
'
|
'
update
'
|
'
delete
'
;
export
type
Type
=
'
routing
'
|
'
certificate
'
|
'
forwarding
'
;
export
const
ActionLabels
:
Record
<
Action
,
string
>
=
{
create
:
'
생성
'
,
update
:
'
수정
'
,
delete
:
'
삭제
'
,
};
export
const
TypeLabels
:
Record
<
Type
,
string
>
=
{
routing
:
'
라우팅
'
,
certificate
:
'
인증서
'
,
forwarding
:
'
포워딩
'
,
};
export
interface
Log
{
id
:
number
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment