From 0df4047d3dd6e1f94d3e40c3943b57f1b4ae3896 Mon Sep 17 00:00:00 2001 From: Alex Corey Date: Mon, 8 Jun 2020 11:55:21 -0400 Subject: [PATCH 1/2] Adds routing stubs for Applications --- awx/ui_next/src/routeConfig.js | 4 +- .../src/screens/Application/Applications.jsx | 26 ---------- .../Applications/Application/Application.jsx | 26 ++++++++++ .../screens/Applications/Application/index.js | 1 + .../ApplicationAdd/ApplicationAdd.jsx | 15 ++++++ .../Applications/ApplicationAdd/index.js | 1 + .../ApplicationDetails/ApplicationDetails.jsx | 11 +++++ .../Applications/ApplicationDetails/index.js | 1 + .../ApplicationEdit/ApplicationEdit.jsx | 11 +++++ .../Applications/ApplicationEdit/index.js | 1 + .../src/screens/Applications/Applications.jsx | 49 +++++++++++++++++++ .../Applications.test.jsx | 2 +- .../ApplicationsList/ApplicationsList.jsx | 15 ++++++ .../Applications/ApplicationsList/index.js | 1 + .../{Application => Applications}/index.js | 0 15 files changed, 135 insertions(+), 29 deletions(-) delete mode 100644 awx/ui_next/src/screens/Application/Applications.jsx create mode 100644 awx/ui_next/src/screens/Applications/Application/Application.jsx create mode 100644 awx/ui_next/src/screens/Applications/Application/index.js create mode 100644 awx/ui_next/src/screens/Applications/ApplicationAdd/ApplicationAdd.jsx create mode 100644 awx/ui_next/src/screens/Applications/ApplicationAdd/index.js create mode 100644 awx/ui_next/src/screens/Applications/ApplicationDetails/ApplicationDetails.jsx create mode 100644 awx/ui_next/src/screens/Applications/ApplicationDetails/index.js create mode 100644 awx/ui_next/src/screens/Applications/ApplicationEdit/ApplicationEdit.jsx create mode 100644 awx/ui_next/src/screens/Applications/ApplicationEdit/index.js create mode 100644 awx/ui_next/src/screens/Applications/Applications.jsx rename awx/ui_next/src/screens/{Application => Applications}/Applications.test.jsx (94%) create mode 100644 awx/ui_next/src/screens/Applications/ApplicationsList/ApplicationsList.jsx create mode 100644 awx/ui_next/src/screens/Applications/ApplicationsList/index.js rename awx/ui_next/src/screens/{Application => Applications}/index.js (100%) diff --git a/awx/ui_next/src/routeConfig.js b/awx/ui_next/src/routeConfig.js index 37f1732cb0..9ef1167ffa 100644 --- a/awx/ui_next/src/routeConfig.js +++ b/awx/ui_next/src/routeConfig.js @@ -1,6 +1,6 @@ import { t } from '@lingui/macro'; -import Applications from './screens/Application'; +import Applications from './screens/Applications'; import Credentials from './screens/Credential'; import CredentialTypes from './screens/CredentialType'; import Dashboard from './screens/Dashboard'; @@ -138,7 +138,7 @@ function getRouteConfig(i18n) { screen: InstanceGroups, }, { - title: i18n._(t`Integrations`), + title: i18n._(t`Applications`), path: '/applications', screen: Applications, }, diff --git a/awx/ui_next/src/screens/Application/Applications.jsx b/awx/ui_next/src/screens/Application/Applications.jsx deleted file mode 100644 index 47a5e3250a..0000000000 --- a/awx/ui_next/src/screens/Application/Applications.jsx +++ /dev/null @@ -1,26 +0,0 @@ -import React, { Component, Fragment } from 'react'; -import { withI18n } from '@lingui/react'; -import { t } from '@lingui/macro'; -import { - PageSection, - PageSectionVariants, - Title, -} from '@patternfly/react-core'; - -class Applications extends Component { - render() { - const { i18n } = this.props; - const { light } = PageSectionVariants; - - return ( - - - {i18n._(t`Applications`)} - - - - ); - } -} - -export default withI18n()(Applications); diff --git a/awx/ui_next/src/screens/Applications/Application/Application.jsx b/awx/ui_next/src/screens/Applications/Application/Application.jsx new file mode 100644 index 0000000000..5a002f2990 --- /dev/null +++ b/awx/ui_next/src/screens/Applications/Application/Application.jsx @@ -0,0 +1,26 @@ +import React from 'react'; +import { Route, Switch, Redirect } from 'react-router-dom'; +import ApplicationEdit from '../ApplicationEdit'; +import ApplicationDetails from '../ApplicationDetails'; + +function Application() { + return ( + <> + + + + + + + + + + + ); +} + +export default Application; diff --git a/awx/ui_next/src/screens/Applications/Application/index.js b/awx/ui_next/src/screens/Applications/Application/index.js new file mode 100644 index 0000000000..f76f133dd5 --- /dev/null +++ b/awx/ui_next/src/screens/Applications/Application/index.js @@ -0,0 +1 @@ +export { default } from './Application'; diff --git a/awx/ui_next/src/screens/Applications/ApplicationAdd/ApplicationAdd.jsx b/awx/ui_next/src/screens/Applications/ApplicationAdd/ApplicationAdd.jsx new file mode 100644 index 0000000000..a25c690a7b --- /dev/null +++ b/awx/ui_next/src/screens/Applications/ApplicationAdd/ApplicationAdd.jsx @@ -0,0 +1,15 @@ +import React from 'react'; +import { Card, PageSection } from '@patternfly/react-core'; + +function ApplicatonAdd() { + return ( + <> + + +
Applications Add
+
+
+ + ); +} +export default ApplicatonAdd; diff --git a/awx/ui_next/src/screens/Applications/ApplicationAdd/index.js b/awx/ui_next/src/screens/Applications/ApplicationAdd/index.js new file mode 100644 index 0000000000..54101fc16b --- /dev/null +++ b/awx/ui_next/src/screens/Applications/ApplicationAdd/index.js @@ -0,0 +1 @@ +export { default } from './ApplicationAdd'; diff --git a/awx/ui_next/src/screens/Applications/ApplicationDetails/ApplicationDetails.jsx b/awx/ui_next/src/screens/Applications/ApplicationDetails/ApplicationDetails.jsx new file mode 100644 index 0000000000..c8051841bb --- /dev/null +++ b/awx/ui_next/src/screens/Applications/ApplicationDetails/ApplicationDetails.jsx @@ -0,0 +1,11 @@ +import React from 'react'; +import { Card, PageSection } from '@patternfly/react-core'; + +function ApplicationDetails() { + return ( + + Application Details + + ); +} +export default ApplicationDetails; diff --git a/awx/ui_next/src/screens/Applications/ApplicationDetails/index.js b/awx/ui_next/src/screens/Applications/ApplicationDetails/index.js new file mode 100644 index 0000000000..fc3261983b --- /dev/null +++ b/awx/ui_next/src/screens/Applications/ApplicationDetails/index.js @@ -0,0 +1 @@ +export { default } from './ApplicationDetails'; diff --git a/awx/ui_next/src/screens/Applications/ApplicationEdit/ApplicationEdit.jsx b/awx/ui_next/src/screens/Applications/ApplicationEdit/ApplicationEdit.jsx new file mode 100644 index 0000000000..e72f93b681 --- /dev/null +++ b/awx/ui_next/src/screens/Applications/ApplicationEdit/ApplicationEdit.jsx @@ -0,0 +1,11 @@ +import React from 'react'; +import { Card, PageSection } from '@patternfly/react-core'; + +function ApplicationEdit() { + return ( + + Application Edit + + ); +} +export default ApplicationEdit; diff --git a/awx/ui_next/src/screens/Applications/ApplicationEdit/index.js b/awx/ui_next/src/screens/Applications/ApplicationEdit/index.js new file mode 100644 index 0000000000..2ab4beb8d4 --- /dev/null +++ b/awx/ui_next/src/screens/Applications/ApplicationEdit/index.js @@ -0,0 +1 @@ +export { default } from './ApplicationEdit'; diff --git a/awx/ui_next/src/screens/Applications/Applications.jsx b/awx/ui_next/src/screens/Applications/Applications.jsx new file mode 100644 index 0000000000..19a23be08e --- /dev/null +++ b/awx/ui_next/src/screens/Applications/Applications.jsx @@ -0,0 +1,49 @@ +import React, { useState, useCallback } from 'react'; +import { withI18n } from '@lingui/react'; +import { t } from '@lingui/macro'; +import { Route, Switch } from 'react-router-dom'; + +import ApplicationsList from './ApplicationsList'; +import ApplicationAdd from './ApplicationAdd'; +import Application from './Application'; +import Breadcrumbs from '../../components/Breadcrumbs'; + +function Applications({ i18n }) { + const [breadcrumbConfig, setBreadcrumbConfig] = useState({ + '/applications': i18n._(t`Applications`), + '/applications/add': i18n._(t`Create New Application`), + }); + + const buildBreadcrumbConfig = useCallback( + application => { + if (!application) { + return; + } + + setBreadcrumbConfig({ + '/applications': i18n._(t`Applications`), + '/applications/add': i18n._(t`Create New Application`), + [`/application/${application.id}`]: `${application.name}`, + }); + }, + [i18n] + ); + return ( + <> + + + + + + + + + + + + + + ); +} + +export default withI18n()(Applications); diff --git a/awx/ui_next/src/screens/Application/Applications.test.jsx b/awx/ui_next/src/screens/Applications/Applications.test.jsx similarity index 94% rename from awx/ui_next/src/screens/Application/Applications.test.jsx rename to awx/ui_next/src/screens/Applications/Applications.test.jsx index cb747a920b..7915523720 100644 --- a/awx/ui_next/src/screens/Application/Applications.test.jsx +++ b/awx/ui_next/src/screens/Applications/Applications.test.jsx @@ -21,7 +21,7 @@ describe('', () => { test('initially renders without crashing', () => { expect(pageWrapper.length).toBe(1); - expect(pageSections.length).toBe(2); + expect(pageSections.length).toBe(1); expect(title.length).toBe(1); expect(title.props().size).toBe('2xl'); expect(pageSections.first().props().variant).toBe('light'); diff --git a/awx/ui_next/src/screens/Applications/ApplicationsList/ApplicationsList.jsx b/awx/ui_next/src/screens/Applications/ApplicationsList/ApplicationsList.jsx new file mode 100644 index 0000000000..6fcf16bb73 --- /dev/null +++ b/awx/ui_next/src/screens/Applications/ApplicationsList/ApplicationsList.jsx @@ -0,0 +1,15 @@ +import React from 'react'; +import { Card, PageSection } from '@patternfly/react-core'; + +function ApplicationsList() { + return ( + <> + + +
Applications List
+
+
+ + ); +} +export default ApplicationsList; diff --git a/awx/ui_next/src/screens/Applications/ApplicationsList/index.js b/awx/ui_next/src/screens/Applications/ApplicationsList/index.js new file mode 100644 index 0000000000..34f1107076 --- /dev/null +++ b/awx/ui_next/src/screens/Applications/ApplicationsList/index.js @@ -0,0 +1 @@ +export { default } from './ApplicationsList'; diff --git a/awx/ui_next/src/screens/Application/index.js b/awx/ui_next/src/screens/Applications/index.js similarity index 100% rename from awx/ui_next/src/screens/Application/index.js rename to awx/ui_next/src/screens/Applications/index.js From 2784409c46c9e629cac2170262dd4ada07733978 Mon Sep 17 00:00:00 2001 From: Alex Corey Date: Mon, 8 Jun 2020 15:22:11 -0400 Subject: [PATCH 2/2] Fixes folder name --- awx/ui_next/src/routeConfig.js | 2 +- .../{Applications => Application}/Application/Application.jsx | 0 .../{Applications => Application}/Application/index.js | 0 .../ApplicationAdd/ApplicationAdd.jsx | 0 .../{Applications => Application}/ApplicationAdd/index.js | 0 .../ApplicationDetails/ApplicationDetails.jsx | 0 .../{Applications => Application}/ApplicationDetails/index.js | 0 .../ApplicationEdit/ApplicationEdit.jsx | 0 .../{Applications => Application}/ApplicationEdit/index.js | 0 .../screens/{Applications => Application}/Applications.jsx | 0 .../{Applications => Application}/Applications.test.jsx | 4 ---- .../ApplicationsList/ApplicationsList.jsx | 0 .../{Applications => Application}/ApplicationsList/index.js | 0 .../src/screens/{Applications => Application}/index.js | 0 14 files changed, 1 insertion(+), 5 deletions(-) rename awx/ui_next/src/screens/{Applications => Application}/Application/Application.jsx (100%) rename awx/ui_next/src/screens/{Applications => Application}/Application/index.js (100%) rename awx/ui_next/src/screens/{Applications => Application}/ApplicationAdd/ApplicationAdd.jsx (100%) rename awx/ui_next/src/screens/{Applications => Application}/ApplicationAdd/index.js (100%) rename awx/ui_next/src/screens/{Applications => Application}/ApplicationDetails/ApplicationDetails.jsx (100%) rename awx/ui_next/src/screens/{Applications => Application}/ApplicationDetails/index.js (100%) rename awx/ui_next/src/screens/{Applications => Application}/ApplicationEdit/ApplicationEdit.jsx (100%) rename awx/ui_next/src/screens/{Applications => Application}/ApplicationEdit/index.js (100%) rename awx/ui_next/src/screens/{Applications => Application}/Applications.jsx (100%) rename awx/ui_next/src/screens/{Applications => Application}/Applications.test.jsx (82%) rename awx/ui_next/src/screens/{Applications => Application}/ApplicationsList/ApplicationsList.jsx (100%) rename awx/ui_next/src/screens/{Applications => Application}/ApplicationsList/index.js (100%) rename awx/ui_next/src/screens/{Applications => Application}/index.js (100%) diff --git a/awx/ui_next/src/routeConfig.js b/awx/ui_next/src/routeConfig.js index 9ef1167ffa..4b43dc4993 100644 --- a/awx/ui_next/src/routeConfig.js +++ b/awx/ui_next/src/routeConfig.js @@ -1,6 +1,6 @@ import { t } from '@lingui/macro'; -import Applications from './screens/Applications'; +import Applications from './screens/Application'; import Credentials from './screens/Credential'; import CredentialTypes from './screens/CredentialType'; import Dashboard from './screens/Dashboard'; diff --git a/awx/ui_next/src/screens/Applications/Application/Application.jsx b/awx/ui_next/src/screens/Application/Application/Application.jsx similarity index 100% rename from awx/ui_next/src/screens/Applications/Application/Application.jsx rename to awx/ui_next/src/screens/Application/Application/Application.jsx diff --git a/awx/ui_next/src/screens/Applications/Application/index.js b/awx/ui_next/src/screens/Application/Application/index.js similarity index 100% rename from awx/ui_next/src/screens/Applications/Application/index.js rename to awx/ui_next/src/screens/Application/Application/index.js diff --git a/awx/ui_next/src/screens/Applications/ApplicationAdd/ApplicationAdd.jsx b/awx/ui_next/src/screens/Application/ApplicationAdd/ApplicationAdd.jsx similarity index 100% rename from awx/ui_next/src/screens/Applications/ApplicationAdd/ApplicationAdd.jsx rename to awx/ui_next/src/screens/Application/ApplicationAdd/ApplicationAdd.jsx diff --git a/awx/ui_next/src/screens/Applications/ApplicationAdd/index.js b/awx/ui_next/src/screens/Application/ApplicationAdd/index.js similarity index 100% rename from awx/ui_next/src/screens/Applications/ApplicationAdd/index.js rename to awx/ui_next/src/screens/Application/ApplicationAdd/index.js diff --git a/awx/ui_next/src/screens/Applications/ApplicationDetails/ApplicationDetails.jsx b/awx/ui_next/src/screens/Application/ApplicationDetails/ApplicationDetails.jsx similarity index 100% rename from awx/ui_next/src/screens/Applications/ApplicationDetails/ApplicationDetails.jsx rename to awx/ui_next/src/screens/Application/ApplicationDetails/ApplicationDetails.jsx diff --git a/awx/ui_next/src/screens/Applications/ApplicationDetails/index.js b/awx/ui_next/src/screens/Application/ApplicationDetails/index.js similarity index 100% rename from awx/ui_next/src/screens/Applications/ApplicationDetails/index.js rename to awx/ui_next/src/screens/Application/ApplicationDetails/index.js diff --git a/awx/ui_next/src/screens/Applications/ApplicationEdit/ApplicationEdit.jsx b/awx/ui_next/src/screens/Application/ApplicationEdit/ApplicationEdit.jsx similarity index 100% rename from awx/ui_next/src/screens/Applications/ApplicationEdit/ApplicationEdit.jsx rename to awx/ui_next/src/screens/Application/ApplicationEdit/ApplicationEdit.jsx diff --git a/awx/ui_next/src/screens/Applications/ApplicationEdit/index.js b/awx/ui_next/src/screens/Application/ApplicationEdit/index.js similarity index 100% rename from awx/ui_next/src/screens/Applications/ApplicationEdit/index.js rename to awx/ui_next/src/screens/Application/ApplicationEdit/index.js diff --git a/awx/ui_next/src/screens/Applications/Applications.jsx b/awx/ui_next/src/screens/Application/Applications.jsx similarity index 100% rename from awx/ui_next/src/screens/Applications/Applications.jsx rename to awx/ui_next/src/screens/Application/Applications.jsx diff --git a/awx/ui_next/src/screens/Applications/Applications.test.jsx b/awx/ui_next/src/screens/Application/Applications.test.jsx similarity index 82% rename from awx/ui_next/src/screens/Applications/Applications.test.jsx rename to awx/ui_next/src/screens/Application/Applications.test.jsx index 7915523720..f309a2b60a 100644 --- a/awx/ui_next/src/screens/Applications/Applications.test.jsx +++ b/awx/ui_next/src/screens/Application/Applications.test.jsx @@ -7,12 +7,10 @@ import Applications from './Applications'; describe('', () => { let pageWrapper; let pageSections; - let title; beforeEach(() => { pageWrapper = mountWithContexts(); pageSections = pageWrapper.find('PageSection'); - title = pageWrapper.find('Title'); }); afterEach(() => { @@ -22,8 +20,6 @@ describe('', () => { test('initially renders without crashing', () => { expect(pageWrapper.length).toBe(1); expect(pageSections.length).toBe(1); - expect(title.length).toBe(1); - expect(title.props().size).toBe('2xl'); expect(pageSections.first().props().variant).toBe('light'); }); }); diff --git a/awx/ui_next/src/screens/Applications/ApplicationsList/ApplicationsList.jsx b/awx/ui_next/src/screens/Application/ApplicationsList/ApplicationsList.jsx similarity index 100% rename from awx/ui_next/src/screens/Applications/ApplicationsList/ApplicationsList.jsx rename to awx/ui_next/src/screens/Application/ApplicationsList/ApplicationsList.jsx diff --git a/awx/ui_next/src/screens/Applications/ApplicationsList/index.js b/awx/ui_next/src/screens/Application/ApplicationsList/index.js similarity index 100% rename from awx/ui_next/src/screens/Applications/ApplicationsList/index.js rename to awx/ui_next/src/screens/Application/ApplicationsList/index.js diff --git a/awx/ui_next/src/screens/Applications/index.js b/awx/ui_next/src/screens/Application/index.js similarity index 100% rename from awx/ui_next/src/screens/Applications/index.js rename to awx/ui_next/src/screens/Application/index.js