Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Patternfly5 #899

Open
wants to merge 1 commit into
base: v10
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@ exports[`ListItem rendering render with Props 1`] = `
<Label
className="account-icon"
color="blue"
icon={
<UserIcon
color="currentColor"
noVerticalAlign={false}
size="sm"
/>
}
icon={<UserIcon />}
variant="outline"
/>
test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ exports[`ListItemStatus rendering render with Props 1`] = `
<p>
Generating
</p>
<CheckIcon
color="currentColor"
noVerticalAlign={false}
size="sm"
/>
<CheckIcon />
</GridItem>
<GridItem
className="item"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
}

.account-list {
.pf-c-accordion__toggle {
.pf-v5-c-accordion__toggle {
margin-top: 10px;
}

.pf-c-accordion__toggle-text {
.pf-v5-c-accordion__toggle-text {
font-size: 16px;
display: flex;
justify-content: space-between;
Expand All @@ -21,7 +21,7 @@
.account-icon {
margin-right: 5px;

.pf-c-label__icon {
.pf-v5-c-label__icon {
margin: 0;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const InventoryFilter = ({
value={filterTerm}
type="text"
placeholder={__('Filter..')}
onChange={handleFilterChange}
onChange={(e, v) => handleFilterChange(v)}
/>
<ClearButton onClear={handleFilterClear} />
</FormGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#inventory_filter_form {
.pf-c-form__group-control {
.pf-v5-c-form__group-control {
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
font-size: 16px;
}

.pf-c-dropdown__toggle {
.pf-v5-c-dropdown__toggle {
margin-right: -20px;
}

.settings-alert {
margin-bottom: 30px;
.pf-c-alert {
.pf-v5-c-alert {
margin-bottom: 5px;

.pf-c-alert__title {
.pf-v5-c-alert__title {
font-size: var(--pf-global--FontSize--md);
line-height: var(--pf-global--LineHeight--md);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import React, { useState } from 'react';
import {

Check failure on line 2 in webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js

View workflow job for this annotation

GitHub Actions / test_js

Replace `⏎↹Grid,⏎↹GridItem⏎` with `·Grid,·GridItem·`
Dropdown,
DropdownItem,
KebabToggle,
DropdownPosition,
Grid,
GridItem,
Grid,
GridItem
} from '@patternfly/react-core';
import {
Dropdown,

Check failure on line 7 in webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js

View workflow job for this annotation

GitHub Actions / test_js

Replace `↹` with `··`
DropdownItem,

Check failure on line 8 in webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js

View workflow job for this annotation

GitHub Actions / test_js

Replace `↹` with `··`
KebabToggle,

Check failure on line 9 in webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js

View workflow job for this annotation

GitHub Actions / test_js

Replace `↹` with `··`
DropdownPosition

Check failure on line 10 in webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js

View workflow job for this annotation

GitHub Actions / test_js

Replace `↹DropdownPosition` with `··DropdownPosition,`
} from '@patternfly/react-core/deprecated';
import Head from 'foremanReact/components/Head';
import {
INVENTORY_PAGE_TITLE,
Expand Down Expand Up @@ -58,7 +60,7 @@
className="title-dropdown"
onSelect={() => setIsDropdownOpen(false)}
toggle={
<KebabToggle onToggle={isOpen => setIsDropdownOpen(isOpen)} />
<KebabToggle onToggle={(_event, isOpen) => setIsDropdownOpen(isOpen)} />

Check failure on line 63 in webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js

View workflow job for this annotation

GitHub Actions / test_js

Replace `·onToggle={(_event,·isOpen)·=>·setIsDropdownOpen(isOpen)}` with `⏎··············onToggle={(_event,·isOpen)·=>·setIsDropdownOpen(isOpen)}⏎···········`
}
isOpen={isDropdownOpen}
isPlain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
import React, { useCallback, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { useDispatch, useSelector } from 'react-redux';
import { Table, TableBody, TableHeader } from '@patternfly/react-table';
import {
Table,
TableBody,
TableHeader,
} from '@patternfly/react-table/deprecated';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have migration steps to use a non-deprecated elements?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import {
Card,
CardTitle,
Expand All @@ -11,6 +15,7 @@ import {
ModalVariant,
Spinner,
Text,
Icon,
} from '@patternfly/react-core';
import {
CheckCircleIcon,
Expand Down Expand Up @@ -108,8 +113,18 @@ const CloudPingModal = ({ title, isOpen, toggle }) => {

const StatusIcon = ({ isPending, authStatus }) => {
if (isPending) return <Spinner size="sm" />;
if (authStatus.success) return <CheckCircleIcon color="green" />;
if (authStatus.error) return <ExclamationCircleIcon color="red" />;
if (authStatus.success)
return (
<Icon color="green">
<CheckCircleIcon />
</Icon>
);
if (authStatus.error)
return (
<Icon color="red">
<ExclamationCircleIcon />
</Icon>
);
return <Spinner size="sm" />;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ exports[`InventoryAutoUpload rendering render with props 1`] = `
>
Show Advanced Settings

<CaretRightIcon
color="currentColor"
noVerticalAlign={false}
size="sm"
/>
<CaretRightIcon />
</Button>
</Popover>
</Col>
Expand All @@ -78,11 +74,7 @@ exports[`InventoryAutoUpload rendering render with props 1`] = `
<Text
component="p"
>
<InfoAltIcon
color="currentColor"
noVerticalAlign={false}
size="sm"
/>
<InfoAltIcon />

More details can be found in

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
/* eslint-disable react-hooks/exhaustive-deps */
import React, { useEffect } from 'react';
import PropTypes from 'prop-types';
import { Table, TableHeader, TableBody } from '@patternfly/react-table';
import {
Table,

Check failure on line 5 in webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js

View workflow job for this annotation

GitHub Actions / test_js

Replace `↹` with `··`
TableHeader,

Check failure on line 6 in webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js

View workflow job for this annotation

GitHub Actions / test_js

Replace `↹` with `··`
TableBody

Check failure on line 7 in webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js

View workflow job for this annotation

GitHub Actions / test_js

Replace `↹TableBody` with `··TableBody,`
} from '@patternfly/react-table/deprecated';
import { useForemanSettings } from 'foremanReact/Root/Context/ForemanContext';
import SelectAllAlert from './SelectAllAlert';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
InsightsLabel,
Section,
} from '@redhat-cloud-services/frontend-components';
import { DropdownItem } from '@patternfly/react-core';
import {

Check failure on line 7 in webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableConstants.js

View workflow job for this annotation

GitHub Actions / test_js

Replace `⏎↹DropdownItem⏎` with `·DropdownItem·`
DropdownItem
} from '@patternfly/react-core/deprecated';
import { sortable, cellWidth } from '@patternfly/react-table';
import { AnsibeTowerIcon, ExternalLinkAltIcon } from '@patternfly/react-icons';
import { translate as __ } from 'foremanReact/common/I18n';
Expand Down
14 changes: 7 additions & 7 deletions webpack/InsightsCloudSync/Components/InsightsTable/Pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ const paginationTitles = {
page: '', // doesn't work well with translations as it adds 's' for plural, see: https://github.com/patternfly/patternfly-react/issues/6707
itemsPerPage: __('Items per page'),
perPageSuffix: __('per page'),
toFirstPage: __('Go to first page'),
toPreviousPage: __('Go to previous page'),
toLastPage: __('Go to last page'),
toNextPage: __('Go to next page'),
optionsToggle: __('Items per page'),
currPage: __('Current page'),
paginationTitle: __('Pagination'),
toFirstPageAriaLabel: __('Go to first page'),
toPreviousPageAriaLabel: __('Go to previous page'),
toLastPageAriaLabel: __('Go to last page'),
toNextPageAriaLabel: __('Go to next page'),
optionsToggleAriaLabel: __('Items per page'),
currPageAriaLabel: __('Current page'),
paginationAriaLabel: __('Pagination'),
};

const Pagination = ({ variant, ...props }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.rh-cloud-recommendations-table {
.pf-c-table__check {
.pf-v5-c-table__check {
input:disabled {
display: none;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
/* eslint-disable react-hooks/exhaustive-deps */
import React, { useEffect } from 'react';
import PropTypes from 'prop-types';
import { Table, TableHeader, TableBody } from '@patternfly/react-table';
import {
Table,
TableHeader,
TableBody
} from '@patternfly/react-table/deprecated';
import { Modal, ModalVariant, Button } from '@patternfly/react-core';
import { isEmpty } from 'lodash';
import { STATUS } from 'foremanReact/constants';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React from 'react';
import { cellWidth } from '@patternfly/react-table';
import { Icon } from '@patternfly/react-core';
import { CheckCircleIcon } from '@patternfly/react-icons';
import { translate as __ } from 'foremanReact/common/I18n';
import { foremanUrl } from '../../../ForemanRhCloudHelpers';

export const rebootFormatter = ({ title: reboot }) => ({
children: reboot ? <CheckCircleIcon color="green" /> : __('No'),
children: reboot ? <Icon color="green"><CheckCircleIcon /></Icon> : __('No'),
});

export const columns = [
Expand Down
8 changes: 6 additions & 2 deletions webpack/InsightsCloudSync/Components/ToolbarDropdown.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { translate as __ } from 'foremanReact/common/I18n';
import { Dropdown, DropdownItem, KebabToggle } from '@patternfly/react-core';
import {
Dropdown,
DropdownItem,
KebabToggle
} from '@patternfly/react-core/deprecated';
import { ExternalLinkAltIcon } from '@patternfly/react-icons';
import { redHatAdvisorSystems } from '../InsightsCloudSyncHelpers';

Expand Down Expand Up @@ -30,7 +34,7 @@ const ToolbarDropdown = ({ onRecommendationSync }) => {
<Dropdown
className="title-dropdown"
onSelect={() => setIsDropdownOpen(false)}
toggle={<KebabToggle onToggle={isOpen => setIsDropdownOpen(isOpen)} />}
toggle={<KebabToggle onToggle={(_event, isOpen) => setIsDropdownOpen(isOpen)} />}
isOpen={isDropdownOpen}
isPlain
dropdownItems={dropdownItems}
Expand Down
2 changes: 1 addition & 1 deletion webpack/InsightsCloudSync/InsightsCloudSync.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
width: 100%;
}

.pf-c-pagination {
.pf-v5-c-pagination {
padding-right: 0;
}
}
Expand Down
8 changes: 7 additions & 1 deletion webpack/InsightsHostDetailsTab/InsightsTotalRiskChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ import PropTypes from 'prop-types';
import { useDispatch } from 'react-redux';
import { push } from 'connected-react-router';
import { useHistory } from 'react-router-dom';
import { DropdownItem, Bullseye, Title } from '@patternfly/react-core';
import {
Bullseye,
Title
} from '@patternfly/react-core';
import {
DropdownItem
} from '@patternfly/react-core/deprecated';
import { ChartDonut, ChartLegend, ChartLabel } from '@patternfly/react-charts';
import { STATUS } from 'foremanReact/constants';
import { useAPI } from 'foremanReact/common/hooks/API/APIHooks';
Expand Down
14 changes: 8 additions & 6 deletions webpack/InsightsHostDetailsTab/NewHostDetailsTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import { useDispatch, useSelector } from 'react-redux';
import SearchBar from 'foremanReact/components/SearchBar';
import { translate as __ } from 'foremanReact/common/I18n';
import {
Grid,
GridItem,
Dropdown,
DropdownItem,
KebabToggle,
Grid,
GridItem
} from '@patternfly/react-core';
import {
Dropdown,
DropdownItem,
KebabToggle
} from '@patternfly/react-core/deprecated';
import { ExternalLinkAltIcon } from '@patternfly/react-icons';
import InsightsTable from '../InsightsCloudSync/Components/InsightsTable';
import RemediationModal from '../InsightsCloudSync/Components/RemediationModal';
Expand Down Expand Up @@ -74,7 +76,7 @@ const NewHostDetailsTab = ({ hostName, router }) => {
ouiaId="insights-dropdown"
onSelect={() => setIsDropdownOpen(false)}
toggle={
<KebabToggle onToggle={isOpen => setIsDropdownOpen(isOpen)} />
<KebabToggle onToggle={(_event, isOpen) => setIsDropdownOpen(isOpen)} />
}
isOpen={isDropdownOpen}
isPlain
Expand Down
7 changes: 5 additions & 2 deletions webpack/common/DropdownToggle.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { Dropdown, KebabToggle } from '@patternfly/react-core';
import {
Dropdown,
KebabToggle
} from '@patternfly/react-core/deprecated';

const DropdownToggle = ({ items, ...props }) => {
const [isOpen, setOpen] = useState(false);
return (
<Dropdown
onSelect={() => setOpen(false)}
toggle={<KebabToggle onToggle={value => setOpen(value)} />}
toggle={<KebabToggle onToggle={(_event, value) => setOpen(value)} />}
isOpen={isOpen}
isPlain
dropdownItems={items}
Expand Down
2 changes: 1 addition & 1 deletion webpack/common/Switcher/HelpLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const HelpLabel = ({ text, id, className }) => {
<Popover id={`${id}-help`} bodyContent={text} aria-label="help-text">
<button
onClick={e => e.preventDefault()}
className={`pf-c-form__group-label-help ${className}`}
className={`pf-v5-c-form__group-label-help ${className}`}
>
<HelpIcon />
</button>
Expand Down
2 changes: 1 addition & 1 deletion webpack/common/Switcher/SwitcherPF4.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ label.foreman-rh-cloud-switcher {
padding-left: 5px;
}

.pf-c-switch__toggle {
.pf-v5-c-switch__toggle {
margin-right: 5px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ exports[`InsightsCloudSync helpers should return insights cloud Url 1`] = `
id="some-id-help"
>
<button
className="pf-c-form__group-label-help some-class"
className="pf-v5-c-form__group-label-help some-class"
onClick={[Function]}
>
<HelpIcon
color="currentColor"
noVerticalAlign={false}
size="sm"
/>
<HelpIcon />
</button>
</Popover>
`;
Loading
Loading