Skip to content

Commit 736cb48

Browse files
Merge pull request #604 from logonoff/OCPBUGS-63162
OCPBUGS-63162: [release-4.20] Improve alignment with console SDK
2 parents 58f8d94 + 9cbaa60 commit 736cb48

15 files changed

Lines changed: 70 additions & 151 deletions

web/package-lock.json

Lines changed: 0 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
"murmurhash-js": "1.0.x",
7171
"react": "^17.0.1",
7272
"react-dom": "^17.0.1",
73-
"react-helmet": "^6.1.0",
7473
"react-i18next": "^11.8.11",
7574
"react-linkify": "^0.2.2",
7675
"react-modal": "^3.12.1",
@@ -87,7 +86,6 @@
8786
"@types/lodash-es": "^4.17.12",
8887
"@types/node": "^22.17.2",
8988
"@types/react": "17.0.83",
90-
"@types/react-helmet": "^6.1.11",
9189
"@types/react-router-dom": "^5.3.2",
9290
"@types/webpack-dev-server": "^4.7.2",
9391
"@typescript-eslint/eslint-plugin": "^8.39.1",

web/src/components/Incidents/IncidentsPage.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
Stack,
2121
StackItem,
2222
} from '@patternfly/react-core';
23-
import { Helmet } from 'react-helmet';
2423
import { IncidentsTable } from './IncidentsTable';
2524
import {
2625
getIncidentsTimeRanges,
@@ -59,7 +58,7 @@ import { usePatternFlyTheme } from '../hooks/usePatternflyTheme';
5958
import { MonitoringState } from 'src/reducers/observe';
6059
import { Incident } from './model';
6160
import { useAlertsPoller } from '../hooks/useAlertsPoller';
62-
import { Rule } from '@openshift-console/dynamic-plugin-sdk';
61+
import { DocumentTitle, Rule } from '@openshift-console/dynamic-plugin-sdk';
6362

6463
const IncidentsPage = () => {
6564
const { t } = useTranslation(process.env.I18N_NAMESPACE);
@@ -296,9 +295,7 @@ const IncidentsPage = () => {
296295

297296
return (
298297
<>
299-
<Helmet>
300-
<title>{title}</title>
301-
</Helmet>
298+
<DocumentTitle>{title}</DocumentTitle>
302299
<PageSection hasBodyWrapper={false}>
303300
{alertsAreLoading && incidentsAreLoading ? (
304301
<Bullseye>

web/src/components/MetricsPage.tsx

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import {
2+
DocumentTitle,
3+
ListPageHeader,
24
PrometheusData,
35
PrometheusEndpoint,
46
PrometheusLabels,
@@ -60,7 +62,6 @@ import {
6062
import * as _ from 'lodash-es';
6163
import type { FC, Ref } from 'react';
6264
import { useMemo, useCallback, useEffect, useState } from 'react';
63-
import { Helmet } from 'react-helmet';
6465
import { useTranslation } from 'react-i18next';
6566
import { useDispatch, useSelector } from 'react-redux';
6667

@@ -1391,17 +1392,9 @@ const MetricsPage_: FC = () => {
13911392

13921393
return (
13931394
<>
1394-
<Helmet>
1395-
<title>{t('Metrics')}</title>
1396-
</Helmet>
1397-
<PageSection hasBodyWrapper={false}>
1395+
<DocumentTitle>{t('Metrics')}</DocumentTitle>
1396+
<ListPageHeader title={perspective === 'dev' ? undefined : t('Metrics')}>
13981397
<Split hasGutter>
1399-
{perspective !== 'dev' && (
1400-
<SplitItem>
1401-
<Title headingLevel="h1">{t('Metrics')}</Title>
1402-
</SplitItem>
1403-
)}
1404-
<SplitItem isFilled />
14051398
<SplitItem data-test={DataTestIDs.MetricGraphUnitsDropDown}>
14061399
<Tooltip content={<>{t('This dropdown only formats results.')}</>}>
14071400
<GraphUnitsDropDown />
@@ -1414,7 +1407,7 @@ const MetricsPage_: FC = () => {
14141407
<MetricsActionsMenu />
14151408
</SplitItem>
14161409
</Split>
1417-
</PageSection>
1410+
</ListPageHeader>
14181411
<PageSection hasBodyWrapper={false}>
14191412
<Stack hasGutter>
14201413
<StackItem>

web/src/components/alerting/AlertRulesDetailsPage.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
AlertingRuleChartExtension,
33
AlertStates,
4+
DocumentTitle,
45
isAlertingRuleChart,
56
PrometheusAlert,
67
ResourceIcon,
@@ -38,7 +39,6 @@ import {
3839
import { Table, TableVariant, Tbody, Td, Th, Thead, Tr } from '@patternfly/react-table';
3940
import * as _ from 'lodash-es';
4041
import type { FC } from 'react';
41-
import { Helmet } from 'react-helmet';
4242
import { useTranslation } from 'react-i18next';
4343
import { useSelector } from 'react-redux';
4444
import { Link, useNavigate, useParams } from 'react-router-dom-v5-compat';
@@ -184,9 +184,9 @@ const AlertRulesDetailsPage_: FC = () => {
184184

185185
return (
186186
<>
187-
<Helmet>
188-
<title>{t('{{name}} details', { name: rule?.name || RuleResource.label })}</title>
189-
</Helmet>
187+
<DocumentTitle>
188+
{t('{{name}} details', { name: rule?.name || RuleResource.label })}
189+
</DocumentTitle>
190190
<StatusBox data={rule} label={RuleResource.label} loaded={loaded} loadError={loadError}>
191191
<PageGroup>
192192
<PageBreadcrumb hasBodyWrapper={false}>

web/src/components/alerting/AlertRulesPage.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
AlertStates,
3+
DocumentTitle,
34
ListPageFilter,
45
PrometheusAlert,
56
ResourceIcon,
@@ -15,7 +16,6 @@ import { sortable, Td } from '@patternfly/react-table';
1516
import * as _ from 'lodash-es';
1617
import type { FC } from 'react';
1718
import { useMemo } from 'react';
18-
import { Helmet } from 'react-helmet';
1919
import { useTranslation } from 'react-i18next';
2020
import { useSelector } from 'react-redux';
2121
import { Link } from 'react-router-dom-v5-compat';
@@ -219,9 +219,7 @@ const AlertRulesPage_: FC = () => {
219219

220220
return (
221221
<>
222-
<Helmet>
223-
<title>Alerting</title>
224-
</Helmet>
222+
<DocumentTitle>{t('Alerting')}</DocumentTitle>
225223
<PageSection hasBodyWrapper={false}>
226224
<ListPageFilter
227225
data={staticData}

web/src/components/alerting/AlertingPage.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
import { PageSection, Title } from '@patternfly/react-core';
21
import type { FC } from 'react';
32
import { lazy } from 'react';
43
import { useTranslation } from 'react-i18next';
5-
import { HorizontalNav, useActivePerspective } from '@openshift-console/dynamic-plugin-sdk';
4+
import {
5+
HorizontalNav,
6+
ListPageHeader,
7+
useActivePerspective,
8+
} from '@openshift-console/dynamic-plugin-sdk';
69

710
const AlertsPage = lazy(
811
() => import(/* webpackChunkName: "AlertsPage" */ '../alerting/AlertsPage'),
@@ -50,10 +53,8 @@ const AlertingPage: FC = () => {
5053

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

web/src/components/alerting/AlertsDetailsPage.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
Alert,
44
AlertingRuleChartExtension,
55
AlertStates,
6+
DocumentTitle,
67
isAlertingRuleChart,
78
PrometheusLabels,
89
ResourceIcon,
@@ -57,7 +58,6 @@ import {
5758
ToolbarGroup,
5859
ToolbarItem,
5960
} from '@patternfly/react-core';
60-
import { Helmet } from 'react-helmet';
6161
import { MonitoringState } from '../../reducers/observe';
6262
import withFallback from '../console/console-shared/error/fallbacks/withFallback';
6363
import { StatusBox } from '../console/console-shared/src/components/status/StatusBox';
@@ -153,9 +153,9 @@ const AlertsDetailsPage_: FC = () => {
153153

154154
return (
155155
<>
156-
<Helmet>
157-
<title>{t('{{name}} details', { name: labels?.alertname || AlertResource.label })}</title>
158-
</Helmet>
156+
<DocumentTitle>
157+
{t('{{name}} details', { name: labels?.alertname || AlertResource.label })}
158+
</DocumentTitle>
159159
<StatusBox
160160
data={alert}
161161
label={AlertResource.label}

web/src/components/alerting/AlertsPage.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
Alert,
33
AlertStates,
4+
DocumentTitle,
45
ListPageFilter,
56
RowFilter,
67
useListPageFilter,
@@ -10,7 +11,6 @@ import { Table, TableGridBreakpoint, Th, Thead, Tr } from '@patternfly/react-tab
1011
import * as _ from 'lodash-es';
1112
import type { FC } from 'react';
1213
import { useMemo } from 'react';
13-
import { Helmet } from 'react-helmet';
1414
import { useTranslation } from 'react-i18next';
1515
import { useSelector } from 'react-redux';
1616
import { MonitoringState } from '../../reducers/observe';
@@ -144,9 +144,7 @@ const AlertsPage_: FC = () => {
144144

145145
return (
146146
<>
147-
<Helmet>
148-
<title>Alerting</title>
149-
</Helmet>
147+
<DocumentTitle>{t('Alerting')}</DocumentTitle>
150148
<PageSection hasBodyWrapper={false} type="subnav">
151149
<Flex>
152150
<ListPageFilter

web/src/components/alerting/SilenceForm.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { consoleFetchJSON, useActiveNamespace } from '@openshift-console/dynamic-plugin-sdk';
1+
import {
2+
consoleFetchJSON,
3+
DocumentTitle,
4+
useActiveNamespace,
5+
} from '@openshift-console/dynamic-plugin-sdk';
26
import {
37
ActionGroup,
48
Alert,
@@ -34,7 +38,6 @@ import { t_global_spacer_sm } from '@patternfly/react-tokens';
3438
import * as _ from 'lodash-es';
3539
import type { ComponentType, FC, FormEventHandler, MouseEvent, ChangeEvent, Ref } from 'react';
3640
import { useState, useEffect } from 'react';
37-
import { Helmet } from 'react-helmet';
3841
import { Trans, useTranslation } from 'react-i18next';
3942
import { useDispatch, useSelector } from 'react-redux';
4043
import { useNavigate } from 'react-router-dom-v5-compat';
@@ -277,9 +280,7 @@ const SilenceForm_: FC<SilenceFormProps> = ({ defaults, Info, title }) => {
277280

278281
return (
279282
<>
280-
<Helmet>
281-
<title>{title}</title>
282-
</Helmet>
283+
<DocumentTitle>{title}</DocumentTitle>
283284
<PageSection hasBodyWrapper={false}>
284285
<Title headingLevel="h1">{title}</Title>
285286
<HelperText>

0 commit comments

Comments
 (0)