Skip to content

Commit bb3e5fe

Browse files
committed
fix: enable flux
1 parent e2fbf53 commit bb3e5fe

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

src/spaces/mcp/pages/McpPage.tsx

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { ManagedResources } from '../../../components/ControlPlane/ManagedResour
2929
import { Providers } from '../../../components/ControlPlane/Providers.tsx';
3030
import { ProvidersConfig } from '../../../components/ControlPlane/ProvidersConfig.tsx';
3131
import FluxList from '../../../components/ControlPlane/FluxList.tsx';
32-
import { resolveProviderType } from '../../../components/Graphs/graphUtils';
32+
import { resolveProviderType, generateColorMap } from '../../../components/Graphs/graphUtils';
3333

3434
// Utility function to flatten managed resources
3535
const flattenManagedResources = (managedResources: ManagedResourcesResponse): ManagedResourceItem[] => {
@@ -44,20 +44,6 @@ const flattenManagedResources = (managedResources: ManagedResourcesResponse): Ma
4444
const calculateProviderDistribution = (items: ManagedResourceItem[], providerConfigs: any[]) => {
4545
if (!items || items.length === 0) return { segments: [], totalProviders: 0 };
4646

47-
// Graph color palette (same as in graphUtils.ts)
48-
const colors = [
49-
'#FFC933', // MANGO 4
50-
'#FF8AF0', // PINK 4
51-
'#FEADC8', // RASPBERRY 4
52-
'#2CE0BF', // TEAL 4
53-
'#FF8CB2', // RED 4
54-
'#B894FF', // INDIGO 4
55-
'#049F9A', // TEAL 6
56-
'#FA4F96', // RASPBERRY 6
57-
'#F31DED', // PINK 6
58-
'#7858FF', // INDIGO 6
59-
];
60-
6147
// Count resources by provider type (same method as graph)
6248
const providerCounts: Record<string, number> = {};
6349

@@ -67,12 +53,22 @@ const calculateProviderDistribution = (items: ManagedResourceItem[], providerCon
6753
providerCounts[providerType] = (providerCounts[providerType] || 0) + 1;
6854
});
6955

56+
// Create NodeData-like objects for color generation (reuse graph's color logic)
57+
const nodeDataForColors = Object.keys(providerCounts).map(providerType => ({
58+
providerType,
59+
providerConfigName: '', // Not needed for color generation
60+
fluxName: undefined
61+
}));
62+
63+
// Generate colors using the same logic as the graph
64+
const colorMap = generateColorMap(nodeDataForColors as any, 'source');
65+
7066
// Convert to segments with percentages and counts
7167
const total = items.length;
7268
const segments = Object.entries(providerCounts)
73-
.map(([provider, count], index) => ({
69+
.map(([provider, count]) => ({
7470
percentage: Math.round((count / total) * 100),
75-
color: colors[index % colors.length],
71+
color: colorMap[provider] || '#BFBFBF', // fallback color
7672
label: provider.replace('provider-', '').toUpperCase(),
7773
count: count
7874
}))
@@ -319,15 +315,15 @@ function McpPageContent({ mcp, controlPlaneName }: { mcp: any; controlPlaneName:
319315
{/* Right side cards - hide when any component is expanded */}
320316
{!expandedCard && (
321317
<>
322-
{/* Right side: First medium component (GitOps) - DEACTIVATED */}
318+
{/* Right side: First medium component (GitOps) - ACTIVATED */}
323319
<BentoCard
324320
size="medium"
325321
gridColumn="9 / 13"
326322
gridRow="1 / 3"
327-
className={isExpanding ? styles.hidingCard : styles.disabledCard}
323+
className={isExpanding ? styles.hidingCard : ''}
328324
>
329325
<ComponentCard
330-
enabled={true}
326+
enabled={!!mcp?.spec?.components?.flux}
331327
version={mcp?.spec?.components?.flux?.version}
332328
allItems={allItems}
333329
isLoading={managedResourcesLoading}

0 commit comments

Comments
 (0)