Skip to content

Commit 8509cf3

Browse files
committed
OCPBUGS-63531: Use ListPageHeader to enable favorites
1 parent 75c4e87 commit 8509cf3

4 files changed

Lines changed: 33 additions & 63 deletions

File tree

web/src/components/MetricsPage.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
DocumentTitle,
3+
ListPageHeader,
34
PrometheusData,
45
PrometheusEndpoint,
56
PrometheusLabels,
@@ -1231,22 +1232,16 @@ const MetricsPage_: React.FC = () => {
12311232
return (
12321233
<>
12331234
<DocumentTitle>{t('Metrics')}</DocumentTitle>
1234-
<PageSection hasBodyWrapper={false}>
1235+
<ListPageHeader title={perspective !== 'dev' ? t('Metrics') : ''}>
12351236
<Split hasGutter>
1236-
{perspective !== 'dev' && (
1237-
<SplitItem>
1238-
<Title headingLevel="h1">{t('Metrics')}</Title>
1239-
</SplitItem>
1240-
)}
1241-
<SplitItem isFilled />
12421237
<SplitItem>
12431238
<IntervalDropdown />
12441239
</SplitItem>
12451240
<SplitItem>
12461241
<MetricsActionsMenu />
12471242
</SplitItem>
12481243
</Split>
1249-
</PageSection>
1244+
</ListPageHeader>
12501245
<PageSection hasBodyWrapper={false}>
12511246
<Stack hasGutter>
12521247
<StackItem>

web/src/components/alerting/AlertingPage.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import { PageSection, Title } from '@patternfly/react-core';
21
import * as React from 'react';
32
import { useTranslation } from 'react-i18next';
4-
import { HorizontalNav, useActivePerspective } from '@openshift-console/dynamic-plugin-sdk';
3+
import {
4+
HorizontalNav,
5+
ListPageHeader,
6+
useActivePerspective,
7+
} from '@openshift-console/dynamic-plugin-sdk';
58

69
const AlertsPage = React.lazy(
710
() => import(/* webpackChunkName: "AlertsPage" */ '../alerting/AlertsPage'),
@@ -49,10 +52,8 @@ const AlertingPage: React.FC = () => {
4952

5053
return (
5154
<>
52-
<PageSection hasBodyWrapper={false}>
53-
<Title headingLevel="h1">{t('Alerting')}</Title>
54-
<HorizontalNav contextId={contextId} pages={pages} />
55-
</PageSection>
55+
<ListPageHeader title={t('Alerting')} />
56+
<HorizontalNav contextId={contextId} pages={pages} />
5657
</>
5758
);
5859
};

web/src/components/dashboards/legacy/dashboard-skeleton-legacy.tsx

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
import * as _ from 'lodash-es';
22
import * as React from 'react';
33
import { useTranslation } from 'react-i18next';
4-
import { DocumentTitle } from '@openshift-console/dynamic-plugin-sdk';
5-
import {
6-
Divider,
7-
PageSection,
8-
Split,
9-
SplitItem,
10-
Stack,
11-
StackItem,
12-
Title,
13-
} from '@patternfly/react-core';
4+
import { DocumentTitle, ListPageHeader } from '@openshift-console/dynamic-plugin-sdk';
5+
import { Divider, PageSection, Split, SplitItem, Stack, StackItem } from '@patternfly/react-core';
146
import { usePerspective } from '../../hooks/usePerspective';
157
import { CombinedDashboardMetadata } from '../perses/hooks/useDashboardsData';
168
import { DashboardDropdown } from '../shared/dashboard-dropdown';
@@ -21,21 +13,16 @@ const HeaderTop: React.FC = React.memo(() => {
2113
const { t } = useTranslation(process.env.I18N_NAMESPACE);
2214

2315
return (
24-
<Split hasGutter isWrappable>
25-
<SplitItem isFilled>
26-
<Title headingLevel="h1">{t('Dashboards')}</Title>
27-
</SplitItem>
28-
<SplitItem>
29-
<Split hasGutter isWrappable>
30-
<SplitItem>
31-
<TimespanDropdown />
32-
</SplitItem>
33-
<SplitItem>
34-
<PollIntervalDropdown />
35-
</SplitItem>
36-
</Split>
37-
</SplitItem>
38-
</Split>
16+
<ListPageHeader title={t('Dashboards')}>
17+
<Split hasGutter isWrappable>
18+
<SplitItem>
19+
<TimespanDropdown />
20+
</SplitItem>
21+
<SplitItem>
22+
<PollIntervalDropdown />
23+
</SplitItem>
24+
</Split>
25+
</ListPageHeader>
3926
);
4027
});
4128

@@ -61,8 +48,8 @@ export const DashboardSkeletonLegacy: React.FC<MonitoringDashboardsLegacyPagePro
6148
return (
6249
<>
6350
{perspective !== 'dev' && <DocumentTitle>{t('Metrics dashboards')}</DocumentTitle>}
51+
{perspective !== 'dev' && <HeaderTop />}
6452
<PageSection hasBodyWrapper={false}>
65-
{perspective !== 'dev' && <HeaderTop />}
6653
<Stack hasGutter>
6754
{!_.isEmpty(boardItems) && (
6855
<StackItem>

web/src/components/dashboards/perses/dashboard-skeleton.tsx

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
import * as _ from 'lodash-es';
22
import * as React from 'react';
33
import { useTranslation } from 'react-i18next';
4-
import { DocumentTitle } from '@openshift-console/dynamic-plugin-sdk';
5-
import {
6-
Divider,
7-
PageSection,
8-
Split,
9-
SplitItem,
10-
Stack,
11-
StackItem,
12-
Title,
13-
} from '@patternfly/react-core';
4+
import { DocumentTitle, ListPageHeader } from '@openshift-console/dynamic-plugin-sdk';
5+
import { Divider, PageSection, Split, SplitItem, Stack, StackItem } from '@patternfly/react-core';
146
import {
157
DashboardStickyToolbar,
168
useDashboardActions,
@@ -25,18 +17,13 @@ const HeaderTop: React.FC = React.memo(() => {
2517
const { t } = useTranslation(process.env.I18N_NAMESPACE);
2618

2719
return (
28-
<Split hasGutter isWrappable>
29-
<SplitItem isFilled>
30-
<Title headingLevel="h1">{t('Dashboards')}</Title>
31-
</SplitItem>
32-
<SplitItem>
33-
<Split hasGutter isWrappable>
34-
<SplitItem>
35-
<TimeRangeControls />
36-
</SplitItem>
37-
</Split>
38-
</SplitItem>
39-
</Split>
20+
<ListPageHeader title={t('Dashboards')}>
21+
<Split hasGutter isWrappable>
22+
<SplitItem>
23+
<TimeRangeControls />
24+
</SplitItem>
25+
</Split>
26+
</ListPageHeader>
4027
);
4128
});
4229

@@ -78,8 +65,8 @@ export const DashboardSkeleton: React.FC<MonitoringDashboardsPageProps> = React.
7865
return (
7966
<>
8067
{perspective !== 'dev' && <DocumentTitle>{t('Metrics dashboards')}</DocumentTitle>}
68+
{perspective !== 'dev' && <HeaderTop />}
8169
<PageSection hasBodyWrapper={false}>
82-
{perspective !== 'dev' && <HeaderTop />}
8370
<Stack hasGutter>
8471
{!_.isEmpty(boardItems) && (
8572
<StackItem>

0 commit comments

Comments
 (0)