Skip to content

Commit 68ee497

Browse files
[Agent Traces] Update colors for "Kind" labels and flyout styling (opensearch-project#11520)
Signed-off-by: Joshua Li <joshuali925@gmail.com> Co-authored-by: Hoang Nguyen <jasonlh@amazon.com>
1 parent ecbbb4e commit 68ee497

43 files changed

Lines changed: 116 additions & 736 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

β€Žpackages/osd-apm-topology/src/components/nodes/agent_card_node.tsxβ€Ž

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,6 @@ export const AgentCardNode = ({ data }: NodeProps<AgentCardCustomNode>) => {
5656
label={kindConfig.label}
5757
color={kindConfig.color}
5858
textColor={kindConfig.textColor}
59-
icon={
60-
<img
61-
src={kindConfig.icon}
62-
alt=""
63-
className="osd:w-3 osd:h-3 celAgentCard__kind-icon"
64-
/>
65-
}
6659
/>
6760
{data.status && (
6861
<StatusIndicator status={data.status} label={data.statusLabel} icon={data.statusIcon} />

β€Žpackages/osd-apm-topology/src/components/nodes/type_badge.test.tsxβ€Ž

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,19 @@ describe('TypeBadge', () => {
1313
expect(screen.getByText('Service')).toBeInTheDocument();
1414
});
1515

16-
it('applies backgroundColor from color prop', () => {
16+
it('renders a span element with style attribute', () => {
1717
const { container } = render(<TypeBadge label="Agent" color="#006BB4" />);
1818
const badge = container.firstChild as HTMLElement;
19-
expect(badge.style.backgroundColor).toBe('rgb(0, 107, 180)');
19+
// color-mix is not supported by jsdom, so backgroundColor is dropped;
20+
// verify the element renders and text color falls back to the color prop
21+
expect(badge.tagName).toBe('SPAN');
22+
expect(badge.style.color).toBe('rgb(0, 107, 180)');
2023
});
2124

22-
it('defaults text color to white (#FFFFFF)', () => {
25+
it('defaults text color to the color prop value', () => {
2326
const { container } = render(<TypeBadge label="Service" color="#006CE0" />);
2427
const badge = container.firstChild as HTMLElement;
25-
expect(badge.style.color).toBe('rgb(255, 255, 255)');
28+
expect(badge.style.color).toBe('rgb(0, 108, 224)');
2629
});
2730

2831
it('applies custom textColor', () => {

β€Žpackages/osd-apm-topology/src/components/nodes/type_badge.tsxβ€Ž

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ export interface TypeBadgeProps {
1515

1616
/**
1717
* Colored pill badge with an optional icon and label.
18-
* Used to indicate node type (e.g., "Service", "Agent", "LLM", "Tool").
18+
* Uses a pastel background derived from the color with the text in the full color.
1919
*/
2020
export const TypeBadge: React.FC<TypeBadgeProps> = ({ label, color, icon, textColor }) => (
2121
<span
2222
className="osd:inline-flex osd:items-center osd:gap-1 osd:px-2 osd:py-0.5 osd:rounded-full osd:text-xs osd:font-semibold osd:leading-none"
23-
style={{ backgroundColor: color, color: textColor ?? '#FFFFFF' }}
23+
style={{
24+
backgroundColor: `color-mix(in srgb, ${color} 15%, transparent)`,
25+
color: textColor ?? color,
26+
}}
2427
>
2528
{icon && <span className="osd:flex osd:items-center osd:w-3 osd:h-3">{icon}</span>}
2629
{label}

β€Žpackages/osd-apm-topology/src/shared/constants/agent.constants.test.tsβ€Ž

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@ describe('AGENT_NODE_KINDS', () => {
1414
});
1515
});
1616

17-
it('each entry has label, color, and icon fields', () => {
17+
it('each entry has label and color fields', () => {
1818
ALL_KINDS.forEach((kind) => {
1919
const config = AGENT_NODE_KINDS[kind];
2020
expect(config.label).toBeDefined();
2121
expect(config.color).toBeDefined();
22-
expect(config.icon).toBeDefined();
2322
});
2423
});
2524

β€Žpackages/osd-apm-topology/src/shared/constants/agent.constants.tsβ€Ž

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,10 @@
44
*/
55

66
import type { AgentNodeKind } from '../types/agent.types';
7-
import {
8-
AgentIcon,
9-
LlmIcon,
10-
ToolIcon,
11-
RetrievalIcon,
12-
EmbeddingsIcon,
13-
ContentIcon,
14-
OtherIcon,
15-
} from '../resources/agents';
167

178
export interface AgentNodeKindConfig {
189
label: string;
1910
color: string;
20-
/** SVG icon URL for the node kind */
21-
icon: string;
2211
/** Text color for TypeBadge. Dark text for light backgrounds (e.g., amber). */
2312
textColor?: string;
2413
}
@@ -27,36 +16,29 @@ export const AGENT_NODE_KINDS: Record<AgentNodeKind, AgentNodeKindConfig> = {
2716
agent: {
2817
label: 'Agent',
2918
color: 'var(--osd-color-type-agent, #54B399)',
30-
icon: AgentIcon,
3119
},
3220
llm: {
3321
label: 'LLM',
3422
color: 'var(--osd-color-type-llm, #DD0A73)',
35-
icon: LlmIcon,
3623
},
3724
tool: {
3825
label: 'Tool',
3926
color: 'var(--osd-color-type-tool, #E7664C)',
40-
icon: ToolIcon,
4127
},
4228
retrieval: {
4329
label: 'Retrieval',
4430
color: 'var(--osd-color-type-retrieval, #B9A888)',
45-
icon: RetrievalIcon,
4631
},
4732
embeddings: {
4833
label: 'Embeddings',
4934
color: 'var(--osd-color-type-embeddings, #6092C0)',
50-
icon: EmbeddingsIcon,
5135
},
5236
content: {
5337
label: 'Content',
5438
color: 'var(--osd-color-type-content, #D6BF57)',
55-
icon: ContentIcon,
5639
},
5740
other: {
5841
label: 'Other',
5942
color: 'var(--osd-color-type-other, #98A2B3)',
60-
icon: OtherIcon,
6143
},
6244
};

β€Žpackages/osd-apm-topology/src/shared/resources/agents/agent.svgβ€Ž

Lines changed: 0 additions & 10 deletions
This file was deleted.

β€Žpackages/osd-apm-topology/src/shared/resources/agents/content.svgβ€Ž

Lines changed: 0 additions & 18 deletions
This file was deleted.

β€Žpackages/osd-apm-topology/src/shared/resources/agents/embeddings.svgβ€Ž

Lines changed: 0 additions & 27 deletions
This file was deleted.

β€Žpackages/osd-apm-topology/src/shared/resources/agents/index.tsβ€Ž

Lines changed: 0 additions & 12 deletions
This file was deleted.

β€Žpackages/osd-apm-topology/src/shared/resources/agents/llm.svgβ€Ž

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
Β (0)