Unverified Commit c56784be authored by gaoyan's avatar gaoyan Committed by GitHub

Add job overview (#2573)

* Optimize the process * add job overview
parent d326ecbc
...@@ -26,9 +26,10 @@ import org.dinky.data.enums.BusinessType; ...@@ -26,9 +26,10 @@ import org.dinky.data.enums.BusinessType;
import org.dinky.data.model.ID; import org.dinky.data.model.ID;
import org.dinky.data.model.devops.TaskManagerConfiguration; import org.dinky.data.model.devops.TaskManagerConfiguration;
import org.dinky.data.model.ext.JobInfoDetail; import org.dinky.data.model.ext.JobInfoDetail;
import org.dinky.data.model.job.JobInstance; import org.dinky.data.model.home.JobInstanceStatus;
import org.dinky.data.result.ProTableResult; import org.dinky.data.result.ProTableResult;
import org.dinky.data.result.Result; import org.dinky.data.result.Result;
import org.dinky.data.vo.task.JobInstanceVo;
import org.dinky.explainer.lineage.LineageResult; import org.dinky.explainer.lineage.LineageResult;
import org.dinky.service.JobInstanceService; import org.dinky.service.JobInstanceService;
import org.dinky.utils.BuildConfiguration; import org.dinky.utils.BuildConfiguration;
...@@ -78,7 +79,7 @@ public class JobInstanceController { ...@@ -78,7 +79,7 @@ public class JobInstanceController {
paramType = "body", paramType = "body",
required = true, required = true,
dataTypeClass = JsonNode.class) dataTypeClass = JsonNode.class)
public ProTableResult<JobInstance> listJobInstances(@RequestBody JsonNode para) { public ProTableResult<JobInstanceVo> listJobInstances(@RequestBody JsonNode para) {
return jobInstanceService.listJobInstances(para); return jobInstanceService.listJobInstances(para);
} }
...@@ -87,11 +88,8 @@ public class JobInstanceController { ...@@ -87,11 +88,8 @@ public class JobInstanceController {
*/ */
@GetMapping("/getStatusCount") @GetMapping("/getStatusCount")
@ApiOperation("Get status count") @ApiOperation("Get status count")
public Result<Dict> getStatusCount() { public Result<JobInstanceStatus> getStatusCount() {
Dict result = Dict.create() return Result.succeed(jobInstanceService.getStatusCount());
.set("history", jobInstanceService.getStatusCount(true))
.set("instance", jobInstanceService.getStatusCount(false));
return Result.succeed(result);
} }
/** /**
......
...@@ -25,10 +25,10 @@ import org.dinky.data.enums.BusinessType; ...@@ -25,10 +25,10 @@ import org.dinky.data.enums.BusinessType;
import org.dinky.data.enums.MetricsType; import org.dinky.data.enums.MetricsType;
import org.dinky.data.metrics.Jvm; import org.dinky.data.metrics.Jvm;
import org.dinky.data.model.Metrics; import org.dinky.data.model.Metrics;
import org.dinky.data.model.job.JobInstance;
import org.dinky.data.result.ProTableResult; import org.dinky.data.result.ProTableResult;
import org.dinky.data.result.Result; import org.dinky.data.result.Result;
import org.dinky.data.vo.MetricsVO; import org.dinky.data.vo.MetricsVO;
import org.dinky.data.vo.task.JobInstanceVo;
import org.dinky.service.JobInstanceService; import org.dinky.service.JobInstanceService;
import org.dinky.service.MonitorService; import org.dinky.service.MonitorService;
...@@ -93,9 +93,9 @@ public class MonitorController { ...@@ -93,9 +93,9 @@ public class MonitorController {
ObjectNode para = nodeFactory.objectNode(); ObjectNode para = nodeFactory.objectNode();
para.put("isHistory", false); para.put("isHistory", false);
para.put("taskId", taskIds); para.put("taskId", taskIds);
ProTableResult<JobInstance> jobInstanceProTableResult = jobInstanceService.listJobInstances(para); ProTableResult<JobInstanceVo> jobInstanceProTableResult = jobInstanceService.listJobInstances(para);
List<String> jids = jobInstanceProTableResult.getData().stream() List<String> jids = jobInstanceProTableResult.getData().stream()
.map(JobInstance::getJid) .map(JobInstanceVo::getJid)
.collect(Collectors.toList()); .collect(Collectors.toList());
return Result.succeed(monitorService.getData( return Result.succeed(monitorService.getData(
DateUtil.date(startTime), DateUtil.date(startTime),
......
...@@ -21,6 +21,7 @@ package org.dinky.data.model.home; ...@@ -21,6 +21,7 @@ package org.dinky.data.model.home;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/** /**
* JobInstanceStatus * JobInstanceStatus
...@@ -28,6 +29,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -28,6 +29,7 @@ import io.swagger.annotations.ApiModelProperty;
* @since 2022/2/28 22:25 * @since 2022/2/28 22:25
*/ */
@ApiModel(value = "JobInstanceStatus", description = "Job Instance Status Information") @ApiModel(value = "JobInstanceStatus", description = "Job Instance Status Information")
@Data
public class JobInstanceStatus { public class JobInstanceStatus {
@ApiModelProperty(value = "All", dataType = "Integer", example = "10", notes = "Total count of job instances") @ApiModelProperty(value = "All", dataType = "Integer", example = "10", notes = "Total count of job instances")
...@@ -117,109 +119,6 @@ public class JobInstanceStatus { ...@@ -117,109 +119,6 @@ public class JobInstanceStatus {
notes = "Count of job instances in the Unknown state") notes = "Count of job instances in the Unknown state")
private Integer unknown = 0; private Integer unknown = 0;
public JobInstanceStatus() {} @ApiModelProperty(value = "modelOverview", dataType = "JobModelOverview", notes = "batch and steamng count")
private JobModelOverview modelOverview;
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;
}
public Integer getRestarting() {
return restarting;
}
public void setRestarting(Integer restarting) {
this.restarting = restarting;
}
public Integer getCreated() {
return created;
}
public void setCreated(Integer created) {
this.created = created;
}
public Integer getFailing() {
return failing;
}
public void setFailing(Integer failing) {
this.failing = failing;
}
public Integer getCancelling() {
return cancelling;
}
public void setCancelling(Integer cancelling) {
this.cancelling = cancelling;
}
public Integer getSuspended() {
return suspended;
}
public void setSuspended(Integer suspended) {
this.suspended = suspended;
}
public Integer getReconciling() {
return reconciling;
}
public void setReconciling(Integer reconciling) {
this.reconciling = reconciling;
}
public Integer getUnknown() {
return unknown;
}
public void setUnknown(Integer unknown) {
this.unknown = unknown;
}
} }
/*
*
* 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.
*
*/
package org.dinky.data.vo.task;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class JobInstanceVo {
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(
value = "ID",
dataType = "Integer",
example = "1",
notes = "Unique identifier for the job instance")
private Integer id;
@ApiModelProperty(value = "Name", dataType = "String", notes = "Name of the job instance")
private String name;
@ApiModelProperty(
value = "Task ID",
dataType = "Integer",
example = "1",
notes = "Task ID associated with the job instance")
private Integer taskId;
@ApiModelProperty(value = "Step", dataType = "Integer", example = "1", notes = "Step number of the job instance")
private Integer step;
@ApiModelProperty(value = "JID", dataType = "String", notes = "JID of the job instance")
private String jid;
@ApiModelProperty(value = "Status", dataType = "String", notes = "Status of the job instance")
private String status;
@ApiModelProperty(value = "type", dataType = "String", notes = "run mode type", example = "kubernets-application")
private String type;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(
value = "Create Time",
dataType = "String",
notes = "Timestamp indicating the creation time of the job instance")
private LocalDateTime createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(
value = "Update Time",
dataType = "String",
notes = "Timestamp indicating the last update time of the job instance")
private LocalDateTime updateTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(
value = "Finish Time",
dataType = "String",
notes = "Timestamp indicating the finish time of the job instance")
private LocalDateTime finishTime;
@ApiModelProperty(
value = "Duration",
dataType = "Long",
example = "3600",
notes = "Duration of the job instance in seconds")
private Long duration;
@ApiModelProperty(
value = "Failed Restart Count",
dataType = "Integer",
example = "2",
notes = "Count of failed restarts")
private Integer failedRestartCount;
}
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
package org.dinky.mapper; package org.dinky.mapper;
import org.dinky.data.model.home.JobInstanceCount; import org.dinky.data.model.home.JobInstanceCount;
import org.dinky.data.model.home.JobModelOverview;
import org.dinky.data.model.job.JobInstance; import org.dinky.data.model.job.JobInstance;
import org.dinky.mybatis.mapper.SuperMapper; import org.dinky.mybatis.mapper.SuperMapper;
...@@ -43,7 +44,7 @@ public interface JobInstanceMapper extends SuperMapper<JobInstance> { ...@@ -43,7 +44,7 @@ public interface JobInstanceMapper extends SuperMapper<JobInstance> {
List<JobInstanceCount> countStatus(); List<JobInstanceCount> countStatus();
List<JobInstanceCount> countHistoryStatus(); JobModelOverview getJobStreamingOrBatchModelOverview();
@InterceptorIgnore(tenantLine = "true") @InterceptorIgnore(tenantLine = "true")
List<JobInstance> listJobInstanceActive(); List<JobInstance> listJobInstanceActive();
......
...@@ -36,6 +36,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -36,6 +36,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
*/ */
public interface SuperMapper<T> extends BaseMapper<T> { public interface SuperMapper<T> extends BaseMapper<T> {
List<T> selectForProTable( <K> List<K> selectForProTable(
Page<T> page, @Param(Constants.WRAPPER) Wrapper<T> queryWrapper, @Param("param") Map<String, Object> param); Page<K> page, @Param(Constants.WRAPPER) Wrapper<K> queryWrapper, @Param("param") Map<String, Object> param);
} }
...@@ -23,6 +23,7 @@ import org.dinky.data.model.ext.JobInfoDetail; ...@@ -23,6 +23,7 @@ import org.dinky.data.model.ext.JobInfoDetail;
import org.dinky.data.model.home.JobInstanceStatus; import org.dinky.data.model.home.JobInstanceStatus;
import org.dinky.data.model.job.JobInstance; import org.dinky.data.model.job.JobInstance;
import org.dinky.data.result.ProTableResult; import org.dinky.data.result.ProTableResult;
import org.dinky.data.vo.task.JobInstanceVo;
import org.dinky.explainer.lineage.LineageResult; import org.dinky.explainer.lineage.LineageResult;
import org.dinky.mybatis.service.ISuperService; import org.dinky.mybatis.service.ISuperService;
...@@ -49,10 +50,9 @@ public interface JobInstanceService extends ISuperService<JobInstance> { ...@@ -49,10 +50,9 @@ public interface JobInstanceService extends ISuperService<JobInstance> {
/** /**
* Get the count of job instance statuses. * Get the count of job instance statuses.
* *
* @param isHistory A boolean indicating whether to get the history status count or not.
* @return An integer representing the count of job instance statuses. * @return An integer representing the count of job instance statuses.
*/ */
JobInstanceStatus getStatusCount(boolean isHistory); JobInstanceStatus getStatusCount();
/** /**
* Get a list of active job instances. * Get a list of active job instances.
...@@ -123,7 +123,7 @@ public interface JobInstanceService extends ISuperService<JobInstance> { ...@@ -123,7 +123,7 @@ public interface JobInstanceService extends ISuperService<JobInstance> {
* @param para A {@link JsonNode} object representing the filter conditions for listing job instances. * @param para A {@link JsonNode} object representing the filter conditions for listing job instances.
* @return A {@link ProTableResult<JobInstance>} object representing the list of job instances. * @return A {@link ProTableResult<JobInstance>} object representing the list of job instances.
*/ */
ProTableResult<JobInstance> listJobInstances(JsonNode para); ProTableResult<JobInstanceVo> listJobInstances(JsonNode para);
/** /**
* Initialize the tenant by the given job instance ID. * Initialize the tenant by the given job instance ID.
......
...@@ -33,9 +33,11 @@ import org.dinky.data.model.ClusterInstance; ...@@ -33,9 +33,11 @@ import org.dinky.data.model.ClusterInstance;
import org.dinky.data.model.ext.JobInfoDetail; import org.dinky.data.model.ext.JobInfoDetail;
import org.dinky.data.model.home.JobInstanceCount; import org.dinky.data.model.home.JobInstanceCount;
import org.dinky.data.model.home.JobInstanceStatus; import org.dinky.data.model.home.JobInstanceStatus;
import org.dinky.data.model.home.JobModelOverview;
import org.dinky.data.model.job.History; import org.dinky.data.model.job.History;
import org.dinky.data.model.job.JobInstance; import org.dinky.data.model.job.JobInstance;
import org.dinky.data.result.ProTableResult; import org.dinky.data.result.ProTableResult;
import org.dinky.data.vo.task.JobInstanceVo;
import org.dinky.explainer.lineage.LineageBuilder; import org.dinky.explainer.lineage.LineageBuilder;
import org.dinky.explainer.lineage.LineageResult; import org.dinky.explainer.lineage.LineageResult;
import org.dinky.job.FlinkJobTask; import org.dinky.job.FlinkJobTask;
...@@ -89,14 +91,12 @@ public class JobInstanceServiceImpl extends SuperServiceImpl<JobInstanceMapper, ...@@ -89,14 +91,12 @@ public class JobInstanceServiceImpl extends SuperServiceImpl<JobInstanceMapper,
} }
@Override @Override
public JobInstanceStatus getStatusCount(boolean isHistory) { public JobInstanceStatus getStatusCount() {
List<JobInstanceCount> jobInstanceCounts; List<JobInstanceCount> jobInstanceCounts;
if (isHistory) { jobInstanceCounts = baseMapper.countStatus();
jobInstanceCounts = baseMapper.countHistoryStatus(); JobModelOverview modelOverview = baseMapper.getJobStreamingOrBatchModelOverview();
} else {
jobInstanceCounts = baseMapper.countStatus();
}
JobInstanceStatus jobInstanceStatus = new JobInstanceStatus(); JobInstanceStatus jobInstanceStatus = new JobInstanceStatus();
jobInstanceStatus.setModelOverview(modelOverview);
int total = 0; int total = 0;
for (JobInstanceCount item : jobInstanceCounts) { for (JobInstanceCount item : jobInstanceCounts) {
Integer counts = Asserts.isNull(item.getCounts()) ? 0 : item.getCounts(); Integer counts = Asserts.isNull(item.getCounts()) ? 0 : item.getCounts();
...@@ -252,16 +252,16 @@ public class JobInstanceServiceImpl extends SuperServiceImpl<JobInstanceMapper, ...@@ -252,16 +252,16 @@ public class JobInstanceServiceImpl extends SuperServiceImpl<JobInstanceMapper,
} }
@Override @Override
public ProTableResult<JobInstance> listJobInstances(JsonNode para) { public ProTableResult<JobInstanceVo> listJobInstances(JsonNode para) {
int current = para.has("current") ? para.get("current").asInt() : 1; int current = para.has("current") ? para.get("current").asInt() : 1;
int pageSize = para.has("pageSize") ? para.get("pageSize").asInt() : 10; int pageSize = para.has("pageSize") ? para.get("pageSize").asInt() : 10;
QueryWrapper<JobInstance> queryWrapper = new QueryWrapper<>(); QueryWrapper<JobInstanceVo> queryWrapper = new QueryWrapper<>();
ProTableUtil.autoQueryDefalut(para, queryWrapper); ProTableUtil.autoQueryDefalut(para, queryWrapper);
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
Map<String, Object> param = mapper.convertValue(para, Map.class); Map<String, Object> param = mapper.convertValue(para, Map.class);
Page<JobInstance> page = new Page<>(current, pageSize); Page<JobInstanceVo> page = new Page<>(current, pageSize);
List<JobInstance> list = baseMapper.selectForProTable(page, queryWrapper, param); List<JobInstanceVo> list = baseMapper.selectForProTable(page, queryWrapper, param);
return ProTableResult.<JobInstance>builder() return ProTableResult.<JobInstanceVo>builder()
.success(true) .success(true)
.data(list) .data(list)
.total(page.getTotal()) .total(page.getTotal())
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
limit 1 limit 1
</select> </select>
<select id="selectForProTable" resultType="org.dinky.data.model.job.JobInstance"> <select id="selectForProTable" resultType="org.dinky.data.vo.task.JobInstanceVo">
select select
a.*, a.*,
dh.type as type, dh.type as type,
...@@ -72,11 +72,14 @@ ...@@ -72,11 +72,14 @@
group by status group by status
</select> </select>
<select id="countHistoryStatus" resultType="org.dinky.data.model.home.JobInstanceCount"> <select id="getJobStreamingOrBatchModelOverview" resultType="org.dinky.data.model.home.JobModelOverview">
select status, select sum(IF(b.batch, 1, 0)) as batchJobCount,
count(1) as counts sum(IF(b.batch, 0, 1)) as streamingJobCount
from dinky_job_instance from (select json_extract(dh.config_json, '$.batchModel') as batch
group by status from (select max(ji.id) as id from dinky_job_instance ji group by ji.task_id) as a
left join dinky_job_instance dji on dji.id = a.id
left join dinky.dinky_history dh on dji.history_id = dh.id) b
group by b.batch
</select> </select>
<select id="listJobInstanceActive" resultType="org.dinky.data.model.job.JobInstance"> <select id="listJobInstanceActive" resultType="org.dinky.data.model.job.JobInstance">
......
/*
*
* 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 Icon from '@ant-design/icons';
const defaultSvgSize = '100%';
// const style = {overflow: "hidden",width: "100%",height: "100%"};
const style = { overflow: 'hidden' };
export const AllJobIcons = (props: any) => {
const size = props.size || defaultSvgSize;
return (
<>
<Icon
style={style}
component={() => (
<svg className='icon' viewBox='0 0 1024 1024' width={size} height={size}>
<path
d='M505.7536 487.68l434.5856-245.6576L512 0 77.4656 245.6576z'
fill='#6D88FF'
p-id='1877'
></path>
<path
d='M480.768 544.2048L51.2 301.2608v480.1024L480.768 1024v-479.8464z'
fill='#B6C3FF'
p-id='1878'
></path>
<path
d='M543.232 537.1904v486.7584L972.8 781.312V294.3488l-429.568 242.944z'
fill='#6D88FF'
p-id='1879'
></path>
</svg>
)}
/>
</>
);
};
export const BatchIcons = (props: any) => {
const size = props.size || defaultSvgSize;
return (
<>
<Icon
style={style}
component={() => (
<svg viewBox='0 0 1024 1024' width={size} height={size}>
<path
d='M816.1 842.8h-580c-19.3 0-35-15.7-35-35v-580c0-19.3 15.7-35 35-35h580c19.3 0 35 15.7 35 35v580c0 19.3-15.7 35-35 35z'
fill='#B9F4E8'
p-id='5075'
></path>
<path
d='M816.1 850.3h-580c-23.4 0-42.5-19.1-42.5-42.5v-580c0-23.4 19.1-42.5 42.5-42.5h580c23.4 0 42.5 19.1 42.5 42.5v580c0 23.4-19 42.5-42.5 42.5z m-580-650c-15.2 0-27.5 12.3-27.5 27.5v580c0 15.2 12.3 27.5 27.5 27.5h580c15.2 0 27.5-12.3 27.5-27.5v-580c0-15.2-12.3-27.5-27.5-27.5h-580z'
fill='#20DAB4'
p-id='5076'
></path>
<path
d='M695.5 392.6c-30.9 0-56 24.9-56 55.7 0 11 3.2 21.3 8.7 29.9l-38.4 38.4c-11.4-8-25.3-12.7-40.3-12.7-17.5 0-33.5 6.4-45.8 17l-17.3-17.3c4-7.1 6.3-15.3 6.3-24 0-27.3-22.3-49.4-49.7-49.4-27.4 0-49.7 22.1-49.7 49.4 0 6.5 1.3 12.7 3.5 18.3l-29.2 29.2c-8.9-5.9-19.5-9.3-31-9.3-30.9 0-56 24.9-56 55.7 0 30.7 25.1 55.7 56 55.7s56-24.9 56-55.7c0-9.2-2.3-18-6.3-25.6l28-28c8.1 5.7 18 9.1 28.7 9.1 8.5 0 16.5-2.1 23.5-5.9l20 20c-4.5 9.2-7 19.5-7 30.4 0 38.4 31.3 69.6 70 69.6s70-31.1 70-69.6c0-13.5-3.9-26.1-10.5-36.7l39.7-39.7c8 4.3 17.1 6.8 26.9 6.8 30.9 0 56-24.9 56-55.7-0.1-30.7-25.1-55.6-56.1-55.6z m0 0'
fill='#20DAB4'
p-id='5077'
></path>
</svg>
)}
/>
</>
);
};
export const SteamIcons = (props: any) => {
const size = props.size || defaultSvgSize;
return (
<>
<Icon
style={style}
component={() => (
<svg viewBox='0 0 1024 1024' width={size} height={size}>
<path
d='M716.8 642.24c-119.936 91.328-227.872 26.112-230.848 22.88-224.864-150.208-374.72 9.632-374.72 9.632-3.776 3.296-9.504 10.72-11.2 17.152-1.696 6.4-4.256 20.8 1.76 30.56 6.048 9.792 27.328 13.568 36.416 7.04 9.12-6.528 125.92-133.664 323.808-3.232 3.008 3.232 50.976 32.608 119.936 32.608 44.96 0 101.92-13.088 158.88-55.488 7.04-8 17.92-28.544 13.696-41.6-4.224-13.056-14.112-20.896-18.24-22.4-4.16-1.6-16.512-0.416-19.488 2.88z m96 128c-119.936 91.328-227.872 26.112-230.848 22.88-224.864-150.208-374.72 9.632-374.72 9.632-3.776 3.296-9.504 10.72-11.2 17.152-1.696 6.4-4.256 20.8 1.76 30.56 6.048 9.792 27.328 13.568 36.416 7.04 9.12-6.528 125.92-133.664 323.808-3.232 3.008 3.232 50.976 32.608 119.936 32.608 44.96 0 101.92-13.088 158.88-55.488 7.04-8 17.92-28.544 13.696-41.6-4.224-13.056-14.112-20.896-18.24-22.4-4.16-1.6-16.512-0.416-19.488 2.88z m-310.24-218.4c0-35.072 28.032-63.52 62.592-63.52s62.592 28.448 62.592 63.52-28.032 63.52-62.592 63.52-62.592-28.448-62.592-63.52z m-53.376-210.816c27.296 0 49.504 22.464 49.504 50.272 0 27.744-22.112 50.24-49.504 50.24a49.888 49.888 0 0 1-49.536-50.24c0.096-27.808 22.112-50.24 49.536-50.24z m-122.976 26.784a18.912 18.912 0 0 0 18.72-19.04 18.912 18.912 0 0 0-18.72-19.008 18.912 18.912 0 0 0-18.752 19.008c0 10.56 8.416 19.04 18.752 19.04z m-75.04 147.52c0-27.328 21.824-49.472 48.736-49.472 26.912 0 48.736 22.144 48.736 49.472 0 27.328-21.824 49.44-48.736 49.44a49.088 49.088 0 0 1-48.736-49.44z m544-96c0-27.328 21.824-49.472 48.736-49.472 26.912 0 48.736 22.144 48.736 49.472 0 27.328-21.824 49.44-48.736 49.44a49.088 49.088 0 0 1-48.736-49.44z m-576-224c0-27.328 21.824-49.472 48.736-49.472 26.912 0 48.736 22.144 48.736 49.472 0 27.328-21.824 49.44-48.736 49.44a49.088 49.088 0 0 1-48.736-49.44z m381.792 96.32c0-31.488 25.184-57.056 56.224-57.056 31.04 0 56.192 25.6 56.192 57.056 0 31.488-25.184 57.056-56.192 57.056-31.04 0-56.224-25.504-56.224-57.056z m160.128 293.76a37.76 37.76 0 0 0 37.472-38.048 37.76 37.76 0 0 0-37.44-38.048 37.76 37.76 0 0 0-37.504 38.048 37.76 37.76 0 0 0 37.472 38.048z m-192-416a37.76 37.76 0 0 0 37.472-38.048 37.76 37.76 0 0 0-37.44-38.048 37.76 37.76 0 0 0-37.504 38.048 37.76 37.76 0 0 0 37.472 38.048zM416.96 268.064a37.76 37.76 0 0 0 37.504-38.016A37.76 37.76 0 0 0 416.96 192a37.76 37.76 0 0 0-37.44 38.048 37.76 37.76 0 0 0 37.44 38.016z m232.512 149.12c0 10.464 8.416 19.008 18.72 19.008a18.912 18.912 0 0 0 18.752-19.008 18.912 18.912 0 0 0-18.752-19.008 18.88 18.88 0 0 0-18.72 19.008z m-480 0c0 10.464 8.416 19.008 18.72 19.008a18.912 18.912 0 0 0 18.752-19.008 18.912 18.912 0 0 0-18.752-19.008 18.88 18.88 0 0 0-18.72 19.008z m232.16 175.712c0 10.496 8.416 19.04 18.72 19.04a18.912 18.912 0 0 0 18.752-19.04 18.912 18.912 0 0 0-18.752-19.008 18.912 18.912 0 0 0-18.72 19.008z'
fill='#1296db'
p-id='6430'
></path>
</svg>
)}
/>
</>
);
};
export const RunningIcons = (props: any) => {
const size = props.size || defaultSvgSize;
return (
<>
<Icon
style={style}
component={() => (
<svg viewBox='0 0 1024 1024' width={size} height={size}>
<path
d='M813.3 749.3H216.7c-48.2 0-87.6-39.4-87.6-87.6V268.2c0-48.2 39.4-87.6 87.6-87.6h596.6c48.2 0 87.6 39.4 87.6 87.6v393.5c-0.1 48.1-39.6 87.6-87.6 87.6z'
fill='#1890ff'
opacity='.7'
p-id='7692'
></path>
<path
d='M499.5 619L300 818.4c-12.8 12.8-3.8 34.9 14.4 34.9h400.9c18.2 0 27.4-22.1 14.3-35L528.3 618.9c-8-7.9-20.9-7.9-28.8 0.1z'
fill='#1890ff'
opacity='.7'
p-id='7693'
></path>
<path
d='M308.5 594.6c-10.2 0-20.5-3.9-28.3-11.7-15.6-15.6-15.6-40.9 0-56.6l133.2-133.2c15.6-15.6 40.9-15.6 56.6 0l85.8 85.8 137.4-137.4c15.6-15.6 40.9-15.6 56.6 0 15.6 15.6 15.6 40.9 0 56.6L584 563.8c-15.6 15.6-40.9 15.6-56.6 0L441.6 478 336.7 582.9c-7.8 7.8-18 11.7-28.2 11.7z'
fill='#1890ff'
p-id='7694'
></path>
</svg>
)}
/>
</>
);
};
export const CancelIcons = (props: any) => {
const size = props.size || defaultSvgSize;
return (
<>
<Icon
style={style}
component={() => (
<svg viewBox='0 0 1024 1024' width={size} height={size}>
<path
d='M646.2 648.2c-9 9-21.3 13.8-33.7 13.8-12.3 0-24.7-4.7-33.7-13.8l-65.4-65.4c-0.8-0.8-2-0.8-2.8 0l-65.4 65.4c-18.5 18.5-48.8 18.5-67.3 0s-18.5-48.8 0-67.3l65.4-65.4c0.8-0.8 0.8-2 0-2.8l-65.4-65.4c-18.5-18.5-18.5-48.8 0-67.3s48.8-18.5 67.3 0l65.4 65.4c0.8 0.8 2 0.8 2.8 0l65.4-65.4c18.5-18.5 48.8-18.5 67.3 0 9 9 13.8 21.3 13.8 33.7 0 12.3-4.8 24.6-13.8 33.7l-65.4 65.4c-0.8 0.8-0.8 2 0 2.8l65.4 65.4c18.6 18.4 18.6 48.7 0.1 67.2z'
fill='#faad14'
p-id='17826'
></path>
<path
d='M512 87.4c-235.6 0-426.7 191-426.7 426.7 0 235.6 191 426.7 426.7 426.7s426.7-191 426.7-426.7S747.7 87.4 512 87.4z m165.3 591.9c-16.9 16.9-40.5 26.7-64.8 26.7-24.2 0-47.8-9.7-64.8-26.6L512 643.6l-35.7 35.7C459 696.5 436 706 411.5 706s-47.5-9.5-64.8-26.8c-35.7-35.7-35.7-93.8 0-129.5l35.7-35.7-35.7-35.7c-35.7-35.7-35.7-93.8 0-129.5C364 331.5 387 322 411.5 322s47.5 9.5 64.8 26.8l35.7 35.7 35.7-35.7C565 331.5 588 322 612.5 322s47.5 9.5 64.8 26.8c16.9 16.9 26.6 40.5 26.6 64.8s-9.7 47.8-26.6 64.8L641.5 514l35.7 35.7c35.8 35.8 35.8 93.9 0.1 129.6z'
fill='#faad14'
p-id='17827'
></path>
</svg>
)}
/>
</>
);
};
export const ErrorIcons = (props: any) => {
const size = props.size || defaultSvgSize;
return (
<>
<Icon
style={style}
component={() => (
<svg viewBox='0 0 1024 1024' width={size} height={size}>
<path
d='M800.3 205.1L534.8 116c-16-5.4-33.3-5.3-49.2 0.2l-264.5 92.3c-29.3 10-49 37.5-49.1 68.4l1.7 265.4c0.7 81 31.1 158.9 85.6 218.9 25 27.7 56.9 51.5 97.8 72.7l144 74.6c9 4.7 19.7 4.6 28.7-0.2L672.5 832c40.4-21.6 72.2-45.7 96.9-73.8 53.6-60.6 83-138.9 82.6-219.8l-1.7-265.6c-0.5-30.9-20.5-58.1-50-67.7z'
fill='#FA5151'
p-id='22708'
></path>
<path
d='M549.8 512l94.4-94.4c10.4-10.4 10.4-27.4 0-37.8-10.4-10.4-27.4-10.4-37.8 0L512 474.2l-94.4-94.4c-10.4-10.4-27.4-10.4-37.8 0s-10.4 27.4 0 37.8l94.4 94.4-94.4 94.4c-10.4 10.4-10.4 27.4 0 37.8 5.2 5.2 12 7.8 18.9 7.8s13.7-2.6 18.9-7.8l94.5-94.4 94.4 94.4c5.2 5.2 12 7.8 18.9 7.8s13.7-2.6 18.9-7.8c10.4-10.4 10.4-27.4 0-37.8L549.8 512z'
fill='#FFFFFF'
p-id='22709'
></path>
</svg>
)}
/>
</>
);
};
export const RestartIcons = (props: any) => {
const size = props.size || defaultSvgSize;
return (
<>
<Icon
style={style}
component={() => (
<svg viewBox='0 0 1024 1024' width={size} height={size}>
<path
d='M465.408 828.586667l-18.773333 126.72a451.669333 451.669333 0 0 0 119.978666 1.365333l-15.530666-127.061333a323.242667 323.242667 0 0 1-85.674667-1.024z m143.36-11.52l38.826667 122.026666c38.656-12.202667 75.093333-29.610667 108.373333-51.285333l-69.717333-107.349333a318.549333 318.549333 0 0 1-77.397334 36.693333zM512 64a448 448 0 0 0-145.92 871.68l41.813333-121.002667A320.170667 320.170667 0 0 1 512 192c96.512 0 183.04 42.666667 241.749333 110.250667L667.306667 388.693333a16.042667 16.042667 0 0 0 11.349333 27.306667h265.386667a16.042667 16.042667 0 0 0 15.957333-16.042667v-265.386666a16.042667 16.042667 0 0 0-27.306667-11.264L844.373333 211.626667l-4.522666-4.864A446.805333 446.805333 0 0 0 512 64z m275.370667 611.072a321.365333 321.365333 0 0 1-54.613334 68.608l88.32 92.672c29.696-28.330667 55.466667-60.586667 76.458667-96.085333l-110.08-65.194667z m-323.413334-387.072a16.042667 16.042667 0 0 0-15.957333 16.042667v239.957333a63.914667 63.914667 0 0 0 32.085333 55.808L632.490667 687.786667c7.68 4.437333 17.408 1.792 21.845333-5.802667l48.042667-83.2a15.957333 15.957333 0 0 0-5.973334-21.845333L576 507.392V304.042667a16.042667 16.042667 0 0 0-16.042667-16.042667z'
fill='#707070'
p-id='28926'
></path>
</svg>
)}
/>
</>
);
};
export const UnknownIcons = (props: any) => {
const size = props.size || defaultSvgSize;
return (
<>
<Icon
style={style}
component={() => (
<svg viewBox='0 0 1024 1024' width={size} height={size}>
<path
d='M524.054 731.32c0-108.306 69.937-200.084 167.027-233.194L441.038 66.62 37.452 763.082h486.602v-31.763z m-46.562-73.872H400.71v-74.223h76.782v74.223zM458.49 552.684h-38.267L398.921 376.16v-95.951h80.374v95.951L458.49 552.684z m541.064 232.519l0.207-81.39s-53.749-10.667-54.64-14.26c-5.599-21.823-13.284-40.931-23.094-58.705 26.118 35.31 56.401 9.667 56.401 9.667l-60.585-80.665s-39.27 32.311-49.037 36.972c-4.557-1.771-9.289-3.365-14.353-4.858-5.293-1.295-19.853-53.055-19.853-53.055l-81.617-0.673s-8.761 50.135-21.997 53.541c-11.927 3.607-22.31 8.956-31.469 15.842 8.434-15.595-30.804-48.445-30.804-48.445l-60.617 82.022s30.416 30.623 32.426 40.855a182.397 182.397 0 0 0-3.646 9.849c-13.028 4.516-50.114 11.909-50.114 11.909l0.176 81.39s43.145 8.978 51.337 16.187a161.202 161.202 0 0 0 5.758 13.732c-9.963 12.438-36.547 33.182-36.547 33.182l62.511 81.339s49.078-31.743 57.156-33.554c3.987 1.719 8.058 3.356 12.24 4.805 7.394 2.589 12.635 49.979 12.635 49.979l81.442 0.187s2.775-46.53 8.709-48.353a172.006 172.006 0 0 0 17.326-6.483c6.866 2.682 39.024 34.755 39.024 34.755l80.521-82.001s-29.888-20.661-38.122-31.793a180.659 180.659 0 0 0 6.099-14.219c2.785-7.385 52.527-17.762 52.527-17.762z m-207.219 61.661h-0.02c-56.745 0-102.745-46-102.745-102.745v-0.012-0.032c0-56.739 45.997-102.735 102.735-102.735h0.033c56.741 0 102.734 46.002 102.734 102.765 0 56.742-46.034 102.756-102.735 102.756z'
fill='#8c8c8c'
p-id='24881'
></path>
</svg>
)}
/>
</>
);
};
export const FinishIcons = (props: any) => {
const size = props.size || defaultSvgSize;
return (
<>
<Icon
style={style}
component={() => (
<svg viewBox='0 0 1024 1024' width={size} height={size}>
<path
d='M694.1184 935.8848H236.6464c-73.5232 0-133.12-59.5968-133.12-133.12V217.4976c0-73.5232 59.5968-133.12 133.12-133.12h457.472c73.5232 0 133.12 59.5968 133.12 133.12v585.2672c0 73.5232-59.5968 133.12-133.12 133.12z'
fill='#4BE2AC'
p-id='34154'
></path>
<path
d='M629.3504 326.0416h-325.12c-22.6304 0-40.96-18.3296-40.96-40.96s18.3296-40.96 40.96-40.96h325.12c22.6304 0 40.96 18.3296 40.96 40.96s-18.3296 40.96-40.96 40.96zM629.3504 488.448h-325.12c-22.6304 0-40.96-18.3296-40.96-40.96s18.3296-40.96 40.96-40.96h325.12c22.6304 0 40.96 18.3296 40.96 40.96s-18.3296 40.96-40.96 40.96zM459.9296 650.8544H304.2304c-22.6304 0-40.96-18.3296-40.96-40.96s18.3296-40.96 40.96-40.96h155.6992c22.6304 0 40.96 18.3296 40.96 40.96s-18.3808 40.96-40.96 40.96z'
fill='#FFFFFF'
p-id='34155'
></path>
<path
d='M739.84 742.5024m-189.952 0a189.952 189.952 0 1 0 379.904 0 189.952 189.952 0 1 0-379.904 0Z'
fill='#4BE2AC'
p-id='34156'
></path>
<path
d='M740.096 552.8064c-104.9088 0-189.952 85.0432-189.952 189.952 0 99.9936 77.2608 181.8624 175.36 189.3376 58.368-14.08 101.7856-66.6624 101.7856-129.3824V573.952a189.9008 189.9008 0 0 0-87.1936-21.1456z'
fill='#06CC76'
p-id='34157'
></path>
<path
d='M706.5088 848.9472h-0.7168c-9.728-0.2048-18.9952-4.352-25.6-11.52l-64.8192-70.2464a35.84 35.84 0 0 1 2.048-50.6368 35.84 35.84 0 0 1 50.6368 2.048l39.5264 42.8032 92.8256-92.8256c13.9776-13.9776 36.7104-13.9776 50.688 0s13.9776 36.7104 0 50.688l-119.1936 119.1936a36.1472 36.1472 0 0 1-25.3952 10.496z'
fill='#FFFFFF'
p-id='34158'
></path>
</svg>
)}
/>
</>
);
};
...@@ -98,6 +98,13 @@ export default { ...@@ -98,6 +98,13 @@ export default {
* devops * devops
* *
* */ * */
'devops.joblist.status.all': 'All',
'devops.joblist.status.running': 'running',
'devops.joblist.status.cancelled': 'Canceled',
'devops.joblist.status.failed': 'Exception job',
'devops.joblist.status.restarting': 'Restarting',
'devops.joblist.status.finished': 'completed',
'devops.joblist.status.unknown': 'unknown job',
'devops.baseinfo.name': 'Job Name', 'devops.baseinfo.name': 'Job Name',
'devops.baseinfo.parallelism': 'Parallelism', 'devops.baseinfo.parallelism': 'Parallelism',
......
...@@ -93,6 +93,14 @@ export default { ...@@ -93,6 +93,14 @@ export default {
* *
* */ * */
'devops.joblist.status.all': '任务总计',
'devops.joblist.status.running': '运行中',
'devops.joblist.status.cancelled': '已取消',
'devops.joblist.status.failed': '异常作业',
'devops.joblist.status.restarting': '重启中',
'devops.joblist.status.finished': '已完成',
'devops.joblist.status.unknown': '未知作业',
'devops.baseinfo.name': '任务名称', 'devops.baseinfo.name': '任务名称',
'devops.baseinfo.parallelism': '并行度', 'devops.baseinfo.parallelism': '并行度',
'devops.baseinfo.readbytes': '接收字节', 'devops.baseinfo.readbytes': '接收字节',
......
...@@ -25,8 +25,11 @@ import { parseSecondStr } from '@/utils/function'; ...@@ -25,8 +25,11 @@ import { parseSecondStr } from '@/utils/function';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import type { ActionType, ProColumns } from '@ant-design/pro-components'; import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProTable } from '@ant-design/pro-components'; import { ProTable } from '@ant-design/pro-components';
import { Typography } from 'antd';
import { useRef } from 'react'; import { useRef } from 'react';
const { Link } = Typography;
type HistoryProps = { type HistoryProps = {
taskId: number; taskId: number;
}; };
...@@ -65,12 +68,9 @@ const JobHistoryList = (props: HistoryProps) => { ...@@ -65,12 +68,9 @@ const JobHistoryList = (props: HistoryProps) => {
title: l('global.table.operate'), title: l('global.table.operate'),
valueType: 'option', valueType: 'option',
render: (text: any, record: Jobs.JobInstance) => [ render: (text: any, record: Jobs.JobInstance) => [
<a <Link href={`#/devops/job-detail?id=${record.id}`} key={'history-detail'}>
key={'history-detail'}
onClick={() => history.push(`/devops/job-detail?id=${record.id}`)}
>
{l('devops.joblist.detail')} {l('devops.joblist.detail')}
</a> </Link>
] ]
} }
]; ];
......
/*
*
* 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 { ProCard } from '@ant-design/pro-components';
import { Divider, Space, Typography } from 'antd';
const { Text, Link } = Typography;
type StatisticsCardParams = {
title: string;
value?: string | number;
icon: any;
link?: string;
extra?: any;
divider?: boolean;
atClick?: () => void;
};
const StatisticsCard = (props: StatisticsCardParams) => {
const { title, value, icon, extra = <></>, divider = true, link, atClick } = props;
return (
<>
<ProCard layout={'center'} onClick={() => (atClick ? atClick() : {})} hoverable={true}>
<Space size={20}>
{icon}
<Space direction='vertical'>
<Text>{title}</Text>
<Text style={{ fontSize: 30 }}>{value}</Text>
</Space>
{extra}
</Space>
</ProCard>
{divider ? <Divider type={'vertical'} /> : <></>}
</>
);
};
export default StatisticsCard;
/*
*
* 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 {
AllJobIcons,
BatchIcons,
CancelIcons,
ErrorIcons,
FinishIcons,
RestartIcons,
RunningIcons,
SteamIcons,
UnknownIcons
} from '@/components/Icons/DevopsIcons';
import { DevopContext } from '@/pages/DevOps';
import { JOB_STATUS } from '@/pages/DevOps/constants';
import StatisticsCard from '@/pages/DevOps/JobList/components/Overview/StatisticsCard';
import { getData } from '@/services/api';
import { API_CONSTANTS } from '@/services/endpoints';
import { StatusCountOverView } from '@/types/Home/data';
import { l } from '@/utils/intl';
import { ProCard } from '@ant-design/pro-components';
import { Button, Col, Row, Space } from 'antd';
import { useContext, useEffect, useState } from 'react';
const JobOverview = (props: any) => {
const [statusCount, setStatusCount] = useState<StatusCountOverView>();
const { statusFilter, setStatusFilter } = useContext<any>(DevopContext);
useEffect(() => {
getData(API_CONSTANTS.GET_STATUS_COUNT)
.then((res) => {
setStatusCount(res.data);
})
.catch(() => {});
}, []);
return (
<Row gutter={[16, 8]}>
<Col span={5}>
<ProCard colSpan={'20%'} boxShadow={true}>
<StatisticsCard
title={l('devops.joblist.status.all')}
value={statusCount?.all}
icon={<AllJobIcons size={60} />}
divider={false}
atClick={() => {
setStatusFilter(undefined);
}}
extra={
<Space direction='vertical'>
<Button type={'text'} icon={<BatchIcons size={20} />}>
{l('home.job.batch')}: {statusCount?.modelOverview?.batchJobCount}
</Button>
<Button type={'text'} icon={<SteamIcons size={20} />}>
{l('home.job.stream')}: {statusCount?.modelOverview?.streamingJobCount}
</Button>
</Space>
}
/>
</ProCard>
</Col>
<Col span={19}>
<ProCard layout='center' boxShadow={true}>
<StatisticsCard
title={l('devops.joblist.status.running')}
value={statusCount?.running}
icon={<RunningIcons size={60} />}
atClick={() => {
setStatusFilter(JOB_STATUS.RUNNING);
}}
/>
<StatisticsCard
title={l('devops.joblist.status.cancelled')}
value={statusCount?.canceled}
icon={<CancelIcons size={60} />}
atClick={() => {
setStatusFilter(JOB_STATUS.CANCELED);
}}
/>
<StatisticsCard
title={l('devops.joblist.status.failed')}
value={statusCount?.failed}
icon={<ErrorIcons size={60} />}
atClick={() => {
setStatusFilter(JOB_STATUS.FAILED);
}}
/>
<StatisticsCard
title={l('devops.joblist.status.restarting')}
value={statusCount?.restarting}
icon={<RestartIcons size={60} />}
atClick={() => {
setStatusFilter(JOB_STATUS.RESTARTING);
}}
/>
<StatisticsCard
title={l('devops.joblist.status.finished')}
value={statusCount?.finished}
icon={<FinishIcons size={60} />}
atClick={() => {
setStatusFilter(JOB_STATUS.FINISHED);
}}
/>
<StatisticsCard
title={l('devops.joblist.status.unknown')}
value={statusCount?.unknown}
icon={<UnknownIcons size={60} />}
divider={false}
atClick={() => {
setStatusFilter(JOB_STATUS.UNKNOWN);
}}
/>
</ProCard>
</Col>
</Row>
);
};
export default JobOverview;
...@@ -19,23 +19,27 @@ ...@@ -19,23 +19,27 @@
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 { JOB_STATUS_FILTER, LIFECYCLE_FILTER } from '@/pages/DevOps/function'; import { DevopContext } from '@/pages/DevOps';
import JobHistoryList from '@/pages/DevOps/JobList/components/JobHistoryList'; import { JOB_LIFE_CYCLE } from '@/pages/DevOps/constants';
import JobHistoryList from '@/pages/DevOps/JobList/components/JobHistoryList/JobHistoryList';
import { queryList } from '@/services/api'; import { queryList } from '@/services/api';
import { PROTABLE_OPTIONS_PUBLIC } from '@/services/constants'; 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 { parseMilliSecondStr } from '@/utils/function'; import { parseMilliSecondStr } from '@/utils/function';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { ClockCircleTwoTone, EyeTwoTone } from '@ant-design/icons'; import { 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 { ProTable } from '@ant-design/pro-components'; import { ProCard, ProTable } from '@ant-design/pro-components';
import { Button, Table } from 'antd'; import { Button, Radio, Table } from 'antd';
import { useEffect, useRef } from 'react'; import { useContext, useEffect, useRef, useState } from 'react';
import { history } from 'umi'; import { history } from 'umi';
const JobList = () => { const JobList = () => {
const tableRef = useRef<ActionType>(); const tableRef = useRef<ActionType>();
const { statusFilter, setStatusFilter } = useContext<any>(DevopContext);
const [stepFilter, setStepFilter] = useState<number | undefined>();
const [taskFilter, setTaskFilter] = useState<string | undefined>();
const jobListColumns: ProColumns<Jobs.JobInstance>[] = [ const jobListColumns: ProColumns<Jobs.JobInstance>[] = [
{ {
...@@ -51,9 +55,6 @@ const JobList = () => { ...@@ -51,9 +55,6 @@ const JobList = () => {
}, },
{ {
title: l('global.table.lifecycle'), title: l('global.table.lifecycle'),
filters: LIFECYCLE_FILTER(),
hideInSearch: true,
filterMultiple: false,
dataIndex: 'step', dataIndex: 'step',
render: (_: any, row: { step: number }) => <JobLifeCycleTag status={row.step} /> render: (_: any, row: { step: number }) => <JobLifeCycleTag status={row.step} />
}, },
...@@ -80,9 +81,6 @@ const JobList = () => { ...@@ -80,9 +81,6 @@ const JobList = () => {
}, },
{ {
title: l('global.table.status'), title: l('global.table.status'),
filters: JOB_STATUS_FILTER(),
filterMultiple: false,
hideInSearch: true,
dataIndex: 'status', dataIndex: 'status',
render: (_: any, row: Jobs.JobInstance) => <StatusTag status={row.status} /> render: (_: any, row: Jobs.JobInstance) => <StatusTag status={row.status} />
}, },
...@@ -109,33 +107,56 @@ const JobList = () => { ...@@ -109,33 +107,56 @@ const JobList = () => {
}, []); }, []);
return ( return (
<ProTable<Jobs.JobInstance> <ProCard boxShadow={true} style={{ height: '73vh' }}>
{...PROTABLE_OPTIONS_PUBLIC} <ProTable<Jobs.JobInstance>
rowKey={(record) => record.jid} {...PROTABLE_OPTIONS_PUBLIC}
columns={jobListColumns} search={false}
params={{ isHistory: false }} loading={{ delay: 1000 }}
actionRef={tableRef} rowKey={(record) => record.jid}
headerTitle={l('devops.joblist.joblist')} columns={jobListColumns}
request={async (params, sorter, filter: any) => params={{ isHistory: false, status: statusFilter, step: stepFilter, name: taskFilter }}
queryList(API_CONSTANTS.GET_JOB_LIST, { actionRef={tableRef}
...params, toolbar={{
sorter, settings: false,
filter search: { onSearch: (value: string) => setTaskFilter(value) },
}) filter: (
} <>
expandable={{ <Radio.Group defaultValue={undefined} onChange={(e) => setStepFilter(e.target.value)}>
expandedRowRender: (record) => <JobHistoryList taskId={record.taskId} key={record.jid} />, <Radio.Button value={undefined} defaultChecked={true}>
expandIcon: ({ expanded, onExpand, record }) => ( {l('global.table.lifecycle.all')}
<Button </Radio.Button>
className={'options-button'} <Radio.Button value={JOB_LIFE_CYCLE.PUBLISH}>
key={`${record.id}_history`} {l('global.table.lifecycle.publish')}
onClick={(e) => onExpand(record, e)} </Radio.Button>
title={l('devops.joblist.history')} <Radio.Button value={JOB_LIFE_CYCLE.DEVELOP}>
icon={<ClockCircleTwoTone twoToneColor={expanded ? '#52c41a' : '#4096ff'} />} {l('global.table.lifecycle.dev')}
/> </Radio.Button>
) </Radio.Group>
}} </>
/> ),
actions: [<Button icon={<RedoOutlined />} onClick={() => tableRef.current?.reload()} />]
}}
request={async (params, sorter, filter: any) =>
queryList(API_CONSTANTS.GET_JOB_LIST, {
...params,
sorter,
filter
})
}
expandable={{
expandedRowRender: (record) => <JobHistoryList taskId={record.taskId} key={record.jid} />,
expandIcon: ({ expanded, onExpand, record }) => (
<Button
className={'options-button'}
key={`${record.id}_history`}
onClick={(e) => onExpand(record, e)}
title={l('devops.joblist.history')}
icon={<ClockCircleTwoTone twoToneColor={expanded ? '#52c41a' : '#4096ff'} />}
/>
)
}}
/>
</ProCard>
); );
}; };
export default JobList; export default JobList;
...@@ -17,42 +17,7 @@ ...@@ -17,42 +17,7 @@
* *
*/ */
import { JOB_LIFE_CYCLE, JOB_STATUS } from '@/pages/DevOps/constants'; import { JOB_STATUS } from '@/pages/DevOps/constants';
import { l } from '@/utils/intl';
/**
* 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 = () => {
return [
{ text: l('global.table.lifecycle.dev'), value: JOB_LIFE_CYCLE.DEVELOP },
{ text: l('global.table.lifecycle.online'), value: JOB_LIFE_CYCLE.ONLINE },
{ text: l('global.table.lifecycle.unknown'), value: JOB_LIFE_CYCLE.UNKNOWN }
];
};
/**
* 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 = () => {
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 }
];
};
/** /**
* Checks if a job status indicates that the job is done. * Checks if a job status indicates that the job is done.
......
...@@ -19,16 +19,28 @@ ...@@ -19,16 +19,28 @@
import SlowlyAppear from '@/components/Animation/SlowlyAppear'; import SlowlyAppear from '@/components/Animation/SlowlyAppear';
import JobList from '@/pages/DevOps/JobList'; import JobList from '@/pages/DevOps/JobList';
import JobOverview from '@/pages/DevOps/JobList/components/Overview';
import { PageContainer } from '@ant-design/pro-layout'; import { PageContainer } from '@ant-design/pro-layout';
import { Space } from 'antd';
import { createContext, useState } from 'react';
export const DevopContext = createContext({});
export default () => { export default () => {
const [statusFilter, setStatusFilter] = useState();
/** /**
* breadcrumb={{style:{display:'none'}}} is used to hide the breadcrumb || 隐藏右上角的路由导航面包屑 * breadcrumb={{style:{display:'none'}}} is used to hide the breadcrumb || 隐藏右上角的路由导航面包屑
*/ */
return ( return (
<SlowlyAppear> <SlowlyAppear>
<PageContainer title={false} breadcrumb={{ style: { display: 'none' } }}> <PageContainer title={false} breadcrumb={{ style: { display: 'none' } }}>
<JobList /> <DevopContext.Provider value={{ statusFilter, setStatusFilter }}>
<Space direction='vertical' size={16}>
<JobOverview />
<JobList />
</Space>
</DevopContext.Provider>
</PageContainer> </PageContainer>
</SlowlyAppear> </SlowlyAppear>
); );
......
...@@ -31,6 +31,7 @@ export type StatusCountOverView = { ...@@ -31,6 +31,7 @@ export type StatusCountOverView = {
suspended: number; suspended: number;
reconciling: number; reconciling: number;
unknown: number; unknown: number;
modelOverview: BatchStreamingOverView;
}; };
export type PieItem = { export type PieItem = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment