From e8cd8c249c19add9c8cd59b59049f251822ebee1 Mon Sep 17 00:00:00 2001 From: nixocio Date: Thu, 23 Sep 2021 17:06:49 -0400 Subject: [PATCH] Break lines for long strings on main lists Break lines for long strings on main lists to avoid horizontal scrolling. Main goal of this change is to avoid actions items to be hidden on the main lists. See: https://github.com/ansible/awx/issues/6302 --- awx/ui/src/components/JobList/JobListItem.js | 6 +++--- awx/ui/src/components/PaginatedTable/TdBreakWord.js | 13 +++++++++++++ awx/ui/src/components/PaginatedTable/index.js | 1 + .../Schedule/ScheduleList/ScheduleListItem.js | 6 +++--- .../src/components/TemplateList/TemplateListItem.js | 6 +++--- .../ApplicationsList/ApplicationListItem.js | 11 +++++------ .../Credential/CredentialList/CredentialListItem.js | 6 +++--- .../CredentialTypeList/CredentialTypeListItem.js | 7 +++---- .../ExecutionEnvironmentListItem.js | 10 ++++++---- awx/ui/src/screens/Host/HostList/HostListItem.js | 10 +++++----- .../InstanceGroupList/InstanceGroupListItem.js | 6 +++--- .../Inventory/InventoryHosts/InventoryHostItem.js | 6 +++--- .../Inventory/InventoryList/InventoryListItem.js | 11 +++++------ .../InventorySources/InventorySourceListItem.js | 6 +++--- .../NotificationTemplateListItem.js | 7 +++---- .../OrganizationList/OrganizationListItem.js | 7 ++++--- .../screens/Project/ProjectList/ProjectListItem.js | 6 +++--- awx/ui/src/screens/Team/TeamList/TeamListItem.js | 12 ++++++------ awx/ui/src/screens/User/UserList/UserListItem.js | 8 ++++---- 19 files changed, 79 insertions(+), 66 deletions(-) create mode 100644 awx/ui/src/components/PaginatedTable/TdBreakWord.js diff --git a/awx/ui/src/components/JobList/JobListItem.js b/awx/ui/src/components/JobList/JobListItem.js index 10a9f2d5e2..10a63d5c88 100644 --- a/awx/ui/src/components/JobList/JobListItem.js +++ b/awx/ui/src/components/JobList/JobListItem.js @@ -8,7 +8,7 @@ import { RocketIcon } from '@patternfly/react-icons'; import styled from 'styled-components'; import { formatDateString } from 'util/dates'; import { isJobRunning } from 'util/jobs'; -import { ActionsTd, ActionItem } from '../PaginatedTable'; +import { ActionsTd, ActionItem, TdBreakWord } from '../PaginatedTable'; import { LaunchButton, ReLaunchDropDown } from '../LaunchButton'; import StatusLabel from '../StatusLabel'; import { DetailList, Detail, LaunchedByDetail } from '../DetailList'; @@ -76,7 +76,7 @@ function JobListItem({ }} dataLabel={t`Select`} /> - + @@ -84,7 +84,7 @@ function JobListItem({ - + {job.status && } diff --git a/awx/ui/src/components/PaginatedTable/TdBreakWord.js b/awx/ui/src/components/PaginatedTable/TdBreakWord.js new file mode 100644 index 0000000000..4b8c69bcf4 --- /dev/null +++ b/awx/ui/src/components/PaginatedTable/TdBreakWord.js @@ -0,0 +1,13 @@ +import React from 'react'; +import { Td as _Td } from '@patternfly/react-table'; +import styled from 'styled-components'; + +const Td = styled(_Td)` + && { + word-break: break-all; + } +`; + +export default function TdBreakWord({ children, ...props }) { + return {children}; +} diff --git a/awx/ui/src/components/PaginatedTable/index.js b/awx/ui/src/components/PaginatedTable/index.js index 67b83c87c2..9b64b0e9f5 100644 --- a/awx/ui/src/components/PaginatedTable/index.js +++ b/awx/ui/src/components/PaginatedTable/index.js @@ -6,3 +6,4 @@ export { default as ToolbarDeleteButton } from './ToolbarDeleteButton'; export { default as ToolbarAddButton } from './ToolbarAddButton'; export { default as ToolbarSyncSourceButton } from './ToolbarSyncSourceButton'; export { default as getSearchableKeys } from './getSearchableKeys'; +export { default as TdBreakWord } from './TdBreakWord'; diff --git a/awx/ui/src/components/Schedule/ScheduleList/ScheduleListItem.js b/awx/ui/src/components/Schedule/ScheduleList/ScheduleListItem.js index 1b33cf4875..b29bbb30b4 100644 --- a/awx/ui/src/components/Schedule/ScheduleList/ScheduleListItem.js +++ b/awx/ui/src/components/Schedule/ScheduleList/ScheduleListItem.js @@ -14,7 +14,7 @@ import styled from 'styled-components'; import { Schedule } from 'types'; import { formatDateString } from 'util/dates'; import { DetailList, Detail } from '../../DetailList'; -import { ActionsTd, ActionItem } from '../../PaginatedTable'; +import { ActionsTd, ActionItem, TdBreakWord } from '../../PaginatedTable'; import { ScheduleToggle } from '..'; const ExclamationTriangleIcon = styled(PFExclamationTriangleIcon)` @@ -74,7 +74,7 @@ function ScheduleListItem({ }} dataLabel={t`Selected`} /> - + {schedule.name} @@ -90,7 +90,7 @@ function ScheduleListItem({ )} - + { jobTypeLabels[ diff --git a/awx/ui/src/components/TemplateList/TemplateListItem.js b/awx/ui/src/components/TemplateList/TemplateListItem.js index e3ed4e77d4..f5fb74fda5 100644 --- a/awx/ui/src/components/TemplateList/TemplateListItem.js +++ b/awx/ui/src/components/TemplateList/TemplateListItem.js @@ -16,7 +16,7 @@ import { JobTemplatesAPI, WorkflowJobTemplatesAPI } from 'api'; import { toTitleCase } from 'util/strings'; import getDocsBaseUrl from 'util/getDocsBaseUrl'; import { useConfig } from 'contexts/Config'; -import { ActionsTd, ActionItem } from '../PaginatedTable'; +import { ActionsTd, ActionItem, TdBreakWord } from '../PaginatedTable'; import { DetailList, Detail, DeletedDetail } from '../DetailList'; import ChipGroup from '../ChipGroup'; import CredentialChip from '../CredentialChip'; @@ -131,7 +131,7 @@ function TemplateListItem({ }} dataLabel={t`Selected`} /> - + {template.name} @@ -172,7 +172,7 @@ function TemplateListItem({ )} - + {toTitleCase(template.type)} {lastRun} diff --git a/awx/ui/src/screens/Application/ApplicationsList/ApplicationListItem.js b/awx/ui/src/screens/Application/ApplicationsList/ApplicationListItem.js index afd5ea3ce4..e0c5708602 100644 --- a/awx/ui/src/screens/Application/ApplicationsList/ApplicationListItem.js +++ b/awx/ui/src/screens/Application/ApplicationsList/ApplicationListItem.js @@ -1,12 +1,11 @@ import React from 'react'; import { string, bool, func } from 'prop-types'; - import { Button } from '@patternfly/react-core'; import { Tr, Td } from '@patternfly/react-table'; import { t } from '@lingui/macro'; import { Link } from 'react-router-dom'; import { PencilAltIcon } from '@patternfly/react-icons'; -import { ActionsTd, ActionItem } from 'components/PaginatedTable'; +import { ActionsTd, ActionItem, TdBreakWord } from 'components/PaginatedTable'; import { formatDateString } from 'util/dates'; import { Application } from 'types'; @@ -28,18 +27,18 @@ function ApplicationListItem({ }} dataLabel={t`Selected`} /> - + {application.name} - - + + {application.summary_fields.organization.name} - + {formatDateString(application.modified)} diff --git a/awx/ui/src/screens/Credential/CredentialList/CredentialListItem.js b/awx/ui/src/screens/Credential/CredentialList/CredentialListItem.js index a1a68be929..c6b95964bd 100644 --- a/awx/ui/src/screens/Credential/CredentialList/CredentialListItem.js +++ b/awx/ui/src/screens/Credential/CredentialList/CredentialListItem.js @@ -6,7 +6,7 @@ import { Link } from 'react-router-dom'; import { Button } from '@patternfly/react-core'; import { Tr, Td } from '@patternfly/react-table'; import { PencilAltIcon } from '@patternfly/react-icons'; -import { ActionsTd, ActionItem } from 'components/PaginatedTable'; +import { ActionsTd, ActionItem, TdBreakWord } from 'components/PaginatedTable'; import { timeOfDay } from 'util/dates'; import { Credential } from 'types'; @@ -52,11 +52,11 @@ function CredentialListItem({ }} dataLabel={t`Selected`} /> - + {credential.name} - + {credential.summary_fields.credential_type.name} diff --git a/awx/ui/src/screens/CredentialType/CredentialTypeList/CredentialTypeListItem.js b/awx/ui/src/screens/CredentialType/CredentialTypeList/CredentialTypeListItem.js index e1519db504..245fe8b0e6 100644 --- a/awx/ui/src/screens/CredentialType/CredentialTypeList/CredentialTypeListItem.js +++ b/awx/ui/src/screens/CredentialType/CredentialTypeList/CredentialTypeListItem.js @@ -1,12 +1,11 @@ import React from 'react'; import { string, bool, func } from 'prop-types'; - import { t } from '@lingui/macro'; import { Link } from 'react-router-dom'; import { Button } from '@patternfly/react-core'; import { Tr, Td } from '@patternfly/react-table'; import { PencilAltIcon } from '@patternfly/react-icons'; -import { ActionsTd, ActionItem } from 'components/PaginatedTable'; +import { ActionsTd, ActionItem, TdBreakWord } from 'components/PaginatedTable'; import { CredentialType } from 'types'; function CredentialTypeListItem({ @@ -28,11 +27,11 @@ function CredentialTypeListItem({ }} dataLabel={t`Selected`} /> - + {credentialType.name} - + - + {executionEnvironment.name} - + {executionEnvironment.image} {executionEnvironment.organization ? ( diff --git a/awx/ui/src/screens/Host/HostList/HostListItem.js b/awx/ui/src/screens/Host/HostList/HostListItem.js index 6bf291a979..1ddfdfc855 100644 --- a/awx/ui/src/screens/Host/HostList/HostListItem.js +++ b/awx/ui/src/screens/Host/HostList/HostListItem.js @@ -7,7 +7,7 @@ import { Button } from '@patternfly/react-core'; import { Tr, Td, ExpandableRowContent } from '@patternfly/react-table'; import { Link } from 'react-router-dom'; import { PencilAltIcon } from '@patternfly/react-icons'; -import { ActionsTd, ActionItem } from 'components/PaginatedTable'; +import { ActionsTd, ActionItem, TdBreakWord } from 'components/PaginatedTable'; import { Host } from 'types'; import HostToggle from 'components/HostToggle'; import { DetailList, Detail } from 'components/DetailList'; @@ -47,12 +47,12 @@ function HostListItem({ }} dataLabel={t`Selected`} /> - + {host.name} - - + + {host.summary_fields.inventory && ( )} - + - + {instanceGroup.name} - + {isContainerGroup(instanceGroup) ? t`Container group` diff --git a/awx/ui/src/screens/Inventory/InventoryHosts/InventoryHostItem.js b/awx/ui/src/screens/Inventory/InventoryHosts/InventoryHostItem.js index 52779ca82e..e92bd886e9 100644 --- a/awx/ui/src/screens/Inventory/InventoryHosts/InventoryHostItem.js +++ b/awx/ui/src/screens/Inventory/InventoryHosts/InventoryHostItem.js @@ -5,7 +5,7 @@ import { Button } from '@patternfly/react-core'; import { Tr, Td } from '@patternfly/react-table'; import { Link } from 'react-router-dom'; import { PencilAltIcon } from '@patternfly/react-icons'; -import { ActionsTd, ActionItem } from 'components/PaginatedTable'; +import { ActionsTd, ActionItem, TdBreakWord } from 'components/PaginatedTable'; import HostToggle from 'components/HostToggle'; import { Host } from 'types'; @@ -30,11 +30,11 @@ function InventoryHostItem({ onSelect, }} /> - + {host.name} - + - + {inventory.pending_deletion ? ( {inventory.name} ) : ( @@ -90,7 +89,7 @@ function InventoryListItem({ {inventory.name} )} - + {inventory.kind !== 'smart' && ( @@ -99,13 +98,13 @@ function InventoryListItem({ {inventory.kind === 'smart' ? t`Smart Inventory` : t`Inventory`} - + {inventory?.summary_fields?.organization?.name} - + {inventory.pending_deletion ? ( diff --git a/awx/ui/src/screens/Inventory/InventorySources/InventorySourceListItem.js b/awx/ui/src/screens/Inventory/InventorySources/InventorySourceListItem.js index 21c6fdd90a..9df8993d82 100644 --- a/awx/ui/src/screens/Inventory/InventorySources/InventorySourceListItem.js +++ b/awx/ui/src/screens/Inventory/InventorySources/InventorySourceListItem.js @@ -9,7 +9,7 @@ import { } from '@patternfly/react-icons'; import styled from 'styled-components'; -import { ActionsTd, ActionItem } from 'components/PaginatedTable'; +import { ActionsTd, ActionItem, TdBreakWord } from 'components/PaginatedTable'; import StatusLabel from 'components/StatusLabel'; import JobCancelButton from 'components/JobCancelButton'; import { formatDateString } from 'util/dates'; @@ -67,7 +67,7 @@ function InventorySourceListItem({ onSelect, }} /> - + {source.name} @@ -82,7 +82,7 @@ function InventorySourceListItem({ )} - + {job && ( - + {template.name} - + {status && } diff --git a/awx/ui/src/screens/Organization/OrganizationList/OrganizationListItem.js b/awx/ui/src/screens/Organization/OrganizationList/OrganizationListItem.js index c88344e91f..68071c3c01 100644 --- a/awx/ui/src/screens/Organization/OrganizationList/OrganizationListItem.js +++ b/awx/ui/src/screens/Organization/OrganizationList/OrganizationListItem.js @@ -10,7 +10,7 @@ import { ExclamationTriangleIcon as PFExclamationTriangleIcon, PencilAltIcon, } from '@patternfly/react-icons'; -import { ActionsTd, ActionItem } from 'components/PaginatedTable'; +import { ActionsTd, ActionItem, TdBreakWord } from 'components/PaginatedTable'; import { Organization } from 'types'; @@ -18,6 +18,7 @@ const ExclamationTriangleIcon = styled(PFExclamationTriangleIcon)` color: var(--pf-global--warning-color--100); margin-left: 18px; `; + function OrganizationListItem({ organization, isSelected, @@ -41,7 +42,7 @@ function OrganizationListItem({ }} dataLabel={t`Selected`} /> - + {organization.name} @@ -58,7 +59,7 @@ function OrganizationListItem({ )} - + {organization.summary_fields.related_field_counts.users} diff --git a/awx/ui/src/screens/Project/ProjectList/ProjectListItem.js b/awx/ui/src/screens/Project/ProjectList/ProjectListItem.js index fff07c9110..47d65a4fcc 100644 --- a/awx/ui/src/screens/Project/ProjectList/ProjectListItem.js +++ b/awx/ui/src/screens/Project/ProjectList/ProjectListItem.js @@ -11,7 +11,7 @@ import { UndoIcon, } from '@patternfly/react-icons'; import styled from 'styled-components'; -import { ActionsTd, ActionItem } from 'components/PaginatedTable'; +import { ActionsTd, ActionItem, TdBreakWord } from 'components/PaginatedTable'; import { formatDateString, timeOfDay } from 'util/dates'; import { ProjectsAPI } from 'api'; import { DetailList, Detail, DeletedDetail } from 'components/DetailList'; @@ -171,7 +171,7 @@ function ProjectListItem({ }} dataLabel={t`Selected`} /> - + {project.name} @@ -188,7 +188,7 @@ function ProjectListItem({ )} - + {job && ( - + {team.name} - - + + {team.summary_fields.organization && ( {team.summary_fields.organization.name} )} - + - + {user.username} @@ -49,7 +49,7 @@ function UserListItem({ user, isSelected, onSelect, detailUrl, rowIndex }) { )} - + {user.first_name && <>{user.first_name}}