feature(web): 优化时间线展示
加入分页,增加对时间点的排序,默认最近的在最前面
This commit is contained in:
@@ -34,31 +34,16 @@ public class TimelineController {
|
||||
public ImmutableList<HudiInstant> allInstants(
|
||||
@RequestParam("flink_job_id") Long flinkJobId,
|
||||
@RequestParam("alias") String alias,
|
||||
@RequestParam(value = "filter_type", required = false) List<String> filterType,
|
||||
@RequestParam(value = "filter_action", required = false) List<String> filterAction,
|
||||
@RequestParam(value = "filter_state", required = false) List<String> filterState
|
||||
@RequestParam(value = "filter_type", required = false) List<String> filterType
|
||||
) throws IOException {
|
||||
return timelineService.timeline(
|
||||
flinkJobId,
|
||||
alias,
|
||||
Lists.immutable.ofAll(filterType),
|
||||
Lists.immutable.ofAll(filterAction),
|
||||
Lists.immutable.ofAll(filterState)
|
||||
);
|
||||
return timelineService.timeline(flinkJobId, alias, Lists.immutable.ofAll(filterType));
|
||||
}
|
||||
|
||||
@GetMapping("list_hdfs")
|
||||
public ImmutableList<HudiInstant> allInstants(
|
||||
@RequestParam("hdfs") String hdfs,
|
||||
@RequestParam(value = "filter_type", required = false) List<String> filterType,
|
||||
@RequestParam(value = "filter_action", required = false) List<String> filterAction,
|
||||
@RequestParam(value = "filter_state", required = false) List<String> filterState
|
||||
@RequestParam(value = "filter_type", required = false) List<String> filterType
|
||||
) throws IOException {
|
||||
return timelineService.timeline(
|
||||
hdfs,
|
||||
Lists.immutable.ofAll(filterType),
|
||||
Lists.immutable.ofAll(filterAction),
|
||||
Lists.immutable.ofAll(filterState)
|
||||
);
|
||||
return timelineService.timeline(hdfs, Lists.immutable.ofAll(filterType));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,9 +37,9 @@ public class TimelineService {
|
||||
|
||||
@Cacheable(value = "timeline", sync = true, key = "#flinkJobId.toString()+#alias")
|
||||
@Retryable(Throwable.class)
|
||||
public ImmutableList<HudiInstant> timeline(Long flinkJobId, String alias, ImmutableList<String> filterType, ImmutableList<String> filterAction, ImmutableList<String> filterState) throws IOException {
|
||||
public ImmutableList<HudiInstant> timeline(Long flinkJobId, String alias, ImmutableList<String> filterType) throws IOException {
|
||||
TableMeta meta = infoService.tableMetaDetail(flinkJobId, alias);
|
||||
return timeline(meta.getHudi().getTargetHdfsPath(), filterType, filterAction, filterState);
|
||||
return timeline(meta.getHudi().getTargetHdfsPath(), filterType);
|
||||
}
|
||||
|
||||
private static final String INSTANT_TYPE_ACTIVE = "active";
|
||||
@@ -47,7 +47,7 @@ public class TimelineService {
|
||||
|
||||
@Cacheable(value = "timeline", sync = true, key = "#hdfs")
|
||||
@Retryable(Throwable.class)
|
||||
public ImmutableList<HudiInstant> timeline(String hdfs, ImmutableList<String> filterType, ImmutableList<String> filterAction, ImmutableList<String> filterState) throws IOException {
|
||||
public ImmutableList<HudiInstant> timeline(String hdfs, ImmutableList<String> filterType) throws IOException {
|
||||
HoodieTableMetaClient client = HoodieTableMetaClient.builder()
|
||||
.setConf(new Configuration())
|
||||
.setBasePath(hdfs)
|
||||
@@ -59,15 +59,11 @@ public class TimelineService {
|
||||
if (filterType.contains(INSTANT_TYPE_ARCHIVE)) {
|
||||
HoodieUtils.getAllInstants(client, HoodieTableMetaClient::getArchivedTimeline)
|
||||
.collect(instant -> covert(INSTANT_TYPE_ARCHIVE, instant))
|
||||
.select(instant -> ObjectUtil.isEmpty(filterAction) || filterAction.contains(instant.getAction()))
|
||||
.select(instant -> ObjectUtil.isEmpty(filterState) || filterState.contains(instant.getState()))
|
||||
.forEach(instants::add);
|
||||
}
|
||||
if (filterType.contains(INSTANT_TYPE_ACTIVE)) {
|
||||
HoodieUtils.getAllInstants(client, HoodieTableMetaClient::getActiveTimeline)
|
||||
.collect(instant -> covert(INSTANT_TYPE_ACTIVE, instant))
|
||||
.select(instant -> ObjectUtil.isEmpty(filterAction) || filterAction.contains(instant.getAction()))
|
||||
.select(instant -> ObjectUtil.isEmpty(filterState) || filterState.contains(instant.getState()))
|
||||
.forEach(instants::add);
|
||||
}
|
||||
return instants
|
||||
|
||||
Reference in New Issue
Block a user