From 71361cf5bd97838eae9f5e8a1b51d557107d06be Mon Sep 17 00:00:00 2001 From: Lasserich Date: Thu, 30 Oct 2025 10:53:28 +0100 Subject: [PATCH 1/3] feat: filter button + tinted nodes --- src/components/Graphs/Graph.module.css | 36 ++++++++++- src/components/Graphs/Graph.tsx | 86 ++++++++++++++++---------- src/components/Graphs/useGraph.ts | 14 +++-- 3 files changed, 95 insertions(+), 41 deletions(-) diff --git a/src/components/Graphs/Graph.module.css b/src/components/Graphs/Graph.module.css index 15887d86..5f75ad4b 100644 --- a/src/components/Graphs/Graph.module.css +++ b/src/components/Graphs/Graph.module.css @@ -3,12 +3,39 @@ height: 600px; overflow: hidden; font-family: var(--sapFontFamily); + position: relative; } .graphColumn { flex: 1; display: flex; flex-direction: column; + background-color: #ffffff; +} + +.topLegendContainer { + position: absolute; + top: 1rem; + right: 1rem; + display: flex; + align-items: center; + z-index: 2; +} + +.filterIcon { + display: flex; + align-items: center; + cursor: pointer; + padding: 4px; + border-radius: 8px; + transition: background-color 0.2s ease; + background-color: rgba(255, 255, 255, 0.9); + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); + margin-left: 0.5rem; +} + +.filterIcon:hover { + background-color: var(--sapButton_Hover_Background, #f0f0f0); } .graphHeader { @@ -45,7 +72,6 @@ color: var(--sapTextColor, #222); } -/* Remove the default fieldset frame when used for grouping only */ .fieldsetReset { border: 0; margin: 0; @@ -53,7 +79,13 @@ min-inline-size: 0; } -/* React Flow Controls dark mode */ +.popoverButtonContainer { + display: flex; + flex-direction: column; + gap: 0.5rem; + padding: 0.5rem; +} + :global([data-theme='dark'] .react-flow__controls) { background-color: rgba(28, 28, 28, 0.9); border: 1px solid rgba(255, 255, 255, 0.15); diff --git a/src/components/Graphs/Graph.tsx b/src/components/Graphs/Graph.tsx index 3d215da4..84b3ab7d 100644 --- a/src/components/Graphs/Graph.tsx +++ b/src/components/Graphs/Graph.tsx @@ -1,7 +1,7 @@ import React, { useState, useCallback, useMemo } from 'react'; -import { ReactFlow, Background, Controls, MarkerType, Node, Panel } from '@xyflow/react'; +import { ReactFlow, Background, Controls, MarkerType, Node } from '@xyflow/react'; +import { Button, Popover } from '@ui5/webcomponents-react'; import type { NodeProps } from '@xyflow/react'; -import { RadioButton, FlexBox, FlexBoxAlignItems } from '@ui5/webcomponents-react'; import styles from './Graph.module.css'; import '@xyflow/react/dist/style.css'; import { NodeData, ColorBy } from './types'; @@ -32,7 +32,8 @@ const Graph: React.FC = () => { const { t } = useTranslation(); const { openInAside } = useSplitter(); const { isDarkTheme } = useTheme(); - const [colorBy, setColorBy] = useState('provider'); + const [colorBy, setColorBy] = useState('source'); + const [filterPopoverOpen, setFilterPopoverOpen] = useState(false); const handleYamlClick = useCallback( (item: ManagedResourceItem) => { @@ -92,37 +93,56 @@ const Graph: React.FC = () => { > - - -
-
- {t('Graphs.colorizedTitle')} - setColorBy('provider')} - /> - setColorBy('source')} - /> - setColorBy('flux')} - /> -
-
-
-
- - - + +
+ + setFilterPopoverOpen(false)} + placement="Top" + > +
+ + + +
+
+
+
+
); diff --git a/src/components/Graphs/useGraph.ts b/src/components/Graphs/useGraph.ts index d8c53531..e452fb99 100644 --- a/src/components/Graphs/useGraph.ts +++ b/src/components/Graphs/useGraph.ts @@ -24,14 +24,17 @@ function buildGraph( treeData.forEach((n) => { const colorKey: string = colorBy === 'source' ? n.providerType : colorBy === 'flux' ? (n.fluxName ?? 'default') : n.providerConfigName; - const node: Node = { + const borderColor = colorMap[colorKey] || '#ccc'; + const backgroundColor = `${borderColor}08`; + + const node: Node = { id: n.id, type: 'custom', data: { ...n }, style: { - border: `2px solid ${colorMap[colorKey] || '#ccc'}`, + border: `2px solid ${borderColor}`, borderRadius: 8, - backgroundColor: 'var(--sapTile_Background, #fff)', + backgroundColor, width: nodeWidth, height: nodeHeight, }, @@ -53,8 +56,7 @@ function buildGraph( id: `e-${n.parentId}-${n.id}`, source: n.parentId, target: n.id, - markerEnd: { type: MarkerType.ArrowClosed }, - }); + style: { strokeWidth: 2, stroke: '#888' }, }); } n.extraRefs?.forEach((refId) => { if (nodeMap.has(refId)) { @@ -63,7 +65,7 @@ function buildGraph( id: `e-${refId}-${n.id}`, source: refId, target: n.id, - markerEnd: { type: MarkerType.ArrowClosed }, + style: { strokeWidth: 2, stroke: '#888' }, }); } }); From 62a9f30f807636faba26585287dae7b0e435afac Mon Sep 17 00:00:00 2001 From: Lasserich Date: Thu, 30 Oct 2025 11:10:54 +0100 Subject: [PATCH 2/3] fix: linting --- src/components/Graphs/Graph.tsx | 4 ++-- src/components/Graphs/useGraph.ts | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/components/Graphs/Graph.tsx b/src/components/Graphs/Graph.tsx index 84b3ab7d..150deaeb 100644 --- a/src/components/Graphs/Graph.tsx +++ b/src/components/Graphs/Graph.tsx @@ -96,12 +96,12 @@ const Graph: React.FC = () => {
- + setFilterPopoverOpen(false)} placement="Top" + onClose={() => setFilterPopoverOpen(false)} >