Skip to content

Commit

Permalink
Refs #37619 - Additional ouia/lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ofedoren committed Jul 2, 2024
1 parent 720e495 commit 411ab70
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 4 deletions.
3 changes: 3 additions & 0 deletions webpack/components/ConfirmModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const ConfirmModal = props => {

const actions = [
<Button
ouiaId={`oscap-conf-modal-${props.record.id}-confirm`}
key="confirm"
variant="primary"
onClick={() => props.onConfirm(callMutation, props.record.id)}
Expand All @@ -19,6 +20,7 @@ const ConfirmModal = props => {
{__('Confirm')}
</Button>,
<Button
ouiaId={`oscap-conf-modal-${props.record.id}-cancel`}
key="cancel"
variant="link"
onClick={event => props.onClose()}
Expand All @@ -34,6 +36,7 @@ const ConfirmModal = props => {

return (
<Modal
ouiaId={`oscap-conf-modal-${props.record.id}`}
variant={ModalVariant.medium}
title={props.title}
isOpen={props.isOpen}
Expand Down
3 changes: 3 additions & 0 deletions webpack/components/EditableInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const EditableInput = props => {
const editBtn = (
<SplitItem>
<Button
ouiaId={`oscap-edit-${props.attrName}-edit-button`}
className="inline-edit-icon"
aria-label={`edit ${props.attrName}`}
variant="plain"
Expand Down Expand Up @@ -115,6 +116,7 @@ const EditableInput = props => {
</SplitItem>
<SplitItem>
<Button
ouiaId={`oscap-edit-${props.attrName}-submit-button`}
aria-label={`submit ${props.attrName}`}
variant="plain"
onClick={onSubmit}
Expand All @@ -125,6 +127,7 @@ const EditableInput = props => {
</SplitItem>
<SplitItem>
<Button
ouiaId={`oscap-edit-${props.attrName}-cancel-button`}
aria-label={`cancel editing ${props.attrName}`}
variant="plain"
onClick={onCancel}
Expand Down
14 changes: 12 additions & 2 deletions webpack/components/EmptyState.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,19 @@ const EmptyStateIcon = ({ error, search, lock }) => {
return <PfEmptyStateIcon icon={CubeIcon} />;
};

const EmptyState = ({ title, body, error, search, lock, primaryButton }) => (
const EmptyState = ({
title,
body,
error,
search,
lock,
primaryButton,
ouiaEmptyStateTitleId,
}) => (
<Bullseye>
<PfEmptyState variant={EmptyStateVariant.small}>
<EmptyStateIcon error={!!error} search={search} lock={lock} />
<Title headingLevel="h2" size="lg">
<Title ouiaId={ouiaEmptyStateTitleId} headingLevel="h2" size="lg">
{title}
</Title>
<EmptyStateBody>{body}</EmptyStateBody>
Expand Down Expand Up @@ -65,6 +73,7 @@ EmptyState.propTypes = {
search: PropTypes.bool,
lock: PropTypes.bool,
primaryButton: PropTypes.node,
ouiaEmptyStateTitleId: PropTypes.string,
};

EmptyState.defaultProps = {
Expand All @@ -75,6 +84,7 @@ EmptyState.defaultProps = {
search: false,
lock: false,
primaryButton: null,
ouiaEmptyStateTitleId: 'oscap-empty-state-title',
};

export default EmptyState;
4 changes: 3 additions & 1 deletion webpack/components/IndexLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const IndexLayout = ({ pageTitle, children, contentWidthSpan }) => (
<Grid className="scap-page-grid">
<GridItem span={12} className="pf-u-pb-xl">
<TextContent>
<Text component={TextVariants.h1}>{pageTitle}</Text>
<Text ouiaId="oscap-index-title" component={TextVariants.h1}>
{pageTitle}
</Text>
</TextContent>
</GridItem>
<GridItem span={contentWidthSpan}>{children}</GridItem>
Expand Down
3 changes: 3 additions & 0 deletions webpack/components/IndexTable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const IndexTable = ({
totalCount,
toolbarBtns,
ariaTableLabel,
ouiaTableId,
columns,
...rest
}) => {
Expand Down Expand Up @@ -38,6 +39,7 @@ const IndexTable = ({
</FlexItem>
</Flex>
<Table
ouiaId={ouiaTableId}
aria-label={ariaTableLabel}
cells={columns}
{...rest}
Expand All @@ -56,6 +58,7 @@ IndexTable.propTypes = {
toolbarBtns: PropTypes.node,
totalCount: PropTypes.number.isRequired,
ariaTableLabel: PropTypes.string.isRequired,
ouiaTableId: PropTypes.string.isRequired,
columns: PropTypes.array.isRequired,
};

Expand Down
4 changes: 4 additions & 0 deletions webpack/components/LinkButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ const LinkButton = ({
btnText,
isDisabled,
btnAriaLabel,
ouiaId,
}) => (
<Link to={path}>
<Button
ouiaId={ouiaId}
variant={btnVariant}
isDisabled={isDisabled}
aria-label={btnAriaLabel}
Expand All @@ -27,12 +29,14 @@ LinkButton.propTypes = {
btnVariant: PropTypes.string,
isDisabled: PropTypes.bool,
btnAriaLabel: PropTypes.string,
ouiaId: PropTypes.string,
};

LinkButton.defaultProps = {
btnVariant: 'primary',
isDisabled: false,
btnAriaLabel: null,
ouiaId: 'oscap-link-button',
};

export default LinkButton;
2 changes: 2 additions & 0 deletions webpack/components/OpenscapRemediationWizard/steps/Finish.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const Finish = ({ onClose }) => {
/>
) : (
<EmptyState
ouiaEmptyStateTitleId="oscap-rem-wiz-empty-state-title"
error
title={__('Error!')}
body={errorMsg(data)}
Expand All @@ -107,6 +108,7 @@ const Finish = ({ onClose }) => {
const body =
status === STATUS.RESOLVED ? (
<EmptyState
ouiaEmptyStateTitleId="oscap-rem-wiz-empty-state-title"
title={__(
'The job has started on selected host(s), you can check the status on the job details page.'
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@ const SnippetSelect = () => {
)}
</Form>
) : (
<EmptyState error title={__('Error!')} body={errorMsg(logError)} />
<EmptyState
ouiaEmptyStateTitleId="oscap-rem-wiz-empty-state-title"
error
title={__('Error!')}
body={errorMsg(logError)}
/>
);

return (
Expand Down
1 change: 1 addition & 0 deletions webpack/helpers/formFieldsHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const SelectField = props => {
validated={valid}
>
<FormSelect
ouiaId={`oscap-form-sel-${field.name}`}
{...fieldProps}
className="without_select2"
aria-label={fieldProps.name}
Expand Down

0 comments on commit 411ab70

Please sign in to comment.