mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 14:27:42 -02:30
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:
@@ -3,7 +3,6 @@ import { useLocation } from 'react-router-dom';
|
|||||||
import { withI18n } from '@lingui/react';
|
import { withI18n } from '@lingui/react';
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import { SchedulesAPI } from '@api';
|
import { SchedulesAPI } from '@api';
|
||||||
import { Card, PageSection } from '@patternfly/react-core';
|
|
||||||
import AlertModal from '@components/AlertModal';
|
import AlertModal from '@components/AlertModal';
|
||||||
import ErrorDetail from '@components/ErrorDetail';
|
import ErrorDetail from '@components/ErrorDetail';
|
||||||
import DataListToolbar from '@components/DataListToolbar';
|
import DataListToolbar from '@components/DataListToolbar';
|
||||||
@@ -86,63 +85,61 @@ function ScheduleList({ i18n, loadSchedules }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageSection>
|
<>
|
||||||
<Card>
|
<PaginatedDataList
|
||||||
<PaginatedDataList
|
contentError={contentError}
|
||||||
contentError={contentError}
|
hasContentLoading={isLoading || isDeleteLoading}
|
||||||
hasContentLoading={isLoading || isDeleteLoading}
|
items={schedules}
|
||||||
items={schedules}
|
itemCount={itemCount}
|
||||||
itemCount={itemCount}
|
qsConfig={QS_CONFIG}
|
||||||
qsConfig={QS_CONFIG}
|
onRowClick={handleSelect}
|
||||||
onRowClick={handleSelect}
|
renderItem={item => (
|
||||||
renderItem={item => (
|
<ScheduleListItem
|
||||||
<ScheduleListItem
|
isSelected={selected.some(row => row.id === item.id)}
|
||||||
isSelected={selected.some(row => row.id === item.id)}
|
key={item.id}
|
||||||
key={item.id}
|
onSelect={() => handleSelect(item)}
|
||||||
onSelect={() => handleSelect(item)}
|
schedule={item}
|
||||||
schedule={item}
|
/>
|
||||||
/>
|
)}
|
||||||
)}
|
toolbarSearchColumns={[
|
||||||
toolbarSearchColumns={[
|
{
|
||||||
{
|
name: i18n._(t`Name`),
|
||||||
name: i18n._(t`Name`),
|
key: 'name',
|
||||||
key: 'name',
|
isDefault: true,
|
||||||
isDefault: true,
|
},
|
||||||
},
|
]}
|
||||||
]}
|
toolbarSortColumns={[
|
||||||
toolbarSortColumns={[
|
{
|
||||||
{
|
name: i18n._(t`Name`),
|
||||||
name: i18n._(t`Name`),
|
key: 'name',
|
||||||
key: 'name',
|
},
|
||||||
},
|
{
|
||||||
{
|
name: i18n._(t`Next Run`),
|
||||||
name: i18n._(t`Next Run`),
|
key: 'next_run',
|
||||||
key: 'next_run',
|
},
|
||||||
},
|
{
|
||||||
{
|
name: i18n._(t`Type`),
|
||||||
name: i18n._(t`Type`),
|
key: 'unified_job_template__polymorphic_ctype__model',
|
||||||
key: 'unified_job_template__polymorphic_ctype__model',
|
},
|
||||||
},
|
]}
|
||||||
]}
|
renderToolbar={props => (
|
||||||
renderToolbar={props => (
|
<DataListToolbar
|
||||||
<DataListToolbar
|
{...props}
|
||||||
{...props}
|
showSelectAll
|
||||||
showSelectAll
|
isAllSelected={isAllSelected}
|
||||||
isAllSelected={isAllSelected}
|
onSelectAll={handleSelectAll}
|
||||||
onSelectAll={handleSelectAll}
|
qsConfig={QS_CONFIG}
|
||||||
qsConfig={QS_CONFIG}
|
additionalControls={[
|
||||||
additionalControls={[
|
<ToolbarDeleteButton
|
||||||
<ToolbarDeleteButton
|
key="delete"
|
||||||
key="delete"
|
onDelete={handleDelete}
|
||||||
onDelete={handleDelete}
|
itemsToDelete={selected}
|
||||||
itemsToDelete={selected}
|
pluralizedItemName={i18n._(t`Schedules`)}
|
||||||
pluralizedItemName={i18n._(t`Schedules`)}
|
/>,
|
||||||
/>,
|
]}
|
||||||
]}
|
/>
|
||||||
/>
|
)}
|
||||||
)}
|
/>
|
||||||
/>
|
|
||||||
</Card>
|
|
||||||
{deletionError && (
|
{deletionError && (
|
||||||
<AlertModal
|
<AlertModal
|
||||||
isOpen={deletionError}
|
isOpen={deletionError}
|
||||||
@@ -154,7 +151,7 @@ function ScheduleList({ i18n, loadSchedules }) {
|
|||||||
<ErrorDetail error={deletionError} />
|
<ErrorDetail error={deletionError} />
|
||||||
</AlertModal>
|
</AlertModal>
|
||||||
)}
|
)}
|
||||||
</PageSection>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { t } from '@lingui/macro';
|
|||||||
import Breadcrumbs from '@components/Breadcrumbs';
|
import Breadcrumbs from '@components/Breadcrumbs';
|
||||||
import ScheduleList from '@components/ScheduleList';
|
import ScheduleList from '@components/ScheduleList';
|
||||||
import { SchedulesAPI } from '@api';
|
import { SchedulesAPI } from '@api';
|
||||||
|
import { PageSection, Card } from '@patternfly/react-core';
|
||||||
|
|
||||||
function Schedules({ i18n }) {
|
function Schedules({ i18n }) {
|
||||||
const loadSchedules = params => {
|
const loadSchedules = params => {
|
||||||
@@ -21,7 +22,11 @@ function Schedules({ i18n }) {
|
|||||||
/>
|
/>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path="/schedules">
|
<Route path="/schedules">
|
||||||
<ScheduleList loadSchedules={loadSchedules} />
|
<PageSection>
|
||||||
|
<Card>
|
||||||
|
<ScheduleList loadSchedules={loadSchedules} />
|
||||||
|
</Card>
|
||||||
|
</PageSection>
|
||||||
</Route>
|
</Route>
|
||||||
</Switch>
|
</Switch>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -112,10 +112,6 @@ class Template extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tabsArray.push(
|
tabsArray.push(
|
||||||
{
|
|
||||||
name: i18n._(t`Schedules`),
|
|
||||||
link: '/home',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: i18n._(t`Completed Jobs`),
|
name: i18n._(t`Completed Jobs`),
|
||||||
link: `${match.url}/completed_jobs`,
|
link: `${match.url}/completed_jobs`,
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ describe('<Template />', () => {
|
|||||||
const tabs = await waitForElement(
|
const tabs = await waitForElement(
|
||||||
wrapper,
|
wrapper,
|
||||||
'.pf-c-tabs__item',
|
'.pf-c-tabs__item',
|
||||||
el => el.length === 7
|
el => el.length === 6
|
||||||
);
|
);
|
||||||
expect(tabs.at(2).text()).toEqual('Notifications');
|
expect(tabs.at(2).text()).toEqual('Notifications');
|
||||||
done();
|
done();
|
||||||
|
|||||||
Reference in New Issue
Block a user