Skip to content

Commit

Permalink
fix(frontend): fix default summary time (#3390)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeepc committed Nov 22, 2023
1 parent 483826e commit 48f9b2a
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 75 deletions.
35 changes: 0 additions & 35 deletions web/src/components/CreateTestHeader/CreateTestHeader.styled.ts

This file was deleted.

23 changes: 0 additions & 23 deletions web/src/components/CreateTestHeader/CreateTestHeader.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions web/src/components/CreateTestHeader/index.ts

This file was deleted.

Expand Up @@ -25,7 +25,7 @@ const CreateTestSuiteModal = ({isOpen, onClose}: IProps) => {
isValid={isFormValid}
isOpen
onClose={onClose}
title="Create Test Suite"
title="Create a new test suite"
stepList={stepList}
activeStep={activeStep}
onGoTo={() => null}
Expand Down
Expand Up @@ -8,12 +8,10 @@ export const Footer = styled.div`
`;

export const Modal = styled(AntModal)`
top: 50px;
& .ant-modal-body {
background: ${({theme}) => theme.color.background};
max-height: calc(100vh - 250px);
overflow: scroll;
overflow-y: scroll;
}
`;

Expand Down
2 changes: 1 addition & 1 deletion web/src/components/VariableSetModal/VariableSetModal.tsx
Expand Up @@ -52,7 +52,7 @@ const VariableSetModal = ({variableSet, isOpen, onClose, onSubmit, isLoading}: I
/>
}
onCancel={onClose}
title={<S.Title>{isEditing ? 'Edit Variable Set' : 'Create Variable Set'}</S.Title>}
title={<S.Title>{isEditing ? 'Edit variable set' : 'Create a new variable set'}</S.Title>}
visible={isOpen}
>
<VariableSetForm
Expand Down
25 changes: 15 additions & 10 deletions web/src/models/Summary.model.ts
@@ -1,4 +1,5 @@
import {TTestSchemas} from 'types/Common.types';
import Date from 'utils/Date';

export type TRawTestSummary = TTestSchemas['TestSummary'];
type Summary = {
Expand All @@ -12,15 +13,19 @@ type Summary = {
};
};

const Summary = (summary: TRawTestSummary = {}): Summary => ({
runs: summary.runs ?? 0,
hasRuns: !!summary.runs && summary.runs > 0,
lastRun: {
time: summary.lastRun?.time ?? '',
passes: summary.lastRun?.passes ?? 0,
fails: summary.lastRun?.fails ?? 0,
analyzerScore: summary.lastRun?.analyzerScore ?? 0,
},
});
const Summary = (summary: TRawTestSummary = {}): Summary => {
const time = summary.lastRun?.time ?? '';

return {
runs: summary.runs ?? 0,
hasRuns: !!summary.runs && summary.runs > 0,
lastRun: {
time: Date.isDefaultDate(time) ? '' : time,
passes: summary.lastRun?.passes ?? 0,
fails: summary.lastRun?.fails ?? 0,
analyzerScore: summary.lastRun?.analyzerScore ?? 0,
},
};
};

export default Summary;
3 changes: 3 additions & 0 deletions web/src/utils/Date.ts
Expand Up @@ -15,6 +15,9 @@ const Date = {
}
return formatDistanceToNowStrict(isoDate, {addSuffix: true});
},
isDefaultDate(date: string) {
return date === '0001-01-01T00:00:00Z';
},
};

export default Date;

0 comments on commit 48f9b2a

Please sign in to comment.