diff --git a/.gitignore b/.gitignore index 37727320b1..2f3635eabe 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,7 @@ awx/ui/templates/ui/index.html awx/ui/templates/ui/installing.html awx/ui_next/node_modules/ awx/ui_next/coverage/ -awx/ui_next/build/locales/_build +awx/ui_next/build rsyslog.pid /tower-license /tower-license/** diff --git a/MANIFEST.in b/MANIFEST.in index 53e1d8eebd..6260b87cea 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,6 +6,8 @@ recursive-include awx/templates *.html recursive-include awx/api/templates *.md *.html recursive-include awx/ui/templates *.html recursive-include awx/ui/static * +recursive-include awx/ui_next/build *.html +recursive-include awx/ui_next/build * recursive-include awx/playbooks *.yml recursive-include awx/lib/site-packages * recursive-include awx/plugins *.ps1 diff --git a/Makefile b/Makefile index ac2b209b1d..f95bd63257 100644 --- a/Makefile +++ b/Makefile @@ -568,14 +568,25 @@ ui-zuul-lint-and-test: # UI NEXT TASKS # -------------------------------------- -ui-next-lint: +awx/ui_next/node_modules: $(NPM_BIN) --prefix awx/ui_next install - $(NPM_BIN) run --prefix awx/ui_next lint - $(NPM_BIN) run --prefix awx/ui_next prettier-check -ui-next-test: - $(NPM_BIN) --prefix awx/ui_next install - $(NPM_BIN) run --prefix awx/ui_next test +ui-release-next: + mkdir -p awx/ui_next/build/static + touch awx/ui_next/build/static/.placeholder + +ui-devel-next: awx/ui_next/node_modules + $(NPM_BIN) --prefix awx/ui_next run build + mkdir -p awx/public/static/css + mkdir -p awx/public/static/js + mkdir -p awx/public/static/media + cp -r awx/ui_next/build/static/css/* awx/public/static/css + cp -r awx/ui_next/build/static/js/* awx/public/static/js + cp -r awx/ui_next/build/static/media/* awx/public/static/media + +clean-ui-next: + rm -rf awx/ui_next/node_modules + rm -rf awx/ui_next/build ui-next-zuul-lint-and-test: $(NPM_BIN) --prefix awx/ui_next install @@ -594,10 +605,10 @@ dev_build: release_build: $(PYTHON) setup.py release_build -dist/$(SDIST_TAR_FILE): ui-release VERSION +dist/$(SDIST_TAR_FILE): ui-release ui-release-next VERSION $(PYTHON) setup.py $(SDIST_COMMAND) -dist/$(WHEEL_FILE): ui-release +dist/$(WHEEL_FILE): ui-release ui-release-next $(PYTHON) setup.py $(WHEEL_COMMAND) sdist: dist/$(SDIST_TAR_FILE) diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index 7a477316da..d40c3e5a68 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -94,6 +94,7 @@ USE_TZ = True STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'ui', 'static'), + os.path.join(BASE_DIR, 'ui_next', 'build', 'static'), os.path.join(BASE_DIR, 'static'), ) @@ -253,6 +254,7 @@ TEMPLATES = [ }, 'DIRS': [ os.path.join(BASE_DIR, 'templates'), + os.path.join(BASE_DIR, 'ui_next', 'build'), ], }, ] diff --git a/awx/ui_next/public/images/pfbg_2000.jpg b/awx/ui_next/public/static/media/pfbg_2000.jpg similarity index 100% rename from awx/ui_next/public/images/pfbg_2000.jpg rename to awx/ui_next/public/static/media/pfbg_2000.jpg diff --git a/awx/ui_next/public/images/pfbg_576.jpg b/awx/ui_next/public/static/media/pfbg_576.jpg similarity index 100% rename from awx/ui_next/public/images/pfbg_576.jpg rename to awx/ui_next/public/static/media/pfbg_576.jpg diff --git a/awx/ui_next/public/images/pfbg_576@2x.jpg b/awx/ui_next/public/static/media/pfbg_576@2x.jpg similarity index 100% rename from awx/ui_next/public/images/pfbg_576@2x.jpg rename to awx/ui_next/public/static/media/pfbg_576@2x.jpg diff --git a/awx/ui_next/public/images/pfbg_768.jpg b/awx/ui_next/public/static/media/pfbg_768.jpg similarity index 100% rename from awx/ui_next/public/images/pfbg_768.jpg rename to awx/ui_next/public/static/media/pfbg_768.jpg diff --git a/awx/ui_next/public/images/pfbg_768@2x.jpg b/awx/ui_next/public/static/media/pfbg_768@2x.jpg similarity index 100% rename from awx/ui_next/public/images/pfbg_768@2x.jpg rename to awx/ui_next/public/static/media/pfbg_768@2x.jpg diff --git a/awx/ui_next/src/App.jsx b/awx/ui_next/src/App.jsx index ffafd07dba..9b230ac553 100644 --- a/awx/ui_next/src/App.jsx +++ b/awx/ui_next/src/App.jsx @@ -2,7 +2,7 @@ import React from 'react'; import { useRouteMatch, useLocation, - HashRouter, + BrowserRouter, Route, Switch, Redirect, @@ -76,7 +76,7 @@ function App() { } export default () => ( - + - + ); diff --git a/awx/ui_next/src/components/AppContainer/AppContainer.test.jsx b/awx/ui_next/src/components/AppContainer/AppContainer.test.jsx index c01a7ee6d4..93a7bb5963 100644 --- a/awx/ui_next/src/components/AppContainer/AppContainer.test.jsx +++ b/awx/ui_next/src/components/AppContainer/AppContainer.test.jsx @@ -66,9 +66,9 @@ describe('', () => { // sidebar groups and route links expect(wrapper.find('NavExpandableGroup').length).toBe(2); - expect(wrapper.find('a[href="/#/foo"]').length).toBe(1); - expect(wrapper.find('a[href="/#/bar"]').length).toBe(1); - expect(wrapper.find('a[href="/#/fiz"]').length).toBe(1); + expect(wrapper.find('a[href="/foo"]').length).toBe(1); + expect(wrapper.find('a[href="/bar"]').length).toBe(1); + expect(wrapper.find('a[href="/fiz"]').length).toBe(1); expect(wrapper.find('#group_one').length).toBe(1); expect(wrapper.find('#group_two').length).toBe(1); diff --git a/awx/ui_next/src/components/AppContainer/NavExpandableGroup.jsx b/awx/ui_next/src/components/AppContainer/NavExpandableGroup.jsx index 6403e617f7..370ac52f40 100644 --- a/awx/ui_next/src/components/AppContainer/NavExpandableGroup.jsx +++ b/awx/ui_next/src/components/AppContainer/NavExpandableGroup.jsx @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { withRouter } from 'react-router-dom'; +import { withRouter, Link } from 'react-router-dom'; import { NavExpandable, NavItem } from '@patternfly/react-core'; class NavExpandableGroup extends Component { @@ -41,9 +41,8 @@ class NavExpandableGroup extends Component { groupId={groupId} isActive={this.isActivePath(path)} key={path} - to={`/#${path}`} > - {title} + {title} ))} diff --git a/awx/ui_next/urls.py b/awx/ui_next/urls.py new file mode 100644 index 0000000000..bb288cf625 --- /dev/null +++ b/awx/ui_next/urls.py @@ -0,0 +1,14 @@ +from django.conf.urls import url +from django.views.generic.base import TemplateView + + +class IndexView(TemplateView): + + template_name = 'index.html' + + +app_name = 'ui_next' + +urlpatterns = [ + url(r'^next/*', IndexView.as_view(), name='ui_next') +] diff --git a/awx/urls.py b/awx/urls.py index ba0f0ee421..bdcae84bcb 100644 --- a/awx/urls.py +++ b/awx/urls.py @@ -14,6 +14,7 @@ from awx.main.views import ( urlpatterns = [ + url(r'', include('awx.ui_next.urls', namespace='ui_next')), url(r'', include('awx.ui.urls', namespace='ui')), url(r'^api/', include('awx.api.urls', namespace='api')), url(r'^sso/', include('awx.sso.urls', namespace='sso')), diff --git a/tools/docker-compose/bootstrap_development.sh b/tools/docker-compose/bootstrap_development.sh index 095d3e0d04..68210a8713 100755 --- a/tools/docker-compose/bootstrap_development.sh +++ b/tools/docker-compose/bootstrap_development.sh @@ -28,3 +28,4 @@ make init mkdir -p /awx_devel/awx/public/static mkdir -p /awx_devel/awx/ui/static +mkdir -p /awx_devel/awx/ui_next/build/static