Skip to content

Commit

Permalink
feat(trace-view): Add faint project badges to span rows (#81819)
Browse files Browse the repository at this point in the history
As per the new designs, adds faint project badges to span rows. I have
not added them to autogrouped rows, as I am unsure whether they should
have them or not 🤔

We can explore adding them to autogroup span rows if necessary


![image](https://github.com/user-attachments/assets/1e2622a6-62ad-43d8-9813-49c4bcfc487e)
  • Loading branch information
0Calories authored Dec 6, 2024
1 parent f48ca85 commit cdea8a0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import {Fragment, useMemo} from 'react';
import styled from '@emotion/styled';
import clamp from 'lodash/clamp';
import {PlatformIcon} from 'platformicons';

import {useHasTraceNewUi} from 'sentry/views/performance/newTraceDetails/useHasTraceNewUi';

import {TraceIcons} from '../traceIcons';
import type {TraceTree} from '../traceModels/traceTree';
Expand Down Expand Up @@ -95,3 +99,18 @@ export function TracePerformanceIssueIcons(props: TracePerformanceIssueIconsProp
</Fragment>
);
}

export function SpanProjectIcon({platform}: {platform: string}) {
const hasTraceNewUi = useHasTraceNewUi();

if (!hasTraceNewUi) {
return null;
}

return <FaintProjectIcon platform={platform} />;
}

const FaintProjectIcon = styled(PlatformIcon)`
opacity: 0.2;
filter: grayscale(1);
`;
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {SpanProjectIcon} from 'sentry/views/performance/newTraceDetails/traceRow/traceIcons';

import {TraceIcons} from '../traceIcons';
import type {TraceTree} from '../traceModels/traceTree';
import type {TraceTreeNode} from '../traceModels/traceTreeNode';
Expand Down Expand Up @@ -57,6 +59,9 @@ export function TraceSpanRow(props: TraceRowProps<TraceTreeNode<TraceTree.Span>>
</TraceChildrenButton>
) : null}
</div>
<SpanProjectIcon
platform={props.projects[props.node.metadata.project_slug ?? ''] ?? 'default'}
/>
<span className="TraceOperation">{props.node.value.op ?? '<unknown>'}</span>
<strong className="TraceEmDash"></strong>
<span className="TraceDescription" title={props.node.value.description}>
Expand Down

0 comments on commit cdea8a0

Please sign in to comment.