Skip to content

Commit

Permalink
Upgrades pf deps to latest. Adds ability to click on row items in ord…
Browse files Browse the repository at this point in the history
…er to select them rather than having to click on checkboxes/radio buttons.
  • Loading branch information
mabashian committed Jan 2, 2020
1 parent 0bbf5e4 commit ef3f98a
Show file tree
Hide file tree
Showing 35 changed files with 162 additions and 115 deletions.
173 changes: 80 additions & 93 deletions awx/ui_next/package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions awx/ui_next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
},
"dependencies": {
"@lingui/react": "^2.7.2",
"@patternfly/patternfly": "^2.40.2",
"@patternfly/react-core": "^3.120.2",
"@patternfly/react-icons": "^3.14.15",
"@patternfly/react-tokens": "^2.6.31",
"@patternfly/patternfly": "^2.46.1",
"@patternfly/react-core": "^3.129.3",
"@patternfly/react-icons": "^3.14.28",
"@patternfly/react-tokens": "^2.7.14",
"ansi-to-html": "^0.6.11",
"axios": "^0.18.1",
"codemirror": "^5.47.0",
Expand Down
1 change: 1 addition & 0 deletions awx/ui_next/src/components/AddRole/SelectResourceStep.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class SelectResourceStep extends React.Component {
itemCount={count}
qsConfig={this.qsConfig}
toolbarColumns={columns}
onRowClick={onRowClick}
renderItem={item => (
<CheckboxListItem
isSelected={selectedResourceRows.some(i => i.id === item.id)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ const CheckboxListItem = ({
}) => {
const CheckboxRadio = isRadio ? DataListRadio : DataListCheck;
return (
<DataListItem key={itemId} aria-labelledby={`check-action-item-${itemId}`}>
<DataListItem
key={itemId}
aria-labelledby={`check-action-item-${itemId}`}
id={`${itemId}`}
>
<DataListItemRow>
<CheckboxRadio
id={`selected-${itemId}`}
Expand Down
1 change: 1 addition & 0 deletions awx/ui_next/src/components/Lookup/shared/OptionsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function OptionsList({
qsConfig={qsConfig}
toolbarColumns={columns}
hasContentLoading={isLoading}
onRowClick={selectItem}
renderItem={item => (
<CheckboxListItem
key={item.id}
Expand Down
4 changes: 2 additions & 2 deletions awx/ui_next/src/components/MultiSelect/MultiSelect.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('<MultiSelect />', () => {
/>
);
const component = wrapper.find('MultiSelect');
const input = component.find('TextInput');
const input = component.find('TextInputBase');
input.invoke('onChange')('Flabadoo');
input.simulate('keydown', { key: 'Enter' });

Expand All @@ -58,7 +58,7 @@ describe('<MultiSelect />', () => {
/>
);

const input = wrapper.find('TextInput');
const input = wrapper.find('TextInputBase');
input.simulate('focus');
wrapper.update();
const event = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function NotificationListItem(props) {
<DataListItem
aria-labelledby={`items-list-item-${notification.id}`}
key={notification.id}
id={`${notification.id}`}
>
<DataListItemRow>
<DataListItemCells
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ exports[`<NotificationListItem canToggleNotifications /> initially renders succe
>
<DataListItem
aria-labelledby="items-list-item-9000"
id="9000"
key="9000"
>
<li
aria-labelledby="items-list-item-9000"
className="pf-c-data-list__item"
id="9000"
>
<DataListItemRow
key=".0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@ class PaginatedDataList extends React.Component {
super(props);
this.handleSetPage = this.handleSetPage.bind(this);
this.handleSetPageSize = this.handleSetPageSize.bind(this);
this.handleListItemSelect = this.handleListItemSelect.bind(this);
}

handleListItemSelect = (id = 0) => {
const { items, onRowClick } = this.props;
const match = items.find(item => item.id === Number(id));
onRowClick(match);
};

handleSetPage(event, pageNumber) {
const { history, qsConfig } = this.props;
const { search } = history.location;
Expand Down Expand Up @@ -95,7 +102,12 @@ class PaginatedDataList extends React.Component {
);
} else {
Content = (
<DataList aria-label={dataListLabel}>{items.map(renderItem)}</DataList>
<DataList
aria-label={dataListLabel}
onSelectDataListItem={id => this.handleListItemSelect(id)}
>
{items.map(renderItem)}
</DataList>
);
}

Expand Down Expand Up @@ -157,6 +169,7 @@ PaginatedDataList.propTypes = {
renderToolbar: PropTypes.func,
hasContentLoading: PropTypes.bool,
contentError: PropTypes.shape(),
onRowClick: PropTypes.func,
};

PaginatedDataList.defaultProps = {
Expand All @@ -167,6 +180,7 @@ PaginatedDataList.defaultProps = {
showPageSizeOptions: true,
renderItem: item => <PaginatedDataListItem key={item.id} item={item} />,
renderToolbar: props => <DataListToolbar {...props} />,
onRowClick: () => null,
};

export { PaginatedDataList as _PaginatedDataList };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ const DetailWrapper = styled(TextContent)`

export default function PaginatedDataListItem({ item }) {
return (
<DataListItem aria-labelledby={`items-list-item-${item.id}`} key={item.id}>
<DataListItem
aria-labelledby={`items-list-item-${item.id}`}
key={item.id}
id={`${item.id}`}
>
<DataListItemRow>
<DataListItemCells
dataListCells={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ exports[`<ToolbarDeleteButton /> should render button 1`] = `
zIndex={9999}
>
<PopoverBase
animateFill={false}
appendTo={[Function]}
aria="describedby"
arrow={true}
Expand Down Expand Up @@ -80,7 +79,6 @@ exports[`<ToolbarDeleteButton /> should render button 1`] = `
lazy={true}
maxWidth="18.75rem"
onCreate={[Function]}
performance={true}
placement="top"
popperOptions={
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ class ResourceAccessListItem extends React.Component {
const [teamRoles, userRoles] = this.getRoleLists();

return (
<DataListItem aria-labelledby="access-list-item" key={accessRecord.id}>
<DataListItem
aria-labelledby="access-list-item"
key={accessRecord.id}
id={`${accessRecord.id}`}
>
<DataListItemRow>
<DataListItemCells
dataListCells={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ exports[`<ResourceAccessListItem /> initially renders succesfully 1`] = `
>
<DataListItem
aria-labelledby="access-list-item"
id="2"
key="2"
>
<li
aria-labelledby="access-list-item"
className="pf-c-data-list__item"
id="2"
>
<DataListItemRow
key=".0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function CredentialList({ i18n }) {
items={credentials}
itemCount={credentialCount}
qsConfig={QS_CONFIG}
onRowClick={handleSelect}
renderItem={item => (
<CredentialListItem
key={item.id}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ function CredentialListItem({
const canEdit = credential.summary_fields.user_capabilities.edit;

return (
<DataListItem key={credential.id} aria-labelledby={labelId}>
<DataListItem
key={credential.id}
aria-labelledby={labelId}
id={`${credential.id}`}
>
<DataListItemRow>
<DataListCheck
id={`select-credential-${credential.id}`}
Expand Down
1 change: 1 addition & 0 deletions awx/ui_next/src/screens/Host/HostList/HostList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ class HostsList extends Component {
itemCount={itemCount}
pluralizedItemName={i18n._(t`Hosts`)}
qsConfig={QS_CONFIG}
onRowClick={this.handleSelect}
toolbarColumns={[
{
name: i18n._(t`Name`),
Expand Down
2 changes: 1 addition & 1 deletion awx/ui_next/src/screens/Host/HostList/HostListItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class HostListItem extends React.Component {
} = this.props;
const labelId = `check-action-${host.id}`;
return (
<DataListItem key={host.id} aria-labelledby={labelId}>
<DataListItem key={host.id} aria-labelledby={labelId} id={`${host.id}`}>
<DataListItemRow>
<DataListCheck
id={`select-host-${host.id}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function InventoryGroupItem({
const editUrl = `/inventories/inventory/${inventoryId}/groups/${group.id}/edit`;

return (
<DataListItem key={group.id} aria-labelledby={labelId}>
<DataListItem key={group.id} aria-labelledby={labelId} id={`${group.id}`}>
<DataListItemRow>
<DataListCheck
aria-labelledby={labelId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ function InventoryGroupsList({ i18n, location, match }) {
items={groups}
itemCount={groupCount}
qsConfig={QS_CONFIG}
onRowClick={handleSelect}
renderItem={item => (
<InventoryGroupItem
key={item.id}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function InventoryHostItem(props) {
const labelId = `check-action-${host.id}`;

return (
<DataListItem key={host.id} aria-labelledby={labelId}>
<DataListItem key={host.id} aria-labelledby={labelId} id={`${host.id}`}>
<DataListItemRow>
<DataListCheck
id={`select-host-${host.id}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ function InventoryHosts({ i18n, location, match }) {
itemCount={hostCount}
pluralizedItemName={i18n._(t`Hosts`)}
qsConfig={QS_CONFIG}
onRowClick={handleSelect}
toolbarColumns={[
{
name: i18n._(t`Name`),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ class InventoriesList extends Component {
itemCount={itemCount}
pluralizedItemName={i18n._(t`Inventories`)}
qsConfig={QS_CONFIG}
onRowClick={this.handleSelect}
toolbarColumns={[
{
name: i18n._(t`Name`),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ class InventoryListItem extends React.Component {
const { inventory, isSelected, onSelect, detailUrl, i18n } = this.props;
const labelId = `check-action-${inventory.id}`;
return (
<DataListItem key={inventory.id} aria-labelledby={labelId}>
<DataListItem
key={inventory.id}
aria-labelledby={labelId}
id={`${inventory.id}`}
>
<DataListItemRow>
<DataListCheck
id={`select-inventory-${inventory.id}`}
Expand Down
1 change: 1 addition & 0 deletions awx/ui_next/src/screens/Job/JobList/JobList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class JobList extends Component {
itemCount={itemCount}
pluralizedItemName="Jobs"
qsConfig={QS_CONFIG}
onRowClick={this.handleSelect}
toolbarColumns={[
{
name: i18n._(t`Name`),
Expand Down
1 change: 1 addition & 0 deletions awx/ui_next/src/screens/Job/JobList/JobListItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class JobListItem extends Component {
<DataListItem
aria-labelledby={`check-action-${job.id}`}
css="--pf-c-data-list__expandable-content--BoxShadow: none;"
id={`${job.id}`}
>
<DataListItemRow>
<DataListCheck
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ function OrganizationsList({ i18n }) {
itemCount={itemCount}
pluralizedItemName="Organizations"
qsConfig={QS_CONFIG}
onRowClick={handleSelect}
toolbarColumns={[
{
name: i18n._(t`Name`),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ function OrganizationListItem({
}) {
const labelId = `check-action-${organization.id}`;
return (
<DataListItem key={organization.id} aria-labelledby={labelId}>
<DataListItem
key={organization.id}
aria-labelledby={labelId}
id={`${organization.id}`}
>
<DataListItemRow>
<DataListCheck
id={`select-organization-${organization.id}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class ProjectsList extends Component {
itemCount={itemCount}
pluralizedItemName={i18n._(t`Projects`)}
qsConfig={QS_CONFIG}
onRowClick={this.handleSelect}
toolbarColumns={[
{
name: i18n._(t`Name`),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ class ProjectListItem extends React.Component {
const { project, isSelected, onSelect, detailUrl, i18n } = this.props;
const labelId = `check-action-${project.id}`;
return (
<DataListItem key={project.id} aria-labelledby={labelId}>
<DataListItem
key={project.id}
aria-labelledby={labelId}
id={`${project.id}`}
>
<DataListItemRow>
<DataListCheck
id={`select-project-${project.id}`}
Expand Down
1 change: 1 addition & 0 deletions awx/ui_next/src/screens/Team/TeamList/TeamList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class TeamsList extends Component {
itemCount={itemCount}
pluralizedItemName={i18n._(t`Teams`)}
qsConfig={QS_CONFIG}
onRowClick={this.handleSelect}
toolbarColumns={[
{
name: i18n._(t`Name`),
Expand Down
2 changes: 1 addition & 1 deletion awx/ui_next/src/screens/Team/TeamList/TeamListItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class TeamListItem extends React.Component {
const { team, isSelected, onSelect, detailUrl, i18n } = this.props;
const labelId = `check-action-${team.id}`;
return (
<DataListItem key={team.id} aria-labelledby={labelId}>
<DataListItem key={team.id} aria-labelledby={labelId} id={`${team.id}`}>
<DataListItemRow>
<DataListCheck
id={`select-team-${team.id}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,9 @@ class TemplatesList extends Component {
hasContentLoading={hasContentLoading}
items={templates}
itemCount={itemCount}
pluralizedItemName="Templates"
pluralizedItemName={i18n._(t`Templates`)}
qsConfig={QS_CONFIG}
onRowClick={this.handleSelect}
toolbarColumns={[
{
name: i18n._(t`Name`),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class TemplateListItem extends Component {
<DataListItem
aria-labelledby={`check-action-${template.id}`}
css="--pf-c-data-list__expandable-content--BoxShadow: none;"
id={`${template.id}`}
>
<DataListItemRow>
<DataListCheck
Expand Down
1 change: 1 addition & 0 deletions awx/ui_next/src/screens/User/UserList/UserList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class UsersList extends Component {
itemCount={itemCount}
pluralizedItemName="Users"
qsConfig={QS_CONFIG}
onRowClick={this.handleSelect}
toolbarColumns={[
{
name: i18n._(t`Username`),
Expand Down
2 changes: 1 addition & 1 deletion awx/ui_next/src/screens/User/UserList/UserListItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class UserListItem extends React.Component {
const { user, isSelected, onSelect, detailUrl, i18n } = this.props;
const labelId = `check-action-${user.id}`;
return (
<DataListItem key={user.id} aria-labelledby={labelId}>
<DataListItem key={user.id} aria-labelledby={labelId} id={`${user.id}`}>
<DataListItemRow>
<DataListCheck
id={`select-user-${user.id}`}
Expand Down

0 comments on commit ef3f98a

Please sign in to comment.