Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend): add error handling for trigger section (#2274)
- Loading branch information
Showing
19 changed files
with
311 additions
and
103 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
web/src/components/FailedTrace/__tests__/FailedTrace.test.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {Typography} from 'antd'; | ||
import TestRunEvent from 'models/TestRunEvent.model'; | ||
import * as S from './RunEvents.styled'; | ||
|
||
interface IProps { | ||
event: TestRunEvent; | ||
} | ||
|
||
const RunEvent = ({event}: IProps) => ( | ||
<S.EventContainer> | ||
<S.Dot $logLevel={event.logLevel} /> | ||
<Typography.Title level={3}>{event.title}</Typography.Title> | ||
<Typography.Text>{event.description}</Typography.Text> | ||
</S.EventContainer> | ||
); | ||
|
||
export default RunEvent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import {CloseCircleFilled} from '@ant-design/icons'; | ||
import {Typography} from 'antd'; | ||
import styled, {DefaultTheme} from 'styled-components'; | ||
|
||
import {LogLevel} from 'models/TestRunEvent.model'; | ||
|
||
function getLogLevelColor(logLevel: LogLevel, theme: DefaultTheme): string { | ||
if (logLevel === LogLevel.Error) return theme.color.error; | ||
if (logLevel === LogLevel.Success) return theme.color.success; | ||
if (logLevel === LogLevel.Warning) return theme.color.warningYellow; | ||
return theme.color.textLight; | ||
} | ||
|
||
export const Container = styled.div` | ||
align-items: center; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
padding: 70px 120px; | ||
`; | ||
|
||
export const Dot = styled.div<{$logLevel?: LogLevel}>` | ||
background: #ffffff; | ||
border: 2px solid ${({theme, $logLevel = LogLevel.Info}) => getLogLevelColor($logLevel, theme)}; | ||
border-radius: 50%; | ||
left: -5px; | ||
height: 10px; | ||
position: absolute; | ||
top: 0; | ||
width: 10px; | ||
`; | ||
|
||
export const ErrorIcon = styled(CloseCircleFilled)` | ||
color: ${({theme}) => theme.color.error}; | ||
font-size: 32px; | ||
margin-bottom: 26px; | ||
`; | ||
|
||
export const EventContainer = styled.div` | ||
border-left: 1px solid ${({theme}) => theme.color.textLight}; | ||
padding: 0 20px 20px; | ||
position: relative; | ||
`; | ||
|
||
export const Link = styled(Typography.Link)` | ||
font-weight: bold; | ||
`; | ||
|
||
export const ListContainer = styled.div` | ||
padding: 24px 0; | ||
`; | ||
|
||
export const Paragraph = styled(Typography.Paragraph)` | ||
text-align: center; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import TestRunEvent, {TestRunStage} from 'models/TestRunEvent.model'; | ||
import TestRunService from 'services/TestRun.service'; | ||
import RunEventsTrigger from './RunEventsTrigger'; | ||
|
||
export interface IPropsComponent { | ||
events: TestRunEvent[]; | ||
} | ||
|
||
interface IProps extends IPropsComponent { | ||
stage: TestRunStage; | ||
} | ||
|
||
const ComponentMap: Record<TestRunStage, (props: IPropsComponent) => React.ReactElement> = { | ||
[TestRunStage.Trigger]: RunEventsTrigger, | ||
[TestRunStage.Trace]: RunEventsTrigger, | ||
[TestRunStage.Test]: RunEventsTrigger, | ||
}; | ||
|
||
const RunEvents = ({events, stage}: IProps) => { | ||
const Component = ComponentMap[stage]; | ||
const filteredEvents = TestRunService.getTestRunEventsByStage(events, stage); | ||
|
||
return <Component events={filteredEvents} />; | ||
}; | ||
|
||
export default RunEvents; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import {Typography} from 'antd'; | ||
|
||
import {DISCORD_URL, GITHUB_ISSUES_URL} from 'constants/Common.constants'; | ||
import RunEvent from './RunEvent'; | ||
import {IPropsComponent} from './RunEvents'; | ||
import * as S from './RunEvents.styled'; | ||
|
||
const RunEventsTrigger = ({events}: IPropsComponent) => ( | ||
<S.Container> | ||
<S.ErrorIcon /> | ||
<Typography.Title level={2}>Test Run Failed</Typography.Title> | ||
<S.Paragraph> | ||
We prepared the breakdown of diagnostic steps and tips to help identify the source of the issue: | ||
</S.Paragraph> | ||
|
||
<S.ListContainer> | ||
{events.map(event => ( | ||
<RunEvent event={event} key={event.type} /> | ||
))} | ||
</S.ListContainer> | ||
|
||
<S.Paragraph> | ||
<Typography.Text type="secondary"> | ||
<S.Link href={GITHUB_ISSUES_URL} target="_blank"> | ||
Create an issue | ||
</S.Link>{' '} | ||
or contact us via{' '} | ||
<S.Link href={DISCORD_URL} target="_blank"> | ||
Discord | ||
</S.Link> | ||
. We will check it out and will help you rectify the issue. | ||
</Typography.Text> | ||
</S.Paragraph> | ||
</S.Container> | ||
); | ||
|
||
export default RunEventsTrigger; |
2 changes: 1 addition & 1 deletion
2
web/src/components/FailedTrace/index.ts → web/src/components/RunEvents/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// eslint-disable-next-line no-restricted-exports | ||
export {default} from './FailedTrace'; | ||
export {default} from './RunEvents'; |
Oops, something went wrong.