mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
updates test issues caused by PF bump
This commit is contained in:
@@ -8,7 +8,7 @@ describe('<CardCloseButton>', () => {
|
|||||||
const button = wrapper.find('Button');
|
const button = wrapper.find('Button');
|
||||||
expect(button).toHaveLength(1);
|
expect(button).toHaveLength(1);
|
||||||
expect(button.prop('variant')).toBe('plain');
|
expect(button.prop('variant')).toBe('plain');
|
||||||
expect(button.prop('className')).toBe('pf-c-card__close');
|
expect(button.prop('aria-label')).toBe('Close');
|
||||||
expect(wrapper.find('Link')).toHaveLength(0);
|
expect(wrapper.find('Link')).toHaveLength(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -18,6 +18,6 @@ describe('<CardCloseButton>', () => {
|
|||||||
const link = wrapper.find('Link');
|
const link = wrapper.find('Link');
|
||||||
expect(link).toHaveLength(1);
|
expect(link).toHaveLength(1);
|
||||||
expect(link.prop('to')).toEqual('/foo');
|
expect(link.prop('to')).toEqual('/foo');
|
||||||
expect(link.prop('className')).toEqual('pf-c-button pf-c-card__close');
|
expect(link.prop('aria-label')).toEqual('Close');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
13
src/app.scss
13
src/app.scss
@@ -72,7 +72,7 @@
|
|||||||
// page header overrides
|
// page header overrides
|
||||||
//
|
//
|
||||||
|
|
||||||
.pf-c-page__main-section.pf-m-condensed {
|
.pf-c-page__main-section {
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
}
|
}
|
||||||
@@ -208,17 +208,6 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pf-c-card__close {
|
|
||||||
position: absolute;
|
|
||||||
top: 5px;
|
|
||||||
right: 4px;
|
|
||||||
color: var(--pf-c-button--m-plain--Color);
|
|
||||||
|
|
||||||
&.pf-c-button {
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.pf-c-card__header {
|
.pf-c-card__header {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
39
src/components/BasicChip/BasicChip.jsx
Normal file
39
src/components/BasicChip/BasicChip.jsx
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
import { Chip as PFChip } from '@patternfly/react-core';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const Chip = styled(PFChip)`
|
||||||
|
padding: 3px 8px;
|
||||||
|
height: 24px;
|
||||||
|
margin-right: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
|
||||||
|
&.pf-c-chip {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.pf-m-overflow {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:not(.pf-m-overflow) .pf-c-button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
const BasicChip = ({ children, onToggle, isOverflowChip }) => (
|
||||||
|
<Chip
|
||||||
|
className="awx-c-chip--basic"
|
||||||
|
onClick={onToggle}
|
||||||
|
isOverflowChip={isOverflowChip}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</Chip>
|
||||||
|
);
|
||||||
|
|
||||||
|
BasicChip.propTypes = {
|
||||||
|
children: PropTypes.node.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default BasicChip;
|
||||||
@@ -1,18 +1,29 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import {
|
import {
|
||||||
PageSection,
|
PageSection as PFPageSection,
|
||||||
PageSectionVariants,
|
PageSectionVariants,
|
||||||
Breadcrumb,
|
Breadcrumb,
|
||||||
BreadcrumbItem,
|
BreadcrumbItem,
|
||||||
BreadcrumbHeading
|
BreadcrumbHeading as PFBreadcrumbHeading
|
||||||
} from '@patternfly/react-core';
|
} from '@patternfly/react-core';
|
||||||
import {
|
import {
|
||||||
Link,
|
Link,
|
||||||
Route,
|
Route,
|
||||||
withRouter
|
withRouter
|
||||||
} from 'react-router-dom';
|
} from 'react-router-dom';
|
||||||
import './breadcrumbs.scss';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const PageSection = styled(PFPageSection)`
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const BreadcrumbHeading = styled(PFBreadcrumbHeading)`
|
||||||
|
--pf-c-breadcrumb__heading--FontSize: 20px;
|
||||||
|
line-height: 24px;
|
||||||
|
flex: 100%;
|
||||||
|
`;
|
||||||
|
|
||||||
const Breadcrumbs = ({ breadcrumbConfig }) => {
|
const Breadcrumbs = ({ breadcrumbConfig }) => {
|
||||||
const { light } = PageSectionVariants;
|
const { light } = PageSectionVariants;
|
||||||
@@ -20,7 +31,6 @@ const Breadcrumbs = ({ breadcrumbConfig }) => {
|
|||||||
return (
|
return (
|
||||||
<PageSection
|
<PageSection
|
||||||
variant={light}
|
variant={light}
|
||||||
className="pf-m-condensed"
|
|
||||||
>
|
>
|
||||||
<Breadcrumb>
|
<Breadcrumb>
|
||||||
<Route
|
<Route
|
||||||
@@ -47,7 +57,6 @@ const Crumb = ({ breadcrumbConfig, match }) => {
|
|||||||
crumbElement = (
|
crumbElement = (
|
||||||
<BreadcrumbHeading
|
<BreadcrumbHeading
|
||||||
key="breadcrumb-heading"
|
key="breadcrumb-heading"
|
||||||
className="heading"
|
|
||||||
>
|
>
|
||||||
{crumb}
|
{crumb}
|
||||||
</BreadcrumbHeading>
|
</BreadcrumbHeading>
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
.pf-c-breadcrumb__item.heading {
|
|
||||||
--pf-c-breadcrumb__heading--FontSize: 20px;
|
|
||||||
line-height: 24px;
|
|
||||||
flex: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pf-c-breadcrumb__item:nth-last-child(2) {
|
|
||||||
.pf-c-breadcrumb__item-divider {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +1,24 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { string } from 'prop-types';
|
import { string } from 'prop-types';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link as RRLink } 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 pf-c-card__close"
|
className="pf-c-button"
|
||||||
aria-label={i18n._(t`Close`)}
|
aria-label={i18n._(t`Close`)}
|
||||||
title={i18n._(t`Close`)}
|
title={i18n._(t`Close`)}
|
||||||
to={linkTo}
|
to={linkTo}
|
||||||
@@ -23,7 +31,6 @@ function CardCloseButton ({ linkTo, i18n, i18nHash, ...props }) {
|
|||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
variant="plain"
|
variant="plain"
|
||||||
className="pf-c-card__close"
|
|
||||||
aria-label={i18n._(t`Close`)}
|
aria-label={i18n._(t`Close`)}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -3,27 +3,24 @@ import PropTypes from 'prop-types';
|
|||||||
import { withI18n } from '@lingui/react';
|
import { withI18n } from '@lingui/react';
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import {
|
import {
|
||||||
ActionGroup,
|
ActionGroup as PFActionGroup,
|
||||||
Toolbar,
|
Toolbar,
|
||||||
ToolbarGroup,
|
ToolbarGroup,
|
||||||
Button
|
Button
|
||||||
} from '@patternfly/react-core';
|
} from '@patternfly/react-core';
|
||||||
import './styles.scss';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
const formActionGroupStyle = {
|
const ActionGroup = styled(PFActionGroup)`
|
||||||
display: 'flex',
|
display: flex;
|
||||||
flexDirection: 'row',
|
flex-direction: row;
|
||||||
justifyContent: 'flex-end',
|
justify-content: flex-end;
|
||||||
};
|
--pf-c-form__group--m-action--MarginTop: 0;
|
||||||
|
`;
|
||||||
const buttonGroupStyle = {
|
|
||||||
marginRight: '20px'
|
|
||||||
};
|
|
||||||
|
|
||||||
const FormActionGroup = ({ onSubmit, submitDisabled, onCancel, i18n }) => (
|
const FormActionGroup = ({ onSubmit, submitDisabled, onCancel, i18n }) => (
|
||||||
<ActionGroup style={formActionGroupStyle}>
|
<ActionGroup>
|
||||||
<Toolbar>
|
<Toolbar>
|
||||||
<ToolbarGroup style={buttonGroupStyle}>
|
<ToolbarGroup css="margin-right: 20px">
|
||||||
<Button aria-label={i18n._(t`Save`)} variant="primary" type="submit" onClick={onSubmit} isDisabled={submitDisabled}>{i18n._(t`Save`)}</Button>
|
<Button aria-label={i18n._(t`Save`)} variant="primary" type="submit" onClick={onSubmit} isDisabled={submitDisabled}>{i18n._(t`Save`)}</Button>
|
||||||
</ToolbarGroup>
|
</ToolbarGroup>
|
||||||
<ToolbarGroup>
|
<ToolbarGroup>
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
import FormActionGroup from './FormActionGroup';
|
|
||||||
|
|
||||||
export default FormActionGroup;
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
.pf-c-form__group.pf-m-action {
|
|
||||||
--pf-c-form__group--m-action--MarginTop: 0;
|
|
||||||
}
|
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
export default function FormRow ({ children }) {
|
export default function FormRow ({ children }) {
|
||||||
|
const Row = styled.div`
|
||||||
|
display: grid;
|
||||||
|
grid-gap: 20px;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||||
|
`;
|
||||||
return (
|
return (
|
||||||
<div
|
<Row>
|
||||||
style={{
|
|
||||||
display: 'grid',
|
|
||||||
gridGap: '20px',
|
|
||||||
gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))'
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</Row>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { Config } from '../../../contexts/Config';
|
|||||||
import { withNetwork } from '../../../contexts/Network';
|
import { withNetwork } from '../../../contexts/Network';
|
||||||
import FormRow from '../../../components/FormRow';
|
import FormRow from '../../../components/FormRow';
|
||||||
import FormField from '../../../components/FormField';
|
import FormField from '../../../components/FormField';
|
||||||
import FormActionGroup from '../../../components/FormActionGroup';
|
import FormActionGroup from '../../../components/FormActionGroup/FormActionGroup';
|
||||||
import AnsibleSelect from '../../../components/AnsibleSelect';
|
import AnsibleSelect from '../../../components/AnsibleSelect';
|
||||||
import InstanceGroupsLookup from './InstanceGroupsLookup';
|
import InstanceGroupsLookup from './InstanceGroupsLookup';
|
||||||
import { required } from '../../../util/validators';
|
import { required } from '../../../util/validators';
|
||||||
|
|||||||
Reference in New Issue
Block a user