import { orderBy } from 'lodash'; import * as React from 'react'; import type { IExecution, IExecutionStage, ITask, ITaskStep } from '../../domain'; import { robotToHuman } from '../../presentation'; import { StatusGlyph } from '../../task/StatusGlyph'; import { displayableTasks } from '../../task/displayableTasks.filter'; import { duration } from '../../utils'; export interface IRunningTasksPopoverContentProps { executions: IExecution[]; tasks: ITask[]; } interface IItemDetailsProps { item: IExecutionStage | ITaskStep; transformName?: boolean; } export const ItemDetails = ({ item, transformName }: IItemDetailsProps) => (
{transformName ? robotToHuman(item.name) : item.name}
{duration(item.runningTimeInMs)}
); export const RunningTasksPopoverContent = ({ executions, tasks }: IRunningTasksPopoverContentProps) => { const sortedTasks = orderBy(tasks || [], ['startTime'], ['asc']); return (
{sortedTasks.map((task, index) => (
{task.name} {displayableTasks(task.steps).map((step, i) => ( ))}
))}
{executions.map((execution, index) => (
Pipeline: {execution.name} {(execution.stages || []).map((stage, i) => ( ))}
))}
); };