Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bkunyun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bkunyun
Commits
92c60990
Commit
92c60990
authored
Oct 18, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 应用环境列表完成80%
parent
c5554013
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
208 additions
and
15 deletions
+208
-15
api_manager.ts
src/api/api_manager.ts
+1
-0
resourceCenter.ts
src/api/resourceCenter.ts
+17
-1
index.module.css
.../UserResourcesEnvironment/AddEnvironment/index.module.css
+4
-1
index.tsx
...sources/UserResourcesEnvironment/AddEnvironment/index.tsx
+7
-1
index.module.css
...r/UserResources/UserResourcesEnvironment/index.module.css
+4
-0
index.tsx
...ceCenter/UserResources/UserResourcesEnvironment/index.tsx
+174
-12
index.tsx
src/views/ResourceCenter/UserResources/index.tsx
+1
-0
No files found.
src/api/api_manager.ts
View file @
92c60990
...
@@ -52,6 +52,7 @@ const RESTAPI = {
...
@@ -52,6 +52,7 @@ const RESTAPI = {
API_GET_PUBLIC_ENV
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/common/public/env`
,
// 获取公共环境
API_GET_PUBLIC_ENV
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/common/public/env`
,
// 获取公共环境
API_GET_PUBLIC_PROJECT
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/common/public/project`
,
// 获取公共环境
API_GET_PUBLIC_PROJECT
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/common/public/project`
,
// 获取公共环境
API_ACTORENV_BUILDENV
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/actorenv/buildenv`
,
// 新增应用环境
API_ACTORENV_BUILDENV
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/actorenv/buildenv`
,
// 新增应用环境
API_ACTORENV_LIST
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/actorenv/list`
,
// 查询用户的应用环境(算子环境)
};
};
export
default
RESTAPI
;
export
default
RESTAPI
;
src/api/resourceCenter.ts
View file @
92c60990
...
@@ -34,12 +34,28 @@ const addActorenvBuildenv = (params: addActorenvBuildenvParams) => {
...
@@ -34,12 +34,28 @@ const addActorenvBuildenv = (params: addActorenvBuildenvParams) => {
return
request
({
return
request
({
url
:
Api
.
API_ACTORENV_BUILDENV
,
url
:
Api
.
API_ACTORENV_BUILDENV
,
method
:
"post"
,
method
:
"post"
,
data
:
{...
params
,
name
:
'123'
}
,
data
:
params
,
});
});
};
};
// 获取公共环境
const
getActorenvList
=
(
params
:
{
type
:
'BATCH'
|
'FLOW'
|
''
,
page
:
number
,
size
:
number
,
title
?:
string
,
})
=>
{
return
request
({
url
:
Api
.
API_ACTORENV_LIST
,
method
:
"get"
,
params
,
});
};
export
{
export
{
getPublicEnv
,
getPublicEnv
,
getPublicProject
,
getPublicProject
,
addActorenvBuildenv
,
addActorenvBuildenv
,
getActorenvList
,
};
};
src/views/ResourceCenter/UserResources/UserResourcesEnvironment/AddEnvironment/index.module.css
View file @
92c60990
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
display
:
flex
;
display
:
flex
;
border-radius
:
4px
;
border-radius
:
4px
;
margin-bottom
:
24px
;
margin-bottom
:
24px
;
height
:
60
0px
;
height
:
58
0px
;
}
}
.form
{
.form
{
width
:
368px
;
width
:
368px
;
...
@@ -98,6 +98,9 @@
...
@@ -98,6 +98,9 @@
align-items
:
center
;
align-items
:
center
;
justify-content
:
center
;
justify-content
:
center
;
}
}
.isDragActive
{
border
:
1px
dashed
#000
;
}
.formItemHaveHelperText
{
.formItemHaveHelperText
{
margin-bottom
:
10px
;
margin-bottom
:
10px
;
}
}
src/views/ResourceCenter/UserResources/UserResourcesEnvironment/AddEnvironment/index.tsx
View file @
92c60990
...
@@ -262,7 +262,13 @@ const AddEnvironment = (props: IAddEnvironmentProps) => {
...
@@ -262,7 +262,13 @@ const AddEnvironment = (props: IAddEnvironmentProps) => {
<
span
className=
{
style
.
download
}
>
下载模板
</
span
>
<
span
className=
{
style
.
download
}
>
下载模板
</
span
>
</
div
>
</
div
>
<
div
className=
{
style
.
formItem
}
>
<
div
className=
{
style
.
formItem
}
>
<
div
className=
{
style
.
uploadBox
}
{
...
getRootProps
()}
>
<
div
className=
{
classNames
({
[
style
.
uploadBox
]:
true
,
[
style
.
isDragActive
]:
isDragActive
,
})
}
{
...
getRootProps
()}
>
<
input
{
...
getInputProps
()}
/>
<
input
{
...
getInputProps
()}
/>
<
span
>
点击选择环境包或将文件
</
span
>
<
span
>
点击选择环境包或将文件
</
span
>
<
span
>
拖到此处上传
</
span
>
<
span
>
拖到此处上传
</
span
>
...
...
src/views/ResourceCenter/UserResources/UserResourcesEnvironment/index.module.css
View file @
92c60990
.environment
{
.environment
{
padding
:
19px
24px
0
;
}
}
.top
{
.top
{
display
:
flex
;
display
:
flex
;
...
@@ -6,3 +7,6 @@
...
@@ -6,3 +7,6 @@
justify-content
:
space-between
;
justify-content
:
space-between
;
margin-bottom
:
20px
;
margin-bottom
:
20px
;
}
}
.tableBox
{
height
:
calc
(
100vh
-
177px
);
}
src/views/ResourceCenter/UserResources/UserResourcesEnvironment/index.tsx
View file @
92c60990
// 应用环境
// 应用环境
import
{
useState
}
from
"react"
;
import
{
use
Effect
,
use
State
}
from
"react"
;
import
style
from
"./index.module.css"
;
import
style
from
"./index.module.css"
;
import
SearchInput
from
"@/components/BusinessComponents/SearchInput"
;
import
SearchInput
from
"@/components/BusinessComponents/SearchInput"
;
import
MySelect
from
"@/components/mui/MySelect"
;
import
MySelect
from
"@/components/mui/MySelect"
;
import
MyButton
from
"@/components/mui/MyButton"
;
import
MyButton
from
"@/components/mui/MyButton"
;
import
MyTable
from
"@/components/mui/MyTableNew"
;
import
useMyRequest
from
"@/hooks/useMyRequest"
;
import
{
getActorenvList
}
from
"@/api/resourceCenter"
;
import
AddEnvironment
from
"./AddEnvironment"
;
import
AddEnvironment
from
"./AddEnvironment"
;
const
UserResourcesEnvironment
=
()
=>
{
const
UserResourcesEnvironment
=
()
=>
{
const
[
addOpen
,
setAddopen
]
=
useState
(
false
);
const
[
addOpen
,
setAddopen
]
=
useState
(
false
);
const
[
title
,
setTitle
]
=
useState
(
""
);
const
[
type
,
setType
]
=
useState
<
"BATCH"
|
"FLOW"
|
""
>
(
""
);
const
[
list
,
setList
]
=
useState
([]);
const
[
page
,
setPage
]
=
useState
(
0
);
const
[
count
,
setCount
]
=
useState
(
0
);
const
[
size
,
setSize
]
=
useState
(
20
);
const
headCells
:
Array
<
any
>
=
[
{
id
:
"title"
,
label
:
"环境名称"
,
},
{
id
:
"type"
,
label
:
"环境类型"
,
width
:
100
,
},
{
id
:
""
,
label
:
"创建时间"
,
width
:
160
,
},
{
id
:
"status"
,
label
:
"构建状态"
,
width
:
150
,
},
{
id
:
"caozuo"
,
label
:
"操作"
,
width
:
160
,
},
];
const
{
run
:
getList
}
=
useMyRequest
(
getActorenvList
,
{
onSuccess
:
(
res
)
=>
{
console
.
log
(
res
);
setList
(
res
.
data
.
content
);
setCount
(
res
.
data
.
totalPages
-
1
);
},
});
const
pageChange
=
(
value
:
number
)
=>
{
setPage
(
value
-
1
);
};
useEffect
(()
=>
{
getList
({
page
,
size
,
title
,
type
,
});
},
[
getList
,
page
,
size
,
title
,
type
]);
const
renderType
=
(
item
:
any
)
=>
{
if
(
item
.
type
===
"BATCH"
)
{
return
"批式"
;
}
else
if
(
item
.
type
===
"FLOW"
)
{
return
"流式"
;
}
else
{
return
""
;
}
};
const
renderStatus
=
(
item
:
any
)
=>
{
if
(
item
.
status
===
"PENDING"
)
{
return
"准备构建"
;
}
else
if
(
item
.
status
===
"CREATING"
)
{
return
"正在构建"
;
}
else
if
(
item
.
status
===
"FAILED"
)
{
return
"构建失败"
;
}
else
if
(
item
.
status
===
"CREATED"
)
{
return
"构建完成"
;
}
else
{
return
""
;
}
};
const
renderButtons
=
(
item
:
any
)
=>
{
if
(
item
.
status
===
"FAILED"
)
{
return
(
<>
<
MyButton
text=
"详情"
style=
{
{
position
:
"relative"
,
left
:
"-10px"
,
minWidth
:
"10px"
,
height
:
"22px"
,
padding
:
"0 10px"
,
}
}
variant=
"text"
size=
"medium"
/>
<
MyButton
text=
"删除"
style=
{
{
position
:
"relative"
,
left
:
"-10px"
,
minWidth
:
"10px"
,
height
:
"22px"
,
padding
:
"0 10px"
,
}
}
variant=
"text"
size=
"medium"
color=
"error"
/>
</>
);
}
else
{
return
(
<
MyButton
text=
"详情"
style=
{
{
position
:
"relative"
,
left
:
"-10px"
,
minWidth
:
"10px"
,
height
:
"22px"
,
padding
:
"0 10px"
,
}
}
variant=
"text"
size=
"medium"
// onClick={() => hanleDownloadFile(item)}
/>
);
}
};
return
(
return
(
<
div
className=
{
style
.
environment
}
>
<
div
className=
{
style
.
environment
}
>
<
div
className=
{
style
.
top
}
>
<
div
className=
{
style
.
top
}
>
<
div
className=
{
style
.
topLeft
}
>
<
div
className=
{
style
.
topLeft
}
>
<
SearchInput
sx=
{
{
width
:
340
,
marginRight
:
"16px"
}
}
></
SearchInput
>
<
SearchInput
<
MySelect
sx=
{
{
width
:
340
,
marginRight
:
"16px"
}
}
options=
{
[
onKeyUp=
{
(
e
:
any
)
=>
{
{
if
(
e
.
keyCode
===
13
)
{
label
:
"环境类型"
,
setTitle
(
e
.
target
.
value
);
value
:
"a"
,
}
},
}
}
]
}
></
SearchInput
>
sx=
{
{
width
:
"150px"
,
height
:
"32px"
}
}
{
!
addOpen
&&
(
></
MySelect
>
<
MySelect
title=
"环境类型"
isTitle=
{
true
}
options=
{
[
{
label
:
"批式"
,
value
:
"BATCH"
,
},
{
label
:
"流式"
,
value
:
"FLOW"
,
},
]
}
value=
{
type
}
onChange=
{
(
e
:
any
)
=>
setType
(
e
)
}
sx=
{
{
width
:
"150px"
,
height
:
"32px"
}
}
></
MySelect
>
)
}
</
div
>
</
div
>
<
div
className=
{
style
.
topRight
}
>
<
div
className=
{
style
.
topRight
}
>
<
MyButton
<
MyButton
...
@@ -36,7 +183,22 @@ const UserResourcesEnvironment = () => {
...
@@ -36,7 +183,22 @@ const UserResourcesEnvironment = () => {
></
MyButton
>
></
MyButton
>
</
div
>
</
div
>
</
div
>
</
div
>
UserResourcesEnvironment
<
div
className=
{
style
.
tableBox
}
>
<
MyTable
rows=
{
list
.
map
((
item
:
any
)
=>
({
...
item
,
type
:
renderType
(
item
),
status
:
renderStatus
(
item
),
caozuo
:
renderButtons
(
item
),
}))
}
headCells=
{
headCells
}
fixedHead=
{
true
}
hasTableFooter=
{
true
}
page=
{
page
}
count=
{
count
}
pageChange=
{
pageChange
}
></
MyTable
>
</
div
>
{
addOpen
&&
<
AddEnvironment
setAddopen=
{
setAddopen
}
></
AddEnvironment
>
}
{
addOpen
&&
<
AddEnvironment
setAddopen=
{
setAddopen
}
></
AddEnvironment
>
}
</
div
>
</
div
>
);
);
...
...
src/views/ResourceCenter/UserResources/index.tsx
View file @
92c60990
...
@@ -36,6 +36,7 @@ const UserResources = () => {
...
@@ -36,6 +36,7 @@ const UserResources = () => {
title=
"个人资源"
title=
"个人资源"
tabList=
{
tabList
}
tabList=
{
tabList
}
defaultValue=
{
"USERRESOURCES_ENVIRONMENT"
}
defaultValue=
{
"USERRESOURCES_ENVIRONMENT"
}
tabPanelSx=
{
{
padding
:
"0"
}
}
/>
/>
</
div
>
</
div
>
);
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment