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
5ee0ddd2
Commit
5ee0ddd2
authored
Feb 28, 2022
by
wenmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
运维中心主页
parent
0e110478
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
466 additions
and
32 deletions
+466
-32
JobInstanceController.java
...main/java/com/dlink/controller/JobInstanceController.java
+13
-4
JobInstanceMapper.java
...min/src/main/java/com/dlink/mapper/JobInstanceMapper.java
+5
-0
JobInstance.java
dlink-admin/src/main/java/com/dlink/model/JobInstance.java
+11
-0
JobInstanceCount.java
...admin/src/main/java/com/dlink/model/JobInstanceCount.java
+37
-0
JobInstanceStatus.java
...dmin/src/main/java/com/dlink/model/JobInstanceStatus.java
+76
-0
JobInstanceService.java
...n/src/main/java/com/dlink/service/JobInstanceService.java
+3
-0
JobInstanceServiceImpl.java
...n/java/com/dlink/service/impl/JobInstanceServiceImpl.java
+34
-0
JobInstanceMapper.xml
dlink-admin/src/main/resources/mapper/JobInstanceMapper.xml
+25
-1
JobStatus.java
dlink-common/src/main/java/com/dlink/model/JobStatus.java
+11
-0
dlink.sql
dlink-doc/sql/dlink.sql
+2
-1
dlink_history.sql
dlink-doc/sql/dlink_history.sql
+6
-1
routes.ts
dlink-web/config/routes.ts
+16
-21
menu.ts
dlink-web/src/locales/zh-CN/menu.ts
+4
-4
index.tsx
dlink-web/src/pages/DevOps/JobInstanceTable/index.tsx
+111
-0
data.d.ts
dlink-web/src/pages/DevOps/data.d.ts
+27
-0
index.tsx
dlink-web/src/pages/DevOps/index.tsx
+80
-0
service.ts
dlink-web/src/pages/DevOps/service.ts
+5
-0
No files found.
dlink-admin/src/main/java/com/dlink/controller/JobInstanceController.java
View file @
5ee0ddd2
...
...
@@ -2,6 +2,7 @@ package com.dlink.controller;
import
com.dlink.common.result.ProTableResult
;
import
com.dlink.common.result.Result
;
import
com.dlink.model.Jar
;
import
com.dlink.model.JobInstance
;
import
com.dlink.service.JobInstanceService
;
import
com.fasterxml.jackson.databind.JsonNode
;
...
...
@@ -23,14 +24,14 @@ import java.util.List;
@RequestMapping
(
"/api/jobInstance"
)
public
class
JobInstanceController
{
@Autowired
private
JobInstanceService
J
obInstanceService
;
private
JobInstanceService
j
obInstanceService
;
/**
* 动态查询列表
*/
@PostMapping
public
ProTableResult
<
JobInstance
>
listJobInstances
(
@RequestBody
JsonNode
para
)
{
return
J
obInstanceService
.
selectForProTable
(
para
);
return
j
obInstanceService
.
selectForProTable
(
para
);
}
/**
...
...
@@ -42,7 +43,7 @@ public class JobInstanceController {
List
<
Integer
>
error
=
new
ArrayList
<>();
for
(
final
JsonNode
item
:
para
){
Integer
id
=
item
.
asInt
();
if
(!
J
obInstanceService
.
removeById
(
id
)){
if
(!
j
obInstanceService
.
removeById
(
id
)){
error
.
add
(
id
);
}
}
...
...
@@ -61,7 +62,15 @@ public class JobInstanceController {
*/
@PostMapping
(
"/getOneById"
)
public
Result
getOneById
(
@RequestBody
JobInstance
JobInstance
)
throws
Exception
{
JobInstance
=
J
obInstanceService
.
getById
(
JobInstance
.
getId
());
JobInstance
=
j
obInstanceService
.
getById
(
JobInstance
.
getId
());
return
Result
.
succeed
(
JobInstance
,
"获取成功"
);
}
/**
* 获取状态统计信息
*/
@GetMapping
(
"/getStatusCount"
)
public
Result
getStatusCount
()
{
return
Result
.
succeed
(
jobInstanceService
.
getStatusCount
(),
"获取成功"
);
}
}
dlink-admin/src/main/java/com/dlink/mapper/JobInstanceMapper.java
View file @
5ee0ddd2
...
...
@@ -2,8 +2,11 @@ package com.dlink.mapper;
import
com.dlink.db.mapper.SuperMapper
;
import
com.dlink.model.JobInstance
;
import
com.dlink.model.JobInstanceCount
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
/**
* JobInstanceMapper
*
...
...
@@ -12,4 +15,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public
interface
JobInstanceMapper
extends
SuperMapper
<
JobInstance
>
{
List
<
JobInstanceCount
>
countStatus
();
}
dlink-admin/src/main/java/com/dlink/model/JobInstance.java
View file @
5ee0ddd2
...
...
@@ -49,6 +49,17 @@ public class JobInstance implements Serializable {
private
LocalDateTime
finishTime
;
private
Long
duration
;
private
Integer
failed_restart_count
;
@TableField
(
exist
=
false
)
private
String
type
;
@TableField
(
exist
=
false
)
private
String
clusterAlias
;
@TableField
(
exist
=
false
)
private
String
jobManagerAddress
;
}
dlink-admin/src/main/java/com/dlink/model/JobInstanceCount.java
0 → 100644
View file @
5ee0ddd2
package
com
.
dlink
.
model
;
/**
* JobInstanceCount
*
* @author wenmo
* @since 2022/2/28 22:20
*/
public
class
JobInstanceCount
{
private
String
status
;
private
Integer
counts
;
public
JobInstanceCount
()
{
}
public
JobInstanceCount
(
String
status
,
Integer
counts
)
{
this
.
status
=
status
;
this
.
counts
=
counts
;
}
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
Integer
getCounts
()
{
return
counts
;
}
public
void
setCounts
(
Integer
counts
)
{
this
.
counts
=
counts
;
}
}
dlink-admin/src/main/java/com/dlink/model/JobInstanceStatus.java
0 → 100644
View file @
5ee0ddd2
package
com
.
dlink
.
model
;
/**
* JobInstanceStatus
*
* @author wenmo
* @since 2022/2/28 22:25
*/
public
class
JobInstanceStatus
{
private
Integer
all
=
0
;
private
Integer
initializing
=
0
;
private
Integer
running
=
0
;
private
Integer
finished
=
0
;
private
Integer
failed
=
0
;
private
Integer
canceled
=
0
;
public
JobInstanceStatus
()
{
}
public
JobInstanceStatus
(
Integer
all
,
Integer
initializing
,
Integer
running
,
Integer
finished
,
Integer
failed
,
Integer
canceled
)
{
this
.
all
=
all
;
this
.
initializing
=
initializing
;
this
.
running
=
running
;
this
.
finished
=
finished
;
this
.
failed
=
failed
;
this
.
canceled
=
canceled
;
}
public
Integer
getAll
()
{
return
all
;
}
public
void
setAll
(
Integer
all
)
{
this
.
all
=
all
;
}
public
Integer
getInitializing
()
{
return
initializing
;
}
public
void
setInitializing
(
Integer
initializing
)
{
this
.
initializing
=
initializing
;
}
public
Integer
getRunning
()
{
return
running
;
}
public
void
setRunning
(
Integer
running
)
{
this
.
running
=
running
;
}
public
Integer
getFinished
()
{
return
finished
;
}
public
void
setFinished
(
Integer
finished
)
{
this
.
finished
=
finished
;
}
public
Integer
getFailed
()
{
return
failed
;
}
public
void
setFailed
(
Integer
failed
)
{
this
.
failed
=
failed
;
}
public
Integer
getCanceled
()
{
return
canceled
;
}
public
void
setCanceled
(
Integer
canceled
)
{
this
.
canceled
=
canceled
;
}
}
dlink-admin/src/main/java/com/dlink/service/JobInstanceService.java
View file @
5ee0ddd2
...
...
@@ -2,6 +2,7 @@ package com.dlink.service;
import
com.dlink.db.service.ISuperService
;
import
com.dlink.model.JobInstance
;
import
com.dlink.model.JobInstanceStatus
;
/**
* JobInstanceService
...
...
@@ -10,4 +11,6 @@ import com.dlink.model.JobInstance;
* @since 2022/2/2 13:52
*/
public
interface
JobInstanceService
extends
ISuperService
<
JobInstance
>
{
JobInstanceStatus
getStatusCount
();
}
dlink-admin/src/main/java/com/dlink/service/impl/JobInstanceServiceImpl.java
View file @
5ee0ddd2
package
com
.
dlink
.
service
.
impl
;
import
com.dlink.assertion.Asserts
;
import
com.dlink.db.service.impl.SuperServiceImpl
;
import
com.dlink.mapper.JobInstanceMapper
;
import
com.dlink.model.JobInstance
;
import
com.dlink.model.JobInstanceCount
;
import
com.dlink.model.JobInstanceStatus
;
import
com.dlink.model.JobStatus
;
import
com.dlink.service.JobInstanceService
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* JobInstanceServiceImpl
*
...
...
@@ -14,4 +20,32 @@ import org.springframework.stereotype.Service;
*/
@Service
public
class
JobInstanceServiceImpl
extends
SuperServiceImpl
<
JobInstanceMapper
,
JobInstance
>
implements
JobInstanceService
{
@Override
public
JobInstanceStatus
getStatusCount
()
{
List
<
JobInstanceCount
>
jobInstanceCounts
=
baseMapper
.
countStatus
();
JobInstanceStatus
jobInstanceStatus
=
new
JobInstanceStatus
();
Integer
total
=
0
;
for
(
JobInstanceCount
item
:
jobInstanceCounts
)
{
Integer
counts
=
Asserts
.
isNull
(
item
.
getCounts
())?
0
:
item
.
getCounts
();
total
+=
counts
;
switch
(
JobStatus
.
get
(
item
.
getStatus
()))
{
case
INITIALIZING:
jobInstanceStatus
.
setInitializing
(
counts
);
break
;
case
RUNNING:
jobInstanceStatus
.
setRunning
(
counts
);
break
;
case
FINISHED:
jobInstanceStatus
.
setFinished
(
counts
);
break
;
case
FAILED:
jobInstanceStatus
.
setFailed
(
counts
);
break
;
case
CANCELED:
jobInstanceStatus
.
setCanceled
(
counts
);
}
}
jobInstanceStatus
.
setAll
(
total
);
return
jobInstanceStatus
;
}
}
dlink-admin/src/main/resources/mapper/JobInstanceMapper.xml
View file @
5ee0ddd2
...
...
@@ -4,11 +4,26 @@
<select
id=
"selectForProTable"
resultType=
"com.dlink.model.JobInstance"
>
select
a.*
a.*,
dh.type as type,
(select dc.alias FROM dlink_cluster dc where dc.id=a.cluster_id) as clusterAlias
from
dlink_job_instance a
left join dlink_history dh on a.history_id = dh.id
<where>
1=1
<if
test=
'param.status!=null and param.status!=""'
>
and a.status = #{param.status}
</if>
<if
test=
'param.type!=null and param.type!=""'
>
and dh.type = #{param.type}
</if>
<if
test=
'param.name!=null and param.name!=""'
>
and a.name like "%${param.name}%"
</if>
<if
test=
'param.jid!=null and param.jid!=""'
>
and a.jid like "%${param.jid}%"
</if>
<if
test=
'param.createTime!=null and param.createTime!=""'
>
and a.create_time
<![CDATA[>=]]>
str_to_date( #{param.createTime},'%Y-%m-%d %H:%i:%s')
and a.create_time
<![CDATA[<=]]>
str_to_date( #{param.createTime},'%Y-%m-%d %H:%i:%s')
...
...
@@ -25,4 +40,13 @@
</if>
</where>
</select>
<select
id=
"countStatus"
resultType=
"com.dlink.model.JobInstanceCount"
>
select
status,
count(1) as counts
from
dlink_job_instance
group by status
</select>
</mapper>
dlink-common/src/main/java/com/dlink/model/JobStatus.java
View file @
5ee0ddd2
package
com
.
dlink
.
model
;
import
com.dlink.assertion.Asserts
;
/**
* JobState
*
...
...
@@ -78,4 +80,13 @@ public enum JobStatus {
public
String
getValue
()
{
return
value
;
}
public
static
JobStatus
get
(
String
value
){
for
(
JobStatus
type
:
JobStatus
.
values
())
{
if
(
Asserts
.
isEqualsIgnoreCase
(
type
.
getValue
(),
value
)){
return
type
;
}
}
return
JobStatus
.
UNKNOWN
;
}
}
dlink-doc/sql/dlink.sql
View file @
5ee0ddd2
...
...
@@ -317,7 +317,8 @@ create table dlink_job_instance
history_id
int
null
comment
'提交历史ID'
,
create_time
datetime
null
comment
'创建时间'
,
update_time
datetime
null
comment
'更新时间'
,
finish_time
int
null
comment
'完成时间'
,
finish_time
datetime
null
comment
'完成时间'
,
duration
bigint
null
comment
'耗时'
,
error
text
null
comment
'异常日志'
,
failed_restart_count
int
null
comment
'重启次数'
)
comment
'作业实例'
;
...
...
dlink-doc/sql/dlink_history.sql
View file @
5ee0ddd2
...
...
@@ -510,7 +510,7 @@ create table dlink_job_instance
history_id
int
null
comment
'提交历史ID'
,
create_time
datetime
null
comment
'创建时间'
,
update_time
datetime
null
comment
'更新时间'
,
finish_time
int
null
comment
'完成时间'
,
finish_time
datetime
null
comment
'完成时间'
,
error
text
null
comment
'异常日志'
,
failed_restart_count
int
null
comment
'重启次数'
)
comment
'作业实例'
;
...
...
@@ -591,5 +591,10 @@ create table dlink_alert_history
-- 0.6.0-SNAPSHOT 2022-02-25
-- ----------------------------
ALTER
TABLE
`dlink_job_instance`
MODIFY
COLUMN
name
varchar
(
255
)
NULL
COMMENT
'作业实例名'
;
-- ----------------------------
-- 0.6.0-SNAPSHOT 2022-02-28
-- ----------------------------
ALTER
TABLE
`dlink_job_instance`
ADD
COLUMN
`duration`
BIGINT
NULL
COMMENT
'耗时'
AFTER
`finish_time`
;
SET
FOREIGN_KEY_CHECKS
=
1
;
dlink-web/config/routes.ts
View file @
5ee0ddd2
...
...
@@ -23,18 +23,10 @@ export default [
component
:
'./FlinkSqlStudio'
,
},
{
path
:
'/taskcenter'
,
name
:
'taskcenter'
,
icon
:
'partition'
,
routes
:
[
/*{
path: '/taskcenter/task',
name: 'task',
icon: 'task',
component: './Task',
},*/
],
path
:
'/devops'
,
name
:
'devops'
,
icon
:
'control'
,
component
:
'./DevOps'
,
},
{
path
:
'/registration'
,
...
...
@@ -45,14 +37,19 @@ export default [
path
:
'/registration/cluster'
,
name
:
'cluster'
,
icon
:
'cluster'
,
routes
:
[
{
path
:
'/registration/cluster/clusterInstance'
,
name
:
'clusterInstance'
,
component
:
'./Cluster'
,
},
{
path
:
'/registration
/clusterConfiguration'
,
path
:
'/registration/cluster
/clusterConfiguration'
,
name
:
'clusterConfiguration'
,
icon
:
'setting'
,
component
:
'./ClusterConfiguration'
,
},
],
},
{
path
:
'/registration/jar'
,
name
:
'jar'
,
...
...
@@ -73,13 +70,11 @@ export default [
{
path
:
'/registration/alert/alertInstance'
,
name
:
'alertInstance'
,
icon
:
'task'
,
component
:
'./AlertInstance'
,
},
{
path
:
'/registration/alert/alertGroup'
,
name
:
'alertGroup'
,
icon
:
'task'
,
component
:
'./AlertGroup'
,
},
],
...
...
dlink-web/src/locales/zh-CN/menu.ts
View file @
5ee0ddd2
...
...
@@ -51,16 +51,16 @@ export default {
'menu.editor.koni'
:
'拓扑编辑器'
,
'menu.demo'
:
'Demo 开发模板'
,
'menu.registration'
:
'注册中心'
,
'menu.registration.cluster'
:
'集群实例'
,
'menu.registration.clusterConfiguration'
:
'集群配置'
,
'menu.registration.cluster'
:
'集群管理'
,
'menu.registration.cluster.clusterInstance'
:
'集群实例管理'
,
'menu.registration.cluster.clusterConfiguration'
:
'集群配置管理'
,
'menu.registration.database'
:
'数据源管理'
,
'menu.registration.alert'
:
'报警管理'
,
'menu.registration.alert.alertInstance'
:
'报警实例管理'
,
'menu.registration.alert.alertGroup'
:
'报警组管理'
,
'menu.studio'
:
'FlinkSql IDE'
,
'menu.flinksqlstudio'
:
'FlinkSQL Studio'
,
'menu.taskcenter'
:
'作业中心'
,
'menu.taskcenter.task'
:
'作业管理'
,
'menu.devops'
:
'运维中心'
,
'menu.registration.jar'
:
'Jar 管理'
,
'menu.registration.document'
:
'文档管理'
,
'menu.settings'
:
'系统设置'
,
...
...
dlink-web/src/pages/DevOps/JobInstanceTable/index.tsx
0 → 100644
View file @
5ee0ddd2
import
{
Tag
}
from
'antd'
;
import
{
CheckCircleOutlined
,
SyncOutlined
,
CloseCircleOutlined
,
MinusCircleOutlined
,
ClockCircleOutlined
,
DownOutlined
}
from
"@ant-design/icons"
;
import
{
queryData
}
from
"@/components/Common/crud"
;
import
React
,
{
useState
}
from
"react"
;
import
type
{
ProColumns
}
from
'@ant-design/pro-table'
;
import
ProTable
from
"@ant-design/pro-table"
;
import
{
JobInstanceTableListItem
}
from
"@/pages/DevOps/data"
;
const
url
=
'/api/jobInstance'
;
const
JobInstanceTable
=
(
props
:
any
)
=>
{
const
{
status
,
dispatch
}
=
props
;
const
getColumns
=
()
=>
{
const
columns
:
ProColumns
<
JobInstanceTableListItem
>
[]
=
[{
title
:
"作业名"
,
dataIndex
:
"name"
,
sorter
:
true
,
},{
title
:
"运行模式"
,
dataIndex
:
"type"
,
sorter
:
true
,
},{
title
:
"集群实例"
,
dataIndex
:
"clusterAlias"
,
sorter
:
true
,
},{
title
:
"作业ID"
,
dataIndex
:
"jid"
,
key
:
"jid"
,
},
{
title
:
"状态"
,
dataIndex
:
"status"
,
sorter
:
true
,
render
:
(
_
,
row
)
=>
{
return
(
<>
{
(
row
.
status
==
'FINISHED'
)
?
(<
Tag
icon=
{
<
CheckCircleOutlined
/>
}
color=
"success"
>
FINISHED
</
Tag
>)
:
(
row
.
status
==
'RUNNING'
)
?
(<
Tag
icon=
{
<
SyncOutlined
spin
/>
}
color=
"processing"
>
RUNNING
</
Tag
>)
:
(
row
.
status
==
'FAILED'
)
?
(<
Tag
icon=
{
<
CloseCircleOutlined
/>
}
color=
"error"
>
FAILED
</
Tag
>)
:
(
row
.
status
==
'CANCELED'
)
?
(<
Tag
icon=
{
<
MinusCircleOutlined
/>
}
color=
"default"
>
CANCELED
</
Tag
>)
:
(
row
.
status
==
'INITIALIZING'
)
?
(<
Tag
icon=
{
<
ClockCircleOutlined
/>
}
color=
"default"
>
INITIALIZING
</
Tag
>)
:(
row
.
status
==
'RESTARTING'
)
?
(<
Tag
icon=
{
<
ClockCircleOutlined
/>
}
color=
"default"
>
RESTARTING
</
Tag
>)
:
(<
Tag
color=
"default"
>
UNKNOWEN
</
Tag
>)
}
</>)
;
}
},
{
title
:
"开始时间"
,
dataIndex
:
"createTime"
,
sorter
:
true
,
valueType
:
'dateTime'
,
},
{
title
:
"更新时间"
,
dataIndex
:
"updateTime"
,
sorter
:
true
,
valueType
:
'dateTime'
,
hideInTable
:
true
},
{
title
:
"结束时间"
,
dataIndex
:
"finishTime"
,
sorter
:
true
,
valueType
:
'dateTime'
,
hideInTable
:
true
},
{
title
:
"耗时"
,
dataIndex
:
"duration"
,
sorter
:
true
,
valueType
:
'second'
,
},];
return
columns
;
};
return
(
<><
ProTable
request=
{
(
params
,
sorter
,
filter
)
=>
queryData
(
url
,
{...
params
,
status
,
sorter
:
{
id
:
'descend'
},
filter
})
}
columns=
{
getColumns
()
}
size=
"small"
search=
{
false
}
toolBarRender=
{
false
}
pagination=
{
{
pageSize
:
5
,
}
}
/>
</>
);
};
export
default
JobInstanceTable
;
dlink-web/src/pages/DevOps/data.d.ts
0 → 100644
View file @
5ee0ddd2
export
type
JobInstanceTableListItem
=
{
id
:
number
,
name
:
string
,
taskId
:
number
,
clusterId
:
number
,
clusterAlias
:
string
,
type
:
string
,
jobManagerAddress
:
string
,
jid
:
string
,
status
:
string
,
historyId
:
number
,
error
:
string
,
failedRestartCount
:
number
,
duration
:
number
,
createTime
:
Date
,
updateTime
:
Date
,
finishTime
:
Date
,
};
export
type
StatusCount
=
{
all
:
number
,
initializing
:
number
,
running
:
number
,
finished
:
number
,
failed
:
number
,
canceled
:
number
,
}
dlink-web/src/pages/DevOps/index.tsx
0 → 100644
View file @
5ee0ddd2
import
{
Typography
,
Divider
,
Badge
,
Empty
,
Tag
}
from
"antd"
;
import
ProCard
,
{
StatisticCard
}
from
'@ant-design/pro-card'
;
import
type
{
StatisticProps
}
from
'@ant-design/pro-card'
;
import
JobInstanceTable
from
"./JobInstanceTable"
;
import
{
getStatusCount
}
from
"@/pages/DevOps/service"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
StatusCount
}
from
"@/pages/DevOps/data"
;
const
{
Statistic
}
=
StatisticCard
;
const
DevOps
=
(
props
:
any
)
=>
{
// const {current} = props;
const
statusCountDefault
=
[
{
key
:
''
,
title
:
'全部'
,
value
:
0
,
total
:
true
},
{
key
:
'INITIALIZING'
,
status
:
'default'
,
title
:
'初始化'
,
value
:
0
},
{
key
:
'RUNNING'
,
status
:
'success'
,
title
:
'运行中'
,
value
:
0
},
{
key
:
'FINISHED'
,
status
:
'processing'
,
title
:
'已完成'
,
value
:
0
},
{
key
:
'FAILED'
,
status
:
'error'
,
title
:
'发生异常'
,
value
:
0
},
{
key
:
'CANCELED'
,
status
:
'warning'
,
title
:
'停止'
,
value
:
0
},
];
const
[
statusCount
,
setStatusCount
]
=
useState
<
any
[]
>
(
statusCountDefault
);
const
refreshStatusCount
=
()
=>
{
const
res
=
getStatusCount
();
res
.
then
((
result
)
=>
{
const
statusCountData
:
StatusCount
=
result
.
datas
;
const
items
:
any
=
[
{
key
:
''
,
title
:
'全部'
,
value
:
statusCountData
.
all
,
total
:
true
},
{
key
:
'INITIALIZING'
,
status
:
'default'
,
title
:
'初始化'
,
value
:
statusCountData
.
initializing
},
{
key
:
'RUNNING'
,
status
:
'success'
,
title
:
'运行中'
,
value
:
statusCountData
.
running
},
{
key
:
'FINISHED'
,
status
:
'processing'
,
title
:
'已完成'
,
value
:
statusCountData
.
finished
},
{
key
:
'FAILED'
,
status
:
'error'
,
title
:
'发生异常'
,
value
:
statusCountData
.
failed
},
{
key
:
'CANCELED'
,
status
:
'warning'
,
title
:
'停止'
,
value
:
statusCountData
.
canceled
},
];
setStatusCount
(
items
);
});
}
useEffect
(()
=>
{
refreshStatusCount
();
},
[]);
return
(
<
ProCard
tabs=
{
{
onChange
:
(
key
)
=>
{
},
}
}
>
{
statusCount
.
map
((
item
)
=>
(
<
ProCard
.
TabPane
style=
{
{
width
:
'100%'
}
}
key=
{
item
.
key
}
tab=
{
<
Statistic
layout=
"vertical"
title=
{
item
.
title
}
value=
{
item
.
value
}
status=
{
item
.
status
as
StatisticProps
[
'status'
]
}
style=
{
{
width
:
120
,
borderRight
:
item
.
total
?
'1px solid #f0f0f0'
:
undefined
}
}
/>
}
>
<
div
style=
{
{
alignItems
:
'center'
,
justifyContent
:
'center'
,
backgroundColor
:
'#fafafa'
,
}
}
>
<
JobInstanceTable
status=
{
item
.
key
}
/>
</
div
>
</
ProCard
.
TabPane
>
))
}
</
ProCard
>
);
};
export
default
DevOps
;
dlink-web/src/pages/DevOps/service.ts
0 → 100644
View file @
5ee0ddd2
import
{
getData
}
from
"@/components/Common/crud"
;
export
function
getStatusCount
()
{
return
getData
(
"api/jobInstance/getStatusCount"
);
}
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