Use API order instead of reordering timeline (#1503)

This commit is contained in:
Shuchang Zheng
2025-01-06 09:13:05 -08:00
committed by GitHub
parent 45cfa58648
commit 2e9bcc3463
3 changed files with 7 additions and 9 deletions

View File

@@ -56,8 +56,6 @@ function WorkflowRunTimeline({
const workflowRunIsNotFinalized = statusIsNotFinalized(workflowRun); const workflowRunIsNotFinalized = statusIsNotFinalized(workflowRun);
const timeline = workflowRunTimeline.slice().reverse();
const numberOfActions = workflowRunTimeline.reduce((total, current) => { const numberOfActions = workflowRunTimeline.reduce((total, current) => {
if (isTaskVariantBlockItem(current)) { if (isTaskVariantBlockItem(current)) {
return total + current.block!.actions!.length; return total + current.block!.actions!.length;
@@ -98,8 +96,10 @@ function WorkflowRunTimeline({
</div> </div>
</div> </div>
)} )}
{timeline.length === 0 && <div>Workflow timeline is empty</div>} {workflowRunTimeline.length === 0 && (
{timeline?.map((timelineItem) => { <div>Workflow timeline is empty</div>
)}
{workflowRunTimeline?.map((timelineItem) => {
if (isBlockItem(timelineItem)) { if (isBlockItem(timelineItem)) {
return ( return (
<WorkflowRunTimelineBlockItem <WorkflowRunTimelineBlockItem

View File

@@ -31,7 +31,7 @@ function WorkflowRunTimelineBlockItem({
onBlockItemClick, onBlockItemClick,
onActionClick, onActionClick,
}: Props) { }: Props) {
const actions = block.actions ? [...block.actions].reverse() : []; const actions = block.actions ?? [];
const hasActiveAction = const hasActiveAction =
isAction(activeItem) && isAction(activeItem) &&

View File

@@ -37,15 +37,13 @@ function findActiveItem(
return "stream"; return "stream";
} }
if (timeline?.length > 0) { if (timeline?.length > 0) {
const last = timeline.length - 1; const timelineItem = timeline![0];
const timelineItem = timeline![last];
if (isBlockItem(timelineItem)) { if (isBlockItem(timelineItem)) {
if ( if (
timelineItem.block.actions && timelineItem.block.actions &&
timelineItem.block.actions.length > 0 timelineItem.block.actions.length > 0
) { ) {
const last = timelineItem.block.actions.length - 1; return timelineItem.block.actions[0]!;
return timelineItem.block.actions[last]!;
} }
return timelineItem.block; return timelineItem.block;
} }