Remove tab and button style overrides

This commit is contained in:
Marliana Lara
2020-02-20 18:50:05 -05:00
parent 2a8679234a
commit f2e1e71302
35 changed files with 154 additions and 308 deletions

View File

@@ -85,7 +85,6 @@ class SelectResourceStep extends React.Component {
return ( return (
<Fragment> <Fragment>
{isLoading && <div>{i18n._(t`Loading...`)}</div>}
{isInitialized && ( {isInitialized && (
<Fragment> <Fragment>
<div> <div>
@@ -102,6 +101,7 @@ class SelectResourceStep extends React.Component {
/> />
)} )}
<PaginatedDataList <PaginatedDataList
hasContentLoading={isLoading}
items={resources} items={resources}
itemCount={count} itemCount={count}
qsConfig={this.qsConfig} qsConfig={this.qsConfig}

View File

@@ -3,13 +3,8 @@ import { CardActions } from '@patternfly/react-core';
import styled from 'styled-components'; import styled from 'styled-components';
const CardActionsWrapper = styled.div` const CardActionsWrapper = styled.div`
display: flex;
justify-content: flex-end;
margin-top: 20px; margin-top: 20px;
--pf-c-card__actions--PaddingLeft: 0;
& > .pf-c-card__actions > :not(:first-child) {
margin-left: 0.5rem;
}
`; `;
function CardActionsRow({ children }) { function CardActionsRow({ children }) {

View File

@@ -7,7 +7,7 @@ const TabbedCardHeader = styled(CardHeader)`
--pf-c-card--child--PaddingRight: 0; --pf-c-card--child--PaddingRight: 0;
--pf-c-card__header--not-last-child--PaddingBottom: 24px; --pf-c-card__header--not-last-child--PaddingBottom: 24px;
--pf-c-card__header--not-last-child--PaddingBottom: 0; --pf-c-card__header--not-last-child--PaddingBottom: 0;
position: relative; display: flex;
`; `;
export default TabbedCardHeader; export default TabbedCardHeader;

View File

@@ -1,24 +1,16 @@
import React from 'react'; import React from 'react';
import { string } from 'prop-types'; import { string } from 'prop-types';
import { Link as RRLink } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Button } from '@patternfly/react-core'; import { Button } from '@patternfly/react-core';
import { TimesIcon } from '@patternfly/react-icons'; import { TimesIcon } from '@patternfly/react-icons';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import styled from 'styled-components';
const Link = styled(RRLink)`
position: absolute;
top: 5px;
right: 4px;
color: var(--pf-c-button--m-plain--Color);
`;
function CardCloseButton({ linkTo, i18n, i18nHash, ...props }) { function CardCloseButton({ linkTo, i18n, i18nHash, ...props }) {
if (linkTo) { if (linkTo) {
return ( return (
<Link <Link
className="pf-c-button" className="pf-c-button pf-m-plain"
aria-label={i18n._(t`Close`)} aria-label={i18n._(t`Close`)}
title={i18n._(t`Close`)} title={i18n._(t`Close`)}
to={linkTo} to={linkTo}

View File

@@ -81,8 +81,8 @@ class DataListToolbar extends React.Component {
<Sort qsConfig={qsConfig} columns={sortColumns} onSort={onSort} /> <Sort qsConfig={qsConfig} columns={sortColumns} onSort={onSort} />
</DataToolbarItem> </DataToolbarItem>
</DataToolbarToggleGroup> </DataToolbarToggleGroup>
<DataToolbarGroup> {showExpandCollapse && (
{showExpandCollapse && ( <DataToolbarGroup>
<Fragment> <Fragment>
<DataToolbarItem> <DataToolbarItem>
<ExpandCollapse <ExpandCollapse
@@ -92,9 +92,9 @@ class DataListToolbar extends React.Component {
/> />
</DataToolbarItem> </DataToolbarItem>
</Fragment> </Fragment>
)} </DataToolbarGroup>
</DataToolbarGroup> )}
<DataToolbarGroup css="margin-left: auto"> <DataToolbarGroup>
{additionalControls.map(control => ( {additionalControls.map(control => (
<DataToolbarItem key={control.key}>{control}</DataToolbarItem> <DataToolbarItem key={control.key}>{control}</DataToolbarItem>
))} ))}

View File

@@ -1,27 +1,8 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import styled from 'styled-components';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import { ActionGroup as PFActionGroup, Button } from '@patternfly/react-core'; import { ActionGroup, Button } from '@patternfly/react-core';
const ActionGroup = styled(PFActionGroup)`
display: flex;
justify-content: flex-end;
--pf-c-form__group--m-action--MarginTop: 0;
grid-column: 1 / -1;
margin-right: calc(var(--pf-c-form__actions--MarginRight) * -1);
.pf-c-form__actions {
& > button {
margin: 0;
}
& > :not(:first-child) {
margin-left: 24px;
}
}
`;
const FormActionGroup = ({ onSubmit, submitDisabled, onCancel, i18n }) => ( const FormActionGroup = ({ onSubmit, submitDisabled, onCancel, i18n }) => (
<ActionGroup> <ActionGroup>

View File

@@ -1,19 +1,9 @@
import React from 'react'; import React from 'react';
import { string, func } from 'prop-types'; import { string, func } from 'prop-types';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Button as PFButton, Tooltip } from '@patternfly/react-core'; import { Button, Tooltip } from '@patternfly/react-core';
import { PlusIcon } from '@patternfly/react-icons';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import styled from 'styled-components';
const Button = styled(PFButton)`
&& {
background-color: #5cb85c;
padding: 5px 8px;
--pf-global--FontSize--md: 14px;
}
`;
function ToolbarAddButton({ linkTo, onClick, i18n }) { function ToolbarAddButton({ linkTo, onClick, i18n }) {
if (!linkTo && !onClick) { if (!linkTo && !onClick) {
@@ -30,14 +20,14 @@ function ToolbarAddButton({ linkTo, onClick, i18n }) {
variant="primary" variant="primary"
aria-label={i18n._(t`Add`)} aria-label={i18n._(t`Add`)}
> >
<PlusIcon /> {i18n._(t`Add`)}
</Button> </Button>
</Tooltip> </Tooltip>
); );
} }
return ( return (
<Button variant="primary" aria-label={i18n._(t`Add`)} onClick={onClick}> <Button variant="primary" aria-label={i18n._(t`Add`)} onClick={onClick}>
<PlusIcon /> {i18n._(t`Add`)}
</Button> </Button>
); );
} }

View File

@@ -9,27 +9,10 @@ import {
checkPropTypes, checkPropTypes,
} from 'prop-types'; } from 'prop-types';
import { Button, Tooltip } from '@patternfly/react-core'; import { Button, Tooltip } from '@patternfly/react-core';
import { TrashAltIcon } from '@patternfly/react-icons';
import styled from 'styled-components';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import AlertModal from '../AlertModal'; import AlertModal from '../AlertModal';
const DeleteButton = styled(Button)`
padding: 5px 8px;
&:hover {
background-color: #d9534f;
color: white;
}
&[disabled] {
color: var(--pf-c-button--m-plain--Color);
pointer-events: initial;
cursor: not-allowed;
}
`;
const requireNameOrUsername = props => { const requireNameOrUsername = props => {
const { name, username } = props; const { name, username } = props;
if (!name && !username) { if (!name && !username) {
@@ -149,14 +132,14 @@ class ToolbarDeleteButton extends React.Component {
<Fragment> <Fragment>
<Tooltip content={this.renderTooltip()} position="top"> <Tooltip content={this.renderTooltip()} position="top">
<div> <div>
<DeleteButton <Button
variant="plain" variant="danger"
aria-label={i18n._(t`Delete`)} aria-label={i18n._(t`Delete`)}
onClick={this.handleConfirmDelete} onClick={this.handleConfirmDelete}
isDisabled={isDisabled} isDisabled={isDisabled}
> >
<TrashAltIcon /> {i18n._(t`Delete`)}
</DeleteButton> </Button>
</div> </div>
</Tooltip> </Tooltip>
{isModalOpen && ( {isModalOpen && (

View File

@@ -39,7 +39,9 @@ describe('<ToolbarDeleteButton />', () => {
); );
wrapper.find('ToolbarDeleteButton').setState({ isModalOpen: true }); wrapper.find('ToolbarDeleteButton').setState({ isModalOpen: true });
wrapper.update(); wrapper.update();
wrapper.find('button.pf-m-danger').simulate('click'); wrapper
.find('ModalBoxFooter button[aria-label="confirm delete"]')
.simulate('click');
expect(onDelete).toHaveBeenCalled(); expect(onDelete).toHaveBeenCalled();
expect(wrapper.find('ToolbarDeleteButton').state('isModalOpen')).toBe( expect(wrapper.find('ToolbarDeleteButton').state('isModalOpen')).toBe(
false false

View File

@@ -97,121 +97,51 @@ exports[`<ToolbarDeleteButton /> should render button 1`] = `
zIndex={9999} zIndex={9999}
> >
<div> <div>
<ToolbarDeleteButton__DeleteButton <Component
aria-label="Delete" aria-label="Delete"
isDisabled={true} isDisabled={true}
onClick={[Function]} onClick={[Function]}
variant="plain" variant="danger"
> >
<StyledComponent <ComponentWithOuia
aria-label="Delete" component={[Function]}
forwardedComponent={ componentProps={
Object { Object {
"$$typeof": Symbol(react.forward_ref), "aria-label": "Delete",
"attrs": Array [], "children": "Delete",
"componentStyle": ComponentStyle { "isDisabled": true,
"componentId": "ToolbarDeleteButton__DeleteButton-sc-1e3r0eg-0", "onClick": [Function],
"isStatic": true, "variant": "danger",
"lastClassName": "bQjfFG",
"rules": Array [
"padding:5px 8px;&:hover{background-color:#d9534f;color:white;}&[disabled]{color:var(--pf-c-button--m-plain--Color);pointer-events:initial;cursor:not-allowed;}",
],
},
"displayName": "ToolbarDeleteButton__DeleteButton",
"foldedComponentIds": Array [],
"render": [Function],
"styledComponentId": "ToolbarDeleteButton__DeleteButton-sc-1e3r0eg-0",
"target": [Function],
"toString": [Function],
"warnTooManyClasses": [Function],
"withComponent": [Function],
} }
} }
forwardedRef={null} consumerContext={null}
isDisabled={true}
onClick={[Function]}
variant="plain"
> >
<Component <Button
aria-label="Delete" aria-label="Delete"
className="ToolbarDeleteButton__DeleteButton-sc-1e3r0eg-0 bQjfFG"
isDisabled={true} isDisabled={true}
onClick={[Function]} onClick={[Function]}
variant="plain" ouiaContext={
> Object {
<ComponentWithOuia "isOuia": false,
component={[Function]} "ouiaId": null,
componentProps={
Object {
"aria-label": "Delete",
"children": <TrashAltIcon
color="currentColor"
noVerticalAlign={false}
size="sm"
title={null}
/>,
"className": "ToolbarDeleteButton__DeleteButton-sc-1e3r0eg-0 bQjfFG",
"isDisabled": true,
"onClick": [Function],
"variant": "plain",
}
} }
consumerContext={null} }
variant="danger"
>
<button
aria-disabled={null}
aria-label="Delete"
className="pf-c-button pf-m-danger"
disabled={true}
onClick={[Function]}
tabIndex={null}
type="button"
> >
<Button Delete
aria-label="Delete" </button>
className="ToolbarDeleteButton__DeleteButton-sc-1e3r0eg-0 bQjfFG" </Button>
isDisabled={true} </ComponentWithOuia>
onClick={[Function]} </Component>
ouiaContext={
Object {
"isOuia": false,
"ouiaId": null,
}
}
variant="plain"
>
<button
aria-disabled={null}
aria-label="Delete"
className="pf-c-button pf-m-plain ToolbarDeleteButton__DeleteButton-sc-1e3r0eg-0 bQjfFG"
disabled={true}
onClick={[Function]}
tabIndex={null}
type="button"
>
<TrashAltIcon
color="currentColor"
noVerticalAlign={false}
size="sm"
title={null}
>
<svg
aria-hidden={true}
aria-labelledby={null}
fill="currentColor"
height="1em"
role="img"
style={
Object {
"verticalAlign": "-0.125em",
}
}
viewBox="0 0 448 512"
width="1em"
>
<path
d="M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"
transform=""
/>
</svg>
</TrashAltIcon>
</button>
</Button>
</ComponentWithOuia>
</Component>
</StyledComponent>
</ToolbarDeleteButton__DeleteButton>
</div> </div>
<Portal <Portal
containerInfo={ containerInfo={

View File

@@ -1,40 +1,7 @@
import React from 'react'; import React from 'react';
import { shape, string, number, arrayOf, node, oneOfType } from 'prop-types'; import { shape, string, number, arrayOf, node, oneOfType } from 'prop-types';
import { Tab, Tabs as PFTabs } from '@patternfly/react-core'; import { Tab, Tabs } from '@patternfly/react-core';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import styled from 'styled-components';
const Tabs = styled(PFTabs)`
--pf-c-tabs__button--PaddingLeft: 20px;
--pf-c-tabs__button--PaddingRight: 20px;
.pf-c-tabs__list {
li:first-of-type .pf-c-tabs__button {
&::before {
border-left: none;
}
&::after {
margin-left: 0;
}
}
}
.pf-c-tabs__item.pf-m-current .pf-c-tabs__button {
font-weight: bold;
}
&:not(.pf-c-tabs__item)::before {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
content: '';
border: solid var(--pf-c-tabs__item--BorderColor);
border-width: var(--pf-c-tabs__item--BorderWidth) 0
var(--pf-c-tabs__item--BorderWidth) 0;
}
`;
function RoutedTabs(props) { function RoutedTabs(props) {
const { tabsArray } = props; const { tabsArray } = props;

View File

@@ -204,7 +204,6 @@ class Search extends React.Component {
} }
isOpen={isSearchDropdownOpen} isOpen={isSearchDropdownOpen}
dropdownItems={searchDropdownItems} dropdownItems={searchDropdownItems}
style={{ width: '100%', maxWidth: '100px' }}
/> />
) : ( ) : (
<NoOptionDropdown>{searchColumnName}</NoOptionDropdown> <NoOptionDropdown>{searchColumnName}</NoOptionDropdown>

View File

@@ -135,7 +135,6 @@ class Sort extends React.Component {
onSelect={this.handleDropdownSelect} onSelect={this.handleDropdownSelect}
direction={up} direction={up}
isOpen={isSortDropdownOpen} isOpen={isSortDropdownOpen}
style={{ width: '100%', maxWidth: '100px' }}
toggle={ toggle={
<DropdownToggle <DropdownToggle
id="awx-sort" id="awx-sort"

View File

@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { Card, PageSection } from '@patternfly/react-core'; import { Card, PageSection, CardActions } from '@patternfly/react-core';
import { import {
Switch, Switch,
useParams, useParams,
@@ -60,7 +60,9 @@ function Credential({ i18n, setBreadcrumb }) {
let cardHeader = hasContentLoading ? null : ( let cardHeader = hasContentLoading ? null : (
<TabbedCardHeader> <TabbedCardHeader>
<RoutedTabs tabsArray={tabsArray} /> <RoutedTabs tabsArray={tabsArray} />
<CardCloseButton linkTo="/credentials" /> <CardActions>
<CardCloseButton linkTo="/credentials" />
</CardActions>
</TabbedCardHeader> </TabbedCardHeader>
); );

View File

@@ -119,15 +119,15 @@ function CredentialList({ i18n }) {
onSelectAll={handleSelectAll} onSelectAll={handleSelectAll}
qsConfig={QS_CONFIG} qsConfig={QS_CONFIG}
additionalControls={[ additionalControls={[
...(canAdd
? [<ToolbarAddButton key="add" linkTo="/credentials/add" />]
: []),
<ToolbarDeleteButton <ToolbarDeleteButton
key="delete" key="delete"
onDelete={handleDelete} onDelete={handleDelete}
itemsToDelete={selected} itemsToDelete={selected}
pluralizedItemName={i18n._(t`Credentials`)} pluralizedItemName={i18n._(t`Credentials`)}
/>, />,
...(canAdd
? [<ToolbarAddButton key="add" linkTo="/credentials/add" />]
: []),
]} ]}
/> />
)} )}

View File

@@ -9,7 +9,7 @@ import {
useRouteMatch, useRouteMatch,
useLocation, useLocation,
} from 'react-router-dom'; } from 'react-router-dom';
import { Card } from '@patternfly/react-core'; import { Card, CardActions } from '@patternfly/react-core';
import { CaretLeftIcon } from '@patternfly/react-icons'; import { CaretLeftIcon } from '@patternfly/react-icons';
import { TabbedCardHeader } from '@components/Card'; import { TabbedCardHeader } from '@components/Card';
@@ -103,7 +103,9 @@ function Host({ inventory, i18n, setBreadcrumb }) {
let cardHeader = ( let cardHeader = (
<TabbedCardHeader> <TabbedCardHeader>
<RoutedTabs tabsArray={tabsArray} /> <RoutedTabs tabsArray={tabsArray} />
<CardCloseButton linkTo={hostListUrl} /> <CardActions>
<CardCloseButton linkTo={hostListUrl} />
</CardActions>
</TabbedCardHeader> </TabbedCardHeader>
); );

View File

@@ -134,15 +134,15 @@ function HostList({ i18n }) {
onSelectAll={handleSelectAll} onSelectAll={handleSelectAll}
qsConfig={QS_CONFIG} qsConfig={QS_CONFIG}
additionalControls={[ additionalControls={[
...(canAdd
? [<ToolbarAddButton key="add" linkTo={`${match.url}/add`} />]
: []),
<ToolbarDeleteButton <ToolbarDeleteButton
key="delete" key="delete"
onDelete={handleHostDelete} onDelete={handleHostDelete}
itemsToDelete={selected} itemsToDelete={selected}
pluralizedItemName={i18n._(t`Hosts`)} pluralizedItemName={i18n._(t`Hosts`)}
/>, />,
...(canAdd
? [<ToolbarAddButton key="add" linkTo={`${match.url}/add`} />]
: []),
]} ]}
/> />
)} )}

View File

@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { Card, PageSection } from '@patternfly/react-core'; import { Card, CardActions, PageSection } from '@patternfly/react-core';
import { import {
Switch, Switch,
Route, Route,
@@ -66,7 +66,9 @@ function Inventory({ i18n, setBreadcrumb }) {
let cardHeader = hasContentLoading ? null : ( let cardHeader = hasContentLoading ? null : (
<TabbedCardHeader> <TabbedCardHeader>
<RoutedTabs tabsArray={tabsArray} /> <RoutedTabs tabsArray={tabsArray} />
<CardCloseButton linkTo="/inventories" /> <CardActions>
<CardCloseButton linkTo="/inventories" />
</CardActions>
</TabbedCardHeader> </TabbedCardHeader>
); );

View File

@@ -10,8 +10,8 @@ import {
useLocation, useLocation,
useParams, useParams,
} from 'react-router-dom'; } from 'react-router-dom';
import { CardActions } from '@patternfly/react-core';
import { CaretLeftIcon } from '@patternfly/react-icons'; import { CaretLeftIcon } from '@patternfly/react-icons';
import { GroupsAPI } from '@api';
import CardCloseButton from '@components/CardCloseButton'; import CardCloseButton from '@components/CardCloseButton';
import RoutedTabs from '@components/RoutedTabs'; import RoutedTabs from '@components/RoutedTabs';
import ContentError from '@components/ContentError'; import ContentError from '@components/ContentError';
@@ -19,6 +19,7 @@ import ContentLoading from '@components/ContentLoading';
import { TabbedCardHeader } from '@components/Card'; import { TabbedCardHeader } from '@components/Card';
import InventoryGroupEdit from '../InventoryGroupEdit/InventoryGroupEdit'; import InventoryGroupEdit from '../InventoryGroupEdit/InventoryGroupEdit';
import InventoryGroupDetail from '../InventoryGroupDetail/InventoryGroupDetail'; import InventoryGroupDetail from '../InventoryGroupDetail/InventoryGroupDetail';
import { GroupsAPI } from '@api';
function InventoryGroup({ i18n, setBreadcrumb, inventory }) { function InventoryGroup({ i18n, setBreadcrumb, inventory }) {
const [inventoryGroup, setInventoryGroup] = useState(null); const [inventoryGroup, setInventoryGroup] = useState(null);
@@ -109,9 +110,11 @@ function InventoryGroup({ i18n, setBreadcrumb, inventory }) {
cardHeader = ( cardHeader = (
<TabbedCardHeader> <TabbedCardHeader>
<RoutedTabs tabsArray={tabsArray} /> <RoutedTabs tabsArray={tabsArray} />
<CardCloseButton <CardActions>
linkTo={`/inventories/inventory/${inventory.id}/groups`} <CardCloseButton
/> linkTo={`/inventories/inventory/${inventory.id}/groups`}
/>
</CardActions>
</TabbedCardHeader> </TabbedCardHeader>
); );
} }

View File

@@ -1,5 +1,4 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { TrashAltIcon } from '@patternfly/react-icons';
import { withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
@@ -12,7 +11,6 @@ import DataListToolbar from '@components/DataListToolbar';
import PaginatedDataList, { import PaginatedDataList, {
ToolbarAddButton, ToolbarAddButton,
} from '@components/PaginatedDataList'; } from '@components/PaginatedDataList';
import styled from 'styled-components';
import InventoryGroupItem from './InventoryGroupItem'; import InventoryGroupItem from './InventoryGroupItem';
import InventoryGroupsDeleteModal from '../shared/InventoryGroupsDeleteModal'; import InventoryGroupsDeleteModal from '../shared/InventoryGroupsDeleteModal';
@@ -22,21 +20,6 @@ const QS_CONFIG = getQSConfig('group', {
order_by: 'name', order_by: 'name',
}); });
const DeleteButton = styled(Button)`
padding: 5px 8px;
&:hover {
background-color: #d9534f;
color: white;
}
&[disabled] {
color: var(--pf-c-button--m-plain--Color);
pointer-events: initial;
cursor: not-allowed;
}
`;
function cannotDelete(item) { function cannotDelete(item) {
return !item.summary_fields.user_capabilities.delete; return !item.summary_fields.user_capabilities.delete;
} }
@@ -224,20 +207,6 @@ function InventoryGroupsList({ i18n, location, match }) {
onSelectAll={handleSelectAll} onSelectAll={handleSelectAll}
qsConfig={QS_CONFIG} qsConfig={QS_CONFIG}
additionalControls={[ additionalControls={[
<Tooltip content={renderTooltip()} position="top" key="delete">
<div>
<DeleteButton
variant="plain"
aria-label={i18n._(t`Delete`)}
onClick={toggleModal}
isDisabled={
selected.length === 0 || selected.some(cannotDelete)
}
>
<TrashAltIcon />
</DeleteButton>
</div>
</Tooltip>,
...(canAdd ...(canAdd
? [ ? [
<ToolbarAddButton <ToolbarAddButton
@@ -246,6 +215,20 @@ function InventoryGroupsList({ i18n, location, match }) {
/>, />,
] ]
: []), : []),
<Tooltip content={renderTooltip()} position="top" key="delete">
<div>
<Button
variant="danger"
aria-label={i18n._(t`Delete`)}
onClick={toggleModal}
isDisabled={
selected.length === 0 || selected.some(cannotDelete)
}
>
{i18n._(t`Delete`)}
</Button>
</div>
</Tooltip>,
]} ]}
/> />
)} )}

View File

@@ -159,12 +159,6 @@ function InventoryHostList({ i18n, location, match }) {
onSelectAll={handleSelectAll} onSelectAll={handleSelectAll}
qsConfig={QS_CONFIG} qsConfig={QS_CONFIG}
additionalControls={[ additionalControls={[
<ToolbarDeleteButton
key="delete"
onDelete={handleDelete}
itemsToDelete={selected}
pluralizedItemName={i18n._(t`Hosts`)}
/>,
...(canAdd ...(canAdd
? [ ? [
<ToolbarAddButton <ToolbarAddButton
@@ -173,6 +167,12 @@ function InventoryHostList({ i18n, location, match }) {
/>, />,
] ]
: []), : []),
<ToolbarDeleteButton
key="delete"
onDelete={handleDelete}
itemsToDelete={selected}
pluralizedItemName={i18n._(t`Hosts`)}
/>,
]} ]}
/> />
)} )}

View File

@@ -202,13 +202,13 @@ class InventoriesList extends Component {
onSelectAll={this.handleSelectAll} onSelectAll={this.handleSelectAll}
qsConfig={QS_CONFIG} qsConfig={QS_CONFIG}
additionalControls={[ additionalControls={[
...(canAdd ? [addButton] : []),
<ToolbarDeleteButton <ToolbarDeleteButton
key="delete" key="delete"
onDelete={this.handleInventoryDelete} onDelete={this.handleInventoryDelete}
itemsToDelete={selected} itemsToDelete={selected}
pluralizedItemName="Inventories" pluralizedItemName="Inventories"
/>, />,
...(canAdd ? [addButton] : []),
]} ]}
/> />
)} )}

View File

@@ -1,7 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { Card, PageSection } from '@patternfly/react-core'; import { Card, CardActions, PageSection } from '@patternfly/react-core';
import { Switch, Route, Redirect, withRouter, Link } from 'react-router-dom'; import { Switch, Route, Redirect, withRouter, Link } from 'react-router-dom';
import { TabbedCardHeader } from '@components/Card'; import { TabbedCardHeader } from '@components/Card';
import CardCloseButton from '@components/CardCloseButton'; import CardCloseButton from '@components/CardCloseButton';
@@ -77,7 +77,9 @@ class SmartInventory extends Component {
let cardHeader = hasContentLoading ? null : ( let cardHeader = hasContentLoading ? null : (
<TabbedCardHeader> <TabbedCardHeader>
<RoutedTabs tabsArray={tabsArray} /> <RoutedTabs tabsArray={tabsArray} />
<CardCloseButton linkTo="/inventories" /> <CardActions>
<CardCloseButton linkTo="/inventories" />
</CardActions>
</TabbedCardHeader> </TabbedCardHeader>
); );

View File

@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { Route, withRouter, Switch, Redirect, Link } from 'react-router-dom'; import { Route, withRouter, Switch, Redirect, Link } from 'react-router-dom';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import { Card, PageSection } from '@patternfly/react-core'; import { Card, CardActions, PageSection } from '@patternfly/react-core';
import { JobsAPI } from '@api'; import { JobsAPI } from '@api';
import { TabbedCardHeader } from '@components/Card'; import { TabbedCardHeader } from '@components/Card';
import ContentError from '@components/ContentError'; import ContentError from '@components/ContentError';
@@ -74,7 +74,9 @@ class Job extends Component {
let cardHeader = ( let cardHeader = (
<TabbedCardHeader> <TabbedCardHeader>
<RoutedTabs tabsArray={tabsArray} /> <RoutedTabs tabsArray={tabsArray} />
<CardCloseButton linkTo="/jobs" /> <CardActions>
<CardCloseButton linkTo="/jobs" />
</CardActions>
</TabbedCardHeader> </TabbedCardHeader>
); );

View File

@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import { Switch, Route, withRouter, Redirect, Link } from 'react-router-dom'; import { Switch, Route, withRouter, Redirect, Link } from 'react-router-dom';
import { Card, PageSection } from '@patternfly/react-core'; import { Card, CardActions, PageSection } from '@patternfly/react-core';
import CardCloseButton from '@components/CardCloseButton'; import CardCloseButton from '@components/CardCloseButton';
import { TabbedCardHeader } from '@components/Card'; import { TabbedCardHeader } from '@components/Card';
import RoutedTabs from '@components/RoutedTabs'; import RoutedTabs from '@components/RoutedTabs';
@@ -132,7 +132,9 @@ class Organization extends Component {
let cardHeader = ( let cardHeader = (
<TabbedCardHeader> <TabbedCardHeader>
<RoutedTabs tabsArray={tabsArray} /> <RoutedTabs tabsArray={tabsArray} />
<CardCloseButton linkTo="/organizations" /> <CardActions>
<CardCloseButton linkTo="/organizations" />
</CardActions>
</TabbedCardHeader> </TabbedCardHeader>
); );

View File

@@ -140,15 +140,15 @@ function OrganizationsList({ i18n }) {
onSelectAll={handleSelectAll} onSelectAll={handleSelectAll}
qsConfig={QS_CONFIG} qsConfig={QS_CONFIG}
additionalControls={[ additionalControls={[
...(canAdd
? [<ToolbarAddButton key="add" linkTo={addUrl} />]
: []),
<ToolbarDeleteButton <ToolbarDeleteButton
key="delete" key="delete"
onDelete={handleOrgDelete} onDelete={handleOrgDelete}
itemsToDelete={selected} itemsToDelete={selected}
pluralizedItemName="Organizations" pluralizedItemName="Organizations"
/>, />,
...(canAdd
? [<ToolbarAddButton key="add" linkTo={addUrl} />]
: []),
]} ]}
/> />
)} )}

View File

@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import { Switch, Route, withRouter, Redirect, Link } from 'react-router-dom'; import { Switch, Route, withRouter, Redirect, Link } from 'react-router-dom';
import { Card, PageSection } from '@patternfly/react-core'; import { Card, CardActions, PageSection } from '@patternfly/react-core';
import { TabbedCardHeader } from '@components/Card'; import { TabbedCardHeader } from '@components/Card';
import CardCloseButton from '@components/CardCloseButton'; import CardCloseButton from '@components/CardCloseButton';
import RoutedTabs from '@components/RoutedTabs'; import RoutedTabs from '@components/RoutedTabs';
@@ -152,7 +152,9 @@ class Project extends Component {
let cardHeader = ( let cardHeader = (
<TabbedCardHeader> <TabbedCardHeader>
<RoutedTabs tabsArray={tabsArray} /> <RoutedTabs tabsArray={tabsArray} />
<CardCloseButton linkTo="/projects" /> <CardActions>
<CardCloseButton linkTo="/projects" />
</CardActions>
</TabbedCardHeader> </TabbedCardHeader>
); );

View File

@@ -200,12 +200,6 @@ class ProjectsList extends Component {
onSelectAll={this.handleSelectAll} onSelectAll={this.handleSelectAll}
qsConfig={QS_CONFIG} qsConfig={QS_CONFIG}
additionalControls={[ additionalControls={[
<ToolbarDeleteButton
key="delete"
onDelete={this.handleProjectDelete}
itemsToDelete={selected}
pluralizedItemName={i18n._(t`Projects`)}
/>,
...(canAdd ...(canAdd
? [ ? [
<ToolbarAddButton <ToolbarAddButton
@@ -214,6 +208,12 @@ class ProjectsList extends Component {
/>, />,
] ]
: []), : []),
<ToolbarDeleteButton
key="delete"
onDelete={this.handleProjectDelete}
itemsToDelete={selected}
pluralizedItemName={i18n._(t`Projects`)}
/>,
]} ]}
/> />
)} )}

View File

@@ -9,7 +9,7 @@ import {
useLocation, useLocation,
useParams, useParams,
} from 'react-router-dom'; } from 'react-router-dom';
import { Card, PageSection } from '@patternfly/react-core'; import { Card, CardActions, PageSection } from '@patternfly/react-core';
import CardCloseButton from '@components/CardCloseButton'; import CardCloseButton from '@components/CardCloseButton';
import { TabbedCardHeader } from '@components/Card'; import { TabbedCardHeader } from '@components/Card';
import RoutedTabs from '@components/RoutedTabs'; import RoutedTabs from '@components/RoutedTabs';
@@ -48,7 +48,9 @@ function Team({ i18n, setBreadcrumb }) {
let cardHeader = ( let cardHeader = (
<TabbedCardHeader> <TabbedCardHeader>
<RoutedTabs tabsArray={tabsArray} /> <RoutedTabs tabsArray={tabsArray} />
<CardCloseButton linkTo="/teams" /> <CardActions>
<CardCloseButton linkTo="/teams" />
</CardActions>
</TabbedCardHeader> </TabbedCardHeader>
); );

View File

@@ -187,12 +187,6 @@ class TeamsList extends Component {
onSelectAll={this.handleSelectAll} onSelectAll={this.handleSelectAll}
qsConfig={QS_CONFIG} qsConfig={QS_CONFIG}
additionalControls={[ additionalControls={[
<ToolbarDeleteButton
key="delete"
onDelete={this.handleTeamDelete}
itemsToDelete={selected}
pluralizedItemName={i18n._(t`Teams`)}
/>,
...(canAdd ...(canAdd
? [ ? [
<ToolbarAddButton <ToolbarAddButton
@@ -201,6 +195,12 @@ class TeamsList extends Component {
/>, />,
] ]
: []), : []),
<ToolbarDeleteButton
key="delete"
onDelete={this.handleTeamDelete}
itemsToDelete={selected}
pluralizedItemName={i18n._(t`Teams`)}
/>,
]} ]}
/> />
)} )}

View File

@@ -1,7 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { Card, PageSection } from '@patternfly/react-core'; import { Card, CardActions, PageSection } from '@patternfly/react-core';
import { Switch, Route, Redirect, withRouter, Link } from 'react-router-dom'; import { Switch, Route, Redirect, withRouter, Link } from 'react-router-dom';
import { TabbedCardHeader } from '@components/Card'; import { TabbedCardHeader } from '@components/Card';
import CardCloseButton from '@components/CardCloseButton'; import CardCloseButton from '@components/CardCloseButton';
@@ -124,7 +124,9 @@ class Template extends Component {
let cardHeader = ( let cardHeader = (
<TabbedCardHeader> <TabbedCardHeader>
<RoutedTabs tabsArray={tabsArray} /> <RoutedTabs tabsArray={tabsArray} />
<CardCloseButton linkTo="/templates" /> <CardActions>
<CardCloseButton linkTo="/templates" />
</CardActions>
</TabbedCardHeader> </TabbedCardHeader>
); );

View File

@@ -213,13 +213,13 @@ function TemplateList({ i18n }) {
onSelectAll={handleSelectAll} onSelectAll={handleSelectAll}
qsConfig={QS_CONFIG} qsConfig={QS_CONFIG}
additionalControls={[ additionalControls={[
...(canAddJT || canAddWFJT ? [addButton] : []),
<ToolbarDeleteButton <ToolbarDeleteButton
key="delete" key="delete"
onDelete={handleTemplateDelete} onDelete={handleTemplateDelete}
itemsToDelete={selected} itemsToDelete={selected}
pluralizedItemName="Templates" pluralizedItemName="Templates"
/>, />,
...(canAddJT || canAddWFJT ? [addButton] : []),
]} ]}
/> />
)} )}

View File

@@ -1,7 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { Card, PageSection } from '@patternfly/react-core'; import { Card, CardActions, PageSection } from '@patternfly/react-core';
import { Switch, Route, Redirect, withRouter, Link } from 'react-router-dom'; import { Switch, Route, Redirect, withRouter, Link } from 'react-router-dom';
import { TabbedCardHeader } from '@components/Card'; import { TabbedCardHeader } from '@components/Card';
import AppendBody from '@components/AppendBody'; import AppendBody from '@components/AppendBody';
@@ -90,7 +90,9 @@ class WorkflowJobTemplate extends Component {
let cardHeader = hasContentLoading ? null : ( let cardHeader = hasContentLoading ? null : (
<TabbedCardHeader> <TabbedCardHeader>
<RoutedTabs tabsArray={tabsArray} /> <RoutedTabs tabsArray={tabsArray} />
<CardCloseButton linkTo="/templates" /> <CardActions>
<CardCloseButton linkTo="/templates" />
</CardActions>
</TabbedCardHeader> </TabbedCardHeader>
); );

View File

@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import { Switch, Route, withRouter, Redirect, Link } from 'react-router-dom'; import { Switch, Route, withRouter, Redirect, Link } from 'react-router-dom';
import { Card, PageSection } from '@patternfly/react-core'; import { Card, CardActions, PageSection } from '@patternfly/react-core';
import { TabbedCardHeader } from '@components/Card'; import { TabbedCardHeader } from '@components/Card';
import CardCloseButton from '@components/CardCloseButton'; import CardCloseButton from '@components/CardCloseButton';
import RoutedTabs from '@components/RoutedTabs'; import RoutedTabs from '@components/RoutedTabs';
@@ -81,7 +81,9 @@ class User extends Component {
let cardHeader = ( let cardHeader = (
<TabbedCardHeader> <TabbedCardHeader>
<RoutedTabs tabsArray={tabsArray} /> <RoutedTabs tabsArray={tabsArray} />
<CardCloseButton linkTo="/users" /> <CardActions>
<CardCloseButton linkTo="/users" />
</CardActions>
</TabbedCardHeader> </TabbedCardHeader>
); );

View File

@@ -191,12 +191,6 @@ class UsersList extends Component {
onSelectAll={this.handleSelectAll} onSelectAll={this.handleSelectAll}
qsConfig={QS_CONFIG} qsConfig={QS_CONFIG}
additionalControls={[ additionalControls={[
<ToolbarDeleteButton
key="delete"
onDelete={this.handleUserDelete}
itemsToDelete={selected}
pluralizedItemName="Users"
/>,
...(canAdd ...(canAdd
? [ ? [
<ToolbarAddButton <ToolbarAddButton
@@ -205,6 +199,12 @@ class UsersList extends Component {
/>, />,
] ]
: []), : []),
<ToolbarDeleteButton
key="delete"
onDelete={this.handleUserDelete}
itemsToDelete={selected}
pluralizedItemName="Users"
/>,
]} ]}
/> />
)} )}