diff --git a/awx/ui_next/src/screens/Template/TemplateList/TemplateList.jsx b/awx/ui_next/src/screens/Template/TemplateList/TemplateList.jsx index 68efedd2de..82a2dffcf4 100644 --- a/awx/ui_next/src/screens/Template/TemplateList/TemplateList.jsx +++ b/awx/ui_next/src/screens/Template/TemplateList/TemplateList.jsx @@ -11,9 +11,11 @@ import { import AlertModal from '../../../components/AlertModal'; import DatalistToolbar from '../../../components/DataListToolbar'; import ErrorDetail from '../../../components/ErrorDetail'; -import PaginatedDataList, { - ToolbarDeleteButton, -} from '../../../components/PaginatedDataList'; +import { ToolbarDeleteButton } from '../../../components/PaginatedDataList'; +import PaginatedTable, { + HeaderRow, + HeaderCell, +} from '../../../components/PaginatedTable'; import useRequest, { useDeleteItems } from '../../../util/useRequest'; import { getQSConfig, parseQueryString } from '../../../util/qs'; import useWsTemplates from '../../../util/useWsTemplates'; @@ -167,7 +169,7 @@ function TemplateList({ i18n }) { return ( - + {i18n._(t`Name`)} + {i18n._(t`Type`)} + + {i18n._(t`Recent Jobs`)} + + + } renderToolbar={props => ( )} - renderItem={template => ( + renderRow={(template, index) => ( handleSelect(template)} isSelected={selected.some(row => row.id === template.id)} fetchTemplates={fetchTemplates} + rowIndex={index} /> )} emptyStateControls={(canAddJT || canAddWFJT) && addButton} diff --git a/awx/ui_next/src/screens/Template/TemplateList/TemplateListItem.jsx b/awx/ui_next/src/screens/Template/TemplateList/TemplateListItem.jsx index 057178f656..6481f7072d 100644 --- a/awx/ui_next/src/screens/Template/TemplateList/TemplateListItem.jsx +++ b/awx/ui_next/src/screens/Template/TemplateList/TemplateListItem.jsx @@ -1,15 +1,8 @@ import 'styled-components/macro'; import React, { useState, useCallback } from 'react'; import { Link } from 'react-router-dom'; -import { - Button, - DataListAction as _DataListAction, - DataListCheck, - DataListItem, - DataListItemRow, - DataListItemCells, - Tooltip, -} from '@patternfly/react-core'; +import { Button, Tooltip } from '@patternfly/react-core'; +import { Tr, Td } from '@patternfly/react-table'; import { t } from '@lingui/macro'; import { withI18n } from '@lingui/react'; import { @@ -18,9 +11,7 @@ import { ProjectDiagramIcon, RocketIcon, } from '@patternfly/react-icons'; -import styled from 'styled-components'; -import DataListCell from '../../../components/DataListCell'; - +import { ActionsTd, ActionItem } from '../../../components/PaginatedTable'; import { timeOfDay } from '../../../util/dates'; import { JobTemplatesAPI, WorkflowJobTemplatesAPI } from '../../../api'; @@ -29,13 +20,6 @@ import Sparkline from '../../../components/Sparkline'; import { toTitleCase } from '../../../util/strings'; import CopyButton from '../../../components/CopyButton'; -const DataListAction = styled(_DataListAction)` - align-items: center; - display: grid; - grid-gap: 16px; - grid-template-columns: repeat(4, 40px); -`; - function TemplateListItem({ i18n, template, @@ -43,6 +27,7 @@ function TemplateListItem({ onSelect, detailUrl, fetchTemplates, + rowIndex, }) { const [isDisabled, setIsDisabled] = useState(false); const labelId = `check-action-${template.id}`; @@ -74,108 +59,96 @@ function TemplateListItem({ (!template.summary_fields.inventory && !template.ask_inventory_on_launch)); return ( - - - - - - - {template.name} - - - {missingResourceIcon && ( - - - - - - )} - , - - {toTitleCase(template.type)} - , - - - , - ]} - /> - + + + + {template.name} + + {missingResourceIcon && ( + + + + + + )} + + {toTitleCase(template.type)} + + + + + - {template.type === 'workflow_job_template' && ( - + + + + + {({ handleLaunch }) => ( - - )} - {template.summary_fields.user_capabilities.start && ( - - - {({ handleLaunch }) => ( - - )} - - - )} - {template.summary_fields.user_capabilities.edit && ( - - - - )} - {template.summary_fields.user_capabilities.copy && ( - - )} - - - + )} + + + + + + + + + + ); }