Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dlink
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
zhaowei
dlink
Commits
9b8c5882
Commit
9b8c5882
authored
Mar 14, 2022
by
walkhan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://github.com/DataLinkDC/dlink
into dev
parents
7263d5a1
cd33d563
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
92 additions
and
52 deletions
+92
-52
JobLifeCycle.tsx
dlink-web/src/components/Common/JobLifeCycle.tsx
+49
-0
index.tsx
dlink-web/src/components/Studio/StudioMenu/index.tsx
+15
-16
conf.ts
dlink-web/src/components/Studio/conf.ts
+0
-16
index.tsx
dlink-web/src/pages/DevOps/JobInfo/index.tsx
+2
-1
index.tsx
dlink-web/src/pages/DevOps/JobInstanceTable/index.tsx
+11
-16
index.tsx
dlink-web/src/pages/DevOps/index.tsx
+15
-3
No files found.
dlink-web/src/components/Common/JobLifeCycle.tsx
0 → 100644
View file @
9b8c5882
import
{
Tag
}
from
'antd'
;
import
{
EditOutlined
,
CameraOutlined
,
CarryOutOutlined
,
}
from
"@ant-design/icons"
;
export
type
JobLifeCycleFormProps
=
{
step
:
number
|
undefined
;
};
export
const
JOB_LIFE_CYCLE
=
{
UNKNOWN
:
0
,
CREATE
:
1
,
DEVELOP
:
2
,
DEBUG
:
3
,
RELEASE
:
4
,
ONLINE
:
5
,
CANCEL
:
6
,
};
export
const
isDeletedTask
=
(
taskStep
:
number
)
=>
{
if
(
taskStep
&&
taskStep
===
JOB_LIFE_CYCLE
.
CANCEL
)
{
return
true
;
}
return
false
;
};
const
JobLifeCycle
=
(
props
:
JobLifeCycleFormProps
)
=>
{
const
{
step
}
=
props
;
const
renderJobLifeCycle
=
()
=>
{
switch
(
step
){
case
JOB_LIFE_CYCLE
.
DEVELOP
:
return
(<
Tag
icon=
{
<
EditOutlined
/>
}
color=
"default"
>
开发中
</
Tag
>);
case
JOB_LIFE_CYCLE
.
RELEASE
:
return
(<
Tag
icon=
{
<
CameraOutlined
/>
}
color=
"green"
>
已发布
</
Tag
>);
case
JOB_LIFE_CYCLE
.
ONLINE
:
return
(<
Tag
icon=
{
<
CarryOutOutlined
/>
}
color=
"blue"
>
已上线
</
Tag
>);
default
:
return
undefined
;
}
};
return
(<>
{
renderJobLifeCycle
()
}
</>)
};
export
default
JobLifeCycle
;
dlink-web/src/components/Studio/StudioMenu/index.tsx
View file @
9b8c5882
import
styles
from
"./index.less"
;
import
styles
from
"./index.less"
;
import
{
Menu
,
Dropdown
,
Tooltip
,
Row
,
Col
,
Popconfirm
,
notification
,
Modal
,
message
}
from
"antd"
;
import
{
Menu
,
Dropdown
,
Tooltip
,
Row
,
Col
,
notification
,
Modal
,
message
}
from
"antd"
;
import
{
import
{
PauseCircleTwoTone
,
CarryOutTwoTone
,
DeleteTwoTone
,
PlayCircleTwoTone
,
CameraTwoTone
,
SnippetsTwoTone
,
PauseCircleTwoTone
,
CarryOutTwoTone
,
DeleteTwoTone
,
PlayCircleTwoTone
,
CameraTwoTone
,
SnippetsTwoTone
,
FileAddTwoTone
,
FolderOpenTwoTone
,
SafetyCertificateTwoTone
,
SaveTwoTone
,
FlagTwoTone
,
CodeTwoTone
,
FileAddTwoTone
,
FolderOpenTwoTone
,
SafetyCertificateTwoTone
,
SaveTwoTone
,
FlagTwoTone
,
CodeTwoTone
,
...
@@ -28,13 +28,11 @@ import React, {useCallback, useEffect, useState} from "react";
...
@@ -28,13 +28,11 @@ import React, {useCallback, useEffect, useState} from "react";
import
StudioExplain
from
"../StudioConsole/StudioExplain"
;
import
StudioExplain
from
"../StudioConsole/StudioExplain"
;
import
{
import
{
DIALECT
,
DIALECT
,
isDeletedTask
,
isExecuteSql
,
isExecuteSql
,
isOnline
,
isOnline
,
isRunningTask
,
isRunningTask
,
isSql
,
isSql
,
isTask
,
isTask
,
TASKSTEPS
}
from
"@/components/Studio/conf"
;
}
from
"@/components/Studio/conf"
;
import
{
import
{
ModalForm
,
ModalForm
,
...
@@ -42,6 +40,7 @@ import {
...
@@ -42,6 +40,7 @@ import {
import
SqlExport
from
"@/pages/FlinkSqlStudio/SqlExport"
;
import
SqlExport
from
"@/pages/FlinkSqlStudio/SqlExport"
;
import
{
Dispatch
}
from
"@@/plugin-dva/connect"
;
import
{
Dispatch
}
from
"@@/plugin-dva/connect"
;
import
StudioTabs
from
"@/components/Studio/StudioTabs"
;
import
StudioTabs
from
"@/components/Studio/StudioTabs"
;
import
{
isDeletedTask
,
JOB_LIFE_CYCLE
}
from
"@/components/Common/JobLifeCycle"
;
const
menu
=
(
const
menu
=
(
<
Menu
>
<
Menu
>
...
@@ -289,7 +288,7 @@ const StudioMenu = (props: any) => {
...
@@ -289,7 +288,7 @@ const StudioMenu = (props: any) => {
const
res
=
releaseTask
(
current
.
task
.
id
);
const
res
=
releaseTask
(
current
.
task
.
id
);
res
.
then
((
result
)
=>
{
res
.
then
((
result
)
=>
{
if
(
result
.
code
==
CODE
.
SUCCESS
)
{
if
(
result
.
code
==
CODE
.
SUCCESS
)
{
props
.
changeTaskStep
(
current
.
task
.
id
,
TASKSTEPS
.
RELEASE
);
props
.
changeTaskStep
(
current
.
task
.
id
,
JOB_LIFE_CYCLE
.
RELEASE
);
message
.
success
(
`发布作业【
${
current
.
task
.
alias
}
】成功`
);
message
.
success
(
`发布作业【
${
current
.
task
.
alias
}
】成功`
);
}
else
{
}
else
{
message
.
error
(
`发布作业【
${
current
.
task
.
alias
}
】失败,原因:\n
${
result
.
msg
}
`
);
message
.
error
(
`发布作业【
${
current
.
task
.
alias
}
】失败,原因:\n
${
result
.
msg
}
`
);
...
@@ -308,7 +307,7 @@ const StudioMenu = (props: any) => {
...
@@ -308,7 +307,7 @@ const StudioMenu = (props: any) => {
onOk
:
async
()
=>
{
onOk
:
async
()
=>
{
const
res
=
developTask
(
current
.
task
.
id
);
const
res
=
developTask
(
current
.
task
.
id
);
res
.
then
((
result
)
=>
{
res
.
then
((
result
)
=>
{
result
.
datas
&&
props
.
changeTaskStep
(
current
.
task
.
id
,
TASKSTEPS
.
DEVELOP
);
result
.
datas
&&
props
.
changeTaskStep
(
current
.
task
.
id
,
JOB_LIFE_CYCLE
.
DEVELOP
);
if
(
result
.
code
==
CODE
.
SUCCESS
)
{
if
(
result
.
code
==
CODE
.
SUCCESS
)
{
message
.
success
(
`维护作业【
${
current
.
task
.
alias
}
】成功`
);
message
.
success
(
`维护作业【
${
current
.
task
.
alias
}
】成功`
);
}
}
...
@@ -327,7 +326,7 @@ const StudioMenu = (props: any) => {
...
@@ -327,7 +326,7 @@ const StudioMenu = (props: any) => {
const
res
=
onLineTask
(
current
.
task
.
id
);
const
res
=
onLineTask
(
current
.
task
.
id
);
res
.
then
((
result
)
=>
{
res
.
then
((
result
)
=>
{
if
(
result
.
code
===
CODE
.
SUCCESS
)
{
if
(
result
.
code
===
CODE
.
SUCCESS
)
{
props
.
changeTaskStep
(
current
.
task
.
id
,
TASKSTEPS
.
ONLINE
);
props
.
changeTaskStep
(
current
.
task
.
id
,
JOB_LIFE_CYCLE
.
ONLINE
);
result
.
datas
?.
jobInstanceId
&&
props
.
changeTaskJobInstance
(
current
.
task
.
id
,
result
.
datas
?.
jobInstanceId
);
result
.
datas
?.
jobInstanceId
&&
props
.
changeTaskJobInstance
(
current
.
task
.
id
,
result
.
datas
?.
jobInstanceId
);
message
.
success
(
`上线作业【
${
current
.
task
.
alias
}
】成功`
);
message
.
success
(
`上线作业【
${
current
.
task
.
alias
}
】成功`
);
}
else
{
}
else
{
...
@@ -348,8 +347,8 @@ const StudioMenu = (props: any) => {
...
@@ -348,8 +347,8 @@ const StudioMenu = (props: any) => {
const
res
=
offLineTask
(
current
.
task
.
id
,
type
);
const
res
=
offLineTask
(
current
.
task
.
id
,
type
);
res
.
then
((
result
)
=>
{
res
.
then
((
result
)
=>
{
if
(
result
.
code
===
CODE
.
SUCCESS
)
{
if
(
result
.
code
===
CODE
.
SUCCESS
)
{
if
(
current
.
task
.
step
===
TASKSTEPS
.
ONLINE
){
if
(
current
.
task
.
step
===
JOB_LIFE_CYCLE
.
ONLINE
){
props
.
changeTaskStep
(
current
.
task
.
id
,
TASKSTEPS
.
RELEASE
);
props
.
changeTaskStep
(
current
.
task
.
id
,
JOB_LIFE_CYCLE
.
RELEASE
);
}
}
props
.
changeTaskJobInstance
(
current
.
task
.
id
,
0
);
props
.
changeTaskJobInstance
(
current
.
task
.
id
,
0
);
message
.
success
(
`停止作业【
${
current
.
task
.
alias
}
】成功`
);
message
.
success
(
`停止作业【
${
current
.
task
.
alias
}
】成功`
);
...
@@ -371,7 +370,7 @@ const StudioMenu = (props: any) => {
...
@@ -371,7 +370,7 @@ const StudioMenu = (props: any) => {
const
res
=
offLineTask
(
current
.
task
.
id
,
type
);
const
res
=
offLineTask
(
current
.
task
.
id
,
type
);
res
.
then
((
result
)
=>
{
res
.
then
((
result
)
=>
{
if
(
result
.
code
===
CODE
.
SUCCESS
)
{
if
(
result
.
code
===
CODE
.
SUCCESS
)
{
props
.
changeTaskStep
(
current
.
task
.
id
,
TASKSTEPS
.
RELEASE
);
props
.
changeTaskStep
(
current
.
task
.
id
,
JOB_LIFE_CYCLE
.
RELEASE
);
props
.
changeTaskJobInstance
(
current
.
task
.
id
,
0
);
props
.
changeTaskJobInstance
(
current
.
task
.
id
,
0
);
message
.
success
(
`下线作业【
${
current
.
task
.
alias
}
】成功`
);
message
.
success
(
`下线作业【
${
current
.
task
.
alias
}
】成功`
);
}
else
{
}
else
{
...
@@ -392,7 +391,7 @@ const StudioMenu = (props: any) => {
...
@@ -392,7 +391,7 @@ const StudioMenu = (props: any) => {
const
res
=
cancelTask
(
current
.
task
.
id
);
const
res
=
cancelTask
(
current
.
task
.
id
);
res
.
then
((
result
)
=>
{
res
.
then
((
result
)
=>
{
if
(
result
.
code
===
CODE
.
SUCCESS
)
{
if
(
result
.
code
===
CODE
.
SUCCESS
)
{
props
.
changeTaskStep
(
current
.
task
.
id
,
TASKSTEPS
.
CANCEL
);
props
.
changeTaskStep
(
current
.
task
.
id
,
JOB_LIFE_CYCLE
.
CANCEL
);
message
.
success
(
`注销作业【
${
current
.
task
.
alias
}
】成功`
);
message
.
success
(
`注销作业【
${
current
.
task
.
alias
}
】成功`
);
}
else
{
}
else
{
message
.
error
(
`注销作业【
${
current
.
task
.
alias
}
】失败,原因:\n
${
result
.
msg
}
`
);
message
.
error
(
`注销作业【
${
current
.
task
.
alias
}
】失败,原因:\n
${
result
.
msg
}
`
);
...
@@ -411,7 +410,7 @@ const StudioMenu = (props: any) => {
...
@@ -411,7 +410,7 @@ const StudioMenu = (props: any) => {
onOk
:
async
()
=>
{
onOk
:
async
()
=>
{
const
res
=
recoveryTask
(
current
.
task
.
id
);
const
res
=
recoveryTask
(
current
.
task
.
id
);
res
.
then
((
result
)
=>
{
res
.
then
((
result
)
=>
{
result
.
datas
&&
props
.
changeTaskStep
(
current
.
task
.
id
,
TASKSTEPS
.
DEVELOP
);
result
.
datas
&&
props
.
changeTaskStep
(
current
.
task
.
id
,
JOB_LIFE_CYCLE
.
DEVELOP
);
if
(
result
.
code
==
CODE
.
SUCCESS
)
{
if
(
result
.
code
==
CODE
.
SUCCESS
)
{
message
.
success
(
`恢复作业【
${
current
.
task
.
alias
}
】成功`
);
message
.
success
(
`恢复作业【
${
current
.
task
.
alias
}
】成功`
);
}
}
...
@@ -592,7 +591,7 @@ const StudioMenu = (props: any) => {
...
@@ -592,7 +591,7 @@ const StudioMenu = (props: any) => {
</
Tooltip
>
</
Tooltip
>
}
}
<
Divider
type=
"vertical"
/>
<
Divider
type=
"vertical"
/>
{
current
.
task
.
step
==
TASKSTEPS
.
DEVELOP
?
{
current
.
task
.
step
==
JOB_LIFE_CYCLE
.
DEVELOP
?
<
Tooltip
title=
"发布,发布后将无法修改"
>
<
Tooltip
title=
"发布,发布后将无法修改"
>
<
Button
<
Button
type=
"text"
type=
"text"
...
@@ -600,7 +599,7 @@ const StudioMenu = (props: any) => {
...
@@ -600,7 +599,7 @@ const StudioMenu = (props: any) => {
onClick=
{
toReleaseTask
}
onClick=
{
toReleaseTask
}
/>
/>
</
Tooltip
>:
undefined
</
Tooltip
>:
undefined
}{
current
.
task
.
step
==
TASKSTEPS
.
RELEASE
?
}{
current
.
task
.
step
==
JOB_LIFE_CYCLE
.
RELEASE
?
<><
Tooltip
title=
"维护,点击进入编辑状态"
>
<><
Tooltip
title=
"维护,点击进入编辑状态"
>
<
Button
<
Button
type=
"text"
type=
"text"
...
@@ -615,7 +614,7 @@ const StudioMenu = (props: any) => {
...
@@ -615,7 +614,7 @@ const StudioMenu = (props: any) => {
onClick=
{
toOnLineTask
}
onClick=
{
toOnLineTask
}
/>
/>
</
Tooltip
></>:
undefined
</
Tooltip
></>:
undefined
}{
current
.
task
.
step
==
TASKSTEPS
.
ONLINE
?
}{
current
.
task
.
step
==
JOB_LIFE_CYCLE
.
ONLINE
?
<
Tooltip
title=
"下线,将进入最新发布状态"
>
<
Tooltip
title=
"下线,将进入最新发布状态"
>
<
Button
<
Button
type=
"text"
type=
"text"
...
@@ -623,7 +622,7 @@ const StudioMenu = (props: any) => {
...
@@ -623,7 +622,7 @@ const StudioMenu = (props: any) => {
onClick=
{
()
=>
toOffLineTask
(
'cancel'
)
}
onClick=
{
()
=>
toOffLineTask
(
'cancel'
)
}
/>
/>
</
Tooltip
>:
undefined
</
Tooltip
>:
undefined
}{
(
current
.
task
.
step
!=
TASKSTEPS
.
ONLINE
&&
current
.
task
.
step
!=
TASKSTEPS
.
CANCEL
)
?
}{
(
current
.
task
.
step
!=
JOB_LIFE_CYCLE
.
ONLINE
&&
current
.
task
.
step
!=
JOB_LIFE_CYCLE
.
CANCEL
)
?
<
Tooltip
title=
"注销,将进入回收站"
>
<
Tooltip
title=
"注销,将进入回收站"
>
<
Button
<
Button
type=
"text"
type=
"text"
...
@@ -631,7 +630,7 @@ const StudioMenu = (props: any) => {
...
@@ -631,7 +630,7 @@ const StudioMenu = (props: any) => {
onClick=
{
toCancelTask
}
onClick=
{
toCancelTask
}
/>
/>
</
Tooltip
>:
undefined
</
Tooltip
>:
undefined
}{
current
.
task
.
step
==
TASKSTEPS
.
CANCEL
?
}{
current
.
task
.
step
==
JOB_LIFE_CYCLE
.
CANCEL
?
<
Tooltip
title=
"恢复,将进入维护模式"
>
<
Tooltip
title=
"恢复,将进入维护模式"
>
<
Button
<
Button
type=
"text"
type=
"text"
...
...
dlink-web/src/components/Studio/conf.ts
View file @
9b8c5882
...
@@ -101,19 +101,3 @@ export const isOnline = (type: string) => {
...
@@ -101,19 +101,3 @@ export const isOnline = (type: string) => {
}
}
}
}
export
const
TASKSTEPS
=
{
UNKNOWN
:
0
,
CREATE
:
1
,
DEVELOP
:
2
,
DEBUG
:
3
,
RELEASE
:
4
,
ONLINE
:
5
,
CANCEL
:
6
,
};
export
const
isDeletedTask
=
(
step
:
number
)
=>
{
if
(
step
&&
step
===
TASKSTEPS
.
CANCEL
)
{
return
true
;
}
return
false
;
};
dlink-web/src/pages/DevOps/JobInfo/index.tsx
View file @
9b8c5882
...
@@ -15,6 +15,7 @@ import Config from "@/pages/DevOps/JobInfo/Config";
...
@@ -15,6 +15,7 @@ import Config from "@/pages/DevOps/JobInfo/Config";
import
JobStatus
,
{
isStatusDone
}
from
"@/components/Common/JobStatus"
;
import
JobStatus
,
{
isStatusDone
}
from
"@/components/Common/JobStatus"
;
import
{
cancelJob
,
offLineTask
,
restartJob
}
from
"@/components/Studio/StudioEvent/DDL"
;
import
{
cancelJob
,
offLineTask
,
restartJob
}
from
"@/components/Studio/StudioEvent/DDL"
;
import
{
CODE
}
from
"@/components/Common/crud"
;
import
{
CODE
}
from
"@/components/Common/crud"
;
import
JobLifeCycle
from
"@/components/Common/JobLifeCycle"
;
const
{
Link
}
=
Typography
;
const
{
Link
}
=
Typography
;
...
@@ -154,7 +155,7 @@ const JobInfo = (props: any) => {
...
@@ -154,7 +155,7 @@ const JobInfo = (props: any) => {
return
(
return
(
<
PageContainer
<
PageContainer
header=
{
{
header=
{
{
title
:
`${job?.instance?.name}`
,
title
:
(<><
JobLifeCycle
step=
{
job
?.
instance
?.
step
}
/>
{
job
?.
instance
?.
name
}
</>)
,
ghost
:
true
,
ghost
:
true
,
extra
:
getButtons
(),
extra
:
getButtons
(),
}
}
}
}
...
...
dlink-web/src/pages/DevOps/JobInstanceTable/index.tsx
View file @
9b8c5882
import
{
Tag
}
from
'antd'
;
import
{
history
}
from
'umi'
;
import
{
history
}
from
'umi'
;
import
{
CheckCircleOutlined
,
SyncOutlined
,
CloseCircleOutlined
,
MinusCircleOutlined
,
ClockCircleOutlined
,
DownOutlined
}
from
"@ant-design/icons"
;
import
{
queryData
}
from
"@/components/Common/crud"
;
import
{
queryData
}
from
"@/components/Common/crud"
;
import
React
,
{
useState
}
from
"react"
;
import
React
,
{
useState
}
from
"react"
;
import
type
{
ProColumns
}
from
'@ant-design/pro-table'
;
import
type
{
ProColumns
}
from
'@ant-design/pro-table'
;
import
ProTable
from
"@ant-design/pro-table"
;
import
ProTable
from
"@ant-design/pro-table"
;
import
{
JobInstanceTableListItem
}
from
"@/pages/DevOps/data"
;
import
{
JobInstanceTableListItem
}
from
"@/pages/DevOps/data"
;
import
moment
from
'moment'
;
import
moment
from
'moment'
;
import
{
RUN_MODE
,
TASKSTEPS
}
from
"@/components/Studio/conf"
;
import
{
RUN_MODE
}
from
"@/components/Studio/conf"
;
import
JobStatus
from
"@/components/Common/JobStatus"
;
import
JobStatus
from
"@/components/Common/JobStatus"
;
import
JobLifeCycle
,
{
JOB_LIFE_CYCLE
}
from
"@/components/Common/JobLifeCycle"
;
const
url
=
'/api/jobInstance'
;
const
url
=
'/api/jobInstance'
;
const
JobInstanceTable
=
(
props
:
any
)
=>
{
const
JobInstanceTable
=
(
props
:
any
)
=>
{
const
{
status
,
activeKey
,
dispatch
}
=
props
;
const
{
status
,
activeKey
,
isHistory
,
dispatch
}
=
props
;
const
[
time
,
setTime
]
=
useState
(()
=>
Date
.
now
());
const
[
time
,
setTime
]
=
useState
(()
=>
Date
.
now
());
const
getColumns
=
()
=>
{
const
getColumns
=
()
=>
{
...
@@ -31,27 +27,26 @@ const JobInstanceTable = (props: any) => {
...
@@ -31,27 +27,26 @@ const JobInstanceTable = (props: any) => {
valueType
:
'radio'
,
valueType
:
'radio'
,
valueEnum
:
{
valueEnum
:
{
''
:
{
text
:
'全部'
,
status
:
'ALL'
},
''
:
{
text
:
'全部'
,
status
:
'ALL'
},
1
:
{
text
:
'已创建'
,
status
:
TASKSTEPS
.
CREATE
,
},
2
:
{
2
:
{
text
:
'开发中'
,
text
:
'开发中'
,
status
:
TASKSTEPS
.
DEVELOP
,
status
:
JOB_LIFE_CYCLE
.
DEVELOP
,
},
},
4
:
{
4
:
{
text
:
'已发布'
,
text
:
'已发布'
,
status
:
TASKSTEPS
.
RELEASE
,
status
:
JOB_LIFE_CYCLE
.
RELEASE
,
},
},
5
:
{
5
:
{
text
:
'已上线'
,
text
:
'已上线'
,
status
:
TASKSTEPS
.
ONLINE
,
status
:
JOB_LIFE_CYCLE
.
ONLINE
,
},
},
0
:
{
0
:
{
text
:
'未知'
,
text
:
'未知'
,
status
:
TASKSTEPS
.
UNKNOWN
,
status
:
JOB_LIFE_CYCLE
.
UNKNOWN
,
},
},
},
},
render
:
(
_
,
row
)
=>
{
return
(<
JobLifeCycle
step=
{
row
.
step
}
/>);
}
},{
},{
title
:
"运行模式"
,
title
:
"运行模式"
,
dataIndex
:
"type"
,
dataIndex
:
"type"
,
...
@@ -140,7 +135,7 @@ const JobInstanceTable = (props: any) => {
...
@@ -140,7 +135,7 @@ const JobInstanceTable = (props: any) => {
<><
ProTable
<><
ProTable
request=
{
(
params
,
sorter
,
filter
)
=>
{
request=
{
(
params
,
sorter
,
filter
)
=>
{
setTime
(
Date
.
now
());
setTime
(
Date
.
now
());
return
queryData
(
url
,
{...
params
,
status
,
sorter
:
{
id
:
'descend'
},
filter
});
return
queryData
(
url
,
{...
params
,
status
,
isHistory
,
sorter
:
{
id
:
'descend'
},
filter
});
}
}
}
}
columns=
{
getColumns
()
}
columns=
{
getColumns
()
}
size=
"small"
size=
"small"
...
...
dlink-web/src/pages/DevOps/index.tsx
View file @
9b8c5882
...
@@ -6,12 +6,24 @@ import {useEffect, useState} from "react";
...
@@ -6,12 +6,24 @@ import {useEffect, useState} from "react";
import
{
StatusCount
}
from
"@/pages/DevOps/data"
;
import
{
StatusCount
}
from
"@/pages/DevOps/data"
;
import
{
JOB_STATUS
}
from
"@/components/Common/JobStatus"
;
import
{
JOB_STATUS
}
from
"@/components/Common/JobStatus"
;
import
{
Form
,
Switch
}
from
"antd"
;
const
{
Statistic
}
=
StatisticCard
;
const
{
Statistic
}
=
StatisticCard
;
const
DevOps
=
(
props
:
any
)
=>
{
const
DevOps
=
(
props
:
any
)
=>
{
const
[
isHistory
,
setIsHistory
]
=
useState
<
boolean
>
(
false
);
const
handleHistorySwicthChange
=
(
checked
:
boolean
)
=>
{
setIsHistory
(
checked
);
};
const
renderSwitch
=
()
=>
{
return
(<
Switch
checkedChildren=
"历史"
unCheckedChildren=
"实例"
onChange=
{
handleHistorySwicthChange
}
/>);
};
const
statusCountDefault
=
[
const
statusCountDefault
=
[
{
key
:
''
,
title
:
'全部'
,
value
:
0
,
total
:
true
},
{
key
:
''
,
title
:
renderSwitch
()
,
value
:
0
,
total
:
true
},
{
key
:
JOB_STATUS
.
CREATED
,
status
:
'default'
,
title
:
'已创建'
,
value
:
0
},
{
key
:
JOB_STATUS
.
CREATED
,
status
:
'default'
,
title
:
'已创建'
,
value
:
0
},
{
key
:
JOB_STATUS
.
INITIALIZING
,
status
:
'default'
,
title
:
'初始化'
,
value
:
0
},
{
key
:
JOB_STATUS
.
INITIALIZING
,
status
:
'default'
,
title
:
'初始化'
,
value
:
0
},
{
key
:
JOB_STATUS
.
RUNNING
,
status
:
'success'
,
title
:
'运行中'
,
value
:
0
},
{
key
:
JOB_STATUS
.
RUNNING
,
status
:
'success'
,
title
:
'运行中'
,
value
:
0
},
...
@@ -32,7 +44,7 @@ const DevOps = (props:any) => {
...
@@ -32,7 +44,7 @@ const DevOps = (props:any) => {
res
.
then
((
result
)
=>
{
res
.
then
((
result
)
=>
{
const
statusCountData
:
StatusCount
=
result
.
datas
;
const
statusCountData
:
StatusCount
=
result
.
datas
;
const
items
:
any
=
[
const
items
:
any
=
[
{
key
:
''
,
title
:
'全部'
,
value
:
statusCountData
.
all
,
total
:
true
},
{
key
:
''
,
title
:
renderSwitch
()
,
value
:
statusCountData
.
all
,
total
:
true
},
{
key
:
JOB_STATUS
.
CREATED
,
status
:
'default'
,
title
:
'已创建'
,
value
:
statusCountData
.
created
},
{
key
:
JOB_STATUS
.
CREATED
,
status
:
'default'
,
title
:
'已创建'
,
value
:
statusCountData
.
created
},
{
key
:
JOB_STATUS
.
INITIALIZING
,
status
:
'default'
,
title
:
'初始化'
,
value
:
statusCountData
.
initializing
},
{
key
:
JOB_STATUS
.
INITIALIZING
,
status
:
'default'
,
title
:
'初始化'
,
value
:
statusCountData
.
initializing
},
{
key
:
JOB_STATUS
.
RUNNING
,
status
:
'success'
,
title
:
'运行中'
,
value
:
statusCountData
.
running
},
{
key
:
JOB_STATUS
.
RUNNING
,
status
:
'success'
,
title
:
'运行中'
,
value
:
statusCountData
.
running
},
...
@@ -86,7 +98,7 @@ const DevOps = (props:any) => {
...
@@ -86,7 +98,7 @@ const DevOps = (props:any) => {
backgroundColor
:
'#fafafa'
,
backgroundColor
:
'#fafafa'
,
}
}
}
}
>
>
<
JobInstanceTable
status=
{
item
.
key
}
activeKey=
{
activeKey
}
/>
<
JobInstanceTable
status=
{
item
.
key
}
activeKey=
{
activeKey
}
isHistory=
{
isHistory
}
/>
</
div
>
</
div
>
</
ProCard
.
TabPane
>
</
ProCard
.
TabPane
>
))
}
))
}
...
...
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