-
Notifications
You must be signed in to change notification settings - Fork 77
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 analyzer errors by attribute (#2846)
- Loading branch information
Showing
12 changed files
with
150 additions
and
17 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
web/src/components/AnalyzerErrorsPopover/AnalyzerErrorsPopover.styled.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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {ExclamationCircleFilled} from '@ant-design/icons'; | ||
import {Typography} from 'antd'; | ||
import styled from 'styled-components'; | ||
|
||
export const Container = styled.div` | ||
align-items: center; | ||
display: flex; | ||
gap: 4px; | ||
`; | ||
|
||
export const ContentContainer = styled.div` | ||
overflow-wrap: break-word; | ||
width: 270px; | ||
`; | ||
|
||
export const ErrorIcon = styled(ExclamationCircleFilled)` | ||
color: ${({theme}) => theme.color.error}; | ||
`; | ||
|
||
export const List = styled.ul` | ||
padding-inline-start: 20px; | ||
`; | ||
|
||
export const RuleContainer = styled.div` | ||
margin-bottom: 8px; | ||
`; | ||
|
||
export const Text = styled(Typography.Text)``; | ||
|
||
export const Title = styled(Typography.Title)` | ||
&& { | ||
margin-bottom: 0; | ||
} | ||
`; |
22 changes: 22 additions & 0 deletions
22
web/src/components/AnalyzerErrorsPopover/AnalyzerErrorsPopover.tsx
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,22 @@ | ||
import {Popover} from 'antd'; | ||
import {TAnalyzerError} from 'types/TestRun.types'; | ||
import * as S from './AnalyzerErrorsPopover.styled'; | ||
import Content from './Content'; | ||
|
||
interface IProps { | ||
errors: TAnalyzerError[]; | ||
} | ||
|
||
const AnalyzerErrorsPopover = ({errors}: IProps) => ( | ||
<S.Container> | ||
<Popover | ||
content={<Content errors={errors} />} | ||
placement="right" | ||
title={<S.Title level={3}>Analyzer errors</S.Title>} | ||
> | ||
<S.ErrorIcon /> | ||
</Popover> | ||
</S.Container> | ||
); | ||
|
||
export default AnalyzerErrorsPopover; |
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,39 @@ | ||
import {TAnalyzerError} from 'types/TestRun.types'; | ||
import * as S from './AnalyzerErrorsPopover.styled'; | ||
|
||
interface IProps { | ||
errors: TAnalyzerError[]; | ||
} | ||
|
||
const Content = ({errors}: IProps) => ( | ||
<S.ContentContainer> | ||
{errors.map(analyzerError => ( | ||
<S.RuleContainer key={analyzerError.ruleName}> | ||
<S.Text>{analyzerError.ruleName}</S.Text> | ||
|
||
{analyzerError.errors.length > 1 && ( | ||
<> | ||
<div> | ||
<S.Text type="secondary">{analyzerError.ruleErrorDescription}</S.Text> | ||
</div> | ||
<S.List> | ||
{analyzerError.errors.map(error => ( | ||
<li key={error.value}> | ||
<S.Text type="secondary">{error.value}</S.Text> | ||
</li> | ||
))} | ||
</S.List> | ||
</> | ||
)} | ||
|
||
{analyzerError.errors.length === 1 && ( | ||
<div> | ||
<S.Text type="secondary">{analyzerError.errors[0].description}</S.Text> | ||
</div> | ||
)} | ||
</S.RuleContainer> | ||
))} | ||
</S.ContentContainer> | ||
); | ||
|
||
export default Content; |
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,2 @@ | ||
// eslint-disable-next-line no-restricted-exports | ||
export {default} from './AnalyzerErrorsPopover'; |
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
38 changes: 27 additions & 11 deletions
38
web/src/components/SpanDetail/TraceAttributeRow/TraceAttributeRow.tsx
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,23 +1,39 @@ | ||
import {useMemo} from 'react'; | ||
import AnalyzerErrorsPopover from 'components/AnalyzerErrorsPopover'; | ||
import SpanAttributeService from 'services/SpanAttribute.service'; | ||
import * as S from './TraceAttributeRow.styled'; | ||
import BaseAttributeRow from '../BaseAttributeRow/BaseAttributeRow'; | ||
import {IPropsAttributeRow} from '../SpanDetail'; | ||
|
||
const AttributeRow = ({ | ||
attribute: {key}, | ||
attribute, | ||
searchText, | ||
semanticConventions, | ||
analyzerErrors, | ||
onCreateTestSpec, | ||
onCreateOutput, | ||
}: IPropsAttributeRow) => ( | ||
<S.Container> | ||
<BaseAttributeRow | ||
attribute={attribute} | ||
searchText={searchText} | ||
semanticConventions={semanticConventions} | ||
onCreateTestSpec={onCreateTestSpec} | ||
onCreateOutput={onCreateOutput} | ||
/> | ||
</S.Container> | ||
); | ||
}: IPropsAttributeRow) => { | ||
const attributeAnalyzerErrors = useMemo( | ||
() => SpanAttributeService.getAttributeAnalyzerErrors(key, analyzerErrors), | ||
[key, analyzerErrors] | ||
); | ||
|
||
return ( | ||
<S.Container> | ||
<BaseAttributeRow | ||
attribute={attribute} | ||
searchText={searchText} | ||
semanticConventions={semanticConventions} | ||
onCreateTestSpec={onCreateTestSpec} | ||
onCreateOutput={onCreateOutput} | ||
/> | ||
|
||
<S.Footer> | ||
{!!attributeAnalyzerErrors.length && <AnalyzerErrorsPopover errors={attributeAnalyzerErrors} />} | ||
</S.Footer> | ||
</S.Container> | ||
); | ||
}; | ||
|
||
export default AttributeRow; |
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
4 changes: 2 additions & 2 deletions
4
web/src/components/SpanDetail/TraceSubHeader/TraceSubHeader.tsx
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