From f4ba87ea4f4314941857f5bfb61fd79c4df9b8aa Mon Sep 17 00:00:00 2001 From: mabashian Date: Tue, 25 May 2021 17:04:09 -0400 Subject: [PATCH 1/3] Fixes bug where users were unable to click on text next to checkboxes in modals --- awx/ui_next/src/components/AddRole/SelectResourceStep.jsx | 1 - .../src/components/CheckboxListItem/CheckboxListItem.jsx | 1 - awx/ui_next/src/components/OptionsList/OptionsList.jsx | 2 -- 3 files changed, 4 deletions(-) diff --git a/awx/ui_next/src/components/AddRole/SelectResourceStep.jsx b/awx/ui_next/src/components/AddRole/SelectResourceStep.jsx index 7489b707a8..d74e08b823 100644 --- a/awx/ui_next/src/components/AddRole/SelectResourceStep.jsx +++ b/awx/ui_next/src/components/AddRole/SelectResourceStep.jsx @@ -3,7 +3,6 @@ import PropTypes from 'prop-types'; import { withRouter, useLocation } from 'react-router-dom'; import { t } from '@lingui/macro'; import useRequest from '../../util/useRequest'; - import { SearchColumns, SortColumns } from '../../types'; import DataListToolbar from '../DataListToolbar'; import CheckboxListItem from '../CheckboxListItem'; diff --git a/awx/ui_next/src/components/CheckboxListItem/CheckboxListItem.jsx b/awx/ui_next/src/components/CheckboxListItem/CheckboxListItem.jsx index c76a542ea2..73f0a6fe4a 100644 --- a/awx/ui_next/src/components/CheckboxListItem/CheckboxListItem.jsx +++ b/awx/ui_next/src/components/CheckboxListItem/CheckboxListItem.jsx @@ -4,7 +4,6 @@ import { t } from '@lingui/macro'; import { Td, Tr } from '@patternfly/react-table'; const CheckboxListItem = ({ - isDisabled = false, isRadio = false, isSelected = false, itemId, diff --git a/awx/ui_next/src/components/OptionsList/OptionsList.jsx b/awx/ui_next/src/components/OptionsList/OptionsList.jsx index ccd6fd8ff9..5585f7c413 100644 --- a/awx/ui_next/src/components/OptionsList/OptionsList.jsx +++ b/awx/ui_next/src/components/OptionsList/OptionsList.jsx @@ -9,7 +9,6 @@ import { oneOfType, } from 'prop-types'; import styled from 'styled-components'; - import { t } from '@lingui/macro'; import SelectedList from '../SelectedList'; import CheckboxListItem from '../CheckboxListItem'; @@ -41,7 +40,6 @@ function OptionsList({ deselectItem, renderItemChip, isLoading, - displayKey, }) { return ( From 4b4e57889e08151da4802069150533e6078aee8f Mon Sep 17 00:00:00 2001 From: mabashian Date: Thu, 27 May 2021 10:50:11 -0400 Subject: [PATCH 2/3] Remove unused disabled prop --- awx/ui_next/src/components/CheckboxListItem/CheckboxListItem.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/awx/ui_next/src/components/CheckboxListItem/CheckboxListItem.jsx b/awx/ui_next/src/components/CheckboxListItem/CheckboxListItem.jsx index 73f0a6fe4a..1d0ad57388 100644 --- a/awx/ui_next/src/components/CheckboxListItem/CheckboxListItem.jsx +++ b/awx/ui_next/src/components/CheckboxListItem/CheckboxListItem.jsx @@ -23,7 +23,6 @@ const CheckboxListItem = ({ rowIndex, isSelected, onSelect: isSelected ? onDeselect : onSelect, - disable: isDisabled, variant: isRadio ? 'radio' : 'checkbox', }} name={name} From ad5cc3a3937d518864999dab14d445b254585834 Mon Sep 17 00:00:00 2001 From: mabashian Date: Thu, 27 May 2021 12:23:03 -0400 Subject: [PATCH 3/3] Adds click event to table row to handle selecting/unselecting checkbox/radio --- .../CheckboxListItem/CheckboxListItem.jsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/awx/ui_next/src/components/CheckboxListItem/CheckboxListItem.jsx b/awx/ui_next/src/components/CheckboxListItem/CheckboxListItem.jsx index 1d0ad57388..1467293026 100644 --- a/awx/ui_next/src/components/CheckboxListItem/CheckboxListItem.jsx +++ b/awx/ui_next/src/components/CheckboxListItem/CheckboxListItem.jsx @@ -15,8 +15,20 @@ const CheckboxListItem = ({ columns, item, }) => { + const handleRowClick = () => { + if (isSelected && !isRadio) { + onDeselect(itemId); + } else { + onSelect(itemId); + } + }; + return ( - +