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
4dd8002d
Unverified
Commit
4dd8002d
authored
May 28, 2023
by
gaoyan
Committed by
GitHub
May 28, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Refactor][web] Refactor devops page of overview (#1990)
* add Devops pages * optim Devops pages * optim Devops pages
parent
c01c5aa3
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
395 additions
and
4 deletions
+395
-4
JobInstanceMapper.xml
dinky-admin/src/main/resources/mapper/JobInstanceMapper.xml
+3
-0
routes.ts
dinky-web/config/routes.ts
+3
-3
pages.ts
dinky-web/src/locales/en-US/pages.ts
+8
-0
global.ts
dinky-web/src/locales/zh-CN/global.ts
+2
-1
pages.ts
dinky-web/src/locales/zh-CN/pages.ts
+8
-0
.ignore
dinky-web/src/pages/DevOps/.ignore
+0
-0
JobHistoryList.tsx
...-web/src/pages/DevOps/JobList/compents/JobHistoryList.tsx
+76
-0
constants.tsx
dinky-web/src/pages/DevOps/JobList/constants.tsx
+42
-0
function.tsx
dinky-web/src/pages/DevOps/JobList/function.tsx
+90
-0
index.tsx
dinky-web/src/pages/DevOps/JobList/index.tsx
+109
-0
constants.tsx
dinky-web/src/services/constants.tsx
+2
-0
data.d.ts
dinky-web/src/types/DevOps/data.d.ts
+25
-0
function.tsx
dinky-web/src/utils/function.tsx
+27
-0
No files found.
dinky-admin/src/main/resources/mapper/JobInstanceMapper.xml
View file @
4dd8002d
...
...
@@ -31,6 +31,9 @@
<if
test=
'param.type!=null and param.type!=""'
>
and dh.type = #{param.type}
</if>
<if
test=
'param.taskId!=null and param.taskId!=""'
>
and a.task_id = #{param.taskId}
</if>
<if
test=
'param.step!=null and param.step!=""'
>
and a.step = #{param.step}
</if>
...
...
dinky-web/config/routes.ts
View file @
4dd8002d
...
...
@@ -65,13 +65,13 @@ export default [
routes
:
[
{
path
:
'/devops'
,
redirect
:
'/devops/job'
,
redirect
:
'/devops/job
list
'
,
},
{
path
:
'/devops/job'
,
path
:
'/devops/job
list
'
,
name
:
'job'
,
hideInMenu
:
true
,
// component: './DevOps/JobInfo
',
component
:
'./DevOps/JobList
'
,
},
],
},
...
...
dinky-web/src/locales/en-US/pages.ts
View file @
4dd8002d
...
...
@@ -51,6 +51,14 @@ export default {
'about.communityRules.5'
:
' Register who is using Dinky, and can enter the enterprise user group to provide technical support. '
,
//-------------------------------- devops --------------------------------
// devops
'devops.joblist.joblist'
:
'JobList'
,
'devops.joblist.history'
:
'History'
,
'devops.joblist.detail'
:
'Job Detail'
,
//-------------------------------- auth center --------------------------------
// user
'user.manager'
:
'User Management'
,
...
...
dinky-web/src/locales/zh-CN/global.ts
View file @
4dd8002d
...
...
@@ -127,7 +127,8 @@ export default {
'global.table.status.abnormal'
:
'异常'
,
'global.table.jobname'
:
'任务名称'
,
'global.table.jobid'
:
'作业ID'
,
'global.table.jobid'
:
'Job ID'
,
'global.table.taskid'
:
'任务ID'
,
'global.table.lifecycle'
:
'生命周期'
,
'global.table.lifecycle.all'
:
'全部'
,
'global.table.lifecycle.dev'
:
'开发中'
,
...
...
dinky-web/src/locales/zh-CN/pages.ts
View file @
4dd8002d
...
...
@@ -47,6 +47,14 @@ export default {
'about.communityRules.4'
:
'群提问题请礼貌并且说明【版本、执行模式、操作描述、截图】。'
,
'about.communityRules.5'
:
' 登记谁在使用 Dinky,可进入企业用户群提供技术支持。'
,
//-------------------------------- devops --------------------------------
// devops
'devops.joblist.joblist'
:
'任务列表'
,
'devops.joblist.history'
:
'历史'
,
'devops.joblist.detail'
:
'详情'
,
//-------------------------------- auth center --------------------------------
// user
'user.manager'
:
'用户管理'
,
...
...
dinky-web/src/pages/DevOps/.ignore
deleted
100644 → 0
View file @
c01c5aa3
dinky-web/src/pages/DevOps/JobList/compents/JobHistoryList.tsx
0 → 100644
View file @
4dd8002d
import
type
{
ActionType
,
ProColumns
}
from
'@ant-design/pro-components'
;
import
{
ProTable
}
from
'@ant-design/pro-components'
;
import
React
,
{
useRef
}
from
'react'
;
import
{
Jobs
}
from
"@/types/DevOps/data"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
API_CONSTANTS
}
from
"@/services/constants"
;
import
{
parseSecondStr
}
from
"@/utils/function"
;
import
{
queryList
}
from
"@/services/api"
;
import
{
TagJobStatus
}
from
"@/pages/DevOps/JobList/function"
;
type
HistoryProps
=
{
taskId
:
number
;
};
const
JobHistoryList
=
(
props
:
HistoryProps
)
=>
{
const
{
taskId
}
=
props
const
actionRef
=
useRef
<
ActionType
>
();
const
jobListColums
:
ProColumns
<
Jobs
.
JobInstance
>
[]
=
[
{
title
:
l
(
'global.table.createTime'
),
dataIndex
:
"createTime"
,
valueType
:
'dateTime'
,
},
{
title
:
l
(
'global.table.endTime'
),
dataIndex
:
"finishTime"
,
valueType
:
'dateTime'
,
},
{
title
:
l
(
'global.table.jobid'
),
dataIndex
:
"jid"
,
key
:
"jid"
,
},
{
title
:
l
(
'global.table.status'
),
dataIndex
:
"status"
,
render
:
(
_
,
row
)
=>
TagJobStatus
(
row
.
status
)
},
{
title
:
l
(
'global.table.useTime'
),
render
:
(
_
,
row
)
=>
parseSecondStr
(
row
.
duration
)
},
{
title
:
l
(
'global.table.operate'
),
valueType
:
'option'
,
render
:
()
=>
[<
a
key=
{
"history-detail"
}
>
{
l
(
'devops.joblist.detail'
)
}
</
a
>],
},
];
return
(
<>
<
ProTable
<
Jobs
.
JobInstance
>
search=
{
false
}
params=
{
{
isHistory
:
true
}
}
tableStyle=
{
{
overflowX
:
"hidden"
,
overflowY
:
"hidden"
,
margin
:
"10px"
}
}
size=
{
"small"
}
columns=
{
jobListColums
}
actionRef=
{
actionRef
}
request=
{
(
params
)
=>
queryList
(
API_CONSTANTS
.
GET_JOB_LIST
,
{
...
params
,
filter
:
{
task_id
:
[
taskId
]}
})
}
rowKey=
{
(
record
)
=>
record
.
id
}
toolBarRender=
{
false
}
pagination=
{
{
showSizeChanger
:
false
}
}
/
>
</>
);
}
export default JobHistoryList;
dinky-web/src/pages/DevOps/JobList/constants.tsx
0 → 100644
View file @
4dd8002d
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export
const
JOB_LIFE_CYCLE
=
{
UNKNOWN
:
0
,
CREATE
:
1
,
DEVELOP
:
2
,
DEBUG
:
3
,
RELEASE
:
4
,
ONLINE
:
5
,
CANCEL
:
6
,
};
export
const
JOB_STATUS
=
{
FINISHED
:
'FINISHED'
,
RUNNING
:
'RUNNING'
,
FAILED
:
'FAILED'
,
CANCELED
:
'CANCELED'
,
INITIALIZING
:
'INITIALIZING'
,
RESTARTING
:
'RESTARTING'
,
CREATED
:
'CREATED'
,
FAILING
:
'FAILING'
,
SUSPENDED
:
'SUSPENDED'
,
CANCELLING
:
'CANCELLING'
,
UNKNOWN
:
'UNKNOWN'
,
};
dinky-web/src/pages/DevOps/JobList/function.tsx
0 → 100644
View file @
4dd8002d
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
Tag
}
from
"antd"
;
import
{
CameraOutlined
,
CarryOutOutlined
,
CheckCircleOutlined
,
ClockCircleOutlined
,
CloseCircleOutlined
,
EditOutlined
,
MinusCircleOutlined
,
QuestionCircleOutlined
,
SyncOutlined
}
from
"@ant-design/icons"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
JOB_LIFE_CYCLE
,
JOB_STATUS
}
from
"@/pages/DevOps/JobList/constants"
;
export
const
TagJobLifeCycle
=
(
step
:
number
)
=>
{
switch
(
step
)
{
case
JOB_LIFE_CYCLE
.
DEVELOP
:
return
(<
Tag
icon=
{
<
EditOutlined
/>
}
color=
"default"
>
{
l
(
'global.table.lifecycle.dev'
)
}
</
Tag
>);
case
JOB_LIFE_CYCLE
.
RELEASE
:
return
(<
Tag
icon=
{
<
CameraOutlined
/>
}
color=
"green"
>
{
l
(
'global.table.lifecycle.publish'
)
}
</
Tag
>);
case
JOB_LIFE_CYCLE
.
ONLINE
:
return
(<
Tag
icon=
{
<
CarryOutOutlined
/>
}
color=
"blue"
>
{
l
(
'global.table.lifecycle.online'
)
}
</
Tag
>);
default
:
return
step
;
}
};
export
const
TagJobStatus
=
(
status
:
string
|
undefined
)
=>
{
switch
(
status
)
{
case
JOB_STATUS
.
RUNNING
:
return
<
Tag
icon=
{
<
SyncOutlined
spin
/>
}
color=
"green"
>
RUNNING
</
Tag
>
case
JOB_STATUS
.
FINISHED
:
return
<
Tag
icon=
{
<
CheckCircleOutlined
/>
}
color=
"blue"
>
FINISHED
</
Tag
>
case
JOB_STATUS
.
CANCELED
:
return
<
Tag
icon=
{
<
MinusCircleOutlined
/>
}
color=
"orange"
>
CANCELED
</
Tag
>
case
JOB_STATUS
.
INITIALIZING
:
return
<
Tag
icon=
{
<
ClockCircleOutlined
/>
}
color=
"default"
>
INITIALIZING
</
Tag
>
case
JOB_STATUS
.
RESTARTING
:
return
<
Tag
icon=
{
<
ClockCircleOutlined
/>
}
color=
"default"
>
RESTARTING
</
Tag
>
case
JOB_STATUS
.
CREATED
:
return
<
Tag
icon=
{
<
ClockCircleOutlined
/>
}
color=
"default"
>
CREATED
</
Tag
>
case
JOB_STATUS
.
UNKNOWN
:
return
<
Tag
icon=
{
<
QuestionCircleOutlined
/>
}
color=
"default"
>
UNKNOWN
</
Tag
>
default
:
return
<
Tag
icon=
{
<
CloseCircleOutlined
/>
}
color=
"error"
>
FAILED
</
Tag
>;
}
};
export
const
LIFECYCLE_FILTER
=
()
=>
{
return
[
{
text
:
l
(
'global.table.lifecycle.dev'
),
value
:
JOB_LIFE_CYCLE
.
DEVELOP
},
{
text
:
l
(
'global.table.lifecycle.publish'
),
value
:
JOB_LIFE_CYCLE
.
RELEASE
},
{
text
:
l
(
'global.table.lifecycle.online'
),
value
:
JOB_LIFE_CYCLE
.
ONLINE
},
{
text
:
l
(
'global.table.lifecycle.unknown'
),
value
:
JOB_LIFE_CYCLE
.
UNKNOWN
},
]
};
export
const
JOB_STATUS_FILTER
=
()
=>
{
return
[
{
text
:
JOB_STATUS
.
FINISHED
,
value
:
JOB_STATUS
.
FINISHED
},
{
text
:
JOB_STATUS
.
RUNNING
,
value
:
JOB_STATUS
.
RUNNING
},
{
text
:
JOB_STATUS
.
FAILED
,
value
:
JOB_STATUS
.
FAILED
},
{
text
:
JOB_STATUS
.
CANCELED
,
value
:
JOB_STATUS
.
CANCELED
},
{
text
:
JOB_STATUS
.
INITIALIZING
,
value
:
JOB_STATUS
.
INITIALIZING
},
{
text
:
JOB_STATUS
.
RESTARTING
,
value
:
JOB_STATUS
.
RESTARTING
},
{
text
:
JOB_STATUS
.
CREATED
,
value
:
JOB_STATUS
.
CREATED
},
{
text
:
JOB_STATUS
.
FAILING
,
value
:
JOB_STATUS
.
FAILING
},
{
text
:
JOB_STATUS
.
SUSPENDED
,
value
:
JOB_STATUS
.
SUSPENDED
},
{
text
:
JOB_STATUS
.
CANCELLING
,
value
:
JOB_STATUS
.
CANCELLING
},
{
text
:
JOB_STATUS
.
UNKNOWN
,
value
:
JOB_STATUS
.
UNKNOWN
},
]
};
dinky-web/src/pages/DevOps/JobList/index.tsx
0 → 100644
View file @
4dd8002d
import
type
{
ActionType
,
ProColumns
}
from
'@ant-design/pro-components'
;
import
{
ProTable
}
from
'@ant-design/pro-components'
;
import
{
Button
,
Table
}
from
'antd'
;
import
React
,
{
useEffect
,
useRef
}
from
'react'
;
import
{
Jobs
}
from
"@/types/DevOps/data"
;
import
JobHistoryList
from
"@/pages/DevOps/JobList/compents/JobHistoryList"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
parseSecondStr
}
from
"@/utils/function"
;
import
{
API_CONSTANTS
}
from
"@/services/constants"
;
import
{
queryList
}
from
"@/services/api"
;
import
{
ClockCircleTwoTone
,
EyeTwoTone
}
from
"@ant-design/icons"
;
import
{
JOB_STATUS_FILTER
,
LIFECYCLE_FILTER
,
TagJobLifeCycle
,
TagJobStatus
}
from
"@/pages/DevOps/JobList/function"
;
const
JobList
=
()
=>
{
const
tableRef
=
useRef
<
ActionType
>
();
const
jobListColums
:
ProColumns
<
Jobs
.
JobInstance
>
[]
=
[
{
title
:
l
(
'global.table.taskid'
),
dataIndex
:
"taskId"
,
},
{
title
:
l
(
'global.table.jobname'
),
dataIndex
:
"name"
,
},
{
title
:
l
(
'global.table.lifecycle'
),
filters
:
LIFECYCLE_FILTER
(),
hideInSearch
:
true
,
dataIndex
:
"step"
,
render
:
(
_
,
row
)
=>
TagJobLifeCycle
(
row
.
step
)
},
{
title
:
l
(
'global.table.runmode'
),
dataIndex
:
"type"
,
hideInSearch
:
true
},
{
title
:
l
(
'global.table.jobid'
),
dataIndex
:
"jid"
,
},
{
title
:
l
(
'global.table.createTime'
),
hideInSearch
:
true
,
dataIndex
:
"createTime"
,
},
{
title
:
l
(
'global.table.useTime'
),
hideInSearch
:
true
,
render
:
(
_
,
row
)
=>
parseSecondStr
(
row
.
duration
)
},
{
title
:
l
(
'global.table.status'
),
filters
:
JOB_STATUS_FILTER
(),
hideInSearch
:
true
,
dataIndex
:
"status"
,
render
:
(
_
,
row
)
=>
TagJobStatus
(
row
.
status
)
},
Table
.
EXPAND_COLUMN
,
{
title
:
l
(
'global.table.operate'
),
valueType
:
'option'
,
render
:
(
text
,
record
)
=>
[
<
Button
className=
{
'options-button'
}
key=
{
`${record.id}_history`
}
title=
{
l
(
'devops.joblist.detail'
)
}
icon=
{
<
EyeTwoTone
/>
}
/>
],
},
];
useEffect
(()
=>
{
setInterval
(()
=>
tableRef
.
current
?.
reload
(
false
),
5
*
1000
);
},
[]);
return
(
<
ProTable
<
Jobs
.
JobInstance
>
rowKey=
{
(
record
=>
record
.
jid
)
}
columns=
{
jobListColums
}
params=
{
{
isHistory
:
false
}
}
actionRef=
{
tableRef
}
headerTitle=
{
l
(
'devops.joblist.joblist'
)
}
request=
{
async
(
params
,
sorter
,
filter
:
any
)
=>
{
return
queryList
(
API_CONSTANTS
.
GET_JOB_LIST
,
{
...
params
,
sorter
,
filter
})
}
}
expandable=
{
{
expandedRowRender
:
(
record
)
=>
<
JobHistoryList
taskId=
{
record
.
taskId
}
key=
{
record
.
jid
}
/>,
expandIcon
:
({
expanded
,
onExpand
,
record
})
=>
{
return
(
<
Button
className=
{
'options-button'
}
key=
{
`${record.id}_history`
}
onClick=
{
e
=>
onExpand
(
record
,
e
)
}
title=
{
l
(
'devops.joblist.history'
)
}
icon=
{
<
ClockCircleTwoTone
twoToneColor=
{
expanded
?
'#52c41a'
:
'#4096ff'
}
/>
}
/>
)
}
}
}
/
>
);
}
export default JobList;
dinky-web/src/services/constants.tsx
View file @
4dd8002d
...
...
@@ -168,6 +168,8 @@ export const API_CONSTANTS = {
// process list
PROCESS_LIST
:
"/api/process/listAllProcess"
,
GET_JOB_LIST
:
"/api/jobInstance"
,
};
...
...
dinky-web/src/types/DevOps/data.d.ts
0 → 100644
View file @
4dd8002d
import
{
BaseBeanColumns
}
from
"@/types/Public/data"
;
/**
* about flink job
*/
declare
namespace
Jobs
{
export
type
JobInstance
=
BaseBeanColumns
&
{
taskId
:
number
,
step
:
number
,
clusterId
:
number
,
clusterName
:
string
,
type
:
string
,
jobManagerAddress
:
string
,
jid
:
string
,
status
:
string
,
historyId
:
number
,
error
:
string
,
failedRestartCount
:
number
,
duration
:
number
,
finishTime
:
Date
,
};
}
dinky-web/src/utils/function.tsx
View file @
4dd8002d
...
...
@@ -34,6 +34,7 @@ import {
YAMLSvg
}
from
"@/components/Icons/CodeLanguageIcon"
;
import
path
from
"path"
;
import
{
l
}
from
"@/utils/intl"
;
/**
* PUT tenantId TO localStorage & cookies
...
...
@@ -273,6 +274,32 @@ export const folderSeparator = () => {
}
/**
* Generate time string
* @param s_time datetime
*/
export
const
parseSecondStr
=
(
s_time
:
number
)
=>
{
let
second_time
=
Math
.
floor
(
s_time
);
let
time
=
second_time
+
l
(
'global.time.second'
);
if
(
second_time
>
60
)
{
let
second
=
second_time
%
60
;
let
min
=
Math
.
floor
(
second_time
/
60
);
time
=
min
+
l
(
'global.time.minute'
)
+
second
+
l
(
'global.time.second'
);
if
(
min
>
60
)
{
min
=
Math
.
floor
(
second_time
/
60
)
%
60
;
let
hour
=
Math
.
floor
(
Math
.
floor
(
second_time
/
60
)
/
60
);
time
=
hour
+
l
(
'global.time.hour'
)
+
min
+
l
(
'global.time.minute'
)
+
second
+
l
(
'global.time.second'
);
if
(
hour
>
24
)
{
hour
=
Math
.
floor
(
Math
.
floor
(
second_time
/
60
)
/
60
)
%
24
;
let
day
=
Math
.
floor
(
Math
.
floor
(
Math
.
floor
(
second_time
/
60
)
/
60
)
/
24
);
time
=
day
+
l
(
'global.time.day'
)
+
hour
+
l
(
'global.time.hour'
)
+
min
+
l
(
'global.time.minute'
)
+
second
+
l
(
'global.time.second'
);
}
}
}
return
time
;
}
/**
...
...
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