From e706e0a2e2ce6168ba371a1de8c64bc7abcf49d5 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 27 Feb 2020 12:37:37 -0500 Subject: [PATCH 1/6] update directory structure of schedule list files --- .../Schedule => components}/ScheduleList/ScheduleList.jsx | 2 +- .../Schedule => components}/ScheduleList/ScheduleList.test.jsx | 2 +- .../Schedule => components}/ScheduleList/ScheduleListItem.jsx | 2 +- .../ScheduleList/ScheduleListItem.test.jsx | 0 .../shared => components/ScheduleList}/ScheduleToggle.jsx | 0 .../shared => components/ScheduleList}/ScheduleToggle.test.jsx | 0 .../Schedule => components/ScheduleList}/data.schedules.json | 0 awx/ui_next/src/components/ScheduleList/index.js | 1 + awx/ui_next/src/screens/Schedule/ScheduleList/index.js | 2 -- awx/ui_next/src/screens/Schedule/Schedules.jsx | 2 +- 10 files changed, 5 insertions(+), 6 deletions(-) rename awx/ui_next/src/{screens/Schedule => components}/ScheduleList/ScheduleList.jsx (98%) rename awx/ui_next/src/{screens/Schedule => components}/ScheduleList/ScheduleList.test.jsx (98%) rename awx/ui_next/src/{screens/Schedule => components}/ScheduleList/ScheduleListItem.jsx (98%) rename awx/ui_next/src/{screens/Schedule => components}/ScheduleList/ScheduleListItem.test.jsx (100%) rename awx/ui_next/src/{screens/Schedule/shared => components/ScheduleList}/ScheduleToggle.jsx (100%) rename awx/ui_next/src/{screens/Schedule/shared => components/ScheduleList}/ScheduleToggle.test.jsx (100%) rename awx/ui_next/src/{screens/Schedule => components/ScheduleList}/data.schedules.json (100%) create mode 100644 awx/ui_next/src/components/ScheduleList/index.js delete mode 100644 awx/ui_next/src/screens/Schedule/ScheduleList/index.js diff --git a/awx/ui_next/src/screens/Schedule/ScheduleList/ScheduleList.jsx b/awx/ui_next/src/components/ScheduleList/ScheduleList.jsx similarity index 98% rename from awx/ui_next/src/screens/Schedule/ScheduleList/ScheduleList.jsx rename to awx/ui_next/src/components/ScheduleList/ScheduleList.jsx index 2c1197e7c7..8f8fef3c63 100644 --- a/awx/ui_next/src/screens/Schedule/ScheduleList/ScheduleList.jsx +++ b/awx/ui_next/src/components/ScheduleList/ScheduleList.jsx @@ -12,7 +12,7 @@ import PaginatedDataList, { } from '@components/PaginatedDataList'; import useRequest, { useDeleteItems } from '@util/useRequest'; import { getQSConfig, parseQueryString } from '@util/qs'; -import { ScheduleListItem } from '.'; +import ScheduleListItem from './ScheduleListItem'; const QS_CONFIG = getQSConfig('schedule', { page: 1, diff --git a/awx/ui_next/src/screens/Schedule/ScheduleList/ScheduleList.test.jsx b/awx/ui_next/src/components/ScheduleList/ScheduleList.test.jsx similarity index 98% rename from awx/ui_next/src/screens/Schedule/ScheduleList/ScheduleList.test.jsx rename to awx/ui_next/src/components/ScheduleList/ScheduleList.test.jsx index 706f5f1bca..1528f7888a 100644 --- a/awx/ui_next/src/screens/Schedule/ScheduleList/ScheduleList.test.jsx +++ b/awx/ui_next/src/components/ScheduleList/ScheduleList.test.jsx @@ -3,7 +3,7 @@ import { act } from 'react-dom/test-utils'; import { mountWithContexts } from '@testUtils/enzymeHelpers'; import { SchedulesAPI } from '@api'; import ScheduleList from './ScheduleList'; -import mockSchedules from '../data.schedules.json'; +import mockSchedules from './data.schedules.json'; jest.mock('@api/models/Schedules'); diff --git a/awx/ui_next/src/screens/Schedule/ScheduleList/ScheduleListItem.jsx b/awx/ui_next/src/components/ScheduleList/ScheduleListItem.jsx similarity index 98% rename from awx/ui_next/src/screens/Schedule/ScheduleList/ScheduleListItem.jsx rename to awx/ui_next/src/components/ScheduleList/ScheduleListItem.jsx index 7d34f8b52d..980cecfac5 100644 --- a/awx/ui_next/src/screens/Schedule/ScheduleList/ScheduleListItem.jsx +++ b/awx/ui_next/src/components/ScheduleList/ScheduleListItem.jsx @@ -18,7 +18,7 @@ import { DetailList, Detail } from '@components/DetailList'; import styled from 'styled-components'; import { Schedule } from '@types'; import { formatDateString } from '@util/dates'; -import ScheduleToggle from '../shared/ScheduleToggle'; +import ScheduleToggle from './ScheduleToggle'; const DataListAction = styled(_DataListAction)` align-items: center; diff --git a/awx/ui_next/src/screens/Schedule/ScheduleList/ScheduleListItem.test.jsx b/awx/ui_next/src/components/ScheduleList/ScheduleListItem.test.jsx similarity index 100% rename from awx/ui_next/src/screens/Schedule/ScheduleList/ScheduleListItem.test.jsx rename to awx/ui_next/src/components/ScheduleList/ScheduleListItem.test.jsx diff --git a/awx/ui_next/src/screens/Schedule/shared/ScheduleToggle.jsx b/awx/ui_next/src/components/ScheduleList/ScheduleToggle.jsx similarity index 100% rename from awx/ui_next/src/screens/Schedule/shared/ScheduleToggle.jsx rename to awx/ui_next/src/components/ScheduleList/ScheduleToggle.jsx diff --git a/awx/ui_next/src/screens/Schedule/shared/ScheduleToggle.test.jsx b/awx/ui_next/src/components/ScheduleList/ScheduleToggle.test.jsx similarity index 100% rename from awx/ui_next/src/screens/Schedule/shared/ScheduleToggle.test.jsx rename to awx/ui_next/src/components/ScheduleList/ScheduleToggle.test.jsx diff --git a/awx/ui_next/src/screens/Schedule/data.schedules.json b/awx/ui_next/src/components/ScheduleList/data.schedules.json similarity index 100% rename from awx/ui_next/src/screens/Schedule/data.schedules.json rename to awx/ui_next/src/components/ScheduleList/data.schedules.json diff --git a/awx/ui_next/src/components/ScheduleList/index.js b/awx/ui_next/src/components/ScheduleList/index.js new file mode 100644 index 0000000000..35e4093cba --- /dev/null +++ b/awx/ui_next/src/components/ScheduleList/index.js @@ -0,0 +1 @@ +export { default } from './ScheduleList'; diff --git a/awx/ui_next/src/screens/Schedule/ScheduleList/index.js b/awx/ui_next/src/screens/Schedule/ScheduleList/index.js deleted file mode 100644 index 4f6af384b5..0000000000 --- a/awx/ui_next/src/screens/Schedule/ScheduleList/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default as ScheduleList } from './ScheduleList'; -export { default as ScheduleListItem } from './ScheduleListItem'; diff --git a/awx/ui_next/src/screens/Schedule/Schedules.jsx b/awx/ui_next/src/screens/Schedule/Schedules.jsx index 930b115ecd..5e77596993 100644 --- a/awx/ui_next/src/screens/Schedule/Schedules.jsx +++ b/awx/ui_next/src/screens/Schedule/Schedules.jsx @@ -4,7 +4,7 @@ import { withI18n } from '@lingui/react'; import { t } from '@lingui/macro'; import Breadcrumbs from '@components/Breadcrumbs'; -import { ScheduleList } from './ScheduleList'; +import ScheduleList from '@components/ScheduleList'; function Schedules({ i18n }) { return ( From 4db3e823bfcebb4fb0b4ef75073a1becfa6be430 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 27 Feb 2020 15:05:46 -0500 Subject: [PATCH 2/6] add schedule list to proj, jt and wfjt --- awx/ui_next/src/api/models/JobTemplates.js | 4 +++ awx/ui_next/src/api/models/Projects.js | 4 +++ .../src/api/models/WorkflowJobTemplates.js | 4 +++ .../components/ScheduleList/ScheduleList.jsx | 9 +++-- awx/ui_next/src/screens/Project/Project.jsx | 33 +++++++++++-------- awx/ui_next/src/screens/Template/Template.jsx | 16 +++++++++ .../src/screens/Template/Template.test.jsx | 2 +- .../screens/Template/WorkflowJobTemplate.jsx | 19 +++++++++++ 8 files changed, 74 insertions(+), 17 deletions(-) diff --git a/awx/ui_next/src/api/models/JobTemplates.js b/awx/ui_next/src/api/models/JobTemplates.js index 58060371df..ef615a65f6 100644 --- a/awx/ui_next/src/api/models/JobTemplates.js +++ b/awx/ui_next/src/api/models/JobTemplates.js @@ -61,6 +61,10 @@ class JobTemplates extends InstanceGroupsMixin(NotificationsMixin(Base)) { params, }); } + + readScheduleList(id, params) { + return this.http.get(`${this.baseUrl}${id}/schedules/`, { params }); + } } export default JobTemplates; diff --git a/awx/ui_next/src/api/models/Projects.js b/awx/ui_next/src/api/models/Projects.js index 742150e5aa..3a4049f9f8 100644 --- a/awx/ui_next/src/api/models/Projects.js +++ b/awx/ui_next/src/api/models/Projects.js @@ -21,6 +21,10 @@ class Projects extends LaunchUpdateMixin(NotificationsMixin(Base)) { return this.http.get(`${this.baseUrl}${id}/playbooks/`); } + readScheduleList(id, params) { + return this.http.get(`${this.baseUrl}${id}/schedules/`, { params }); + } + readSync(id) { return this.http.get(`${this.baseUrl}${id}/update/`); } diff --git a/awx/ui_next/src/api/models/WorkflowJobTemplates.js b/awx/ui_next/src/api/models/WorkflowJobTemplates.js index 45b6f6539f..691c444379 100644 --- a/awx/ui_next/src/api/models/WorkflowJobTemplates.js +++ b/awx/ui_next/src/api/models/WorkflowJobTemplates.js @@ -27,6 +27,10 @@ class WorkflowJobTemplates extends Base { createNode(id, data) { return this.http.post(`${this.baseUrl}${id}/workflow_nodes/`, data); } + + readScheduleList(id, params) { + return this.http.get(`${this.baseUrl}${id}/schedules/`, { params }); + } } export default WorkflowJobTemplates; diff --git a/awx/ui_next/src/components/ScheduleList/ScheduleList.jsx b/awx/ui_next/src/components/ScheduleList/ScheduleList.jsx index 8f8fef3c63..51930a3a39 100644 --- a/awx/ui_next/src/components/ScheduleList/ScheduleList.jsx +++ b/awx/ui_next/src/components/ScheduleList/ScheduleList.jsx @@ -20,7 +20,7 @@ const QS_CONFIG = getQSConfig('schedule', { order_by: 'unified_job_template__polymorphic_ctype__model', }); -function ScheduleList({ i18n }) { +function ScheduleList({ i18n, apiModel, resource }) { const [selected, setSelected] = useState([]); const location = useLocation(); @@ -33,14 +33,17 @@ function ScheduleList({ i18n }) { } = useRequest( useCallback(async () => { const params = parseQueryString(QS_CONFIG, location.search); + const response = apiModel + ? apiModel.readScheduleList(resource.id, params) + : SchedulesAPI.read(params); const { data: { count, results }, - } = await SchedulesAPI.read(params); + } = await response; return { itemCount: count, schedules: results, }; - }, [location]), + }, [location, apiModel, resource]), { schedules: [], itemCount: 0, diff --git a/awx/ui_next/src/screens/Project/Project.jsx b/awx/ui_next/src/screens/Project/Project.jsx index 65b4560459..e882a8a594 100644 --- a/awx/ui_next/src/screens/Project/Project.jsx +++ b/awx/ui_next/src/screens/Project/Project.jsx @@ -9,10 +9,10 @@ import RoutedTabs from '@components/RoutedTabs'; import ContentError from '@components/ContentError'; import NotificationList from '@components/NotificationList'; import { ResourceAccessList } from '@components/ResourceAccessList'; +import ScheduleList from '@components/ScheduleList'; import ProjectDetail from './ProjectDetail'; import ProjectEdit from './ProjectEdit'; import ProjectJobTemplatesList from './ProjectJobTemplatesList'; -import ProjectSchedules from './ProjectSchedules'; import { OrganizationsAPI, ProjectsAPI } from '@api'; class Project extends Component { @@ -134,16 +134,17 @@ class Project extends Component { }); } - tabsArray.push( - { - name: i18n._(t`Job Templates`), - link: `${match.url}/job_templates`, - }, - { + tabsArray.push({ + name: i18n._(t`Job Templates`), + link: `${match.url}/job_templates`, + }); + + if (project?.scm_type && project.scm_type !== '') { + tabsArray.push({ name: i18n._(t`Schedules`), link: `${match.url}/schedules`, - } - ); + }); + } tabsArray.forEach((tab, n) => { tab.id = n; @@ -183,6 +184,8 @@ class Project extends Component { ); } + console.log(project); + return ( @@ -230,10 +233,14 @@ class Project extends Component { )} /> - } - /> + {project?.scm_type && project.scm_type !== '' && ( + ( + + )} + /> + )} { tab.id = n; }); @@ -210,6 +218,14 @@ class Template extends Component { )} + {template && ( + ( + + )} + /> + )} ', () => { const tabs = await waitForElement( wrapper, '.pf-c-tabs__item', - el => el.length === 6 + el => el.length === 7 ); expect(tabs.at(2).text()).toEqual('Notifications'); done(); diff --git a/awx/ui_next/src/screens/Template/WorkflowJobTemplate.jsx b/awx/ui_next/src/screens/Template/WorkflowJobTemplate.jsx index 977ac4f6f7..c93bcb9481 100644 --- a/awx/ui_next/src/screens/Template/WorkflowJobTemplate.jsx +++ b/awx/ui_next/src/screens/Template/WorkflowJobTemplate.jsx @@ -10,6 +10,7 @@ import ContentError from '@components/ContentError'; import FullPage from '@components/FullPage'; import JobList from '@components/JobList'; import RoutedTabs from '@components/RoutedTabs'; +import ScheduleList from '@components/ScheduleList'; import { WorkflowJobTemplatesAPI, CredentialsAPI } from '@api'; import WorkflowJobTemplateDetail from './WorkflowJobTemplateDetail'; import { Visualizer } from './WorkflowJobTemplateVisualizer'; @@ -85,6 +86,13 @@ class WorkflowJobTemplate extends Component { { name: i18n._(t`Completed Jobs`), link: `${match.url}/completed_jobs` }, ]; + if (template) { + tabsArray.push({ + name: i18n._(t`Schedules`), + link: `${match.url}/schedules`, + }); + } + tabsArray.forEach((tab, n) => { tab.id = n; }); @@ -162,6 +170,17 @@ class WorkflowJobTemplate extends Component { /> )} + {template && ( + ( + + )} + /> + )} Date: Thu, 27 Feb 2020 15:20:50 -0500 Subject: [PATCH 3/6] add test for conditional show/hide of schedules tab for project detail view --- awx/ui_next/src/screens/Project/Project.jsx | 2 - .../src/screens/Project/Project.test.jsx | 43 +++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/awx/ui_next/src/screens/Project/Project.jsx b/awx/ui_next/src/screens/Project/Project.jsx index e882a8a594..50b8bfcb03 100644 --- a/awx/ui_next/src/screens/Project/Project.jsx +++ b/awx/ui_next/src/screens/Project/Project.jsx @@ -184,8 +184,6 @@ class Project extends Component { ); } - console.log(project); - return ( diff --git a/awx/ui_next/src/screens/Project/Project.test.jsx b/awx/ui_next/src/screens/Project/Project.test.jsx index 264e111dfa..f4926be0fd 100644 --- a/awx/ui_next/src/screens/Project/Project.test.jsx +++ b/awx/ui_next/src/screens/Project/Project.test.jsx @@ -68,6 +68,49 @@ describe('', () => { done(); }); + test('schedules tab shown for scm based projects.', async done => { + ProjectsAPI.readDetail.mockResolvedValue({ data: mockDetails }); + OrganizationsAPI.read.mockResolvedValue({ + count: 0, + next: null, + previous: null, + data: { results: [] }, + }); + + const wrapper = mountWithContexts( + {}} me={mockMe} /> + ); + const tabs = await waitForElement( + wrapper, + '.pf-c-tabs__item', + el => el.length === 4 + ); + expect(tabs.at(3).text()).toEqual('Schedules'); + done(); + }); + + test('schedules tab hidden for manual projects.', async done => { + const manualDetails = Object.assign(mockDetails, { scm_type: '' }); + ProjectsAPI.readDetail.mockResolvedValue({ data: manualDetails }); + OrganizationsAPI.read.mockResolvedValue({ + count: 0, + next: null, + previous: null, + data: { results: [] }, + }); + + const wrapper = mountWithContexts( + {}} me={mockMe} /> + ); + const tabs = await waitForElement( + wrapper, + '.pf-c-tabs__item', + el => el.length === 3 + ); + tabs.forEach(tab => expect(tab.text()).not.toEqual('Schedules')); + done(); + }); + test('should show content error when user attempts to navigate to erroneous route', async () => { const history = createMemoryHistory({ initialEntries: ['/projects/1/foobar'], From c1c382a941003571c10dda77095a1cfd3bb1ba56 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Mon, 2 Mar 2020 09:22:32 -0500 Subject: [PATCH 4/6] update ScheduleList api read to single prop --- .../src/components/ScheduleList/ScheduleList.jsx | 13 ++++--------- .../components/ScheduleList/ScheduleList.test.jsx | 5 ++++- awx/ui_next/src/screens/Project/Project.jsx | 8 +++++++- awx/ui_next/src/screens/Schedule/Schedules.jsx | 7 ++++++- awx/ui_next/src/screens/Template/Template.jsx | 10 +++++++--- .../src/screens/Template/WorkflowJobTemplate.jsx | 13 +++++++------ 6 files changed, 35 insertions(+), 21 deletions(-) diff --git a/awx/ui_next/src/components/ScheduleList/ScheduleList.jsx b/awx/ui_next/src/components/ScheduleList/ScheduleList.jsx index 51930a3a39..e062fb0f75 100644 --- a/awx/ui_next/src/components/ScheduleList/ScheduleList.jsx +++ b/awx/ui_next/src/components/ScheduleList/ScheduleList.jsx @@ -20,7 +20,7 @@ const QS_CONFIG = getQSConfig('schedule', { order_by: 'unified_job_template__polymorphic_ctype__model', }); -function ScheduleList({ i18n, apiModel, resource }) { +function ScheduleList({ i18n, loadSchedules }) { const [selected, setSelected] = useState([]); const location = useLocation(); @@ -33,17 +33,12 @@ function ScheduleList({ i18n, apiModel, resource }) { } = useRequest( useCallback(async () => { const params = parseQueryString(QS_CONFIG, location.search); - const response = apiModel - ? apiModel.readScheduleList(resource.id, params) - : SchedulesAPI.read(params); + const response = loadSchedules(params); const { data: { count, results }, } = await response; - return { - itemCount: count, - schedules: results, - }; - }, [location, apiModel, resource]), + return { itemCount: count, schedules: results }; + }, [location, loadSchedules]), { schedules: [], itemCount: 0, diff --git a/awx/ui_next/src/components/ScheduleList/ScheduleList.test.jsx b/awx/ui_next/src/components/ScheduleList/ScheduleList.test.jsx index 1528f7888a..c257c47c45 100644 --- a/awx/ui_next/src/components/ScheduleList/ScheduleList.test.jsx +++ b/awx/ui_next/src/components/ScheduleList/ScheduleList.test.jsx @@ -22,8 +22,11 @@ describe('ScheduleList', () => { describe('read call successful', () => { beforeAll(async () => { SchedulesAPI.read.mockResolvedValue({ data: mockSchedules }); + const loadSchedules = params => SchedulesAPI.read(params); await act(async () => { - wrapper = mountWithContexts(); + wrapper = mountWithContexts( + + ); }); wrapper.update(); }); diff --git a/awx/ui_next/src/screens/Project/Project.jsx b/awx/ui_next/src/screens/Project/Project.jsx index 50b8bfcb03..83c297c071 100644 --- a/awx/ui_next/src/screens/Project/Project.jsx +++ b/awx/ui_next/src/screens/Project/Project.jsx @@ -30,6 +30,7 @@ class Project extends Component { }; this.loadProject = this.loadProject.bind(this); this.loadProjectAndRoles = this.loadProjectAndRoles.bind(this); + this.loadSchedules = this.loadSchedules.bind(this); } async componentDidMount() { @@ -103,6 +104,11 @@ class Project extends Component { } } + loadSchedules(params) { + const { project } = this.state; + return ProjectsAPI.readScheduleList(project.id, params); + } + render() { const { location, match, me, i18n } = this.props; @@ -235,7 +241,7 @@ class Project extends Component { ( - + )} /> )} diff --git a/awx/ui_next/src/screens/Schedule/Schedules.jsx b/awx/ui_next/src/screens/Schedule/Schedules.jsx index 5e77596993..0127dab873 100644 --- a/awx/ui_next/src/screens/Schedule/Schedules.jsx +++ b/awx/ui_next/src/screens/Schedule/Schedules.jsx @@ -5,8 +5,13 @@ import { t } from '@lingui/macro'; import Breadcrumbs from '@components/Breadcrumbs'; import ScheduleList from '@components/ScheduleList'; +import { SchedulesAPI } from '@api'; function Schedules({ i18n }) { + const loadSchedules = params => { + return SchedulesAPI.read(params); + }; + return ( <> - + diff --git a/awx/ui_next/src/screens/Template/Template.jsx b/awx/ui_next/src/screens/Template/Template.jsx index 6f4dc4ffd9..0818bea7cf 100644 --- a/awx/ui_next/src/screens/Template/Template.jsx +++ b/awx/ui_next/src/screens/Template/Template.jsx @@ -28,6 +28,7 @@ class Template extends Component { }; this.loadTemplate = this.loadTemplate.bind(this); this.loadTemplateAndRoles = this.loadTemplateAndRoles.bind(this); + this.loadSchedules = this.loadSchedules.bind(this); } async componentDidMount() { @@ -82,6 +83,11 @@ class Template extends Component { } } + loadSchedules(params) { + const { template } = this.state; + return JobTemplatesAPI.readScheduleList(template.id, params); + } + render() { const { i18n, location, match, me } = this.props; const { @@ -221,9 +227,7 @@ class Template extends Component { {template && ( ( - - )} + render={() => } /> )} ( - - )} + render={() => } /> )} Date: Mon, 2 Mar 2020 09:35:34 -0500 Subject: [PATCH 5/6] simplify conditional checking if schedules tab should be shown on proj detail --- awx/ui_next/src/screens/Project/Project.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/ui_next/src/screens/Project/Project.jsx b/awx/ui_next/src/screens/Project/Project.jsx index 83c297c071..9e401fde76 100644 --- a/awx/ui_next/src/screens/Project/Project.jsx +++ b/awx/ui_next/src/screens/Project/Project.jsx @@ -145,7 +145,7 @@ class Project extends Component { link: `${match.url}/job_templates`, }); - if (project?.scm_type && project.scm_type !== '') { + if (project?.scm_type) { tabsArray.push({ name: i18n._(t`Schedules`), link: `${match.url}/schedules`, From b57405b696e1efdaf6158fce95a3c78c14000059 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Mon, 2 Mar 2020 10:00:27 -0500 Subject: [PATCH 6/6] 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 --- .../components/ScheduleList/ScheduleList.jsx | 115 +++++++++--------- .../src/screens/Schedule/Schedules.jsx | 7 +- awx/ui_next/src/screens/Template/Template.jsx | 4 - .../src/screens/Template/Template.test.jsx | 2 +- 4 files changed, 63 insertions(+), 65 deletions(-) diff --git a/awx/ui_next/src/components/ScheduleList/ScheduleList.jsx b/awx/ui_next/src/components/ScheduleList/ScheduleList.jsx index e062fb0f75..e24e46e0b6 100644 --- a/awx/ui_next/src/components/ScheduleList/ScheduleList.jsx +++ b/awx/ui_next/src/components/ScheduleList/ScheduleList.jsx @@ -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 ( - - - ( - 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 => ( - , - ]} - /> - )} - /> - + <> + ( + 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 => ( + , + ]} + /> + )} + /> {deletionError && ( )} - + ); } diff --git a/awx/ui_next/src/screens/Schedule/Schedules.jsx b/awx/ui_next/src/screens/Schedule/Schedules.jsx index 0127dab873..0f7c9b0ee0 100644 --- a/awx/ui_next/src/screens/Schedule/Schedules.jsx +++ b/awx/ui_next/src/screens/Schedule/Schedules.jsx @@ -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 }) { /> - + + + + + diff --git a/awx/ui_next/src/screens/Template/Template.jsx b/awx/ui_next/src/screens/Template/Template.jsx index 0818bea7cf..84839c1a3f 100644 --- a/awx/ui_next/src/screens/Template/Template.jsx +++ b/awx/ui_next/src/screens/Template/Template.jsx @@ -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`, diff --git a/awx/ui_next/src/screens/Template/Template.test.jsx b/awx/ui_next/src/screens/Template/Template.test.jsx index 3e72dcd987..c4f0a36af5 100644 --- a/awx/ui_next/src/screens/Template/Template.test.jsx +++ b/awx/ui_next/src/screens/Template/Template.test.jsx @@ -61,7 +61,7 @@ describe('