Skip to content

Commit a2f9e17

Browse files
feat: hide tabs of uninstalled components (#322)
1 parent a045950 commit a2f9e17

File tree

2 files changed

+49
-38
lines changed

2 files changed

+49
-38
lines changed

src/lib/api/types/crate/controlPlanes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export interface ControlPlaneComponentsType {
3131
externalSecretsOperator: ControlPlaneComponentsSpecType | undefined;
3232
kyverno: ControlPlaneComponentsSpecType | undefined;
3333
flux: ControlPlaneComponentsSpecType | undefined;
34+
landscaper: ControlPlaneComponentsSpecType | undefined;
3435
}
3536

3637
export interface ControlPlaneComponentsSpecType {

src/spaces/mcp/pages/McpPage.tsx

Lines changed: 48 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ export default function McpPage() {
8181
return <IllustratedError details={error?.message} />;
8282
}
8383

84+
const isComponentInstalledCrossplane = !!mcp.spec?.components.crossplane;
85+
const isComponentInstalledFlux = !!mcp.spec?.components.flux;
86+
const isComponentInstalledLandscaper = !!mcp.spec?.components.landscaper;
87+
8488
return (
8589
<McpContextProvider
8690
context={{
@@ -154,46 +158,52 @@ export default function McpPage() {
154158
</ObjectPageSubSection>
155159
</ObjectPageSection>
156160

157-
<ObjectPageSection id="crossplane" titleText={t('McpPage.crossplaneTitle')}>
158-
<ObjectPageSubSection id="providers" titleText={t('McpPage.providersTitle')} className={styles.section}>
159-
<Providers />
160-
</ObjectPageSubSection>
161-
<ObjectPageSubSection
162-
id="provider-configs"
163-
titleText={t('McpPage.providerConfigsTitle')}
164-
className={styles.section}
165-
>
166-
<ProvidersConfig />
167-
</ObjectPageSubSection>
168-
<ObjectPageSubSection
169-
id="managed-resources"
170-
titleText={t('McpPage.managedResourcesTitle')}
171-
className={styles.section}
172-
>
173-
<ManagedResources />
174-
</ObjectPageSubSection>
175-
</ObjectPageSection>
161+
{isComponentInstalledCrossplane && (
162+
<ObjectPageSection id="crossplane" titleText={t('McpPage.crossplaneTitle')}>
163+
<ObjectPageSubSection id="providers" titleText={t('McpPage.providersTitle')} className={styles.section}>
164+
<Providers />
165+
</ObjectPageSubSection>
166+
<ObjectPageSubSection
167+
id="provider-configs"
168+
titleText={t('McpPage.providerConfigsTitle')}
169+
className={styles.section}
170+
>
171+
<ProvidersConfig />
172+
</ObjectPageSubSection>
173+
<ObjectPageSubSection
174+
id="managed-resources"
175+
titleText={t('McpPage.managedResourcesTitle')}
176+
className={styles.section}
177+
>
178+
<ManagedResources />
179+
</ObjectPageSubSection>
180+
</ObjectPageSection>
181+
)}
176182

177-
<ObjectPageSection id="flux" titleText={t('McpPage.fluxTitle')}>
178-
<ObjectPageSubSection
179-
id="git-repositories"
180-
titleText={t('McpPage.gitRepositoriesTitle')}
181-
className={styles.section}
182-
>
183-
<GitRepositories />
184-
</ObjectPageSubSection>
185-
<ObjectPageSubSection
186-
id="kustomizations"
187-
titleText={t('McpPage.kustomizationsTitle')}
188-
className={styles.section}
189-
>
190-
<Kustomizations />
191-
</ObjectPageSubSection>
192-
</ObjectPageSection>
183+
{isComponentInstalledFlux && (
184+
<ObjectPageSection id="flux" titleText={t('McpPage.fluxTitle')}>
185+
<ObjectPageSubSection
186+
id="git-repositories"
187+
titleText={t('McpPage.gitRepositoriesTitle')}
188+
className={styles.section}
189+
>
190+
<GitRepositories />
191+
</ObjectPageSubSection>
192+
<ObjectPageSubSection
193+
id="kustomizations"
194+
titleText={t('McpPage.kustomizationsTitle')}
195+
className={styles.section}
196+
>
197+
<Kustomizations />
198+
</ObjectPageSubSection>
199+
</ObjectPageSection>
200+
)}
193201

194-
<ObjectPageSection id="landscapers" titleText={t('McpPage.landscapersTitle')} className={styles.section}>
195-
<Landscapers />
196-
</ObjectPageSection>
202+
{isComponentInstalledLandscaper && (
203+
<ObjectPageSection id="landscapers" titleText={t('McpPage.landscapersTitle')} className={styles.section}>
204+
<Landscapers />
205+
</ObjectPageSection>
206+
)}
197207
</ObjectPage>
198208
</WithinManagedControlPlane>
199209
</AuthProviderMcp>

0 commit comments

Comments
 (0)