Skip to content

Commit 34bd323

Browse files
committed
feat: fix graph view
1 parent 2159066 commit 34bd323

File tree

9 files changed

+81
-64
lines changed

9 files changed

+81
-64
lines changed

src/components/BentoGrid/BentoGrid.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
transform: translateY(-2px);
2828
}
2929

30-
/* Card sizes are now explicitly positioned via gridColumn/gridRow props */
30+
/* Card sizes are explicitly positioned via gridColumn/gridRow props */
3131
/* Layout:
3232
- Left: Extra large graph (8 cols x 4 rows) + Large crossplane (8 cols x 2 rows)
3333
- Right: Two medium GitOps (4 cols x 2 rows each) + Two small underneath (2 cols x 2 rows each)

src/components/BentoGrid/ComponentCard/ComponentCard.module.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
.disabled {
1616
opacity: 0.6;
17+
user-select: none;
18+
pointer-events: none;
1719
}
1820

1921
.clickable {

src/components/BentoGrid/ComponentCard/ComponentCard.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const ComponentCard: React.FC<GenericHintProps & {
1111
size?: 'small' | 'medium' | 'large' | 'extra-large';
1212
secondarySegments?: Array<{ percentage: number; color: string; label: string }>;
1313
secondaryLabel?: string;
14+
expanded?: boolean;
1415
}> = ({
1516
enabled = false,
1617
version,
@@ -22,6 +23,7 @@ export const ComponentCard: React.FC<GenericHintProps & {
2223
size = 'medium',
2324
secondarySegments,
2425
secondaryLabel = 'Secondary Metric',
26+
expanded = false,
2527
}) => {
2628
const { t } = useTranslation();
2729

@@ -59,11 +61,13 @@ export const ComponentCard: React.FC<GenericHintProps & {
5961
{/* Disabled overlay */}
6062
{!enabled && <div className={styles.disabledOverlay} />}
6163

62-
{/* Expand button */}
64+
{/* Expand/Collapse button */}
6365
{onClick && enabled && (
6466
<Button
65-
icon="sap-icon://expand"
67+
icon={expanded ? "sap-icon://collapse" : "sap-icon://expand"}
6668
design="Transparent"
69+
tooltip={expanded ? "Collapse to overview" : "Expand details"}
70+
style={{ zIndex: 1 }} /* Lower z-index */
6771
className={size === 'small' ? styles.expandButtonSmall : styles.expandButton}
6872
onClick={(e) => {
6973
e.stopPropagation();

src/components/BentoGrid/GraphCard/GraphCard.module.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
flex: 1;
1616
position: relative;
1717
z-index: 1;
18+
pointer-events: auto !important;
19+
overflow: hidden;
1820
}
1921

2022
/* Override the Graph component's fixed height globally within this wrapper */

src/components/BentoGrid/GraphCard/GraphCard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const GraphCard: React.FC<GraphCardProps> = ({
1313
className = '',
1414
colorBy = 'source'
1515
}) => {
16+
1617
return (
1718
<div className={`${styles.container} ${className}`}>
1819
<div className={styles.simpleWrapper}>

src/components/Graphs/Graph.module.css

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,21 @@
88
background-color: #ffffff;
99
font-family: var(--sapFontFamily);
1010
position: relative;
11+
touch-action: none;
12+
overflow: hidden;
1113
}
1214

1315
.graphColumn {
1416
flex: 1;
1517
display: flex;
1618
flex-direction: column;
1719
background-color: #ffffff;
20+
position: relative;
21+
width: 100%;
22+
height: 100%;
23+
touch-action: none;
24+
cursor: grab;
25+
overflow: hidden;
1826
}
1927

2028
.bottomLegendContainer {
@@ -143,7 +151,23 @@
143151
stroke-width: 2px;
144152
}
145153

146-
/* Custom background for bright white */
147154
:global(.react-flow__background) {
148155
background-color: #ffffff !important;
156+
}
157+
158+
:global(.react-flow__pane) {
159+
cursor: grab;
160+
overflow: hidden;
161+
}
162+
163+
:global(.react-flow__pane.dragging) {
164+
cursor: grabbing;
165+
}
166+
167+
:global(.react-flow) {
168+
overflow: hidden;
169+
}
170+
171+
:global(.react-flow__renderer) {
172+
overflow: hidden;
149173
}

src/components/Graphs/Graph.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useCallback, useMemo, useEffect } from 'react';
2-
import { ReactFlow, Background, Controls, Node, BackgroundVariant } from '@xyflow/react';
2+
import { ReactFlow, Background, Controls, Node, BackgroundVariant, SelectionMode } from '@xyflow/react';
33
import type { NodeProps } from '@xyflow/react';
44
import { Button, Popover } from '@ui5/webcomponents-react';
55
import styles from './Graph.module.css';
@@ -93,16 +93,20 @@ const Graph: React.FC<GraphProps> = ({ colorBy: initialColorBy = 'source' }) =>
9393
edges={edges}
9494
nodeTypes={nodeTypes}
9595
defaultViewport={{ x: 40, y: 40, zoom: 0.8 }}
96-
minZoom={0.3}
97-
maxZoom={3.0}
96+
minZoom={0.2}
97+
maxZoom={4.0}
9898
proOptions={{
9999
hideAttribution: true,
100100
}}
101101
nodesDraggable={false}
102102
nodesConnectable={false}
103103
elementsSelectable={false}
104-
zoomOnScroll={true}
104+
zoomOnScroll={false}
105+
panOnScroll={false}
105106
panOnDrag={true}
107+
selectionOnDrag={false}
108+
selectionMode={SelectionMode.Partial}
109+
preventScrolling={true}
106110
>
107111
<Background gap={20} variant={BackgroundVariant.Dots} bgColor='#ffffff' />
108112
<Controls showInteractive={false} />

src/spaces/mcp/pages/McpPage.module.css

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,46 @@
44
width: 100%;
55
}
66

7-
/* Dynamic expansion animations for bento grid */
87
.expandedGrid {
98
transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
10-
/* Keep the original 600px height and 6-row structure */
119
}
1210

1311
.expandedCard {
1412
transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
15-
/* Reduced highlighting for component cards */
1613
border: 1px solid var(--sapObjectHeader_BorderColor) !important;
1714
}
1815

1916
.expandedCard:hover {
20-
transform: none !important; /* Remove hover transform */
21-
box-shadow: var(--sapContent_Shadow1) !important; /* Keep normal shadow */
17+
transform: none !important;
18+
box-shadow: var(--sapContent_Shadow1) !important;
2219
}
2320

24-
/* Non-interactive expanded card - no hover effects */
2521
.expandedCardNonInteractive {
2622
transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
27-
pointer-events: none; /* Disable all interaction */
2823
}
2924

3025
.expandedCardNonInteractive:hover {
31-
transform: none !important; /* Override base card hover transform */
32-
box-shadow: var(--sapContent_Shadow1) !important; /* Keep normal shadow */
26+
transform: none !important;
27+
box-shadow: var(--sapContent_Shadow1) !important;
3328
}
3429

35-
/* Disabled/non-interactive card - no hover effects */
3630
.disabledCard {
37-
pointer-events: none; /* Disable all interaction */
38-
opacity: 0.6; /* Visual indication that it's disabled */
31+
pointer-events: none;
32+
opacity: 0.6;
3933
}
4034

4135
.disabledCard:hover {
42-
transform: none !important; /* Override base card hover transform */
43-
box-shadow: var(--sapContent_Shadow1) !important; /* Keep normal shadow */
36+
transform: none !important;
37+
box-shadow: var(--sapContent_Shadow1) !important;
4438
}
4539

46-
/* Non-interactive card (like graph) - no hover effects but allows internal interaction */
4740
.nonInteractiveCard {
48-
/* Allow internal interaction but disable card-level hover effects */
4941
cursor: default;
5042
}
5143

5244
.nonInteractiveCard:hover {
53-
transform: none !important; /* Override base card hover transform */
54-
box-shadow: var(--sapContent_Shadow1) !important; /* Keep normal shadow */
45+
transform: none !important;
46+
box-shadow: var(--sapContent_Shadow1) !important;
5547
}
5648

5749
.hidingCard {

src/spaces/mcp/pages/McpPage.tsx

Lines changed: 26 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { BusyIndicator, ObjectPage, ObjectPageSection, ObjectPageTitle, Button } from '@ui5/webcomponents-react';
1+
import { BusyIndicator, ObjectPage, ObjectPageSection, ObjectPageTitle, Panel } from '@ui5/webcomponents-react';
22
import { useParams } from 'react-router-dom';
33
import CopyKubeconfigButton from '../../../components/ControlPlanes/CopyKubeconfigButton.tsx';
44
import styles from './McpPage.module.css';
55
import '@ui5/webcomponents-fiori/dist/illustrations/SimpleBalloon';
6-
import '@ui5/webcomponents-fiori/dist/illustrations/SimpleError';
76
// thorws error sometimes if not imported
87
import '@ui5/webcomponents-fiori/dist/illustrations/BeforeSearch';
98
import IllustratedError from '../../../components/Shared/IllustratedError.tsx';
@@ -183,6 +182,11 @@ function McpPageContent({ mcp, controlPlaneName }: { mcp: any; controlPlaneName:
183182
}, 300);
184183
};
185184

185+
// Add spacer at the bottom of the content
186+
const BottomSpacer = () => (
187+
<div style={{ height: '40px', backgroundColor: '#f9f9f9', marginTop: '16px', marginBottom: '32px' }}></div>
188+
);
189+
186190
return (
187191
<ObjectPage
188192
preserveHeaderStateOnClick={true}
@@ -245,21 +249,8 @@ function McpPageContent({ mcp, controlPlaneName }: { mcp: any; controlPlaneName:
245249
size="large"
246250
secondarySegments={providerDistribution.segments}
247251
secondaryLabel={`Providers ${providerDistribution.totalProviders}`}
252+
expanded={expandedCard === 'crossplane'} /* Add this prop to control icon */
248253
/>
249-
{expandedCard === 'crossplane' && (
250-
<Button
251-
icon="sap-icon://collapse"
252-
design="Default"
253-
onClick={handleCollapseExpanded}
254-
tooltip="Collapse to overview"
255-
style={{
256-
position: 'absolute',
257-
bottom: '8px',
258-
right: '8px',
259-
zIndex: 10
260-
}}
261-
/>
262-
)}
263254
</div>
264255
</BentoCard>
265256
)}
@@ -282,18 +273,7 @@ function McpPageContent({ mcp, controlPlaneName }: { mcp: any; controlPlaneName:
282273
config={gitOpsConfig}
283274
onClick={handleCollapseExpanded}
284275
size="large"
285-
/>
286-
<Button
287-
icon="sap-icon://collapse"
288-
design="Default"
289-
onClick={handleCollapseExpanded}
290-
tooltip="Collapse to overview"
291-
style={{
292-
position: 'absolute',
293-
bottom: '8px',
294-
right: '8px',
295-
zIndex: 10
296-
}}
276+
expanded={true}
297277
/>
298278
</div>
299279
</BentoCard>
@@ -395,21 +375,29 @@ function McpPageContent({ mcp, controlPlaneName }: { mcp: any; controlPlaneName:
395375
{/* Tables section - outside the BentoGrid to maintain the 600px layout */}
396376
{expandedCard === 'crossplane' && (
397377
<div style={{ marginTop: '24px' }}>
398-
<div className="crossplane-table-element">
399-
<Providers />
400-
</div>
401-
<div className="crossplane-table-element">
402-
<ProvidersConfig />
403-
</div>
404-
<div className="crossplane-table-element">
405-
<ManagedResources />
406-
</div>
378+
<Panel headerText="Details">
379+
<div style={{ marginTop: '24px' }}>
380+
<div className="crossplane-table-element">
381+
<Providers />
382+
</div>
383+
<div className="crossplane-table-element" style={{ marginTop: '16px' }}>
384+
<ProvidersConfig />
385+
</div>
386+
<div className="crossplane-table-element" style={{ marginTop: '16px' }}>
387+
<ManagedResources />
388+
</div>
389+
</div>
390+
</Panel>
391+
<div style={{ height: '12px', backgroundColor: '#f5f5f5', marginBottom: '32px', borderRadius: '0 0 8px 8px' }}></div>
407392
</div>
408393
)}
409394

410395
{expandedCard === 'gitops' && (
411396
<div style={{ marginTop: '24px' }}>
412-
<FluxList />
397+
<Panel headerText="Flux List">
398+
<FluxList />
399+
</Panel>
400+
<div style={{ height: '12px', backgroundColor: '#f5f5f5', marginBottom: '32px', borderRadius: '0 0 8px 8px' }}></div>
413401
</div>
414402
)}
415403
</div>

0 commit comments

Comments
 (0)