From 00ba660ef9c5986b681d65fd099702a2f0d6b59b Mon Sep 17 00:00:00 2001 From: Jorge Padilla Date: Mon, 3 Jul 2023 18:07:06 -0500 Subject: [PATCH] feat(frontend): add test outputs mark to Timeline view --- .../Timeline/TestSpanNode/Header.tsx | 60 +++++++++++++------ .../Timeline/TestSpanNode/TestSpanNode.tsx | 10 +++- .../components/Timeline/Timeline.styled.ts | 13 ++++ 3 files changed, 64 insertions(+), 19 deletions(-) diff --git a/web/src/components/Visualization/components/Timeline/TestSpanNode/Header.tsx b/web/src/components/Visualization/components/Timeline/TestSpanNode/Header.tsx index 6a032c30af..719cc274e2 100644 --- a/web/src/components/Visualization/components/Timeline/TestSpanNode/Header.tsx +++ b/web/src/components/Visualization/components/Timeline/TestSpanNode/Header.tsx @@ -1,31 +1,57 @@ +import {Group} from '@visx/group'; import * as S from '../Timeline.styled'; interface IProps { + hasOutputs?: boolean; totalFailedChecks?: number; totalPassedChecks?: number; } -const Header = ({totalFailedChecks, totalPassedChecks}: IProps) => { +function getOutputsX(totalFailedChecks?: number, totalPassedChecks?: number): number { + if (totalFailedChecks && totalPassedChecks) { + return 44; + } + if (totalFailedChecks || totalPassedChecks) { + return 24; + } + + return 0; +} + +const Header = ({hasOutputs, totalFailedChecks, totalPassedChecks}: IProps) => { const failedChecksX = totalPassedChecks ? 20 : 0; + const outputsX = getOutputsX(totalFailedChecks, totalPassedChecks); return ( <> - {!!totalPassedChecks && ( - <> - - - {totalPassedChecks} - - - )} - {!!totalFailedChecks && ( - <> - - - {totalFailedChecks} - - - )} + + {!!totalPassedChecks && ( + <> + + + {totalPassedChecks} + + + )} + {!!totalFailedChecks && ( + <> + + + {totalFailedChecks} + + + )} + + + {hasOutputs && ( + <> + + + O + + + )} + ); }; diff --git a/web/src/components/Visualization/components/Timeline/TestSpanNode/TestSpanNode.tsx b/web/src/components/Visualization/components/Timeline/TestSpanNode/TestSpanNode.tsx index 24c5c6f0e5..9ade2bedcf 100644 --- a/web/src/components/Visualization/components/Timeline/TestSpanNode/TestSpanNode.tsx +++ b/web/src/components/Visualization/components/Timeline/TestSpanNode/TestSpanNode.tsx @@ -5,12 +5,18 @@ import {IPropsComponent} from '../SpanNodeFactory'; const TestSpanNode = (props: IPropsComponent) => { const {node} = props; - const {span, testSpecs} = useSpanData(node.data.id); + const {span, testSpecs, testOutputs} = useSpanData(node.data.id); return ( } + header={ +
+ } span={span} /> ); diff --git a/web/src/components/Visualization/components/Timeline/Timeline.styled.ts b/web/src/components/Visualization/components/Timeline/Timeline.styled.ts index e859f5584d..a92236c72c 100644 --- a/web/src/components/Visualization/components/Timeline/Timeline.styled.ts +++ b/web/src/components/Visualization/components/Timeline/Timeline.styled.ts @@ -34,6 +34,12 @@ export const CircleNumber = styled.circle` fill: ${({theme}) => theme.color.borderLight}; `; +export const RectOutput = styled.rect` + fill: ${({theme}) => theme.color.warningYellow}; + height: 12px; + width: 12px; +`; + export const GroupCollapse = styled(Group)` cursor: pointer; `; @@ -109,3 +115,10 @@ export const TextNumber = styled.text` font-size: ${({theme}) => theme.size.sm}; pointer-events: none; `; + +export const TextOutput = styled.text` + fill: ${({theme}) => theme.color.white}; + font-size: ${({theme}) => theme.size.xs}; + font-weight: bold; + pointer-events: none; +`;