-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🏭 376 adding component factories for span detail, diagrams and trace …
…node (#393)
- Loading branch information
Showing
14 changed files
with
141 additions
and
94 deletions.
There are no files selected for viewing
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 { ISpan } from '../../types/Span.types'; | ||
import { ITrace } from '../../types/Trace.types'; | ||
import DAGComponent from './components/DAG'; | ||
|
||
export enum SupportedDiagrams { | ||
DAG = 'dag', | ||
} | ||
|
||
export interface IDiagramProps { | ||
type: SupportedDiagrams; | ||
trace: ITrace; | ||
selectedSpan?: ISpan; | ||
onSelectSpan?(spanId: string): void; | ||
} | ||
|
||
const ComponentMap: Record<string, typeof DAGComponent> = { | ||
[SupportedDiagrams.DAG]: DAGComponent, | ||
}; | ||
|
||
const Diagram: React.FC<IDiagramProps> = ({type, ...props}) => { | ||
const Component = ComponentMap[type || ''] || DAGComponent; | ||
|
||
return <Component type={type} {...props} />; | ||
}; | ||
|
||
export default Diagram; |
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,5 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const Container = styled.div` | ||
position: relative; | ||
`; |
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
2 changes: 1 addition & 1 deletion
2
web/src/components/TraceDiagram/index.ts → web/src/components/Diagram/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 './TraceDiagram'; | ||
export {default} from './Diagram'; |
File renamed without changes.
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,21 @@ | ||
import {SemanticGroupNames} from '../../constants/SemanticGroupNames.constants'; | ||
import {ISpan} from '../../types/Span.types'; | ||
import GenericSpanDetail from './components/GenericSpanDetail'; | ||
|
||
export interface ISpanDetailProps { | ||
testId?: string; | ||
span?: ISpan; | ||
resultId?: string; | ||
} | ||
|
||
const ComponentMap: Record<string, typeof GenericSpanDetail> = { | ||
[SemanticGroupNames.Http]: GenericSpanDetail, | ||
}; | ||
|
||
const SpanDetail: React.FC<ISpanDetailProps> = ({span, ...props}) => { | ||
const Component = ComponentMap[span?.type || ''] || GenericSpanDetail; | ||
|
||
return <Component span={span} {...props} />; | ||
}; | ||
|
||
export default SpanDetail; |
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,2 @@ | ||
// eslint-disable-next-line no-restricted-exports | ||
export {default} from './SpanDetail'; |
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,18 @@ | ||
import {NodeProps} from 'react-flow-renderer'; | ||
import {SemanticGroupNames} from '../../constants/SemanticGroupNames.constants'; | ||
import {ISpan} from '../../types/Span.types'; | ||
import GenericTraceNode from './components/GenericTraceNode'; | ||
|
||
export type TTraceNodeProps = NodeProps<ISpan>; | ||
|
||
const ComponentMap: Record<string, typeof GenericTraceNode> = { | ||
[SemanticGroupNames.Http]: GenericTraceNode, | ||
}; | ||
|
||
const TraceNode: React.FC<TTraceNodeProps> = ({data: span, ...props}) => { | ||
const Component = ComponentMap[span?.type || ''] || GenericTraceNode; | ||
|
||
return <Component data={span} {...props} />; | ||
}; | ||
|
||
export default TraceNode; |
Oops, something went wrong.