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
7c7a966a
Commit
7c7a966a
authored
2 months ago
by
한동현
Browse files
Options
Downloads
Patches
Plain Diff
feat: 포트포워딩 목록 페이지 API 연동
parent
7a33ae17
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/pages/forwarding/List.tsx
+93
-72
93 additions, 72 deletions
src/pages/forwarding/List.tsx
src/types/forwarding.ts
+9
-0
9 additions, 0 deletions
src/types/forwarding.ts
with
102 additions
and
72 deletions
src/pages/forwarding/List.tsx
+
93
−
72
View file @
7c7a966a
import
{
useEffect
,
useState
}
from
'
react
'
;
import
{
Link
}
from
'
react-router
'
;
import
{
Filter
,
Plus
,
Pencil
,
Trash
}
from
'
lucide-react
'
;
import
{
toast
}
from
'
sonner
'
;
import
{
useAuthStore
}
from
'
@/stores/authStore
'
;
import
{
Button
}
from
'
@/components/ui/button
'
;
import
{
Card
,
CardContent
}
from
'
@/components/ui/card
'
;
import
{
Table
,
TableBody
,
TableCell
,
TableHead
,
TableHeader
,
TableRow
}
from
'
@/components/ui/table
'
;
import
{
HoverCard
,
HoverCardContent
,
HoverCardTrigger
}
from
'
@/components/ui/hover-card
'
;
import
{
Input
}
from
'
@/components/ui/input
'
;
import
{
Link
}
from
'
react-router
'
;
const
forwardings
=
[
{
id
:
1
,
name
:
'
아올다 프록시 매니저 콘솔
'
,
created_at
:
'
2021-09-01 11:43:00
'
,
updated_at
:
'
2021-09-01 12:00:00
'
,
port
:
20444
,
instance_ip
:
'
10.16.0.10
'
,
},
{
id
:
2
,
name
:
'
아올다 블로그
'
,
created_at
:
'
2021-09-01 12:00:00
'
,
updated_at
:
'
2021-09-01 12:01:00
'
,
port
:
22222
,
instance_ip
:
'
10.16.0.11
'
,
},
{
id
:
3
,
name
:
'
개인 블로그
'
,
created_at
:
'
2021-09-01 12:01:00
'
,
updated_at
:
'
2021-09-01 13:00:00
'
,
port
:
20411
,
instance_ip
:
'
10.16.3.23
'
,
},
{
id
:
4
,
name
:
'
아올다 테스트 서버
'
,
created_at
:
'
2021-09-01 13:00:00
'
,
updated_at
:
'
2021-09-02 12:00:00
'
,
port
:
20432
,
instance_ip
:
'
10.16.32.1
'
,
},
];
import
{
Forwarding
}
from
'
@/types/forwarding
'
;
import
{
Skeleton
}
from
'
@/components/ui/skeleton
'
;
export
default
function
ForwardingList
()
{
const
{
selectedProject
}
=
useAuthStore
();
const
[
forwardings
,
setForwardings
]
=
useState
<
Forwarding
[]
|
null
>
(
null
);
useEffect
(()
=>
{
fetch
(
`/api/forwardings?projectId=
${
selectedProject
?.
id
}
`
)
.
then
((
response
)
=>
{
if
(
!
response
.
ok
)
{
toast
.
error
(
'
포트포워딩 정보를 조회할 수 없습니다.
'
);
return
{
forwardings
:
[]
};
}
return
response
.
json
();
})
.
then
(({
contents
})
=>
{
setForwardings
(
contents
);
});
},
[
selectedProject
]);
return
(
<
div
className
=
"flex flex-1 flex-col gap-4 p-6"
>
<
div
className
=
"flex justify-between mb-2"
>
<
div
>
<
h1
className
=
"scroll-m-20 text-3xl font-semibold first:mt-0"
>
SSH 포트포워딩 설정
</
h1
>
<
p
className
=
"mt-1 text-base text-gray-500"
>
현재 4개의 SSH 포트포워딩이 설정되어 있습니다.
</
p
>
{
forwardings
===
null
?
(
<
Skeleton
className
=
"w-[24rem] h-[1rem] mt-2 rounded-full"
/>
)
:
(
<
p
className
=
"mt-1 text-base text-gray-500"
>
현재
{
forwardings
?.
length
}
개의 SSH 포트포워딩이 설정되어 있습니다.
</
p
>
)
}
</
div
>
<
Button
className
=
"ml-2"
asChild
>
<
Link
to
=
"./create"
>
...
...
@@ -72,7 +66,32 @@ export default function ForwardingList() {
</
TableRow
>
</
TableHeader
>
<
TableBody
>
{
forwardings
.
map
((
forwarding
)
=>
(
{
forwardings
===
null
?
(
<>
<
TableRow
>
<
TableCell
colSpan
=
{
4
}
>
<
Skeleton
className
=
"w-full h-[1rem] my-2 rounded-full"
/>
</
TableCell
>
</
TableRow
>
<
TableRow
>
<
TableCell
colSpan
=
{
4
}
>
<
Skeleton
className
=
"w-full h-[1rem] my-2 rounded-full"
/>
</
TableCell
>
</
TableRow
>
<
TableRow
>
<
TableCell
colSpan
=
{
4
}
>
<
Skeleton
className
=
"w-full h-[1rem] my-2 rounded-full"
/>
</
TableCell
>
</
TableRow
>
</>
)
:
forwardings
.
length
===
0
?
(
<
TableRow
>
<
TableCell
colSpan
=
{
4
}
className
=
"text-center text-muted-foreground"
>
현재 프로젝트에 등록된 포트포워딩 설정이 없습니다.
</
TableCell
>
</
TableRow
>
)
:
(
forwardings
.
map
((
forwarding
)
=>
(
<
TableRow
key
=
{
forwarding
.
id
}
>
<
TableCell
className
=
"truncate max-w-48"
>
<
HoverCard
>
...
...
@@ -82,17 +101,18 @@ export default function ForwardingList() {
<
div
className
=
"space-y-1"
>
<
p
className
=
"text-sm font-semibold"
>
{
forwarding
.
name
}
</
p
>
<
p
className
=
"text-sm"
>
ssh.aoldacloud.com:
{
forwarding
.
port
}
↔
{
forwarding
.
instance_ip
}
:22
ssh.aoldacloud.com:
{
forwarding
.
serverPort
}
↔
{
forwarding
.
instanceIp
}
:
{
forwarding
.
instancePort
}
</
p
>
<
p
className
=
"text-xs text-muted-foreground mt-2"
>
{
forwarding
.
created
_a
t
}
생성
</
p
>
<
p
className
=
"text-xs text-muted-foreground"
>
{
forwarding
.
updated
_a
t
}
수정
</
p
>
<
p
className
=
"text-xs text-muted-foreground mt-2"
>
{
forwarding
.
created
A
t
}
생성
</
p
>
<
p
className
=
"text-xs text-muted-foreground"
>
{
forwarding
.
updated
A
t
}
수정
</
p
>
</
div
>
</
div
>
</
HoverCardContent
>
</
HoverCard
>
</
TableCell
>
<
TableCell
>
{
forwarding
.
p
ort
}
</
TableCell
>
<
TableCell
>
{
forwarding
.
instance
_i
p
}
</
TableCell
>
<
TableCell
>
{
forwarding
.
serverP
ort
}
</
TableCell
>
<
TableCell
>
{
forwarding
.
instance
I
p
}
</
TableCell
>
<
TableCell
>
<
div
className
=
"flex justify-center items-center gap-2"
>
<
Button
variant
=
"secondary"
className
=
"size-8"
>
...
...
@@ -108,7 +128,8 @@ export default function ForwardingList() {
</
div
>
</
TableCell
>
</
TableRow
>
))
}
))
)
}
</
TableBody
>
</
Table
>
</
CardContent
>
...
...
This diff is collapsed.
Click to expand it.
src/types/forwarding.ts
0 → 100644
+
9
−
0
View file @
7c7a966a
export
interface
Forwarding
{
id
:
number
;
name
:
string
;
createdAt
:
string
;
updatedAt
:
string
;
serverPort
:
number
;
instanceIp
:
string
;
instancePort
:
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