Skip to content

Commit 4384d4c

Browse files
committed
frontend: Home/RecentClusters: Hide RecentClusters
Signed-off-by: René Dudfield <renedudfield@microsoft.com>
1 parent 45a974c commit 4384d4c

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

e2e-tests/tests/multiCluster.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,16 @@ test.describe('multi-cluster setup', () => {
1010
headlampPage = new HeadlampPage(page);
1111

1212
await headlampPage.navigateTopage('/', /Choose a cluster/);
13-
await expect(page.locator('h1:has-text("Home")')).toBeVisible();
14-
await expect(page.locator('h2:has-text("All Clusters")')).toBeVisible();
13+
await expect(page.locator('h1:has-text("All Clusters")')).toBeVisible();
1514
});
1615

1716
test("home page should display two cluster selection buttons labeled 'test' and 'test2'", async ({
1817
page,
1918
}) => {
20-
const buttons = page.locator('button p');
19+
const buttons = page.locator('td a');
2120
await expect(buttons).toHaveCount(2);
22-
await expect(page.locator('button p', { hasText: /^test$/ })).toBeVisible();
23-
await expect(page.locator('button p', { hasText: /^test2$/ })).toBeVisible();
21+
await expect(page.locator('td a', { hasText: /^test$/ })).toBeVisible();
22+
await expect(page.locator('td a', { hasText: /^test2$/ })).toBeVisible();
2423
});
2524

2625
test('home page should display a table containing exactly two rows, each representing a cluster entry', async ({
@@ -48,7 +47,8 @@ test.describe('multi-cluster setup', () => {
4847
const clusterRow = clusterAnchor.locator('../../..');
4948

5049
const clusterStatus = clusterRow.locator('td').nth(2).locator('p');
51-
await expect(clusterStatus).toHaveText('Active');
50+
await expect(clusterStatus).toBeVisible();
51+
await expect(clusterStatus).toHaveText(/Active|Plugin/);
5252
}
5353
});
5454

frontend/src/components/App/Home/config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
export const MULTI_HOME_ENABLED = import.meta.env.REACT_APP_MULTI_HOME_ENABLED === 'true' || true;
33

44
/** Show recent clusters on the home page */
5-
export const ENABLE_RECENT_CLUSTERS =
6-
import.meta.env.REACT_APP_ENABLE_RECENT_CLUSTERS === 'true' || true;
5+
export const ENABLE_RECENT_CLUSTERS = import.meta.env.REACT_APP_ENABLE_RECENT_CLUSTERS === 'true';

frontend/src/components/App/Home/index.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Event from '../../../lib/k8s/event';
99
import { createRouteURL } from '../../../lib/router';
1010
import { PageGrid, SectionBox, SectionFilterHeader } from '../../common';
1111
import ClusterTable from './ClusterTable';
12+
import { ENABLE_RECENT_CLUSTERS } from './config';
1213
import { getCustomClusterNames } from './customClusterNames';
1314
import RecentClusters from './RecentClusters';
1415

@@ -85,17 +86,20 @@ function HomeComponent(props: HomeComponentProps) {
8586
const memoizedComponent = React.useMemo(
8687
() => (
8788
<PageGrid>
88-
<SectionBox headerProps={{ headerStyle: 'main' }} title={t('Home')}>
89-
<RecentClusters clusters={Object.values(customNameClusters)} onButtonClick={() => {}} />
90-
</SectionBox>
89+
{ENABLE_RECENT_CLUSTERS && (
90+
<SectionBox headerProps={{ headerStyle: 'main' }} title={t('Home')}>
91+
<RecentClusters clusters={Object.values(customNameClusters)} onButtonClick={() => {}} />
92+
</SectionBox>
93+
)}
9194
<SectionBox
9295
title={
9396
<SectionFilterHeader
9497
title={t('All Clusters')}
9598
noNamespaceFilter
96-
headerStyle="subsection"
99+
headerStyle={ENABLE_RECENT_CLUSTERS ? 'subsection' : 'main'}
97100
/>
98101
}
102+
headerProps={ENABLE_RECENT_CLUSTERS ? { headerStyle: 'main' } : undefined}
99103
>
100104
<ClusterTable
101105
customNameClusters={customNameClusters}

0 commit comments

Comments
 (0)