Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(frontend): add total spans in awaiting trace status #3569

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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