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
134d16ed
Unverified
Commit
134d16ed
authored
Jul 12, 2023
by
gaoyan
Committed by
GitHub
Jul 12, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor the Devops Job details page (#2120)
* 新增作业详情页面 * lost job api
parent
80c75834
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
531 additions
and
14 deletions
+531
-14
config.ts
dinky-web/config/config.ts
+3
-1
routes.ts
dinky-web/config/routes.ts
+7
-0
global.ts
dinky-web/src/locales/en-US/global.ts
+2
-2
menu.ts
dinky-web/src/locales/en-US/menu.ts
+3
-0
pages.ts
dinky-web/src/locales/en-US/pages.ts
+38
-0
global.ts
dinky-web/src/locales/zh-CN/global.ts
+2
-2
menu.ts
dinky-web/src/locales/zh-CN/menu.ts
+3
-0
pages.ts
dinky-web/src/locales/zh-CN/pages.ts
+39
-0
JobConfigTab.tsx
...eb/src/pages/DevOps/JobDetail/components/JobConfigTab.tsx
+158
-0
JobOperator.tsx
...web/src/pages/DevOps/JobDetail/components/JobOperator.tsx
+91
-0
index.tsx
dinky-web/src/pages/DevOps/JobDetail/index.tsx
+85
-0
JobHistoryList.tsx
...eb/src/pages/DevOps/JobList/components/JobHistoryList.tsx
+1
-1
index.tsx
dinky-web/src/pages/DevOps/JobList/index.tsx
+8
-6
constants.tsx
dinky-web/src/pages/DevOps/constants.tsx
+0
-0
function.tsx
dinky-web/src/pages/DevOps/function.tsx
+45
-2
constants.tsx
dinky-web/src/services/constants.tsx
+3
-0
data.d.ts
dinky-web/src/types/DevOps/data.d.ts
+43
-0
No files found.
dinky-web/config/config.ts
View file @
134d16ed
...
@@ -151,7 +151,9 @@ export default defineConfig({
...
@@ -151,7 +151,9 @@ export default defineConfig({
* @description 它基于 axios 和 ahooks 的 useRequest 提供了一套统一的网络请求和错误处理方案。
* @description 它基于 axios 和 ahooks 的 useRequest 提供了一套统一的网络请求和错误处理方案。
* @doc https://umijs.org/docs/max/request
* @doc https://umijs.org/docs/max/request
*/
*/
request
:
{},
request
:
{
dataField
:
'datas'
,
},
/**
/**
* @name 权限插件
* @name 权限插件
* @description 基于 initialState 的权限插件,必须先打开 initialState
* @description 基于 initialState 的权限插件,必须先打开 initialState
...
...
dinky-web/config/routes.ts
View file @
134d16ed
...
@@ -74,6 +74,13 @@ export default [
...
@@ -74,6 +74,13 @@ export default [
hideInMenu
:
true
,
hideInMenu
:
true
,
component
:
'./DevOps'
,
component
:
'./DevOps'
,
},
},
{
path
:
'/devops/job-detail'
,
name
:
'job-detail'
,
hideInMenu
:
true
,
component
:
'./DevOps/JobDetail'
,
},
],
],
},
},
{
{
...
...
dinky-web/src/locales/en-US/global.ts
View file @
134d16ed
...
@@ -132,11 +132,11 @@ export default {
...
@@ -132,11 +132,11 @@ export default {
'global.table.status.abnormal'
:
'Abnormal'
,
'global.table.status.abnormal'
:
'Abnormal'
,
'global.table.jobname'
:
'Job Name'
,
'global.table.jobname'
:
'Job Name'
,
'global.table.jobid'
:
'Job Id'
,
'global.table.taskid'
:
'Task Id'
,
'global.table.lifecycle'
:
'Life Cycle'
,
'global.table.lifecycle'
:
'Life Cycle'
,
'global.table.lifecycle.all'
:
'All'
,
'global.table.lifecycle.all'
:
'All'
,
'global.table.lifecycle.dev'
:
'Develop'
,
'global.table.lifecycle.dev'
:
'Develop'
,
'global.table.execmode.batch'
:
'Batch Mode'
,
'global.table.execmode.streaming'
:
'Stream Mode'
,
'global.table.lifecycle.publish'
:
'Publish'
,
'global.table.lifecycle.publish'
:
'Publish'
,
'global.table.lifecycle.online'
:
'Online'
,
'global.table.lifecycle.online'
:
'Online'
,
'global.table.lifecycle.unknown'
:
'Unknown'
,
'global.table.lifecycle.unknown'
:
'Unknown'
,
...
...
dinky-web/src/locales/en-US/menu.ts
View file @
134d16ed
...
@@ -34,8 +34,11 @@ export default {
...
@@ -34,8 +34,11 @@ export default {
'menu.account.checkTenantConfirm'
:
'Are you sure to switch tenant [ {tenantCode} ] ?'
,
'menu.account.checkTenantConfirm'
:
'Are you sure to switch tenant [ {tenantCode} ] ?'
,
'menu.datastudio'
:
'Data Studio'
,
'menu.datastudio'
:
'Data Studio'
,
'menu.devops'
:
'Devops'
,
'menu.devops'
:
'Devops'
,
'menu.devops.job'
:
'Job Instance'
,
'menu.devops.job'
:
'Job Instance'
,
'menu.devops.job-detail'
:
'Job Detail'
,
'menu.datacenter'
:
'Meta Data Center'
,
'menu.datacenter'
:
'Meta Data Center'
,
'menu.datacenter.metadata'
:
'Meta Data'
,
'menu.datacenter.metadata'
:
'Meta Data'
,
'menu.registration'
:
'Registration Center'
,
'menu.registration'
:
'Registration Center'
,
...
...
dinky-web/src/locales/en-US/pages.ts
View file @
134d16ed
...
@@ -96,6 +96,44 @@ export default {
...
@@ -96,6 +96,44 @@ export default {
'devops.joblist.history'
:
'History'
,
'devops.joblist.history'
:
'History'
,
'devops.joblist.detail'
:
'Job Detail'
,
'devops.joblist.detail'
:
'Job Detail'
,
'devops.jobinfo.savepoint.trigger'
:
'SavePoint Triggers'
,
'devops.jobinfo.savepoint.stop'
:
'SavePoint Pause'
,
'devops.jobinfo.savepoint.cancel'
:
'SavePoint Stop'
,
'devops.jobinfo.savepoint.canceljob'
:
'Normal Stop'
,
'devops.jobinfo.localenv'
:
'Local Environment'
,
'devops.jobinfo.offline'
:
'Offline'
,
'devops.jobinfo.smart_stop'
:
'Smart Stop'
,
'devops.jobinfo.reonline'
:
'Re-Online'
,
'devops.jobinfo.reonlineJob'
:
'Re-online Job'
,
'devops.jobinfo.reonlineJobConfirm'
:
'Are you sure you want to re-launch this job? '
,
'devops.jobinfo.reonline.success'
:
'Re-online successfully'
,
'devops.jobinfo.reonline.failed'
:
'Failed to re-online'
,
'devops.jobinfo.restart'
:
'Restart'
,
'devops.jobinfo.stopJob'
:
'Stop job'
,
'devops.jobinfo.stopJobConfirm'
:
'Are you sure to just stop this job without SavePoint operation? '
,
'devops.jobinfo.canceljob.success'
:
'Normal stop succeeded'
,
'devops.jobinfo.canceljob.failed'
:
'Normal stop failed'
,
'devops.jobinfo.job.key'
:
'{key} Job'
,
'devops.jobinfo.job.key.success'
:
'{key} Success'
,
'devops.jobinfo.job.keyConfirm'
:
'{key} this Job?'
,
'devops.jobinfo.config.JobInfo'
:
'Job Info'
,
'devops.jobinfo.config.JobOveriew'
:
'Job Overview'
,
'devops.jobinfo.config.JobException'
:
'Exception Info'
,
'devops.jobinfo.config.JobBaseInfo'
:
'Job Base Info'
,
'devops.jobinfo.config.UserCustomConf'
:
'Custom Config'
,
'devops.jobinfo.config.taskId'
:
'Dinky Job ID'
,
'devops.jobinfo.config.JobId'
:
'Flink Job ID'
,
'devops.jobinfo.config.submitType'
:
'Submit Mode'
,
'devops.jobinfo.config.execmode'
:
'Exec Mode'
,
'devops.jobinfo.config.ClusterInstanceName'
:
'Flink Instance'
,
'devops.jobinfo.config.ClusterConfigName'
:
'Cluster Config'
,
'devops.jobinfo.config.useSqlFragment'
:
'Sql Fragment'
,
'devops.jobinfo.config.JobType'
:
'Job Type'
,
'devops.jobinfo.config.startFromSavePoint'
:
'Start from SavePoint'
,
'devops.jobinfo.config.savePointPath'
:
'savePoint path'
,
'devops.jobinfo.config.RestartStrategy'
:
'RestartStrategy'
,
'devops.jobinfo.config.JobParallelism'
:
'JobParallelism'
,
//-------------------------------- auth center --------------------------------
//-------------------------------- auth center --------------------------------
// user
// user
...
...
dinky-web/src/locales/zh-CN/global.ts
View file @
134d16ed
...
@@ -128,8 +128,6 @@ export default {
...
@@ -128,8 +128,6 @@ export default {
'global.table.status.abnormal'
:
'异常'
,
'global.table.status.abnormal'
:
'异常'
,
'global.table.jobname'
:
'任务名称'
,
'global.table.jobname'
:
'任务名称'
,
'global.table.jobid'
:
'Job ID'
,
'global.table.taskid'
:
'任务ID'
,
'global.table.lifecycle'
:
'生命周期'
,
'global.table.lifecycle'
:
'生命周期'
,
'global.table.lifecycle.all'
:
'全部'
,
'global.table.lifecycle.all'
:
'全部'
,
'global.table.lifecycle.dev'
:
'开发中'
,
'global.table.lifecycle.dev'
:
'开发中'
,
...
@@ -137,6 +135,8 @@ export default {
...
@@ -137,6 +135,8 @@ export default {
'global.table.lifecycle.online'
:
'已上线'
,
'global.table.lifecycle.online'
:
'已上线'
,
'global.table.lifecycle.unknown'
:
'未知'
,
'global.table.lifecycle.unknown'
:
'未知'
,
'global.table.execmode'
:
'执行模式'
,
'global.table.execmode'
:
'执行模式'
,
'global.table.execmode.batch'
:
'批模式'
,
'global.table.execmode.streaming'
:
'流模式'
,
'global.table.runmode'
:
'运行模式'
,
'global.table.runmode'
:
'运行模式'
,
'global.table.runmode.local'
:
'本地'
,
'global.table.runmode.local'
:
'本地'
,
'global.table.runmode.remote'
:
'远程'
,
'global.table.runmode.remote'
:
'远程'
,
...
...
dinky-web/src/locales/zh-CN/menu.ts
View file @
134d16ed
...
@@ -34,8 +34,11 @@ export default {
...
@@ -34,8 +34,11 @@ export default {
'menu.account.checkTenantConfirm'
:
'你确定切换租户【{tenantCode}】吗?'
,
'menu.account.checkTenantConfirm'
:
'你确定切换租户【{tenantCode}】吗?'
,
'menu.datastudio'
:
'数据开发'
,
'menu.datastudio'
:
'数据开发'
,
'menu.devops'
:
'运维中心'
,
'menu.devops'
:
'运维中心'
,
'menu.devops.job'
:
'作业实例'
,
'menu.devops.job'
:
'作业实例'
,
'menu.devops.job-detail'
:
'作业详情'
,
'menu.datacenter'
:
'元数据中心'
,
'menu.datacenter'
:
'元数据中心'
,
'menu.datacenter.metadata'
:
'元数据'
,
'menu.datacenter.metadata'
:
'元数据'
,
'menu.registration'
:
'注册中心'
,
'menu.registration'
:
'注册中心'
,
...
...
dinky-web/src/locales/zh-CN/pages.ts
View file @
134d16ed
...
@@ -90,6 +90,45 @@ export default {
...
@@ -90,6 +90,45 @@ export default {
'devops.joblist.history'
:
'历史'
,
'devops.joblist.history'
:
'历史'
,
'devops.joblist.detail'
:
'详情'
,
'devops.joblist.detail'
:
'详情'
,
'devops.jobinfo.savepoint.trigger'
:
'SavePoint 触发'
,
'devops.jobinfo.savepoint.stop'
:
'SavePoint 暂停'
,
'devops.jobinfo.savepoint.cancel'
:
'SavePoint 停止'
,
'devops.jobinfo.savepoint.canceljob'
:
'普通停止'
,
'devops.jobinfo.localenv'
:
'本地环境'
,
'devops.jobinfo.offline'
:
'下线'
,
'devops.jobinfo.smart_stop'
:
'智能停止'
,
'devops.jobinfo.reonline'
:
'重新上线'
,
'devops.jobinfo.reonlineJob'
:
'重新上线任务'
,
'devops.jobinfo.reonlineJobConfirm'
:
'确定重新上线该作业吗?'
,
'devops.jobinfo.reonline.success'
:
'重新上线成功'
,
'devops.jobinfo.reonline.failed'
:
'重新上线失败'
,
'devops.jobinfo.restart'
:
'重新启动'
,
'devops.jobinfo.stopJob'
:
'停止任务'
,
'devops.jobinfo.stopJobConfirm'
:
'确定只停止该作业,不进行 SavePoint 操作吗?'
,
'devops.jobinfo.canceljob.success'
:
'普通停止成功'
,
'devops.jobinfo.canceljob.failed'
:
'普通停止失败'
,
'devops.jobinfo.job.key'
:
'{key} 任务'
,
'devops.jobinfo.job.key.success'
:
'{key} 成功'
,
'devops.jobinfo.job.keyConfirm'
:
'确定{key} 该作业吗?'
,
'devops.jobinfo.config.JobInfo'
:
'作业信息'
,
'devops.jobinfo.config.JobOveriew'
:
'作业概览'
,
'devops.jobinfo.config.JobException'
:
'异常信息'
,
'devops.jobinfo.config.JobBaseInfo'
:
'作业基本信息'
,
'devops.jobinfo.config.UserCustomConf'
:
'用户自定义配置'
,
'devops.jobinfo.config.taskId'
:
'Dinky作业ID'
,
'devops.jobinfo.config.JobId'
:
'Flink Job ID'
,
'devops.jobinfo.config.submitType'
:
'提交模式'
,
'devops.jobinfo.config.execmode'
:
'执行模式'
,
'devops.jobinfo.config.ClusterInstanceName'
:
'Flink实例'
,
'devops.jobinfo.config.ClusterConfigName'
:
'集群配置'
,
'devops.jobinfo.config.useSqlFragment'
:
'语句集'
,
'devops.jobinfo.config.JobType'
:
'任务类型'
,
'devops.jobinfo.config.startFromSavePoint'
:
'从SavePoint启动'
,
'devops.jobinfo.config.savePointPath'
:
'savePoint路径'
,
'devops.jobinfo.config.RestartStrategy'
:
'重启策略'
,
'devops.jobinfo.config.JobParallelism'
:
'作业并行度'
,
//-------------------------------- auth center --------------------------------
//-------------------------------- auth center --------------------------------
// user
// user
...
...
dinky-web/src/pages/DevOps/JobDetail/components/JobConfigTab.tsx
0 → 100644
View file @
134d16ed
/*
*
* 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
{
Descriptions
,
Tag
,
Typography
}
from
'antd'
;
import
{
Link
}
from
'umi'
;
import
{
Jobs
}
from
"@/types/DevOps/data"
;
import
{
l
}
from
'@/utils/intl'
;
import
{
ProCard
}
from
"@ant-design/pro-components"
;
import
{
TagJobStatus
}
from
"@/pages/DevOps/function"
;
import
{
RocketOutlined
}
from
"@ant-design/icons"
;
import
{
parseSecondStr
}
from
'@/utils/function'
;
const
{
Text
,
Paragraph
}
=
Typography
;
type
JobProps
=
{
jobDetail
:
Jobs
.
JobInfoDetail
;
};
/**
* Renders the JobConfigTab component.
*
* @param {JobProps} props - The component props containing the job detail.
* @returns {JSX.Element} - The rendered JobConfigTab component.
*/
const
JobConfigTab
=
(
props
:
JobProps
)
=>
{
const
{
jobDetail
}
=
props
;
/**
* Retrieves the savepoint strategy based on the provided strategy value.
*
* @param {string} strategy - The savepoint strategy value.
* @returns {string} - The localized savepoint strategy label.
*/
const
getSavePointStrategy
=
(
strategy
:
string
)
=>
{
switch
(
strategy
)
{
case
"NONE"
:
return
l
(
'global.savepoint.strategy.disabled'
);
case
"LATEST"
:
return
l
(
'global.savepoint.strategy.latest'
);
case
"EARLIEST"
:
return
l
(
'global.savepoint.strategy.earliest'
);
case
"CUSTOM"
:
return
l
(
'global.savepoint.strategy.custom'
);
default
:
return
l
(
'global.savepoint.strategy.disabled'
);
}
}
/**
* Generates the user custom flink configuration description items.
*
* @param {object} config - The user configuration object.
* @returns {JSX.Element[]} - An array of Descriptions.Item components representing the user configuration.
*/
const
getUserConfig
=
(
config
:
any
)
=>
{
let
formList
=
[];
for
(
let
configKey
in
config
)
{
formList
.
push
(
<
Descriptions
.
Item
label=
{
configKey
}
>
{
config
[
configKey
]
}
</
Descriptions
.
Item
>
)
}
return
formList
;
}
return
<>
<
ProCard
>
<
Descriptions
title=
{
l
(
'devops.jobinfo.config.JobBaseInfo'
)
}
bordered
size=
"small"
>
<
Descriptions
.
Item
label=
{
l
(
'global.table.status'
)
}
>
{
TagJobStatus
(
jobDetail
?.
instance
?.
status
)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
l
(
'devops.jobinfo.config.submitType'
)
}
>
<
Tag
color=
"pink"
><
RocketOutlined
/>
{
jobDetail
?.
history
?.
type
}
</
Tag
>
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
l
(
'devops.jobinfo.config.RestartStrategy'
)
}
>
<
Tag
color=
"blue"
title=
{
"Restart Strategy"
}
>
{
jobDetail
?.
jobHistory
?.
config
[
'execution-config'
][
'restart-strategy'
]
}
</
Tag
>
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
l
(
'devops.jobinfo.config.ClusterInstanceName'
)
}
>
<
Link
to=
{
"/registration/cluster/instance"
}
>
{
jobDetail
?.
cluster
?.
alias
}
</
Link
>
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
l
(
'devops.jobinfo.config.JobId'
)
}
>
<
Text
copyable
><
a
>
{
jobDetail
?.
instance
?.
jid
}
</
a
></
Text
>
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
l
(
'devops.jobinfo.config.taskId'
)
}
>
<
Text
copyable
><
a
>
{
jobDetail
?.
instance
?.
taskId
}
</
a
></
Text
>
</
Descriptions
.
Item
>
{
jobDetail
?.
clusterConfiguration
?
<
Descriptions
.
Item
label=
{
l
(
'devops.jobinfo.config.clusterConfiguration'
)
}
>
<
Link
to=
{
"/registration/cluster/instance"
}
>
{
jobDetail
?.
clusterConfiguration
?.
name
}
</
Link
>
</
Descriptions
.
Item
>
:
undefined
}
<
Descriptions
.
Item
label=
{
l
(
'devops.jobinfo.config.useSqlFragment'
)
}
>
{
jobDetail
?.
history
?.
config
?.
useSqlFragment
?
l
(
'button.enable'
)
:
l
(
'button.disable'
)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
l
(
'devops.jobinfo.config.JobType'
)
}
>
{
jobDetail
?.
history
?.
config
?.
isJarTask
?
'Jar'
:
'FlinkSQL'
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
l
(
'devops.jobinfo.config.execmode'
)
}
>
{
jobDetail
?.
history
?.
config
?.
useBatchModel
?
l
(
'global.table.execmode.batch'
)
:
l
(
'global.table.execmode.streaming'
)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
l
(
'global.table.createTime'
)
}
>
{
jobDetail
?.
instance
?.
createTime
?.
toString
()
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
l
(
'devops.jobinfo.config.JobParallelism'
)
}
>
{
jobDetail
?.
jobHistory
?.
config
[
'execution-config'
][
'job-parallelism'
]
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
l
(
'global.table.useTime'
)
}
>
{
parseSecondStr
(
jobDetail
?.
instance
?.
duration
)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
l
(
'devops.jobinfo.config.startFromSavePoint'
)
}
>
{
getSavePointStrategy
(
jobDetail
?.
history
?.
config
?.
savePointStrategy
)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
l
(
'devops.jobinfo.config.savePointPath'
)
}
span=
{
2
}
>
{
jobDetail
?.
history
?.
config
.
savePointPath
}
</
Descriptions
.
Item
>
</
Descriptions
>
</
ProCard
>
<
br
/>
<
ProCard
>
<
Descriptions
title=
{
l
(
'devops.jobinfo.config.UserCustomConf'
)
}
bordered
size=
"small"
>
{
getUserConfig
(
jobDetail
?.
history
?.
config
?.
config
)
}
</
Descriptions
>
</
ProCard
>
</>
};
export
default
JobConfigTab
;
dinky-web/src/pages/DevOps/JobDetail/components/JobOperator.tsx
0 → 100644
View file @
134d16ed
import
React
,
{
useRef
}
from
'react'
;
import
{
Jobs
}
from
"@/types/DevOps/data"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
Link
}
from
'umi'
;
import
{
Button
,
Dropdown
,
Menu
,
message
,
Modal
,
Space
}
from
"antd"
;
import
{
EllipsisOutlined
}
from
'@ant-design/icons'
;
import
{
isStatusDone
}
from
"@/pages/DevOps/function"
;
import
{
useRequest
}
from
"@@/exports"
;
import
{
API_CONSTANTS
}
from
"@/services/constants"
;
import
{
JOB_LIFE_CYCLE
}
from
"@/pages/DevOps/constants"
;
type
OperatorProps
=
{
jobDetail
:
Jobs
.
JobInfoDetail
;
};
const
operatorType
=
{
RESTART_JOB
:
"restart"
,
CANCEL_JOB
:
"canceljob"
,
SAVEPOINT_CANCEL
:
"cancel"
,
SAVEPOINT_TRIGGER
:
"trigger"
,
SAVEPOINT_STOP
:
"stop"
,
}
const
JobOperator
=
(
props
:
OperatorProps
)
=>
{
const
{
jobDetail
}
=
props
const
webUri
=
`http://
${
jobDetail
?.
history
?.
jobManagerAddress
}
/#/
job
/
$
{
jobDetail
?.
instance
?.
jid
}
/overview`
;
const
handleJobOperator
=
(
key
:
string
)
=>
{
Modal
.
confirm
({
title
:
l
(
'devops.jobinfo.job.key'
,
''
,
{
key
:
key
}),
content
:
l
(
'devops.jobinfo.job.keyConfirm'
,
''
,
{
key
:
key
}),
okText
:
l
(
'button.confirm'
),
cancelText
:
l
(
'button.cancel'
),
onOk
:
async
()
=>
{
if
(
key
==
operatorType
.
CANCEL_JOB
)
{
useRequest
({
url
:
API_CONSTANTS
.
CANCEL_JOB
,
params
:
{
clusterId
:
jobDetail
?.
cluster
?.
id
,
jobId
:
jobDetail
?.
instance
?.
jid
}
});
}
else
if
(
key
==
operatorType
.
RESTART_JOB
)
{
useRequest
({
url
:
API_CONSTANTS
.
RESTART_TASK
,
params
:
{
id
:
jobDetail
?.
instance
?.
taskId
,
isOnLine
:
jobDetail
?.
instance
?.
step
==
JOB_LIFE_CYCLE
.
ONLINE
}
});
}
else
{
useRequest
({
url
:
API_CONSTANTS
.
OFFLINE_TASK
,
params
:
{
id
:
jobDetail
?.
instance
?.
taskId
,
type
:
key
}});
}
message
.
success
(
l
(
'devops.jobinfo.job.key.success'
,
''
,
{
key
:
key
}));
}
});
}
return
(
<
Space
>
<
Button
key=
"flinkwebui"
>
<
Link
to=
{
webUri
}
target=
"_blank"
>
FlinkWebUI
</
Link
>
</
Button
>
<
Button
key=
"autorestart"
type=
"primary"
onClick=
{
()
=>
handleJobOperator
(
operatorType
.
RESTART_JOB
)
}
>
{
jobDetail
?.
instance
?.
step
==
5
?
l
(
'devops.jobinfo.reonline'
)
:
l
(
'devops.jobinfo.restart'
)
}
</
Button
>
{
isStatusDone
(
jobDetail
?.
instance
?.
status
as
string
)
?
<></>
:
<>
<
Button
key=
"autostop"
type=
"primary"
onClick=
{
()
=>
handleJobOperator
(
operatorType
.
SAVEPOINT_STOP
)
}
danger
>
{
jobDetail
?.
instance
?.
step
==
5
?
l
(
'devops.jobinfo.offline'
)
:
l
(
'devops.jobinfo.smart_stop'
)
}
</
Button
>
<
Dropdown
key=
"dropdown"
trigger=
{
[
'click'
]
}
overlay=
{
<
Menu
onClick=
{
({
key
})
=>
handleJobOperator
(
key
)
}
>
<
Menu
.
Item
key=
{
operatorType
.
SAVEPOINT_TRIGGER
}
>
{
l
(
'devops.jobinfo.savepoint.trigger'
)
}
</
Menu
.
Item
>
<
Menu
.
Item
key=
{
operatorType
.
SAVEPOINT_STOP
}
>
{
l
(
'devops.jobinfo.savepoint.stop'
)
}
</
Menu
.
Item
>
<
Menu
.
Item
key=
{
operatorType
.
SAVEPOINT_CANCEL
}
>
{
l
(
'devops.jobinfo.savepoint.cancel'
)
}
</
Menu
.
Item
>
<
Menu
.
Item
key=
{
operatorType
.
CANCEL_JOB
}
>
{
l
(
'devops.jobinfo.savepoint.canceljob'
)
}
</
Menu
.
Item
>
</
Menu
>
}
>
<
Button
key=
"4"
style=
{
{
padding
:
'0 8px'
}
}
>
<
EllipsisOutlined
/>
</
Button
>
</
Dropdown
>
</>
}
</
Space
>
)
}
export
default
JobOperator
;
dinky-web/src/pages/DevOps/JobDetail/index.tsx
0 → 100644
View file @
134d16ed
import
{
PageContainer
}
from
"@ant-design/pro-components"
;
import
{
TagJobLifeCycle
}
from
"@/pages/DevOps/function"
;
import
{
Jobs
}
from
'@/types/DevOps/data'
;
import
{
Tag
}
from
"antd"
;
import
{
ClusterOutlined
,
FireOutlined
,
RocketOutlined
}
from
"@ant-design/icons"
;
import
{
useLocation
}
from
'umi'
;
import
{
useRequest
}
from
"@umijs/max"
;
import
{
API_CONSTANTS
}
from
"@/services/constants"
;
import
JobOperator
from
"@/pages/DevOps/JobDetail/components/JobOperator"
;
import
type
{
FC
}
from
'react'
;
import
{
useState
}
from
"react"
;
import
JobConfigTab
from
"@/pages/DevOps/JobDetail/components/JobConfigTab"
;
import
{
l
}
from
"@/utils/intl"
;
/**
* Enum defining different operators for the JobDetail component.
*/
const
OperatorEnum
=
{
JOB_BASE_INFO
:
"job_base_info"
,
JOB_OVERIVEW
:
"job_overivew"
,
JOB_EXCEPTION
:
"job_exception"
,
}
/**
* Renders the JobDetail component.
*
* @param {any} props - The component props.
* @returns {JSX.Element} - The rendered JobDetail component.
*/
const
JobDetail
:
FC
=
(
props
:
any
)
=>
{
// Get the URL parameters
const
params
=
useLocation
();
const
id
=
params
.
search
.
split
(
"="
)[
1
];
// Set the initial tab key state
const
[
tabKey
,
setTabKey
]
=
useState
<
string
>
(
OperatorEnum
.
JOB_BASE_INFO
);
// Fetch the job detail data
const
{
data
}
=
useRequest
({
url
:
API_CONSTANTS
.
GET_JOB_DETAIL
,
params
:
{
id
:
id
},
},
{
cacheKey
:
'data-detail'
,
pollingInterval
:
1000
,
});
// Extract the job info detail from the fetched data
const
jobInfoDetail
:
Jobs
.
JobInfoDetail
=
data
;
// Define the components for each job operator
const
JobOperatorItems
=
{
[
OperatorEnum
.
JOB_BASE_INFO
]:
<
JobConfigTab
jobDetail
=
{
jobInfoDetail
}
/>
,
[
OperatorEnum
.
JOB_OVERIVEW
]:
<
JobConfigTab
jobDetail
=
{
jobInfoDetail
}
/>
,
[
OperatorEnum
.
JOB_EXCEPTION
]:
<
JobConfigTab
jobDetail
=
{
jobInfoDetail
}
/>
,
};
// Define the tabs config for job operators
const
JobOperatorTabs
=
[
{
tab
:
l
(
'devops.jobinfo.config.JobInfo'
),
key
:
OperatorEnum
.
JOB_BASE_INFO
,
},
{
tab
:
l
(
'devops.jobinfo.config.JobOveriew'
),
key
:
OperatorEnum
.
JOB_OVERIVEW
,
},
{
tab
:
l
(
'devops.jobinfo.config.JobException'
),
key
:
OperatorEnum
.
JOB_EXCEPTION
,
},
];
return
(
<
PageContainer
title=
{
jobInfoDetail
?.
instance
?.
name
}
subTitle=
{
TagJobLifeCycle
(
jobInfoDetail
?.
instance
?.
step
)
}
ghost=
{
false
}
extra=
{
<
JobOperator
jobDetail=
{
jobInfoDetail
}
/>
}
onBack=
{
()
=>
window
.
history
.
back
()
}
breadcrumb=
{
{}
}
tabList=
{
JobOperatorTabs
}
onTabChange=
{
(
key
)
=>
setTabKey
(
key
)
}
tags=
{
[
<
Tag
key=
{
"tg1"
}
color=
"blue"
><
FireOutlined
/>
{
jobInfoDetail
?.
instance
?.
jid
}
</
Tag
>,
<
Tag
key=
{
"tg2"
}
color=
"blue"
><
RocketOutlined
/>
{
jobInfoDetail
?.
history
?.
type
}
</
Tag
>,
<
Tag
key=
{
"tg3"
}
color=
"green"
><
ClusterOutlined
/>
{
jobInfoDetail
?.
cluster
?.
alias
}
</
Tag
>
]
}
>
{
JobOperatorItems
[
tabKey
]
}
</
PageContainer
>
)
}
export
default
JobDetail
;
dinky-web/src/pages/DevOps/JobList/components/JobHistoryList.tsx
View file @
134d16ed
...
@@ -6,7 +6,7 @@ import {l} from "@/utils/intl";
...
@@ -6,7 +6,7 @@ import {l} from "@/utils/intl";
import
{
API_CONSTANTS
}
from
"@/services/constants"
;
import
{
API_CONSTANTS
}
from
"@/services/constants"
;
import
{
parseSecondStr
}
from
"@/utils/function"
;
import
{
parseSecondStr
}
from
"@/utils/function"
;
import
{
queryList
}
from
"@/services/api"
;
import
{
queryList
}
from
"@/services/api"
;
import
{
TagJobStatus
}
from
"@/pages/DevOps/
JobList/
function"
;
import
{
TagJobStatus
}
from
"@/pages/DevOps/function"
;
type
HistoryProps
=
{
type
HistoryProps
=
{
...
...
dinky-web/src/pages/DevOps/JobList/index.tsx
View file @
134d16ed
...
@@ -9,14 +9,15 @@ import {parseSecondStr} from '@/utils/function';
...
@@ -9,14 +9,15 @@ import {parseSecondStr} from '@/utils/function';
import
{
API_CONSTANTS
,
PROTABLE_OPTIONS_PUBLIC
}
from
'@/services/constants'
;
import
{
API_CONSTANTS
,
PROTABLE_OPTIONS_PUBLIC
}
from
'@/services/constants'
;
import
{
queryList
}
from
'@/services/api'
;
import
{
queryList
}
from
'@/services/api'
;
import
{
ClockCircleTwoTone
,
EyeTwoTone
}
from
'@ant-design/icons'
;
import
{
ClockCircleTwoTone
,
EyeTwoTone
}
from
'@ant-design/icons'
;
import
{
JOB_STATUS_FILTER
,
LIFECYCLE_FILTER
,
TagJobLifeCycle
,
TagJobStatus
}
from
'@/pages/DevOps/JobList/function'
;
import
{
JOB_STATUS_FILTER
,
LIFECYCLE_FILTER
,
TagJobLifeCycle
,
TagJobStatus
}
from
'@/pages/DevOps/function'
;
import
{
history
}
from
'umi'
;
const
JobList
=
()
=>
{
const
JobList
=
()
=>
{
const
tableRef
=
useRef
<
ActionType
>
();
const
tableRef
=
useRef
<
ActionType
>
();
const
jobListColumns
:
ProColumns
<
Jobs
.
JobInstance
>
[]
=
[
const
jobListColumns
:
ProColumns
<
Jobs
.
JobInstance
>
[]
=
[
{
{
title
:
l
(
'
global.table.taski
d'
),
title
:
l
(
'
devops.jobinfo.config.taskI
d'
),
dataIndex
:
'taskId'
,
dataIndex
:
'taskId'
,
},
},
{
{
...
@@ -37,7 +38,7 @@ const JobList = () => {
...
@@ -37,7 +38,7 @@ const JobList = () => {
hideInSearch
:
true
hideInSearch
:
true
},
},
{
{
title
:
l
(
'
global.table.jobi
d'
),
title
:
l
(
'
devops.jobinfo.config.JobI
d'
),
dataIndex
:
'jid'
,
dataIndex
:
'jid'
,
width
:
'15%'
,
width
:
'15%'
,
},
},
...
@@ -49,7 +50,7 @@ const JobList = () => {
...
@@ -49,7 +50,7 @@ const JobList = () => {
{
{
title
:
l
(
'global.table.useTime'
),
title
:
l
(
'global.table.useTime'
),
hideInSearch
:
true
,
hideInSearch
:
true
,
render
:
(
_
:
any
,
row
:
{
duration
:
number
;
}
)
=>
parseSecondStr
(
row
.
duration
)
render
:
(
_
:
any
,
row
:
Jobs
.
JobInstance
)
=>
parseSecondStr
(
row
.
duration
)
},
},
{
{
title
:
l
(
'global.table.status'
),
title
:
l
(
'global.table.status'
),
...
@@ -57,18 +58,19 @@ const JobList = () => {
...
@@ -57,18 +58,19 @@ const JobList = () => {
filterMultiple
:
false
,
filterMultiple
:
false
,
hideInSearch
:
true
,
hideInSearch
:
true
,
dataIndex
:
'status'
,
dataIndex
:
'status'
,
render
:
(
_
:
any
,
row
:
{
status
:
string
|
undefined
;
}
)
=>
TagJobStatus
(
row
.
status
)
render
:
(
_
:
any
,
row
:
Jobs
.
JobInstance
)
=>
TagJobStatus
(
row
.
status
)
},
},
Table
.
EXPAND_COLUMN
,
Table
.
EXPAND_COLUMN
,
{
{
title
:
l
(
'global.table.operate'
),
title
:
l
(
'global.table.operate'
),
valueType
:
'option'
,
valueType
:
'option'
,
render
:
(
text
:
any
,
record
:
{
id
:
any
;
}
)
=>
[
render
:
(
text
:
any
,
record
:
Jobs
.
JobInstance
)
=>
[
<
Button
<
Button
className=
{
'options-button'
}
className=
{
'options-button'
}
key=
{
`${record.id}_history`
}
key=
{
`${record.id}_history`
}
title=
{
l
(
'devops.joblist.detail'
)
}
title=
{
l
(
'devops.joblist.detail'
)
}
icon=
{
<
EyeTwoTone
/>
}
icon=
{
<
EyeTwoTone
/>
}
onClick=
{
()
=>
history
.
push
(
`/devops/job-detail?id=${record.id}`
)
}
/>
/>
],
],
},
},
...
...
dinky-web/src/pages/DevOps/
JobList/
constants.tsx
→
dinky-web/src/pages/DevOps/constants.tsx
View file @
134d16ed
File moved
dinky-web/src/pages/DevOps/
JobList/
function.tsx
→
dinky-web/src/pages/DevOps/function.tsx
View file @
134d16ed
...
@@ -26,10 +26,16 @@ import {
...
@@ -26,10 +26,16 @@ import {
SyncOutlined
SyncOutlined
}
from
"@ant-design/icons"
;
}
from
"@ant-design/icons"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
JOB_LIFE_CYCLE
,
JOB_STATUS
}
from
"@/pages/DevOps/
JobList/
constants"
;
import
{
JOB_LIFE_CYCLE
,
JOB_STATUS
}
from
"@/pages/DevOps/constants"
;
export
const
TagJobLifeCycle
=
(
step
:
number
)
=>
{
/**
* Renders a tag for the job life cycle based on the provided step.
*
* @param {number} step - The step in the job life cycle.
* @returns {JSX.Element} - The tag representing the job life cycle.
*/
export
const
TagJobLifeCycle
=
(
step
?:
number
)
=>
{
switch
(
step
)
{
switch
(
step
)
{
case
JOB_LIFE_CYCLE
.
DEVELOP
:
case
JOB_LIFE_CYCLE
.
DEVELOP
:
return
(<
Tag
icon=
{
<
EditOutlined
/>
}
color=
"default"
>
{
l
(
'global.table.lifecycle.dev'
)
}
</
Tag
>);
return
(<
Tag
icon=
{
<
EditOutlined
/>
}
color=
"default"
>
{
l
(
'global.table.lifecycle.dev'
)
}
</
Tag
>);
...
@@ -42,6 +48,12 @@ export const TagJobLifeCycle = (step:number) => {
...
@@ -42,6 +48,12 @@ export const TagJobLifeCycle = (step:number) => {
}
}
};
};
/**
* Renders a tag for the job status based on the provided status.
*
* @param {string|undefined} status - The status of the job.
* @returns {JSX.Element} - The tag representing the job status.
*/
export
const
TagJobStatus
=
(
status
:
string
|
undefined
)
=>
{
export
const
TagJobStatus
=
(
status
:
string
|
undefined
)
=>
{
switch
(
status
)
{
switch
(
status
)
{
case
JOB_STATUS
.
RUNNING
:
case
JOB_STATUS
.
RUNNING
:
...
@@ -63,6 +75,11 @@ export const TagJobStatus = (status:string|undefined) => {
...
@@ -63,6 +75,11 @@ export const TagJobStatus = (status:string|undefined) => {
}
}
};
};
/**
* Generates an array of options for the life cycle filter.
*
* @returns {Array} - An array of objects representing the life cycle filter options.
*/
export
const
LIFECYCLE_FILTER
=
()
=>
{
export
const
LIFECYCLE_FILTER
=
()
=>
{
return
[
return
[
{
text
:
l
(
'global.table.lifecycle.dev'
),
value
:
JOB_LIFE_CYCLE
.
DEVELOP
},
{
text
:
l
(
'global.table.lifecycle.dev'
),
value
:
JOB_LIFE_CYCLE
.
DEVELOP
},
...
@@ -72,6 +89,11 @@ export const LIFECYCLE_FILTER = () => {
...
@@ -72,6 +89,11 @@ export const LIFECYCLE_FILTER = () => {
]
]
};
};
/**
* Generates an array of options for the job status filter.
*
* @returns {Array} - An array of objects representing the job status filter options.
*/
export
const
JOB_STATUS_FILTER
=
()
=>
{
export
const
JOB_STATUS_FILTER
=
()
=>
{
return
[
return
[
{
text
:
JOB_STATUS
.
FINISHED
,
value
:
JOB_STATUS
.
FINISHED
},
{
text
:
JOB_STATUS
.
FINISHED
,
value
:
JOB_STATUS
.
FINISHED
},
...
@@ -88,3 +110,24 @@ export const JOB_STATUS_FILTER = () => {
...
@@ -88,3 +110,24 @@ export const JOB_STATUS_FILTER = () => {
]
]
};
};
/**
* Checks if a job status indicates that the job is done.
*
* @param {string} type - The job status.
* @returns {boolean} - True if the job status indicates that the job is done, false otherwise.
*/
export
function
isStatusDone
(
type
:
string
)
{
if
(
!
type
)
{
return
true
;
}
switch
(
type
)
{
case
JOB_STATUS
.
FAILED
:
case
JOB_STATUS
.
CANCELED
:
case
JOB_STATUS
.
FINISHED
:
case
JOB_STATUS
.
UNKNOWN
:
return
true
;
default
:
return
false
;
}
}
dinky-web/src/services/constants.tsx
View file @
134d16ed
...
@@ -189,6 +189,9 @@ export const API_CONSTANTS = {
...
@@ -189,6 +189,9 @@ export const API_CONSTANTS = {
// ---- devops
// ---- devops
GET_JOB_LIST
:
"/api/jobInstance"
,
GET_JOB_LIST
:
"/api/jobInstance"
,
GET_JOB_DETAIL
:
"/api/jobInstance/getJobInfoDetail"
,
GET_JOB_DETAIL
:
"/api/jobInstance/getJobInfoDetail"
,
CANCEL_JOB
:
"/api/studio/cancel"
,
OFFLINE_TASK
:
"/api/task/offLineTask"
,
RESTART_TASK
:
"/api/task/restartTask"
,
// -- LDAP
// -- LDAP
GET_LDAP_ENABLE
:
"/api/ldap/ldapEnableStatus"
,
GET_LDAP_ENABLE
:
"/api/ldap/ldapEnableStatus"
,
...
...
dinky-web/src/types/DevOps/data.d.ts
View file @
134d16ed
...
@@ -21,5 +21,48 @@ declare namespace Jobs {
...
@@ -21,5 +21,48 @@ declare namespace Jobs {
finishTime
:
Date
,
finishTime
:
Date
,
};
};
export
type
JobConfig
=
{
config
:{},
savePointStrategy
:
string
,
savePointPath
:
string
,
useSqlFragment
:
string
,
isJarTask
:
string
,
useBatchModel
:
string
,
};
export
type
History
=
{
id
:
number
;
tenantId
:
number
;
clusterId
:
number
;
clusterConfigurationId
:
number
;
session
:
string
;
jobId
:
string
;
jobName
:
string
;
jobManagerAddress
:
string
;
status
:
number
;
statement
:
string
;
type
:
string
;
error
:
string
;
result
:
string
;
config
:
JobConfig
;
configJson
:
string
;
startTime
:
string
;
endTime
:
string
;
taskId
:
number
;
statusText
:
string
;
clusterName
:
string
;
};
export
type
JobInfoDetail
=
{
id
:
number
,
instance
:
JobInstance
,
cluster
:
any
,
clusterConfiguration
:
any
,
history
:
History
,
jobHistory
:
any
,
jobManagerConfiguration
:
any
,
taskManagerConfiguration
:
any
,
};
}
}
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