fix(ui): update tasks last run time to include timezone information (#2047)
* fix: update tasks last run time to include timezone information * fix: use system default timezone instead of assuming UTC
This commit is contained in:
+4
-4
@@ -7,7 +7,7 @@ import lombok.Builder;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.Instant;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -27,8 +27,8 @@ public class TasksHistoryResponse {
|
|||||||
private TaskStatus status;
|
private TaskStatus status;
|
||||||
private Integer progressPercentage;
|
private Integer progressPercentage;
|
||||||
private String message;
|
private String message;
|
||||||
private LocalDateTime createdAt;
|
private Instant createdAt;
|
||||||
private LocalDateTime updatedAt;
|
private Instant updatedAt;
|
||||||
private LocalDateTime completedAt;
|
private Instant completedAt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-3
@@ -10,7 +10,9 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -112,12 +114,16 @@ public class TaskHistoryService {
|
|||||||
.status(task.getStatus())
|
.status(task.getStatus())
|
||||||
.progressPercentage(task.getProgressPercentage())
|
.progressPercentage(task.getProgressPercentage())
|
||||||
.message(task.getMessage())
|
.message(task.getMessage())
|
||||||
.createdAt(task.getCreatedAt())
|
.createdAt(toUtcInstant(task.getCreatedAt()))
|
||||||
.updatedAt(task.getUpdatedAt())
|
.updatedAt(toUtcInstant(task.getUpdatedAt()))
|
||||||
.completedAt(task.getCompletedAt())
|
.completedAt(toUtcInstant(task.getCompletedAt()))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Instant toUtcInstant(LocalDateTime localDateTime) {
|
||||||
|
return localDateTime != null ? localDateTime.atZone(ZoneId.systemDefault()).toInstant() : null;
|
||||||
|
}
|
||||||
|
|
||||||
private TasksHistoryResponse.TaskHistory createMetadataOnlyTaskInfo(TaskType taskType) {
|
private TasksHistoryResponse.TaskHistory createMetadataOnlyTaskInfo(TaskType taskType) {
|
||||||
return TasksHistoryResponse.TaskHistory.builder()
|
return TasksHistoryResponse.TaskHistory.builder()
|
||||||
.id(null)
|
.id(null)
|
||||||
|
|||||||
Reference in New Issue
Block a user