Toggle navigation
Toggle navigation
This project
Loading...
Sign in
정민우
/
vps_service
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
ch4n3.yoon
2021-06-11 03:11:35 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ef284ba15741088942ca3ae503b59e44ba685ba3
ef284ba1
1 parent
aefc59f0
[Edit] 디자인 수정
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
139 additions
and
16 deletions
frontend/src/App.js
frontend/src/components/DockerContainerCreate.js
frontend/src/components/DockerContainerList.js
frontend/src/components/DockerDockerfileList.js
frontend/src/components/DockerImageCreate.js
frontend/src/components/Navigation.js
frontend/src/App.js
View file @
ef284ba
...
...
@@ -9,6 +9,7 @@ import DockerImageCreate from './components/DockerImageCreate'
import
DockerImageList
from
'./components/DockerImageList'
import
DockerContainerCreate
from
'./components/DockerContainerCreate'
import
DockerContainerList
from
'./components/DockerContainerList'
import
DockerDockerfileList
from
'./components/DockerDockerfileList'
import
'semantic-ui-css/semantic.min.css'
const
App
=
()
=>
{
...
...
@@ -26,6 +27,9 @@ const App = () => {
component
=
{
DockerContainerCreate
}
/
>
<
Route
exact
path
=
"/docker/container/list"
component
=
{
DockerContainerList
}
/
>
<
Route
exact
path
=
"/docker/dockerfile/list"
component
=
{
DockerDockerfileList
}
/
>
<
Redirect
path
=
"*"
to
=
"/"
/>
<
/Switch
>
<
/BrowserRouter
>
...
...
frontend/src/components/DockerContainerCreate.js
View file @
ef284ba
...
...
@@ -6,7 +6,6 @@ import {
Button
,
Segment
,
Message
,
Divider
,
Form
,
Input
,
Transition
,
...
...
@@ -17,10 +16,14 @@ import {
FormErrorMessage
,
FormHelperText
,
VStack
,
Stack
,
StackDivider
,
Box
,
Text
,
Text
,
AlertDialogOverlay
,
AlertDialogContent
,
Alert
,
AlertIcon
,
AlertDialog
,
}
from
'@chakra-ui/react'
import
{
Divider
,
}
from
'semantic-ui-react'
import
http
from
'../utils/http'
const
DockerContainerCreate
=
()
=>
{
...
...
@@ -85,12 +88,13 @@ const DockerContainerCreate = () => {
const
{
username
,
password
,
port
}
=
response
.
data
.
data
setLoading
(
false
)
if
(
!
status
)
{
setError
(
message
)
}
else
{
if
(
status
)
{
setSuccess
(
true
)
setSsh
(
`ssh
${
username
}
@
${
window
.
location
.
hostname
}
-p
${
port
}
# (password :
${
password
}
)`
)
setTimeout
(
3000
,
()
=>
{
history
.
push
(
'/docker/container/list'
)
})
}
else
{
setError
(
message
)
}
// setTimeout(() => setSuccess(false), 10000);
...
...
@@ -122,20 +126,20 @@ const DockerContainerCreate = () => {
return
(
<
Container
>
<
Divider
hidden
/>
<
Heading
>
Create
Docker
Container
<
/Heading>
<
V
Stack
divider
=
{
<
StackDivider
borderColor
=
"gray.200"
/>
}
<
Stack
divider
=
{
<
Divider
hidden
/>
}
spacing
=
{
4
}
align
=
"stretch"
>
<
Heading
>
Create
Docker
Container
<
/Heading>
<
FormControl
id
=
"container"
isRequired
>
<
FormLabel
>
Container
Name
<
/FormLabel>
<
Input
type
=
"email"
placeholder
=
'Container Name'
/>
<
FormHelperText
>
컨테이너
이름을
입력해주세요
.
<
/FormHelperText>
<
/FormControl>
<
FormControl
id
=
"image"
>
...
...
@@ -146,14 +150,26 @@ const DockerContainerCreate = () => {
<
/Select>
<
/FormControl>
<
Button
size
=
"md"
colorScheme
=
"
green
"
mt
=
"24px"
<
Button
size
=
"md"
colorScheme
=
"
teal
"
mt
=
"24px"
onClick
=
{()
=>
createContainer
()}
>
Create
Container
<
/Button>
<
/VStack>
<
/Stack>
<
AlertDialog
isOpen
=
{
isSuccess
}
onClose
=
{()
=>
setSuccess
(
false
)}
>
<
AlertDialogOverlay
>
<
AlertDialogContent
>
<
Alert
status
=
"success"
>
<
AlertIcon
/>
Successfully
created
!
<
/Alert>
<
/AlertDialogContent>
<
/AlertDialogOverlay>
<
/AlertDialog>
<
/Container>
)
}
...
...
frontend/src/components/DockerContainerList.js
View file @
ef284ba
...
...
@@ -24,6 +24,7 @@ import {
}
from
'@chakra-ui/react'
import
{
Divider
,
Grid
,
}
from
'semantic-ui-react'
import
http
from
'../utils/http'
...
...
@@ -32,6 +33,8 @@ const DockerContainerList = () => {
const
[
isError
,
setError
]
=
useState
(
false
)
const
[
message
,
setMessage
]
=
useState
(
''
)
const
history
=
useHistory
()
const
getContainerList
=
()
=>
{
http
.
get
(
'/docker/container/list'
).
then
(
response
=>
{
const
{
status
,
data
,
message
}
=
response
.
data
...
...
@@ -54,6 +57,20 @@ const DockerContainerList = () => {
<
Divider
hidden
/>
<
Heading
>
Container
List
<
/Heading>
<
Grid
>
<
Grid
.
Column
floated
=
'right'
width
=
{
3
}
>
<
Button
size
=
'xs'
colorScheme
=
'blue'
onClick
=
{()
=>
history
.
push
(
'/docker/container/create'
)}
>
New
Container
<
/Button>
<
/Grid.Column>
<
/Grid>
<
Divider
hidden
/>
<
UnorderedList
>
...
...
frontend/src/components/DockerDockerfileList.js
0 → 100644
View file @
ef284ba
import
React
,
{
useEffect
,
useState
}
from
'react'
import
{
Container
,
Heading
,
Button
,
Text
,
Box
,
}
from
'@chakra-ui/react'
import
{
Divider
,
Grid
,
Header
,
}
from
'semantic-ui-react'
import
http
from
'../utils/http'
import
{
useHistory
}
from
'react-router-dom'
const
ImageBlock
=
({
title
,
desc
,
...
rest
})
=>
{
return
(
<
Box
p
=
{
5
}
shadow
=
"md"
borderWidth
=
"1px"
{...
rest
}
>
<
Heading
fontSize
=
"xl"
>
{
title
}
<
/Heading>
<
Text
mt
=
{
4
}
>
{
desc
}
<
/Text>
<
/Box>
)
}
const
DockerDockerfileList
=
()
=>
{
const
[
token
,
setToken
]
=
useState
(
''
)
const
[
images
,
setImages
]
=
useState
([])
const
history
=
useHistory
()
const
setTokenFromLocalStorage
=
()
=>
{
const
token
=
localStorage
.
getItem
(
'token'
)
setToken
(
token
)
}
const
getImages
=
()
=>
{
http
.
get
(
'/image/list'
,
{
headers
:
{
Authorization
:
`token
${
token
}
`
,
},
}).
then
(
response
=>
{
const
{
success
,
code
,
data
,
message
}
=
response
.
data
if
(
success
)
{
const
{
count
,
data
}
=
data
setImages
(
data
)
}
})
}
useEffect
(()
=>
{
setTokenFromLocalStorage
()
getImages
()
},
[])
return
(
<
Container
>
<
Divider
hidden
/>
<
Heading
>
Dockerfile
List
<
/Heading>
<
Divider
hidden
/>
<
Grid
>
<
Grid
.
Column
floated
=
'right'
width
=
{
3
}
>
<
Button
size
=
'xs'
colorScheme
=
'blue'
onClick
=
{()
=>
history
.
push
(
'/docker/image/create'
)}
>
New
Image
<
/Button>
<
/Grid.Column>
<
/Grid>
{
images
.
map
(
image
=>
(
<
ImageBlock
title
=
{
image
.
name
}
desc
=
{
image
.
name
}
/>
))}
<
/Container>
)
}
export
default
DockerDockerfileList
\ No newline at end of file
frontend/src/components/DockerImageCreate.js
View file @
ef284ba
...
...
@@ -95,7 +95,6 @@ const DockerImageCreate = () => {
<
/AlertDialogContent>
<
/AlertDialogOverlay>
<
/AlertDialog>
<
/Container>
)
}
...
...
frontend/src/components/Navigation.js
View file @
ef284ba
...
...
@@ -14,8 +14,12 @@ const Navigation = () => {
const
panes
=
[
{
menuItem
:
'Home'
,
render
:
()
=>
<
Redirect
to
=
"/"
/>
,
render
:
()
=>
<
Redirect
to
=
"/"
/>
,
},
/*{
menuItem: 'Dockerfile',
render: () => <Redirect to="/docker/dockerfile/list"/>,
},*/
{
menuItem
:
'Image'
,
render
:
()
=>
<
Redirect
to
=
"/docker/image/list"
/>
,
...
...
Please
register
or
login
to post a comment