Skip to content

Commit

Permalink
feat(frontend): add total spans in awaiting trace status (#3569)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeepc authored Jan 26, 2024
1 parent 586cdb0 commit 6c32413
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
6 changes: 3 additions & 3 deletions web/src/components/RunDetailLayout/HeaderRight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const HeaderRight = ({testId, triggerType}: IProps) => {
const {isDraftMode: isTestOutputsDraftMode} = useTestOutput();
const isDraftMode = isTestSpecsDraftMode || isTestOutputsDraftMode;
const {
run: {state, requiredGatesResult},
run: {state, requiredGatesResult, trace},
run,
runEvents,
isLoadingStop,
Expand All @@ -49,8 +49,8 @@ const HeaderRight = ({testId, triggerType}: IProps) => {
{isDraftMode && <TestActions />}
{!isDraftMode && state && state !== TestStateEnum.FINISHED && (
<S.StateContainer data-cy="test-run-result-status">
<S.StateText>Test status:</S.StateText>
<TestState testState={state} />
<S.StateText>Status:</S.StateText>
<TestState testState={state} info={`(${trace?.spans?.length ?? 0} spans)`} />
{isRunPollingState(state) && <SkipPollingPopover isLoading={isLoading} skipPolling={onSkipPolling} />}
</S.StateContainer>
)}
Expand Down
7 changes: 4 additions & 3 deletions web/src/components/TestState/TestState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import TestStateProgress from './TestStateProgress';

interface IProps {
testState: TTestRunState;
info?: string;
}

const TestState = ({testState}: IProps) => {
const {label, percent, status} = TestStateMap[testState];
const TestState = ({testState, info}: IProps) => {
const {label, percent, status, showInfo} = TestStateMap[testState];

return percent ? (
<TestStateProgress label={label} percent={percent} />
<TestStateProgress label={label} percent={percent} showInfo={showInfo} info={info} />
) : (
<TestStateBadge label={label} status={status} />
);
Expand Down
8 changes: 6 additions & 2 deletions web/src/components/TestState/TestStateProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import * as S from './TestState.styled';
interface IProps {
label: string;
percent: number;
showInfo?: boolean;
info?: string;
}

const TestStateProgress = ({label, percent}: IProps) => (
const TestStateProgress = ({label, percent, showInfo, info}: IProps) => (
<S.Container hasMinWidth>
<Progress percent={percent} showInfo={false} status="active" strokeLinecap="square" strokeWidth={6} />
<S.Text>{label}</S.Text>
<S.Text>
{label} {showInfo && info}
</S.Text>
</S.Container>
);

Expand Down
8 changes: 7 additions & 1 deletion web/src/constants/TestRun.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ export enum TestState {

export const TestStateMap: Record<
TestState,
{status: 'success' | 'processing' | 'error' | 'default' | 'warning'; label: string; percent?: number}
{
status: 'success' | 'processing' | 'error' | 'default' | 'warning';
label: string;
percent?: number;
showInfo?: boolean;
}
> = {
[TestState.CREATED]: {
status: 'default',
Expand All @@ -32,6 +37,7 @@ export const TestStateMap: Record<
status: 'warning',
label: 'Awaiting trace',
percent: 50,
showInfo: true,
},
[TestState.AWAITING_TEST_RESULTS]: {
status: 'success',
Expand Down

0 comments on commit 6c32413

Please sign in to comment.