assorted schedule list fixes:

- remove pagesection and card from component...move to where called for root list
- remove unnecessary placeholder schedule tab on job template detail
This commit is contained in:
John Mitchell 2020-03-02 10:00:27 -05:00
parent 5fdf6cf60f
commit b57405b696
4 changed files with 63 additions and 65 deletions

View File

@ -3,7 +3,6 @@ import { useLocation } from 'react-router-dom';
import { withI18n } from '@lingui/react';
import { t } from '@lingui/macro';
import { SchedulesAPI } from '@api';
import { Card, PageSection } from '@patternfly/react-core';
import AlertModal from '@components/AlertModal';
import ErrorDetail from '@components/ErrorDetail';
import DataListToolbar from '@components/DataListToolbar';
@ -86,63 +85,61 @@ function ScheduleList({ i18n, loadSchedules }) {
};
return (
<PageSection>
<Card>
<PaginatedDataList
contentError={contentError}
hasContentLoading={isLoading || isDeleteLoading}
items={schedules}
itemCount={itemCount}
qsConfig={QS_CONFIG}
onRowClick={handleSelect}
renderItem={item => (
<ScheduleListItem
isSelected={selected.some(row => row.id === item.id)}
key={item.id}
onSelect={() => handleSelect(item)}
schedule={item}
/>
)}
toolbarSearchColumns={[
{
name: i18n._(t`Name`),
key: 'name',
isDefault: true,
},
]}
toolbarSortColumns={[
{
name: i18n._(t`Name`),
key: 'name',
},
{
name: i18n._(t`Next Run`),
key: 'next_run',
},
{
name: i18n._(t`Type`),
key: 'unified_job_template__polymorphic_ctype__model',
},
]}
renderToolbar={props => (
<DataListToolbar
{...props}
showSelectAll
isAllSelected={isAllSelected}
onSelectAll={handleSelectAll}
qsConfig={QS_CONFIG}
additionalControls={[
<ToolbarDeleteButton
key="delete"
onDelete={handleDelete}
itemsToDelete={selected}
pluralizedItemName={i18n._(t`Schedules`)}
/>,
]}
/>
)}
/>
</Card>
<>
<PaginatedDataList
contentError={contentError}
hasContentLoading={isLoading || isDeleteLoading}
items={schedules}
itemCount={itemCount}
qsConfig={QS_CONFIG}
onRowClick={handleSelect}
renderItem={item => (
<ScheduleListItem
isSelected={selected.some(row => row.id === item.id)}
key={item.id}
onSelect={() => handleSelect(item)}
schedule={item}
/>
)}
toolbarSearchColumns={[
{
name: i18n._(t`Name`),
key: 'name',
isDefault: true,
},
]}
toolbarSortColumns={[
{
name: i18n._(t`Name`),
key: 'name',
},
{
name: i18n._(t`Next Run`),
key: 'next_run',
},
{
name: i18n._(t`Type`),
key: 'unified_job_template__polymorphic_ctype__model',
},
]}
renderToolbar={props => (
<DataListToolbar
{...props}
showSelectAll
isAllSelected={isAllSelected}
onSelectAll={handleSelectAll}
qsConfig={QS_CONFIG}
additionalControls={[
<ToolbarDeleteButton
key="delete"
onDelete={handleDelete}
itemsToDelete={selected}
pluralizedItemName={i18n._(t`Schedules`)}
/>,
]}
/>
)}
/>
{deletionError && (
<AlertModal
isOpen={deletionError}
@ -154,7 +151,7 @@ function ScheduleList({ i18n, loadSchedules }) {
<ErrorDetail error={deletionError} />
</AlertModal>
)}
</PageSection>
</>
);
}

View File

@ -6,6 +6,7 @@ import { t } from '@lingui/macro';
import Breadcrumbs from '@components/Breadcrumbs';
import ScheduleList from '@components/ScheduleList';
import { SchedulesAPI } from '@api';
import { PageSection, Card } from '@patternfly/react-core';
function Schedules({ i18n }) {
const loadSchedules = params => {
@ -21,7 +22,11 @@ function Schedules({ i18n }) {
/>
<Switch>
<Route path="/schedules">
<ScheduleList loadSchedules={loadSchedules} />
<PageSection>
<Card>
<ScheduleList loadSchedules={loadSchedules} />
</Card>
</PageSection>
</Route>
</Switch>
</>

View File

@ -112,10 +112,6 @@ class Template extends Component {
}
tabsArray.push(
{
name: i18n._(t`Schedules`),
link: '/home',
},
{
name: i18n._(t`Completed Jobs`),
link: `${match.url}/completed_jobs`,

View File

@ -61,7 +61,7 @@ describe('<Template />', () => {
const tabs = await waitForElement(
wrapper,
'.pf-c-tabs__item',
el => el.length === 7
el => el.length === 6
);
expect(tabs.at(2).text()).toEqual('Notifications');
done();