Skip to content

Commit 9f7013e

Browse files
Merge pull request #647 from logonoff/OCPBUGS-63531
OCPBUGS-63531: [release-4.19] Improve alignment with console SDK
2 parents 4684341 + 8509cf3 commit 9f7013e

15 files changed

+66
-156
lines changed

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
@@ -64,7 +64,6 @@
6464
"murmurhash-js": "1.0.x",
6565
"react": "^17.0.1",
6666
"react-dom": "^17.0.1",
67-
"react-helmet": "^6.1.0",
6867
"react-i18next": "^11.8.11",
6968
"react-linkify": "^0.2.2",
7069
"react-modal": "^3.12.1",
@@ -79,7 +78,6 @@
7978
"@types/lodash-es": "^4.17.12",
8079
"@types/node": "^17.0.21",
8180
"@types/react": "17.0.83",
82-
"@types/react-helmet": "^6.1.11",
8381
"@types/react-router-dom": "^5.3.2",
8482
"@types/webpack-dev-server": "^4.7.2",
8583
"@typescript-eslint/eslint-plugin": "^5.15.0",

web/src/components/Incidents/IncidentsPage.jsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ import {
1616
ToolbarItem,
1717
MenuToggle,
1818
Badge,
19-
Title,
2019
PageSection,
2120
Stack,
2221
StackItem,
2322
} from '@patternfly/react-core';
24-
import { Helmet } from 'react-helmet';
23+
import { DocumentTitle } from '@openshift-console/dynamic-plugin-sdk';
2524
import { IncidentsTable } from './IncidentsTable';
2625
import {
2726
getIncidentsTimeRanges,
@@ -277,9 +276,7 @@ const IncidentsPage = () => {
277276

278277
return (
279278
<>
280-
<Helmet>
281-
<title>{title}</title>
282-
</Helmet>
279+
<DocumentTitle>{title}</DocumentTitle>
283280
<PageSection hasBodyWrapper={false}>
284281
{alertsAreLoading && incidentsAreLoading ? (
285282
<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,
@@ -57,7 +59,6 @@ import {
5759
} from '@patternfly/react-table';
5860
import * as _ from 'lodash-es';
5961
import * as React from 'react';
60-
import { Helmet } from 'react-helmet';
6162
import { useTranslation } from 'react-i18next';
6263
import { useDispatch, useSelector } from 'react-redux';
6364

@@ -1230,25 +1231,17 @@ const MetricsPage_: React.FC = () => {
12301231

12311232
return (
12321233
<>
1233-
<Helmet>
1234-
<title>{t('Metrics')}</title>
1235-
</Helmet>
1236-
<PageSection hasBodyWrapper={false}>
1234+
<DocumentTitle>{t('Metrics')}</DocumentTitle>
1235+
<ListPageHeader title={perspective !== 'dev' ? t('Metrics') : ''}>
12371236
<Split hasGutter>
1238-
{perspective !== 'dev' && (
1239-
<SplitItem>
1240-
<Title headingLevel="h1">{t('Metrics')}</Title>
1241-
</SplitItem>
1242-
)}
1243-
<SplitItem isFilled />
12441237
<SplitItem>
12451238
<IntervalDropdown />
12461239
</SplitItem>
12471240
<SplitItem>
12481241
<MetricsActionsMenu />
12491242
</SplitItem>
12501243
</Split>
1251-
</PageSection>
1244+
</ListPageHeader>
12521245
<PageSection hasBodyWrapper={false}>
12531246
<Stack hasGutter>
12541247
<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 * as React 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';
@@ -179,9 +179,9 @@ const AlertRulesDetailsPage_: React.FC = () => {
179179

180180
return (
181181
<>
182-
<Helmet>
183-
<title>{t('{{name}} details', { name: rule?.name || RuleResource.label })}</title>
184-
</Helmet>
182+
<DocumentTitle>
183+
{t('{{name}} details', { name: rule?.name || RuleResource.label })}
184+
</DocumentTitle>
185185
<StatusBox data={rule} label={RuleResource.label} loaded={loaded} loadError={loadError}>
186186
<PageGroup>
187187
<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,
@@ -14,7 +15,6 @@ import {
1415
import { sortable, Td } from '@patternfly/react-table';
1516
import * as _ from 'lodash-es';
1617
import * as React from 'react';
17-
import { Helmet } from 'react-helmet';
1818
import { useTranslation } from 'react-i18next';
1919
import { useSelector } from 'react-redux';
2020
import { Link } from 'react-router-dom-v5-compat';
@@ -214,9 +214,7 @@ const AlertRulesPage_: React.FC = () => {
214214

215215
return (
216216
<>
217-
<Helmet>
218-
<title>Alerting</title>
219-
</Helmet>
217+
<DocumentTitle>{t('Alerting')}</DocumentTitle>
220218
<PageSection hasBodyWrapper={false}>
221219
<ListPageFilter
222220
data={staticData}

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/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,
@@ -56,7 +57,6 @@ import {
5657
ToolbarGroup,
5758
ToolbarItem,
5859
} from '@patternfly/react-core';
59-
import { Helmet } from 'react-helmet';
6060
import { MonitoringState } from '../../reducers/observe';
6161
import withFallback from '../console/console-shared/error/fallbacks/withFallback';
6262
import { StatusBox } from '../console/console-shared/src/components/status/StatusBox';
@@ -150,9 +150,9 @@ const AlertsDetailsPage_: React.FC = () => {
150150

151151
return (
152152
<>
153-
<Helmet>
154-
<title>{t('{{name}} details', { name: labels?.alertname || AlertResource.label })}</title>
155-
</Helmet>
153+
<DocumentTitle>
154+
{t('{{name}} details', { name: labels?.alertname || AlertResource.label })}
155+
</DocumentTitle>
156156
<StatusBox
157157
data={alert}
158158
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,
@@ -9,7 +10,6 @@ import { Flex, PageSection } from '@patternfly/react-core';
910
import { Table, TableGridBreakpoint, Th, Thead, Tr } from '@patternfly/react-table';
1011
import * as _ from 'lodash-es';
1112
import * as React from 'react';
12-
import { Helmet } from 'react-helmet';
1313
import { useTranslation } from 'react-i18next';
1414
import { useSelector } from 'react-redux';
1515
import { MonitoringState } from '../../reducers/observe';
@@ -146,9 +146,7 @@ const AlertsPage_: React.FC = () => {
146146

147147
return (
148148
<>
149-
<Helmet>
150-
<title>Alerting</title>
151-
</Helmet>
149+
<DocumentTitle>{t('Alerting')}</DocumentTitle>
152150
<PageSection hasBodyWrapper={false} type="subnav">
153151
<Flex>
154152
<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,
@@ -33,7 +37,6 @@ import { ExclamationCircleIcon, MinusCircleIcon, PlusCircleIcon } from '@pattern
3337
import { t_global_spacer_sm } from '@patternfly/react-tokens';
3438
import * as _ from 'lodash-es';
3539
import * as React from 'react';
36-
import { Helmet } from 'react-helmet';
3740
import { Trans, useTranslation } from 'react-i18next';
3841
import { useDispatch, useSelector } from 'react-redux';
3942
import { useNavigate } from 'react-router-dom-v5-compat';
@@ -275,9 +278,7 @@ const SilenceForm_: React.FC<SilenceFormProps> = ({ defaults, Info, title }) =>
275278

276279
return (
277280
<>
278-
<Helmet>
279-
<title>{title}</title>
280-
</Helmet>
281+
<DocumentTitle>{title}</DocumentTitle>
281282
<PageSection hasBodyWrapper={false}>
282283
<Title headingLevel="h1">{title}</Title>
283284
<HelperText>

0 commit comments

Comments
 (0)