Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
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
wangpeng
dinky
Commits
e587f49a
Unverified
Commit
e587f49a
authored
Feb 01, 2024
by
Zzm0809
Committed by
GitHub
Feb 01, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Refactor][web] refactor devops overview list layout (#3126)
Co-authored-by:
Zzm0809
<
Zzm0809@users.noreply.github.com
>
parent
a2546328
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
176 additions
and
11 deletions
+176
-11
pages.ts
dinky-web/src/locales/en-US/pages.ts
+2
-1
pages.ts
dinky-web/src/locales/zh-CN/pages.ts
+2
-0
function.tsx
...b/src/pages/DataStudio/LeftContainer/Project/function.tsx
+1
-1
index.tsx
dinky-web/src/pages/DevOps/JobList/index.tsx
+170
-8
index.tsx
dinky-web/src/pages/DevOps/index.tsx
+1
-1
No files found.
dinky-web/src/locales/en-US/pages.ts
View file @
e587f49a
...
@@ -227,7 +227,8 @@ export default {
...
@@ -227,7 +227,8 @@ export default {
'devops.jobinfo.remap.cluster.title.help'
:
'devops.jobinfo.remap.cluster.title.help'
:
'(Note: This operation will modify the configuration of the cluster instance simultaneously.)'
,
'(Note: This operation will modify the configuration of the cluster instance simultaneously.)'
,
'devops.jobinfo.remap.job.title'
:
'Job mapping information'
,
'devops.jobinfo.remap.job.title'
:
'Job mapping information'
,
'devops.joblist.clear.filter'
:
'Cancel Selected'
,
'devops.joblist.clear.filtertips'
:
'Clear selected tasks, but not clear other filter conditions'
,
'devops.joblist.detail'
:
'Job Detail'
,
'devops.joblist.detail'
:
'Job Detail'
,
'devops.joblist.history'
:
'History'
,
'devops.joblist.history'
:
'History'
,
'devops.joblist.joblist'
:
'Job List'
,
'devops.joblist.joblist'
:
'Job List'
,
...
...
dinky-web/src/locales/zh-CN/pages.ts
View file @
e587f49a
...
@@ -214,6 +214,8 @@ export default {
...
@@ -214,6 +214,8 @@ export default {
'devops.jobinfo.remap.cluster.title'
:
'集群实例映射信息'
,
'devops.jobinfo.remap.cluster.title'
:
'集群实例映射信息'
,
'devops.jobinfo.remap.cluster.title.help'
:
' (注意:此操作会同步修改集群实例配置)'
,
'devops.jobinfo.remap.cluster.title.help'
:
' (注意:此操作会同步修改集群实例配置)'
,
'devops.jobinfo.remap.job.title'
:
'Job映射信息'
,
'devops.jobinfo.remap.job.title'
:
'Job映射信息'
,
'devops.joblist.clear.filter'
:
'取消选择'
,
'devops.joblist.clear.filtertips'
:
'清除选择的任务,并不是清除其他得筛选条件'
,
'devops.joblist.detail'
:
'详情'
,
'devops.joblist.detail'
:
'详情'
,
'devops.joblist.history'
:
'历史'
,
'devops.joblist.history'
:
'历史'
,
...
...
dinky-web/src/pages/DataStudio/LeftContainer/Project/function.tsx
View file @
e587f49a
...
@@ -129,7 +129,7 @@ export const showBadge = (type: string) => {
...
@@ -129,7 +129,7 @@ export const showBadge = (type: string) => {
*/
*/
export
const
buildProjectTree
=
(
export
const
buildProjectTree
=
(
data
:
Catalogue
[],
data
:
Catalogue
[]
=
[]
,
searchValue
:
string
=
''
,
searchValue
:
string
=
''
,
path
:
string
[]
=
[]
path
:
string
[]
=
[]
):
any
=>
):
any
=>
...
...
dinky-web/src/pages/DevOps/JobList/index.tsx
View file @
e587f49a
...
@@ -19,6 +19,12 @@
...
@@ -19,6 +19,12 @@
import
JobLifeCycleTag
from
'@/components/JobTags/JobLifeCycleTag'
;
import
JobLifeCycleTag
from
'@/components/JobTags/JobLifeCycleTag'
;
import
StatusTag
from
'@/components/JobTags/StatusTag'
;
import
StatusTag
from
'@/components/JobTags/StatusTag'
;
import
{
buildProjectTree
,
generateList
,
getParentKey
}
from
'@/pages/DataStudio/LeftContainer/Project/function'
;
import
{
getTaskData
}
from
'@/pages/DataStudio/LeftContainer/Project/service'
;
import
{
DevopContext
}
from
'@/pages/DevOps'
;
import
{
DevopContext
}
from
'@/pages/DevOps'
;
import
{
JOB_LIFE_CYCLE
}
from
'@/pages/DevOps/constants'
;
import
{
JOB_LIFE_CYCLE
}
from
'@/pages/DevOps/constants'
;
import
{
getJobDuration
}
from
'@/pages/DevOps/function'
;
import
{
getJobDuration
}
from
'@/pages/DevOps/function'
;
...
@@ -28,19 +34,32 @@ import { PROTABLE_OPTIONS_PUBLIC } from '@/services/constants';
...
@@ -28,19 +34,32 @@ import { PROTABLE_OPTIONS_PUBLIC } from '@/services/constants';
import
{
API_CONSTANTS
}
from
'@/services/endpoints'
;
import
{
API_CONSTANTS
}
from
'@/services/endpoints'
;
import
{
Jobs
}
from
'@/types/DevOps/data'
;
import
{
Jobs
}
from
'@/types/DevOps/data'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
ClockCircleTwoTone
,
EyeTwoTone
,
RedoOutlined
}
from
'@ant-design/icons'
;
import
{
SplitPane
}
from
'@andrewray/react-multi-split-pane'
;
import
{
Pane
}
from
'@andrewray/react-multi-split-pane/dist/lib/Pane'
;
import
{
ClearOutlined
,
ClockCircleTwoTone
,
EyeTwoTone
,
RedoOutlined
}
from
'@ant-design/icons'
;
import
type
{
ActionType
,
ProColumns
}
from
'@ant-design/pro-components'
;
import
type
{
ActionType
,
ProColumns
}
from
'@ant-design/pro-components'
;
import
{
ProCard
,
ProTable
}
from
'@ant-design/pro-components'
;
import
{
ProCard
,
ProTable
}
from
'@ant-design/pro-components'
;
import
{
Button
,
Radio
,
Table
}
from
'antd'
;
import
{
Button
,
Empty
,
Radio
,
Table
,
Tree
}
from
'antd'
;
import
{
useContext
,
useEffect
,
useRef
,
useState
}
from
'react'
;
import
Search
from
'antd/es/input/Search'
;
import
{
Key
,
useContext
,
useEffect
,
useRef
,
useState
}
from
'react'
;
import
{
history
}
from
'umi'
;
import
{
history
}
from
'umi'
;
const
{
DirectoryTree
}
=
Tree
;
const
JobList
=
()
=>
{
const
JobList
=
()
=>
{
const
refObject
=
useRef
<
HTMLDivElement
>
(
null
);
const
tableRef
=
useRef
<
ActionType
>
();
const
tableRef
=
useRef
<
ActionType
>
();
const
{
statusFilter
,
setStatusFilter
}
=
useContext
<
any
>
(
DevopContext
);
const
{
statusFilter
,
setStatusFilter
}
=
useContext
<
any
>
(
DevopContext
);
const
[
stepFilter
,
setStepFilter
]
=
useState
<
number
|
undefined
>
();
const
[
stepFilter
,
setStepFilter
]
=
useState
<
number
|
undefined
>
();
const
[
taskFilter
,
setTaskFilter
]
=
useState
<
string
|
undefined
>
();
const
[
taskFilter
,
setTaskFilter
]
=
useState
<
string
|
undefined
>
();
const
[
taskId
,
setTaskId
]
=
useState
<
number
>
();
const
[
searchValue
,
setSearchValueValue
]
=
useState
(
''
);
const
[
data
,
setData
]
=
useState
<
any
[]
>
([]);
const
[
autoExpandParent
,
setAutoExpandParent
]
=
useState
(
true
);
const
[
expandedKeys
,
setExpandedKeys
]
=
useState
<
Key
[]
>
([]);
const
[
selectedKey
,
setSelectedKey
]
=
useState
<
Key
[]
>
([]);
console
.
log
(
statusFilter
);
const
jobListColumns
:
ProColumns
<
Jobs
.
JobInstance
>
[]
=
[
const
jobListColumns
:
ProColumns
<
Jobs
.
JobInstance
>
[]
=
[
{
{
title
:
l
(
'global.table.jobname'
),
title
:
l
(
'global.table.jobname'
),
...
@@ -95,26 +114,163 @@ const JobList = () => {
...
@@ -95,26 +114,163 @@ const JobList = () => {
}
}
];
];
// 重置选中的 key 和 taskId | reset the selected key and taskId
const
resetValue
=
()
=>
{
setSelectedKey
([]);
setTaskId
(
undefined
);
tableRef
.
current
?.
reload
();
};
// 监听 statusFilter 的变化,如果为 undefined 则重置选中的 key 和 taskId | listen for changes in statusFilter, if it is undefined, reset the selected key and taskId
useEffect
(()
=>
{
if
(
statusFilter
===
undefined
)
{
resetValue
();
}
},
[
statusFilter
]);
/**
* 获取任务数据 | query task data
*/
useEffect
(()
=>
{
getTaskData
().
then
((
res
)
=>
{
if
(
res
)
{
setData
(
buildProjectTree
(
res
,
searchValue
,
[]));
}
});
},
[
searchValue
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
setInterval
(()
=>
tableRef
.
current
?.
reload
(
false
),
5
*
1000
);
setInterval
(()
=>
tableRef
.
current
?.
reload
(
false
),
5
*
1000
);
},
[]);
},
[]);
const
onChangeSearch
=
(
e
:
any
)
=>
{
let
{
value
}
=
e
.
target
;
if
(
!
value
)
{
setSearchValueValue
(
value
);
return
;
}
value
=
String
(
value
).
trim
();
const
expandList
:
any
[]
=
generateList
(
data
,
[]);
let
expandedKeys
:
any
=
expandList
.
map
((
item
:
any
)
=>
{
if
(
item
?.
name
.
indexOf
(
value
)
>
-
1
)
{
return
getParentKey
(
item
.
key
,
data
);
}
return
null
;
})
.
filter
((
item
:
any
,
i
:
number
,
self
:
any
)
=>
item
&&
self
.
indexOf
(
item
)
===
i
);
setExpandedKeys
(
expandedKeys
);
setSearchValueValue
(
value
);
setAutoExpandParent
(
true
);
};
function
onNodeClick
(
info
:
any
)
{
const
{
node
:
{
isLeaf
,
name
,
type
,
parentId
,
path
,
key
,
taskId
,
fullInfo
}
}
=
info
;
if
(
isLeaf
)
{
// 如果是 leaf 节点 则设置选中的 key 和 taskId | if it is a leaf node, set the selected key and taskId
setSelectedKey
([
key
]);
setTaskId
(
taskId
);
}
else
{
// 如果不是 leaf 节点 则设置选中的 key 和 taskId 为 undefined | if it is not a leaf node, set the selected key and taskId to undefined
setTaskId
(
undefined
);
setSelectedKey
([]);
}
}
return
(
return
(
<
ProCard
boxShadow=
{
true
}
>
<
ProCard
boxShadow
ghost
size=
{
'small'
}
bodyStyle=
{
{
height
:
parent
.
innerHeight
-
215
,
marginTop
:
-
30
,
overflow
:
'auto'
,
width
:
'99vw'
}
}
>
<
SplitPane
split=
{
'vertical'
}
defaultSizes=
{
[
100
,
500
]
}
minSize=
{
200
}
className=
{
'split-pane'
}
>
<
Pane
className=
{
'split-pane'
}
forwardRef=
{
refObject
}
minSize=
{
200
}
size=
{
200
}
split=
{
'horizontal'
}
>
<
Search
style=
{
{
margin
:
'8px 0px'
}
}
placeholder=
{
l
(
'global.search.text'
)
}
onChange=
{
onChangeSearch
}
allowClear=
{
true
}
addonAfter=
{
// 如果选中的 key 长度大于 0 则显示清除按钮 | if the length of the selected key is greater than 0, the clear button is displayed
selectedKey
.
length
>
0
&&
(
<
Button
title=
{
l
(
'devops.joblist.clear.filtertips'
)
}
icon=
{
<
ClearOutlined
/>
}
onClick=
{
()
=>
resetValue
()
}
>
{
l
(
'devops.joblist.clear.filter'
)
}
</
Button
>
)
}
/>
{
data
.
length
?
(
<
DirectoryTree
className=
{
'treeList'
}
onSelect=
{
(
_
,
info
)
=>
onNodeClick
(
info
)
}
// onRightClick=
{
onRightClick
}
expandedKeys=
{
expandedKeys
}
// expandAction=
{'
doubleClick
'}
selectedKeys=
{
selectedKey
}
onExpand=
{
(
expandedKeys
:
Key
[])
=>
setExpandedKeys
(
expandedKeys
)
}
treeData=
{
data
}
autoExpandParent=
{
autoExpandParent
}
/>
)
:
(
<
Empty
className=
{
'code-content-empty'
}
/>
)
}
</
Pane
>
<
Pane
className=
{
'split-pane'
}
forwardRef=
{
refObject
}
minSize=
{
200
}
size=
{
200
}
split=
{
'horizontal'
}
>
<
ProTable
<
Jobs
.
JobInstance
>
<
ProTable
<
Jobs
.
JobInstance
>
{
...
PROTABLE_OPTIONS_PUBLIC
}
{
...
PROTABLE_OPTIONS_PUBLIC
}
search=
{
false
}
search=
{
false
}
tableStyle=
{
{
height
:
parent
.
innerHeight
-
210
}
}
loading=
{
{
delay
:
1000
}
}
loading=
{
{
delay
:
1000
}
}
rowKey=
{
(
record
)
=>
record
.
jid
}
rowKey=
{
(
record
)
=>
record
.
jid
}
columns=
{
jobListColumns
}
columns=
{
jobListColumns
}
params=
{
{
isHistory
:
false
,
status
:
statusFilter
,
step
:
stepFilter
,
name
:
taskFilter
}
}
params=
{
{
isHistory
:
false
,
status
:
statusFilter
,
step
:
stepFilter
,
name
:
taskFilter
,
taskId
:
taskId
}
}
actionRef=
{
tableRef
}
actionRef=
{
tableRef
}
toolbar=
{
{
toolbar=
{
{
settings
:
false
,
settings
:
false
,
search
:
{
onSearch
:
(
value
:
string
)
=>
setTaskFilter
(
value
)
},
search
:
{
onSearch
:
(
value
:
string
)
=>
setTaskFilter
(
value
)
},
filter
:
(
filter
:
(
<>
<>
<
Radio
.
Group
defaultValue=
{
undefined
}
onChange=
{
(
e
)
=>
setStepFilter
(
e
.
target
.
value
)
}
>
<
Radio
.
Group
defaultValue=
{
undefined
}
onChange=
{
(
e
)
=>
setStepFilter
(
e
.
target
.
value
)
}
>
<
Radio
.
Button
value=
{
undefined
}
defaultChecked=
{
true
}
>
<
Radio
.
Button
value=
{
undefined
}
defaultChecked=
{
true
}
>
{
l
(
'global.table.lifecycle.all'
)
}
{
l
(
'global.table.lifecycle.all'
)
}
</
Radio
.
Button
>
</
Radio
.
Button
>
...
@@ -127,7 +283,9 @@ const JobList = () => {
...
@@ -127,7 +283,9 @@ const JobList = () => {
</
Radio
.
Group
>
</
Radio
.
Group
>
</>
</>
),
),
actions
:
[<
Button
icon=
{
<
RedoOutlined
/>
}
onClick=
{
()
=>
tableRef
.
current
?.
reload
()
}
/>]
actions
:
[
<
Button
icon=
{
<
RedoOutlined
/>
}
onClick=
{
()
=>
tableRef
.
current
?.
reload
()
}
/>
]
}
}
}
}
request=
{
async
(
params
,
sorter
,
filter
:
any
)
=>
request=
{
async
(
params
,
sorter
,
filter
:
any
)
=>
queryList
(
API_CONSTANTS
.
JOB_INSTANCE
,
{
queryList
(
API_CONSTANTS
.
JOB_INSTANCE
,
{
...
@@ -137,7 +295,9 @@ const JobList = () => {
...
@@ -137,7 +295,9 @@ const JobList = () => {
})
})
}
}
expandable=
{
{
expandable=
{
{
expandedRowRender
:
(
record
)
=>
<
JobHistoryList
taskId=
{
record
.
taskId
}
key=
{
record
.
jid
}
/>,
expandedRowRender
:
(
record
)
=>
(
<
JobHistoryList
taskId=
{
record
.
taskId
}
key=
{
record
.
jid
}
/>
),
expandIcon
:
({
expanded
,
onExpand
,
record
})
=>
(
expandIcon
:
({
expanded
,
onExpand
,
record
})
=>
(
<
Button
<
Button
className=
{
'options-button'
}
className=
{
'options-button'
}
...
@@ -149,6 +309,8 @@ const JobList = () => {
...
@@ -149,6 +309,8 @@ const JobList = () => {
)
)
}
}
}
}
/
>
/
>
</
Pane
>
</
SplitPane
>
</
ProCard
>
</
ProCard
>
);
);
};
};
...
...
dinky-web/src/pages/DevOps/index.tsx
View file @
e587f49a
...
@@ -36,7 +36,7 @@ export default () => {
...
@@ -36,7 +36,7 @@ export default () => {
<
SlowlyAppear
>
<
SlowlyAppear
>
<
PageContainer
title=
{
false
}
breadcrumb=
{
{
style
:
{
display
:
'none'
}
}
}
>
<
PageContainer
title=
{
false
}
breadcrumb=
{
{
style
:
{
display
:
'none'
}
}
}
>
<
DevopContext
.
Provider
value=
{
{
statusFilter
,
setStatusFilter
}
}
>
<
DevopContext
.
Provider
value=
{
{
statusFilter
,
setStatusFilter
}
}
>
<
Space
direction=
'vertical'
size=
{
16
}
>
<
Space
direction=
'vertical'
size=
{
24
}
>
<
JobOverview
/>
<
JobOverview
/>
<
JobList
/>
<
JobList
/>
</
Space
>
</
Space
>
...
...
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