Skip to content

Commit

Permalink
[Improve] Display user nickname in task instance listing (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangshenghang authored Jan 16, 2025
1 parent f07fe97 commit 40d894f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,8 @@ public IPage<SeaTunnelJobInstanceDto> queryJobInstanceListPaging(
Date endTime,
String jobDefineName,
JobMode jobMode) {
IPage<SeaTunnelJobInstanceDto> jobInstanceIPage =
jobInstanceMapper.queryJobInstanceListPaging(
page, startTime, endTime, jobDefineName, jobMode);
return jobInstanceIPage;
return jobInstanceMapper.queryJobInstanceListPaging(
page, startTime, endTime, jobDefineName, jobMode);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ public class SeaTunnelJobInstanceDto extends JobInstance {
private long writeRowCount;

private Long runningTime;

private String username;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.apache.seatunnel.app.common.Status;
import org.apache.seatunnel.app.dal.dao.IJobDefinitionDao;
import org.apache.seatunnel.app.dal.dao.IJobInstanceDao;
import org.apache.seatunnel.app.dal.entity.JobDefinition;
import org.apache.seatunnel.app.dal.entity.JobInstance;
import org.apache.seatunnel.app.domain.dto.job.SeaTunnelJobInstanceDto;
import org.apache.seatunnel.app.domain.response.executor.JobExecutionStatus;
Expand Down Expand Up @@ -93,7 +92,8 @@ public Result<PageInfo<SeaTunnelJobInstanceDto>> getSyncTaskInstancePaging(
if (CollectionUtils.isEmpty(records)) {
return result;
}
populateExecutionMetricsData(userId, jobMode, records);
addRunningTimeToResult(records);
jobPipelineSummaryMetrics(records, jobMode, userId);
pageInfo.setTotal((int) jobInstanceIPage.getTotal());
pageInfo.setTotalList(records);
result.setData(pageInfo);
Expand All @@ -102,7 +102,6 @@ public Result<PageInfo<SeaTunnelJobInstanceDto>> getSyncTaskInstancePaging(

private void populateExecutionMetricsData(
Integer userId, JobMode jobMode, List<SeaTunnelJobInstanceDto> records) {
addJobDefineNameToResult(records);
addRunningTimeToResult(records);
jobPipelineSummaryMetrics(records, jobMode, userId);
}
Expand All @@ -126,16 +125,6 @@ private void addRunningTimeToResult(List<SeaTunnelJobInstanceDto> records) {
}
}

private void addJobDefineNameToResult(List<SeaTunnelJobInstanceDto> records) {
for (SeaTunnelJobInstanceDto jobInstanceDto : records) {
JobDefinition jobDefinition =
jobDefinitionService.getJobDefinitionByJobId(jobInstanceDto.getJobDefineId());
if (jobDefinition != null) {
jobInstanceDto.setJobDefineName(jobDefinition.getName());
}
}
}

public Date dateConverter(String time) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,28 @@
</sql>

<select id="queryJobInstanceListPaging" resultType="org.apache.seatunnel.app.domain.dto.job.SeaTunnelJobInstanceDto">
SELECT *
FROM t_st_job_instance
SELECT ji.*, jd.name AS jobDefineName, cu.username AS username
FROM t_st_job_instance ji
LEFT JOIN t_st_job_definition jd ON ji.job_define_id = jd.id
LEFT JOIN user cu ON ji.create_user_id = cu.id
<where>
<if test="startTime != null">
AND create_time <![CDATA[ >=]]> #{startTime}
AND ji.create_time <![CDATA[ >=]]> #{startTime}
</if>
<if test="endTime == null">
AND (end_time is null or end_time <![CDATA[ <=]]> #{endTime})
AND (ji.end_time is null or ji.end_time <![CDATA[ <=]]> #{endTime})
</if>
<if test="endTime != null">
AND (end_time <![CDATA[ <=]]> #{endTime} or end_time is null)
AND (ji.end_time <![CDATA[ <=]]> #{endTime} or ji.end_time is null)
</if>
<if test="jobDefineName != null">
AND job_define_id in (select x.id from t_st_job_definition x where x.name LIKE concat('%', #{jobDefineName}, '%'))
AND jd.name LIKE concat('%', #{jobDefineName}, '%')
</if>
<if test="jobMode != null">
AND job_type = #{jobMode}
AND ji.job_type = #{jobMode}
</if>
</where>
ORDER BY create_time DESC
ORDER BY ji.create_time DESC
</select>
<select id="getJobExecutionStatus" resultType="org.apache.seatunnel.app.dal.entity.JobInstance">
SELECT `job_status`, `error_message`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export function useSyncTask(syncTaskType = 'BATCH') {
},
{
title: t('project.synchronization_instance.execute_user'),
key: 'createUserId',
key: 'username',
...COLUMN_WIDTH_CONFIG['state']
},
{
Expand Down

0 comments on commit 40d894f

Please sign in to comment.