From 86a4a38be6d382d37e3b5df6f5b181d12115d950 Mon Sep 17 00:00:00 2001 From: Hao Liu Date: Tue, 21 Feb 2023 16:40:47 -0500 Subject: [PATCH 01/15] WIP: functioning manual instruction to get docker-compose working --- .gitignore | 2 ++ Makefile | 4 +++- awx/settings/defaults.py | 13 +++++++++++-- awx/ui-next/README.md | 12 ++++++++++++ awx/ui-next/urls.py | 28 ++++++++++++++++++++++++++++ awx/urls.py | 2 ++ 6 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 awx/ui-next/README.md create mode 100644 awx/ui-next/urls.py diff --git a/.gitignore b/.gitignore index 6231ea4071..d2766fcca1 100644 --- a/.gitignore +++ b/.gitignore @@ -161,3 +161,5 @@ use_dev_supervisor.txt /_build/ /_build_kube_dev/ /Dockerfile.kube-dev + +awx/ui-next/ansible-ui diff --git a/Makefile b/Makefile index 896dcf2c6c..e1ff8f0e70 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +include awx/ui-next/Makefile + PYTHON ?= python3.9 OFFICIAL ?= no NODE ?= node @@ -540,7 +542,7 @@ docker-compose-container-group-clean: rm -rf tools/docker-compose-minikube/_sources/ ## Base development image build -docker-compose-build: +docker-compose-build: ansible-playbook tools/ansible/dockerfile.yml -e build_dev=True -e receptor_image=$(RECEPTOR_IMAGE) DOCKER_BUILDKIT=1 docker build -t $(DEVEL_IMAGE_NAME) \ --build-arg BUILDKIT_INLINE_CACHE=1 \ diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index 4d18540bcd..968a2e39bf 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -83,7 +83,11 @@ USE_L10N = True USE_TZ = True -STATICFILES_DIRS = [os.path.join(BASE_DIR, 'ui', 'build', 'static'), os.path.join(BASE_DIR, 'static')] +STATICFILES_DIRS = [ + os.path.join(BASE_DIR, 'ui', 'build', 'static'), + os.path.join(BASE_DIR, 'ui-next', 'ansible-ui', 'build'), + os.path.join(BASE_DIR, 'static'), +] # Absolute filesystem path to the directory where static file are collected via # the collectstatic command. @@ -290,7 +294,12 @@ TEMPLATES = [ ], 'builtins': ['awx.main.templatetags.swagger'], }, - 'DIRS': [os.path.join(BASE_DIR, 'templates'), os.path.join(BASE_DIR, 'ui', 'build'), os.path.join(BASE_DIR, 'ui', 'public')], + 'DIRS': [ + os.path.join(BASE_DIR, 'templates'), + os.path.join(BASE_DIR, 'ui', 'build'), + os.path.join(BASE_DIR, 'ui', 'public'), + os.path.join(BASE_DIR, 'ui-next', 'ansible-ui', 'build', 'controller'), + ], }, ] diff --git a/awx/ui-next/README.md b/awx/ui-next/README.md new file mode 100644 index 0000000000..a238700135 --- /dev/null +++ b/awx/ui-next/README.md @@ -0,0 +1,12 @@ + + +``` +git clone git@github.com:ansible/ansible-ui.git +``` + +``` +pushd ansible-ui +npm run build:controller +popd +``` + diff --git a/awx/ui-next/urls.py b/awx/ui-next/urls.py new file mode 100644 index 0000000000..1d5a93b8ec --- /dev/null +++ b/awx/ui-next/urls.py @@ -0,0 +1,28 @@ +from django.urls import re_path +from django.utils.translation import gettext_lazy as _ +from django.views.generic.base import TemplateView + +from awx.main.utils.licensing import server_product_name + + +class IndexView(TemplateView): + template_name = 'index_controller.html' + + +class MigrationsNotran(TemplateView): + template_name = 'installing.html' + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + product_name = server_product_name() + context['title'] = _('%s Upgrading' % product_name) + context['image_alt'] = _('Logo') + context['aria_spinner'] = _('Loading') + context['message_upgrade'] = _('%s is currently upgrading.' % product_name) + context['message_refresh'] = _('This page will refresh when complete.') + return context + + +app_name = 'ui-next' + +urlpatterns = [re_path(r'^$', IndexView.as_view(), name='index'), re_path(r'^migrations_notran/$', MigrationsNotran.as_view(), name='migrations_notran')] diff --git a/awx/urls.py b/awx/urls.py index c99eda011c..339a7e9641 100644 --- a/awx/urls.py +++ b/awx/urls.py @@ -9,6 +9,8 @@ from awx.main.views import handle_400, handle_403, handle_404, handle_500, handl urlpatterns = [ re_path(r'', include('awx.ui.urls', namespace='ui')), + re_path(r'^controller/', include('awx.ui-next.urls', namespace='controller')), + # re_path(r'^ui-next/', include('awx.ui-next.urls', namespace='ui-next')), re_path(r'^api/', include('awx.api.urls', namespace='api')), re_path(r'^sso/', include('awx.sso.urls', namespace='sso')), re_path(r'^sso/', include('social_django.urls', namespace='social')), From db6fb2de5e5111d09c4b59bf9b65a259aa22f515 Mon Sep 17 00:00:00 2001 From: Hao Liu Date: Tue, 21 Feb 2023 21:46:19 -0500 Subject: [PATCH 02/15] add ui-next to sdist manifest --- MANIFEST.in | 1 + Makefile | 2 +- awx/ui-next/Makefile | 4 ++++ awx/ui-next/package.json | 9 +++++++++ awx/ui-next/urls.py | 5 ++++- awx/urls.py | 2 +- 6 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 awx/ui-next/Makefile create mode 100644 awx/ui-next/package.json diff --git a/MANIFEST.in b/MANIFEST.in index 04cde5e9f6..751b09db59 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,6 +6,7 @@ recursive-include awx/templates *.html recursive-include awx/api/templates *.md *.html *.yml recursive-include awx/ui/build *.html recursive-include awx/ui/build * +recursive-include awx/ui-next/ansible-ui/build * recursive-include awx/playbooks *.yml recursive-include awx/lib/site-packages * recursive-include awx/plugins *.ps1 diff --git a/Makefile b/Makefile index e1ff8f0e70..372cc9442e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -include awx/ui-next/Makefile +# include awx/ui-next/Makefile PYTHON ?= python3.9 OFFICIAL ?= no diff --git a/awx/ui-next/Makefile b/awx/ui-next/Makefile new file mode 100644 index 0000000000..da14ce19f2 --- /dev/null +++ b/awx/ui-next/Makefile @@ -0,0 +1,4 @@ +ui-next/clone: + +ui-next/build: ui-next/clone + $(MAKE) -C ui-next build \ No newline at end of file diff --git a/awx/ui-next/package.json b/awx/ui-next/package.json new file mode 100644 index 0000000000..7870df4f20 --- /dev/null +++ b/awx/ui-next/package.json @@ -0,0 +1,9 @@ +{ + "name": "ui-next", + "homepage": ".", + "private": true, + "engines": { + "node": ">=16.13.1" + }, + +} \ No newline at end of file diff --git a/awx/ui-next/urls.py b/awx/ui-next/urls.py index 1d5a93b8ec..36bebdd81b 100644 --- a/awx/ui-next/urls.py +++ b/awx/ui-next/urls.py @@ -25,4 +25,7 @@ class MigrationsNotran(TemplateView): app_name = 'ui-next' -urlpatterns = [re_path(r'^$', IndexView.as_view(), name='index'), re_path(r'^migrations_notran/$', MigrationsNotran.as_view(), name='migrations_notran')] +urlpatterns = [ + re_path(r'^$', IndexView.as_view(), name='index'), + re_path(r'^migrations_notran/$', MigrationsNotran.as_view(), name='migrations_notran'), +] diff --git a/awx/urls.py b/awx/urls.py index 339a7e9641..af30cf361e 100644 --- a/awx/urls.py +++ b/awx/urls.py @@ -9,7 +9,7 @@ from awx.main.views import handle_400, handle_403, handle_404, handle_500, handl urlpatterns = [ re_path(r'', include('awx.ui.urls', namespace='ui')), - re_path(r'^controller/', include('awx.ui-next.urls', namespace='controller')), + re_path(r'^controller/.*$', include('awx.ui-next.urls', namespace='controller')), # re_path(r'^ui-next/', include('awx.ui-next.urls', namespace='ui-next')), re_path(r'^api/', include('awx.api.urls', namespace='api')), re_path(r'^sso/', include('awx.sso.urls', namespace='sso')), From de69761fa12fe0d94d053ea12cff77f46863970c Mon Sep 17 00:00:00 2001 From: Hao Liu Date: Wed, 22 Feb 2023 23:48:51 -0500 Subject: [PATCH 03/15] add a rough Makefile for ui-next Update Makefile --- Makefile | 21 ++++++++--- awx/ui-next/Makefile | 89 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 101 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 372cc9442e..87109c8b40 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,7 @@ -# include awx/ui-next/Makefile +mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) +current_dir := $(dir $(mkfile_path)) + +include awx/ui-next/Makefile PYTHON ?= python3.9 OFFICIAL ?= no @@ -399,7 +402,7 @@ bulk_data: # UI TASKS # -------------------------------------- -UI_BUILD_FLAG_FILE = awx/ui/.ui-built +UI_BUILD_FLAG_FILE = $(current_dir)ui/.ui-built clean-ui: rm -rf node_modules @@ -460,7 +463,7 @@ HEADLESS ?= no ifeq ($(HEADLESS), yes) dist/$(SDIST_TAR_FILE): else -dist/$(SDIST_TAR_FILE): $(UI_BUILD_FLAG_FILE) +dist/$(SDIST_TAR_FILE): $(UI_BUILD_FLAG_FILE) awx/ui-next/ansible-ui/build endif $(PYTHON) -m build -s ln -sf $(SDIST_TAR_FILE) dist/awx.tar.gz @@ -508,8 +511,6 @@ docker-compose-sources: .git/hooks/pre-commit -e enable_prometheus=$(PROMETHEUS) \ -e enable_grafana=$(GRAFANA) $(EXTRA_SOURCES_ANSIBLE_OPTS) - - docker-compose: awx/projects docker-compose-sources docker-compose -f tools/docker-compose/_sources/docker-compose.yml $(COMPOSE_OPTS) up $(COMPOSE_UP_OPTS) --remove-orphans @@ -542,7 +543,7 @@ docker-compose-container-group-clean: rm -rf tools/docker-compose-minikube/_sources/ ## Base development image build -docker-compose-build: +docker-compose-build: ansible-playbook tools/ansible/dockerfile.yml -e build_dev=True -e receptor_image=$(RECEPTOR_IMAGE) DOCKER_BUILDKIT=1 docker build -t $(DEVEL_IMAGE_NAME) \ --build-arg BUILDKIT_INLINE_CACHE=1 \ @@ -666,3 +667,11 @@ help/generate: } \ { lastLine = $$0 }' $(MAKEFILE_LIST) | sort -u @printf "\n" + +## Display help for a specific target folder +help/%: + @make -s help MAKEFILE_LIST="$*/Makefile" + +## Display help for a specific target folder +help/%/aliases: + @make -s help/all MAKEFILE_LIST="$*/Makefile.aliases" \ No newline at end of file diff --git a/awx/ui-next/Makefile b/awx/ui-next/Makefile index da14ce19f2..d47583e1db 100644 --- a/awx/ui-next/Makefile +++ b/awx/ui-next/Makefile @@ -1,4 +1,87 @@ -ui-next/clone: +ui_next_mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) +ui_next_dir := $(dir $(ui_next_mkfile_path)) + +ifeq ($(current_dir), undefined) + ui_next_dir := $(dir $(ui_next_mkfile_path)) +else + ui_next_dir := $(shell realpath --relative-to $(current_dir) $(ui_next_dir))/ +endif + +ANSIBLE_UI_GIT_REPO_HTTPS ?= +ANSIBLE_UI_GIT_REPO_SSH ?= + +ANSIBLE_UI_GIT_BRANCH ?= main + +ANSIBLE_UI_LOCAL ?= + +ANSIBLE_UI_DIR ?= $(ui_next_dir)ansible-ui + +.PHONY: ui-next/clone-https +## Shallow clone the ui-next repo via https skip if ANSIBLE_UI_GIT_REPO_HTTPS is undefined +ui-next/clone-https: + @if [ -z "$(ANSIBLE_UI_GIT_REPO_HTTPS)" ]; then \ + echo "SKIP: ui-next/clone-https. ANSIBLE_UI_GIT_REPO_HTTPS is not set."; \ + elif [ -d "$(ANSIBLE_UI_DIR)" ]; then \ + echo "SKIP: ui-next/clone-https. $(ANSIBLE_UI_DIR) already exists."; \ + else \ + git clone --depth 1 --branch $(ANSIBLE_UI_GIT_BRANCH) $(ANSIBLE_UI_GIT_REPO_HTTPS) $(ANSIBLE_UI_DIR) || true; \ + fi + +.PHONY: ui-next/clone-ssh +## Shallow clone the ui-next repo via ssh. +ui-next/clone-ssh: + @if [ -z "$(ANSIBLE_UI_GIT_REPO_SSH)" ]; then \ + echo "SKIP: ui-next/clone-ssh. ANSIBLE_UI_GIT_REPO_SSH is not set."; \ + elif [ -d "$(ANSIBLE_UI_DIR)" ]; then \ + echo "SKIP: ui-next/clone-ssh. $(ANSIBLE_UI_DIR) already exists."; \ + else \ + git clone --depth 1 --branch $(ANSIBLE_UI_GIT_BRANCH) $(ANSIBLE_UI_GIT_REPO_SSH) $(ANSIBLE_UI_DIR) || true; \ + fi + +.PHONY: ui-next/link-local +## Link to a existing local clone of ui-next repo. +ui-next/link-local: + @if [ -z "$(ANSIBLE_UI_LOCAL)" ]; then \ + echo "SKIP: ui-next/link-local. ANSIBLE_UI_LOCAL is not set."; \ + elif [ -d "$(ANSIBLE_UI_DIR)" ]; then \ + echo "SKIP: ui-next/link-local. $(ANSIBLE_UI_DIR) already exists."; \ + else \ + ln -s $(ANSIBLE_UI_LOCAL) $(ANSIBLE_UI_DIR); \ + fi + +.PHONY: ui-next +## Try to link to a local clone of ui-next repo if it exist otherwise clone via ssh than https. +ui-next: + @if [ -d "$(ANSIBLE_UI_DIR)" ]; then \ + echo "SKIP: ui-next. $(ANSIBLE_UI_DIR) already exists."; \ + else \ + $(MAKE) ui-next/link-local ui-next/clone-ssh ui-next/clone-https; \ + fi + +## Alias for ui-next, will not run if ui-next already exist +$(ANSIBLE_UI_DIR): + $(MAKE) ui-next + +.PHONY: ui-next/build +## Build ui-next +ui-next/build: ui-next + cd $(ANSIBLE_UI_DIR) && \ + npm install webpack && \ + npm run build:controller + +## Alias for ui-next/build, will not run if build already exist +$(ANSIBLE_UI_DIR)/build: + $(MAKE) ui-next/build + +.PHONY: ui-next/clean +## Clean ui-next +ui-next/clean: + rm -rf $(UI_NEXT_BUILD_FLAG_FILE) + rm -rf $(ANSIBLE_UI_DIR) + +.PHONY: ui-next/clean/build +## Clean ui-next build +ui-next/clean/build: + rm -rf $(UI_NEXT_BUILD_FLAG_FILE) + rm -rf $(ANSIBLE_UI_DIR)/build -ui-next/build: ui-next/clone - $(MAKE) -C ui-next build \ No newline at end of file From 5fbb6c79b3eac5603994f64aa961a2590224cabb Mon Sep 17 00:00:00 2001 From: Hao Liu Date: Thu, 23 Feb 2023 14:48:10 -0500 Subject: [PATCH 04/15] switch to CURDIR --- Makefile | 5 +---- awx/ui-next/Makefile | 11 ++--------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 87109c8b40..ef3c655464 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,3 @@ -mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) -current_dir := $(dir $(mkfile_path)) - include awx/ui-next/Makefile PYTHON ?= python3.9 @@ -402,7 +399,7 @@ bulk_data: # UI TASKS # -------------------------------------- -UI_BUILD_FLAG_FILE = $(current_dir)ui/.ui-built +UI_BUILD_FLAG_FILE = $(CURDIR)/ui/.ui-built clean-ui: rm -rf node_modules diff --git a/awx/ui-next/Makefile b/awx/ui-next/Makefile index d47583e1db..b4fe199821 100644 --- a/awx/ui-next/Makefile +++ b/awx/ui-next/Makefile @@ -1,21 +1,14 @@ ui_next_mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) -ui_next_dir := $(dir $(ui_next_mkfile_path)) +ui_next_dir := $(shell realpath --relative-to $(CURDIR) $(dir $(ui_next_mkfile_path))) -ifeq ($(current_dir), undefined) - ui_next_dir := $(dir $(ui_next_mkfile_path)) -else - ui_next_dir := $(shell realpath --relative-to $(current_dir) $(ui_next_dir))/ -endif +ANSIBLE_UI_DIR ?= $(ui_next_dir)/src ANSIBLE_UI_GIT_REPO_HTTPS ?= ANSIBLE_UI_GIT_REPO_SSH ?= - ANSIBLE_UI_GIT_BRANCH ?= main ANSIBLE_UI_LOCAL ?= -ANSIBLE_UI_DIR ?= $(ui_next_dir)ansible-ui - .PHONY: ui-next/clone-https ## Shallow clone the ui-next repo via https skip if ANSIBLE_UI_GIT_REPO_HTTPS is undefined ui-next/clone-https: From 729414d5fae195a173ee23dace7466db3f72e70d Mon Sep 17 00:00:00 2001 From: Hao Liu Date: Mon, 27 Feb 2023 15:23:46 -0500 Subject: [PATCH 05/15] WIP --- .gitignore | 2 +- MANIFEST.in | 2 +- Makefile | 4 +- awx/settings/defaults.py | 4 +- awx/ui-next/Makefile | 80 ------------------------------ awx/ui-next/package.json | 9 ---- awx/ui_next/Makefile | 80 ++++++++++++++++++++++++++++++ awx/{ui-next => ui_next}/README.md | 0 awx/{ui-next => ui_next}/urls.py | 5 +- awx/urls.py | 3 +- 10 files changed, 90 insertions(+), 99 deletions(-) delete mode 100644 awx/ui-next/Makefile delete mode 100644 awx/ui-next/package.json create mode 100644 awx/ui_next/Makefile rename awx/{ui-next => ui_next}/README.md (100%) rename awx/{ui-next => ui_next}/urls.py (92%) diff --git a/.gitignore b/.gitignore index d2766fcca1..30acd82ad9 100644 --- a/.gitignore +++ b/.gitignore @@ -162,4 +162,4 @@ use_dev_supervisor.txt /_build_kube_dev/ /Dockerfile.kube-dev -awx/ui-next/ansible-ui +awx/ui_next/src diff --git a/MANIFEST.in b/MANIFEST.in index 751b09db59..61e42bfcde 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,7 +6,7 @@ recursive-include awx/templates *.html recursive-include awx/api/templates *.md *.html *.yml recursive-include awx/ui/build *.html recursive-include awx/ui/build * -recursive-include awx/ui-next/ansible-ui/build * +recursive-include awx/ui_next/src/build * recursive-include awx/playbooks *.yml recursive-include awx/lib/site-packages * recursive-include awx/plugins *.ps1 diff --git a/Makefile b/Makefile index ef3c655464..52cef26da6 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -include awx/ui-next/Makefile +include awx/ui_next/Makefile PYTHON ?= python3.9 OFFICIAL ?= no @@ -460,7 +460,7 @@ HEADLESS ?= no ifeq ($(HEADLESS), yes) dist/$(SDIST_TAR_FILE): else -dist/$(SDIST_TAR_FILE): $(UI_BUILD_FLAG_FILE) awx/ui-next/ansible-ui/build +dist/$(SDIST_TAR_FILE): $(UI_BUILD_FLAG_FILE) awx/ui_next/src/build endif $(PYTHON) -m build -s ln -sf $(SDIST_TAR_FILE) dist/awx.tar.gz diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index 968a2e39bf..a98c8a3b11 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -85,7 +85,7 @@ USE_TZ = True STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'ui', 'build', 'static'), - os.path.join(BASE_DIR, 'ui-next', 'ansible-ui', 'build'), + os.path.join(BASE_DIR, 'ui_next', 'src', 'build'), os.path.join(BASE_DIR, 'static'), ] @@ -298,7 +298,7 @@ TEMPLATES = [ os.path.join(BASE_DIR, 'templates'), os.path.join(BASE_DIR, 'ui', 'build'), os.path.join(BASE_DIR, 'ui', 'public'), - os.path.join(BASE_DIR, 'ui-next', 'ansible-ui', 'build', 'controller'), + os.path.join(BASE_DIR, 'ui_next', 'src', 'build', 'awx'), ], }, ] diff --git a/awx/ui-next/Makefile b/awx/ui-next/Makefile deleted file mode 100644 index b4fe199821..0000000000 --- a/awx/ui-next/Makefile +++ /dev/null @@ -1,80 +0,0 @@ -ui_next_mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) -ui_next_dir := $(shell realpath --relative-to $(CURDIR) $(dir $(ui_next_mkfile_path))) - -ANSIBLE_UI_DIR ?= $(ui_next_dir)/src - -ANSIBLE_UI_GIT_REPO_HTTPS ?= -ANSIBLE_UI_GIT_REPO_SSH ?= -ANSIBLE_UI_GIT_BRANCH ?= main - -ANSIBLE_UI_LOCAL ?= - -.PHONY: ui-next/clone-https -## Shallow clone the ui-next repo via https skip if ANSIBLE_UI_GIT_REPO_HTTPS is undefined -ui-next/clone-https: - @if [ -z "$(ANSIBLE_UI_GIT_REPO_HTTPS)" ]; then \ - echo "SKIP: ui-next/clone-https. ANSIBLE_UI_GIT_REPO_HTTPS is not set."; \ - elif [ -d "$(ANSIBLE_UI_DIR)" ]; then \ - echo "SKIP: ui-next/clone-https. $(ANSIBLE_UI_DIR) already exists."; \ - else \ - git clone --depth 1 --branch $(ANSIBLE_UI_GIT_BRANCH) $(ANSIBLE_UI_GIT_REPO_HTTPS) $(ANSIBLE_UI_DIR) || true; \ - fi - -.PHONY: ui-next/clone-ssh -## Shallow clone the ui-next repo via ssh. -ui-next/clone-ssh: - @if [ -z "$(ANSIBLE_UI_GIT_REPO_SSH)" ]; then \ - echo "SKIP: ui-next/clone-ssh. ANSIBLE_UI_GIT_REPO_SSH is not set."; \ - elif [ -d "$(ANSIBLE_UI_DIR)" ]; then \ - echo "SKIP: ui-next/clone-ssh. $(ANSIBLE_UI_DIR) already exists."; \ - else \ - git clone --depth 1 --branch $(ANSIBLE_UI_GIT_BRANCH) $(ANSIBLE_UI_GIT_REPO_SSH) $(ANSIBLE_UI_DIR) || true; \ - fi - -.PHONY: ui-next/link-local -## Link to a existing local clone of ui-next repo. -ui-next/link-local: - @if [ -z "$(ANSIBLE_UI_LOCAL)" ]; then \ - echo "SKIP: ui-next/link-local. ANSIBLE_UI_LOCAL is not set."; \ - elif [ -d "$(ANSIBLE_UI_DIR)" ]; then \ - echo "SKIP: ui-next/link-local. $(ANSIBLE_UI_DIR) already exists."; \ - else \ - ln -s $(ANSIBLE_UI_LOCAL) $(ANSIBLE_UI_DIR); \ - fi - -.PHONY: ui-next -## Try to link to a local clone of ui-next repo if it exist otherwise clone via ssh than https. -ui-next: - @if [ -d "$(ANSIBLE_UI_DIR)" ]; then \ - echo "SKIP: ui-next. $(ANSIBLE_UI_DIR) already exists."; \ - else \ - $(MAKE) ui-next/link-local ui-next/clone-ssh ui-next/clone-https; \ - fi - -## Alias for ui-next, will not run if ui-next already exist -$(ANSIBLE_UI_DIR): - $(MAKE) ui-next - -.PHONY: ui-next/build -## Build ui-next -ui-next/build: ui-next - cd $(ANSIBLE_UI_DIR) && \ - npm install webpack && \ - npm run build:controller - -## Alias for ui-next/build, will not run if build already exist -$(ANSIBLE_UI_DIR)/build: - $(MAKE) ui-next/build - -.PHONY: ui-next/clean -## Clean ui-next -ui-next/clean: - rm -rf $(UI_NEXT_BUILD_FLAG_FILE) - rm -rf $(ANSIBLE_UI_DIR) - -.PHONY: ui-next/clean/build -## Clean ui-next build -ui-next/clean/build: - rm -rf $(UI_NEXT_BUILD_FLAG_FILE) - rm -rf $(ANSIBLE_UI_DIR)/build - diff --git a/awx/ui-next/package.json b/awx/ui-next/package.json deleted file mode 100644 index 7870df4f20..0000000000 --- a/awx/ui-next/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "ui-next", - "homepage": ".", - "private": true, - "engines": { - "node": ">=16.13.1" - }, - -} \ No newline at end of file diff --git a/awx/ui_next/Makefile b/awx/ui_next/Makefile new file mode 100644 index 0000000000..1ad28e460d --- /dev/null +++ b/awx/ui_next/Makefile @@ -0,0 +1,80 @@ +ui_next_mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) +ui_next_dir := $(shell realpath --relative-to $(CURDIR) $(dir $(ui_next_mkfile_path))) + +ANSIBLE_UI_DIR ?= $(ui_next_dir)/src + +ANSIBLE_UI_GIT_REPO_HTTPS ?= +ANSIBLE_UI_GIT_REPO_SSH ?= +ANSIBLE_UI_GIT_BRANCH ?= main + +ANSIBLE_UI_LOCAL ?= + +.PHONY: ui_next/clone-https +## Shallow clone the ui_next repo via https skip if ANSIBLE_UI_GIT_REPO_HTTPS is undefined +ui_next/clone-https: + @if [ -z "$(ANSIBLE_UI_GIT_REPO_HTTPS)" ]; then \ + echo "SKIP: ui_next/clone-https. ANSIBLE_UI_GIT_REPO_HTTPS is not set."; \ + elif [ -d "$(ANSIBLE_UI_DIR)" ]; then \ + echo "SKIP: ui_next/clone-https. $(ANSIBLE_UI_DIR) already exists."; \ + else \ + git clone --depth 1 --branch $(ANSIBLE_UI_GIT_BRANCH) $(ANSIBLE_UI_GIT_REPO_HTTPS) $(ANSIBLE_UI_DIR) || true; \ + fi + +.PHONY: ui_next/clone-ssh +## Shallow clone the ui_next repo via ssh. +ui_next/clone-ssh: + @if [ -z "$(ANSIBLE_UI_GIT_REPO_SSH)" ]; then \ + echo "SKIP: ui_next/clone-ssh. ANSIBLE_UI_GIT_REPO_SSH is not set."; \ + elif [ -d "$(ANSIBLE_UI_DIR)" ]; then \ + echo "SKIP: ui_next/clone-ssh. $(ANSIBLE_UI_DIR) already exists."; \ + else \ + git clone --depth 1 --branch $(ANSIBLE_UI_GIT_BRANCH) $(ANSIBLE_UI_GIT_REPO_SSH) $(ANSIBLE_UI_DIR) || true; \ + fi + +.PHONY: ui_next/link-local +## Link to a existing local clone of ui_next repo. +ui_next/link-local: + @if [ -z "$(ANSIBLE_UI_LOCAL)" ]; then \ + echo "SKIP: ui_next/link-local. ANSIBLE_UI_LOCAL is not set."; \ + elif [ -d "$(ANSIBLE_UI_DIR)" ]; then \ + echo "SKIP: ui_next/link-local. $(ANSIBLE_UI_DIR) already exists."; \ + else \ + ln -s $(ANSIBLE_UI_LOCAL) $(ANSIBLE_UI_DIR); \ + fi + +.PHONY: ui_next +## Try to link to a local clone of ui_next repo if it exist otherwise clone via ssh than https. +ui_next: + @if [ -d "$(ANSIBLE_UI_DIR)" ]; then \ + echo "SKIP: ui_next. $(ANSIBLE_UI_DIR) already exists."; \ + else \ + $(MAKE) ui_next/link-local ui_next/clone-ssh ui_next/clone-https; \ + fi + +## Alias for ui_next, will not run if ui_next already exist +$(ANSIBLE_UI_DIR): + $(MAKE) ui_next + +.PHONY: ui_next/build +## Build ui_next +ui_next/build: ui_next + cd $(ANSIBLE_UI_DIR) && \ + npm install webpack && \ + npm run build:awx + +## Alias for ui_next/build, will not run if build already exist +$(ANSIBLE_UI_DIR)/build: + $(MAKE) ui_next/build + +.PHONY: ui_next/clean +## Clean ui_next +ui_next/clean: + rm -rf $(UI_NEXT_BUILD_FLAG_FILE) + rm -rf $(ANSIBLE_UI_DIR) + +.PHONY: ui_next/clean/build +## Clean ui_next build +ui_next/clean/build: + rm -rf $(UI_NEXT_BUILD_FLAG_FILE) + rm -rf $(ANSIBLE_UI_DIR)/build + diff --git a/awx/ui-next/README.md b/awx/ui_next/README.md similarity index 100% rename from awx/ui-next/README.md rename to awx/ui_next/README.md diff --git a/awx/ui-next/urls.py b/awx/ui_next/urls.py similarity index 92% rename from awx/ui-next/urls.py rename to awx/ui_next/urls.py index 36bebdd81b..c96994091c 100644 --- a/awx/ui-next/urls.py +++ b/awx/ui_next/urls.py @@ -6,9 +6,10 @@ from awx.main.utils.licensing import server_product_name class IndexView(TemplateView): - template_name = 'index_controller.html' + template_name = 'index_awx.html' +# TODO: Hao fix this class MigrationsNotran(TemplateView): template_name = 'installing.html' @@ -23,7 +24,7 @@ class MigrationsNotran(TemplateView): return context -app_name = 'ui-next' +app_name = 'ui_next' urlpatterns = [ re_path(r'^$', IndexView.as_view(), name='index'), diff --git a/awx/urls.py b/awx/urls.py index af30cf361e..ea4248f7db 100644 --- a/awx/urls.py +++ b/awx/urls.py @@ -9,8 +9,7 @@ from awx.main.views import handle_400, handle_403, handle_404, handle_500, handl urlpatterns = [ re_path(r'', include('awx.ui.urls', namespace='ui')), - re_path(r'^controller/.*$', include('awx.ui-next.urls', namespace='controller')), - # re_path(r'^ui-next/', include('awx.ui-next.urls', namespace='ui-next')), + re_path(r'^ui_next/.*$', include('awx.ui_next.urls', namespace='ui_next')), re_path(r'^api/', include('awx.api.urls', namespace='api')), re_path(r'^sso/', include('awx.sso.urls', namespace='sso')), re_path(r'^sso/', include('social_django.urls', namespace='social')), From 3316cfab3a1a319fca5bcca721a31eb8dbe0f8e3 Mon Sep 17 00:00:00 2001 From: Kia Lam Date: Tue, 21 Feb 2023 17:39:55 -0800 Subject: [PATCH 06/15] Add banner to dashboard page. Co-Authored-By: kialam <2293210+kialam@users.noreply.github.com> --- awx/ui/src/screens/Dashboard/Dashboard.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/awx/ui/src/screens/Dashboard/Dashboard.js b/awx/ui/src/screens/Dashboard/Dashboard.js index 1481b9ac5f..9ec35d7ba0 100644 --- a/awx/ui/src/screens/Dashboard/Dashboard.js +++ b/awx/ui/src/screens/Dashboard/Dashboard.js @@ -1,14 +1,16 @@ import React, { useCallback, useEffect, useState } from 'react'; import styled from 'styled-components'; -import { t } from '@lingui/macro'; +import { t, Trans } from '@lingui/macro'; import { + Banner, Card, PageSection, Tabs, Tab, TabTitleText, } from '@patternfly/react-core'; +import { InfoCircleIcon } from '@patternfly/react-icons'; import useRequest from 'hooks/useRequest'; import { DashboardAPI } from 'api'; @@ -69,6 +71,15 @@ function Dashboard() { } return ( <> + + +

+ A tech preview of the new Ansible Automation + Platform user interface can be found{' '} + here. +

+
+
Date: Mon, 27 Feb 2023 18:48:48 -0500 Subject: [PATCH 07/15] WIP --- MANIFEST.in | 2 +- awx/settings/defaults.py | 4 +-- awx/ui_next/Makefile | 67 ++++++++++++++++++++-------------------- 3 files changed, 36 insertions(+), 37 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 61e42bfcde..09a5392c50 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,7 +6,7 @@ recursive-include awx/templates *.html recursive-include awx/api/templates *.md *.html *.yml recursive-include awx/ui/build *.html recursive-include awx/ui/build * -recursive-include awx/ui_next/src/build * +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/awx/settings/defaults.py b/awx/settings/defaults.py index a98c8a3b11..974169ff53 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -85,7 +85,7 @@ USE_TZ = True STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'ui', 'build', 'static'), - os.path.join(BASE_DIR, 'ui_next', 'src', 'build'), + os.path.join(BASE_DIR, 'ui_next', 'build'), os.path.join(BASE_DIR, 'static'), ] @@ -298,7 +298,7 @@ TEMPLATES = [ os.path.join(BASE_DIR, 'templates'), os.path.join(BASE_DIR, 'ui', 'build'), os.path.join(BASE_DIR, 'ui', 'public'), - os.path.join(BASE_DIR, 'ui_next', 'src', 'build', 'awx'), + os.path.join(BASE_DIR, 'ui_next', 'build', 'awx'), ], }, ] diff --git a/awx/ui_next/Makefile b/awx/ui_next/Makefile index 1ad28e460d..b4b54a468d 100644 --- a/awx/ui_next/Makefile +++ b/awx/ui_next/Makefile @@ -1,80 +1,79 @@ -ui_next_mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) -ui_next_dir := $(shell realpath --relative-to $(CURDIR) $(dir $(ui_next_mkfile_path))) +UI_NEXT_MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +UI_NEXT_DIR := $(shell realpath --relative-to $(CURDIR) $(dir $(UI_NEXT_MKFILE_PATH))) -ANSIBLE_UI_DIR ?= $(ui_next_dir)/src +UI_NEXT_SRC_DIR := $(UI_NEXT_DIR)/src -ANSIBLE_UI_GIT_REPO_HTTPS ?= -ANSIBLE_UI_GIT_REPO_SSH ?= -ANSIBLE_UI_GIT_BRANCH ?= main +UI_NEXT_SRC_GIT_REPO_HTTPS ?= +UI_NEXT_SRC_GIT_REPO_SSH ?= +UI_NEXT_SRC_GIT_BRANCH ?= main -ANSIBLE_UI_LOCAL ?= +UI_NEXT_LOCAL ?= .PHONY: ui_next/clone-https -## Shallow clone the ui_next repo via https skip if ANSIBLE_UI_GIT_REPO_HTTPS is undefined +## Shallow clone the ui_next repo via https skip if UI_NEXT_SRC_GIT_REPO_HTTPS is undefined ui_next/clone-https: - @if [ -z "$(ANSIBLE_UI_GIT_REPO_HTTPS)" ]; then \ - echo "SKIP: ui_next/clone-https. ANSIBLE_UI_GIT_REPO_HTTPS is not set."; \ - elif [ -d "$(ANSIBLE_UI_DIR)" ]; then \ - echo "SKIP: ui_next/clone-https. $(ANSIBLE_UI_DIR) already exists."; \ + @if [ -z "$(UI_NEXT_SRC_GIT_REPO_HTTPS)" ]; then \ + echo "SKIP: ui_next/clone-https. UI_NEXT_SRC_GIT_REPO_HTTPS is not set."; \ + elif [ -d "$(UI_NEXT_SRC_DIR)" ]; then \ + echo "SKIP: ui_next/clone-https. $(UI_NEXT_SRC_DIR) already exists."; \ else \ - git clone --depth 1 --branch $(ANSIBLE_UI_GIT_BRANCH) $(ANSIBLE_UI_GIT_REPO_HTTPS) $(ANSIBLE_UI_DIR) || true; \ + git clone --depth 1 --branch $(UI_NEXT_SRC_GIT_BRANCH) $(UI_NEXT_SRC_GIT_REPO_HTTPS) $(UI_NEXT_SRC_DIR) || true; \ fi .PHONY: ui_next/clone-ssh ## Shallow clone the ui_next repo via ssh. ui_next/clone-ssh: - @if [ -z "$(ANSIBLE_UI_GIT_REPO_SSH)" ]; then \ - echo "SKIP: ui_next/clone-ssh. ANSIBLE_UI_GIT_REPO_SSH is not set."; \ - elif [ -d "$(ANSIBLE_UI_DIR)" ]; then \ - echo "SKIP: ui_next/clone-ssh. $(ANSIBLE_UI_DIR) already exists."; \ + @if [ -z "$(UI_NEXT_SRC_GIT_REPO_SSH)" ]; then \ + echo "SKIP: ui_next/clone-ssh. UI_NEXT_SRC_GIT_REPO_SSH is not set."; \ + elif [ -d "$(UI_NEXT_SRC_DIR)" ]; then \ + echo "SKIP: ui_next/clone-ssh. $(UI_NEXT_SRC_DIR) already exists."; \ else \ - git clone --depth 1 --branch $(ANSIBLE_UI_GIT_BRANCH) $(ANSIBLE_UI_GIT_REPO_SSH) $(ANSIBLE_UI_DIR) || true; \ + git clone --depth 1 --branch $(UI_NEXT_SRC_GIT_BRANCH) $(UI_NEXT_SRC_GIT_REPO_SSH) $(UI_NEXT_SRC_DIR) || true; \ fi .PHONY: ui_next/link-local ## Link to a existing local clone of ui_next repo. ui_next/link-local: - @if [ -z "$(ANSIBLE_UI_LOCAL)" ]; then \ - echo "SKIP: ui_next/link-local. ANSIBLE_UI_LOCAL is not set."; \ - elif [ -d "$(ANSIBLE_UI_DIR)" ]; then \ - echo "SKIP: ui_next/link-local. $(ANSIBLE_UI_DIR) already exists."; \ + @if [ -z "$(UI_NEXT_LOCAL)" ]; then \ + echo "SKIP: ui_next/link-local. UI_NEXT_LOCAL is not set."; \ + elif [ -d "$(UI_NEXT_SRC_DIR)" ]; then \ + echo "SKIP: ui_next/link-local. $(UI_NEXT_SRC_DIR) already exists."; \ else \ - ln -s $(ANSIBLE_UI_LOCAL) $(ANSIBLE_UI_DIR); \ + ln -s $(UI_NEXT_LOCAL) $(UI_NEXT_SRC_DIR); \ fi .PHONY: ui_next ## Try to link to a local clone of ui_next repo if it exist otherwise clone via ssh than https. ui_next: - @if [ -d "$(ANSIBLE_UI_DIR)" ]; then \ - echo "SKIP: ui_next. $(ANSIBLE_UI_DIR) already exists."; \ + @if [ -d "$(UI_NEXT_SRC_DIR)" ]; then \ + echo "SKIP: ui_next. $(UI_NEXT_SRC_DIR) already exists."; \ else \ $(MAKE) ui_next/link-local ui_next/clone-ssh ui_next/clone-https; \ fi ## Alias for ui_next, will not run if ui_next already exist -$(ANSIBLE_UI_DIR): +$(UI_NEXT_SRC_DIR): $(MAKE) ui_next .PHONY: ui_next/build ## Build ui_next ui_next/build: ui_next - cd $(ANSIBLE_UI_DIR) && \ + cd $(UI_NEXT_SRC_DIR) && \ npm install webpack && \ - npm run build:awx + npm run build:awx && \ + mv build ../ ## Alias for ui_next/build, will not run if build already exist -$(ANSIBLE_UI_DIR)/build: +$(UI_NEXT_DIR)/build: $(MAKE) ui_next/build .PHONY: ui_next/clean ## Clean ui_next -ui_next/clean: - rm -rf $(UI_NEXT_BUILD_FLAG_FILE) - rm -rf $(ANSIBLE_UI_DIR) +ui_next/clean: ui_next/clean/build + rm -rf $(UI_NEXT_SRC_DIR) .PHONY: ui_next/clean/build ## Clean ui_next build ui_next/clean/build: - rm -rf $(UI_NEXT_BUILD_FLAG_FILE) - rm -rf $(ANSIBLE_UI_DIR)/build + rm -rf $$(UI_NEXT_DIR)/build From 5d0c5352e84a630eca28aa51da646334ab6e531d Mon Sep 17 00:00:00 2001 From: Hao Liu Date: Mon, 27 Feb 2023 19:43:46 -0500 Subject: [PATCH 08/15] gitignore build --- .gitignore | 1 + awx/ui_next/Makefile | 13 +++++++++---- awx/urls.py | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 30acd82ad9..1e48c997b8 100644 --- a/.gitignore +++ b/.gitignore @@ -163,3 +163,4 @@ use_dev_supervisor.txt /Dockerfile.kube-dev awx/ui_next/src +awx/ui_next/build diff --git a/awx/ui_next/Makefile b/awx/ui_next/Makefile index b4b54a468d..b6fb1b70d5 100644 --- a/awx/ui_next/Makefile +++ b/awx/ui_next/Makefile @@ -56,12 +56,16 @@ $(UI_NEXT_SRC_DIR): $(MAKE) ui_next .PHONY: ui_next/build -## Build ui_next -ui_next/build: ui_next +## Build ui_next from source +ui_next/src/build: ui_next cd $(UI_NEXT_SRC_DIR) && \ npm install webpack && \ - npm run build:awx && \ - mv build ../ + npm run build:awx + +.PHONY: ui_next/build +## Copy ui_next/src/build to ui_next/build +ui_next/build: ui_next/src/build + cp -r $(UI_NEXT_SRC_DIR)/build $(UI_NEXT_DIR)/build ## Alias for ui_next/build, will not run if build already exist $(UI_NEXT_DIR)/build: @@ -77,3 +81,4 @@ ui_next/clean: ui_next/clean/build ui_next/clean/build: rm -rf $$(UI_NEXT_DIR)/build + diff --git a/awx/urls.py b/awx/urls.py index ea4248f7db..605f549d23 100644 --- a/awx/urls.py +++ b/awx/urls.py @@ -9,7 +9,7 @@ from awx.main.views import handle_400, handle_403, handle_404, handle_500, handl urlpatterns = [ re_path(r'', include('awx.ui.urls', namespace='ui')), - re_path(r'^ui_next/.*$', include('awx.ui_next.urls', namespace='ui_next')), + re_path(r'^ui_next/.*', include('awx.ui_next.urls', namespace='ui_next')), re_path(r'^api/', include('awx.api.urls', namespace='api')), re_path(r'^sso/', include('awx.sso.urls', namespace='sso')), re_path(r'^sso/', include('social_django.urls', namespace='social')), From c0927e1c29ab4084c7b58408269bc9e9c5e640d2 Mon Sep 17 00:00:00 2001 From: Hao Liu Date: Mon, 27 Feb 2023 20:49:39 -0500 Subject: [PATCH 09/15] update makefiles --- Makefile | 8 ++++---- awx/ui_next/Makefile | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index dfb3225321..149f9718b0 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -include awx/ui_next/Makefile +-include awx/ui_next/Makefile PYTHON ?= python3.9 OFFICIAL ?= no @@ -387,7 +387,7 @@ bulk_data: # UI TASKS # -------------------------------------- -UI_BUILD_FLAG_FILE = $(CURDIR)/ui/.ui-built +UI_BUILD_FLAG_FILE = awx/ui/.ui-built clean-ui: rm -rf node_modules @@ -448,7 +448,7 @@ HEADLESS ?= no ifeq ($(HEADLESS), yes) dist/$(SDIST_TAR_FILE): else -dist/$(SDIST_TAR_FILE): $(UI_BUILD_FLAG_FILE) awx/ui_next/src/build +dist/$(SDIST_TAR_FILE): $(UI_BUILD_FLAG_FILE) awx/ui_next/build endif $(PYTHON) -m build -s ln -sf $(SDIST_TAR_FILE) dist/awx.tar.gz @@ -590,7 +590,7 @@ awx-kube-dev-build: Dockerfile.kube-dev -t $(DEV_DOCKER_TAG_BASE)/awx_kube_devel:$(COMPOSE_TAG) . ## Build awx image for deployment on Kubernetes environment. -awx-kube-build: Dockerfile +awx-kube-build: Dockerfile awx/ui_next/src DOCKER_BUILDKIT=1 docker build -f Dockerfile \ --build-arg VERSION=$(VERSION) \ --build-arg SETUPTOOLS_SCM_PRETEND_VERSION=$(VERSION) \ diff --git a/awx/ui_next/Makefile b/awx/ui_next/Makefile index b6fb1b70d5..2056536812 100644 --- a/awx/ui_next/Makefile +++ b/awx/ui_next/Makefile @@ -79,6 +79,6 @@ ui_next/clean: ui_next/clean/build .PHONY: ui_next/clean/build ## Clean ui_next build ui_next/clean/build: - rm -rf $$(UI_NEXT_DIR)/build + rm -rf $(UI_NEXT_DIR)/build From 0cd7a0033980ba7357be383e8619a49ad5beac89 Mon Sep 17 00:00:00 2001 From: Hao Liu Date: Tue, 28 Feb 2023 09:51:30 -0500 Subject: [PATCH 10/15] add readme --- awx/ui_next/Makefile | 28 ++++++++++++++-------------- awx/ui_next/README.md | 33 +++++++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/awx/ui_next/Makefile b/awx/ui_next/Makefile index 2056536812..d77524dc0b 100644 --- a/awx/ui_next/Makefile +++ b/awx/ui_next/Makefile @@ -3,32 +3,32 @@ UI_NEXT_DIR := $(shell realpath --relative-to $(CURDIR) $(dir $(UI_NEXT_MKFILE_P UI_NEXT_SRC_DIR := $(UI_NEXT_DIR)/src -UI_NEXT_SRC_GIT_REPO_HTTPS ?= -UI_NEXT_SRC_GIT_REPO_SSH ?= -UI_NEXT_SRC_GIT_BRANCH ?= main +UI_NEXT_GIT_REPO_HTTPS ?= +UI_NEXT_GIT_REPO_SSH ?= +UI_NEXT_GIT_BRANCH ?= main UI_NEXT_LOCAL ?= .PHONY: ui_next/clone-https -## Shallow clone the ui_next repo via https skip if UI_NEXT_SRC_GIT_REPO_HTTPS is undefined +## Shallow clone the ui_next repo via https skip if UI_NEXT_GIT_REPO_HTTPS is undefined ui_next/clone-https: - @if [ -z "$(UI_NEXT_SRC_GIT_REPO_HTTPS)" ]; then \ - echo "SKIP: ui_next/clone-https. UI_NEXT_SRC_GIT_REPO_HTTPS is not set."; \ + @if [ -z "$(UI_NEXT_GIT_REPO_HTTPS)" ]; then \ + echo "SKIP: ui_next/clone-https. UI_NEXT_GIT_REPO_HTTPS is not set."; \ elif [ -d "$(UI_NEXT_SRC_DIR)" ]; then \ echo "SKIP: ui_next/clone-https. $(UI_NEXT_SRC_DIR) already exists."; \ else \ - git clone --depth 1 --branch $(UI_NEXT_SRC_GIT_BRANCH) $(UI_NEXT_SRC_GIT_REPO_HTTPS) $(UI_NEXT_SRC_DIR) || true; \ + git clone --depth 1 --branch $(UI_NEXT_GIT_BRANCH) $(UI_NEXT_GIT_REPO_HTTPS) $(UI_NEXT_SRC_DIR) || true; \ fi .PHONY: ui_next/clone-ssh ## Shallow clone the ui_next repo via ssh. ui_next/clone-ssh: - @if [ -z "$(UI_NEXT_SRC_GIT_REPO_SSH)" ]; then \ - echo "SKIP: ui_next/clone-ssh. UI_NEXT_SRC_GIT_REPO_SSH is not set."; \ + @if [ -z "$(UI_NEXT_GIT_REPO_SSH)" ]; then \ + echo "SKIP: ui_next/clone-ssh. UI_NEXT_GIT_REPO_SSH is not set."; \ elif [ -d "$(UI_NEXT_SRC_DIR)" ]; then \ echo "SKIP: ui_next/clone-ssh. $(UI_NEXT_SRC_DIR) already exists."; \ else \ - git clone --depth 1 --branch $(UI_NEXT_SRC_GIT_BRANCH) $(UI_NEXT_SRC_GIT_REPO_SSH) $(UI_NEXT_SRC_DIR) || true; \ + git clone --depth 1 --branch $(UI_NEXT_GIT_BRANCH) $(UI_NEXT_GIT_REPO_SSH) $(UI_NEXT_SRC_DIR) || true; \ fi .PHONY: ui_next/link-local @@ -42,9 +42,9 @@ ui_next/link-local: ln -s $(UI_NEXT_LOCAL) $(UI_NEXT_SRC_DIR); \ fi -.PHONY: ui_next +.PHONY: ui_next/src ## Try to link to a local clone of ui_next repo if it exist otherwise clone via ssh than https. -ui_next: +ui_next/src: @if [ -d "$(UI_NEXT_SRC_DIR)" ]; then \ echo "SKIP: ui_next. $(UI_NEXT_SRC_DIR) already exists."; \ else \ @@ -53,11 +53,11 @@ ui_next: ## Alias for ui_next, will not run if ui_next already exist $(UI_NEXT_SRC_DIR): - $(MAKE) ui_next + $(MAKE) ui_next/src .PHONY: ui_next/build ## Build ui_next from source -ui_next/src/build: ui_next +ui_next/src/build: ui_next/src cd $(UI_NEXT_SRC_DIR) && \ npm install webpack && \ npm run build:awx diff --git a/awx/ui_next/README.md b/awx/ui_next/README.md index a238700135..35c5beb7c2 100644 --- a/awx/ui_next/README.md +++ b/awx/ui_next/README.md @@ -1,12 +1,33 @@ +# Instruction to build ui_next directly from this directory +## Set src of the ui_next repo -``` -git clone git@github.com:ansible/ansible-ui.git +### via GIT + +```bash +export UI_NEXT_GIT_BRANCH_REPO_HTTPS=https:// ``` -``` -pushd ansible-ui -npm run build:controller -popd +or + +```bash +export UI_NEXT_GIT_BRANCH_REPO_SSH=git@ ``` +optionally set branch (default is main) + +```bash +export UI_NEXT_GIT_BRANCH_BRANCH=main +``` + +### via symlink to existing clone + +```bash +export UI_NEXT_LOCAL = /path/to/your/ui_next +``` + +## Build + +```bash +make ui_next/build +``` From 9c16a3ed7450fa5f49d8aee635848b9b8b608f0b Mon Sep 17 00:00:00 2001 From: Hao Liu Date: Mon, 6 Mar 2023 16:49:13 -0500 Subject: [PATCH 11/15] remove need for realpath also add UI_NEXT repos since they are now public --- awx/ui_next/Makefile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/awx/ui_next/Makefile b/awx/ui_next/Makefile index d77524dc0b..1afb19f521 100644 --- a/awx/ui_next/Makefile +++ b/awx/ui_next/Makefile @@ -1,13 +1,17 @@ UI_NEXT_MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) -UI_NEXT_DIR := $(shell realpath --relative-to $(CURDIR) $(dir $(UI_NEXT_MKFILE_PATH))) +UI_NEXT_DIR := $(subst $(CURDIR)/,, $(UI_NEXT_MKFILE_PATH)) UI_NEXT_SRC_DIR := $(UI_NEXT_DIR)/src +UI_NEXT_BUILD_DIR := $(UI_NEXT_DIR)/build -UI_NEXT_GIT_REPO_HTTPS ?= -UI_NEXT_GIT_REPO_SSH ?= +# Path to your local clone of the UI_NEXT repo +UI_NEXT_LOCAL ?= + +# Git repo and branch to the UI_NEXT repo +UI_NEXT_GIT_REPO_SSH ?= git@github.com:ansible/ansible-ui.git +UI_NEXT_GIT_REPO_HTTPS ?= https://github.com/ansible/ansible-ui.git UI_NEXT_GIT_BRANCH ?= main -UI_NEXT_LOCAL ?= .PHONY: ui_next/clone-https ## Shallow clone the ui_next repo via https skip if UI_NEXT_GIT_REPO_HTTPS is undefined @@ -65,10 +69,10 @@ ui_next/src/build: ui_next/src .PHONY: ui_next/build ## Copy ui_next/src/build to ui_next/build ui_next/build: ui_next/src/build - cp -r $(UI_NEXT_SRC_DIR)/build $(UI_NEXT_DIR)/build + cp -r $(UI_NEXT_SRC_DIR)/build $(UI_NEXT_BUILD_DIR) ## Alias for ui_next/build, will not run if build already exist -$(UI_NEXT_DIR)/build: +$(UI_NEXT_BUILD_DIR): $(MAKE) ui_next/build .PHONY: ui_next/clean @@ -79,6 +83,6 @@ ui_next/clean: ui_next/clean/build .PHONY: ui_next/clean/build ## Clean ui_next build ui_next/clean/build: - rm -rf $(UI_NEXT_DIR)/build + rm -rf $(UI_NEXT_BUILD_DIR) From a612457c4abeaa083be0361c984e3171aa5015cf Mon Sep 17 00:00:00 2001 From: Hao Liu Date: Mon, 6 Mar 2023 17:19:01 -0500 Subject: [PATCH 12/15] fix some bug --- awx/ui_next/Makefile | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/awx/ui_next/Makefile b/awx/ui_next/Makefile index 1afb19f521..83ddd078ec 100644 --- a/awx/ui_next/Makefile +++ b/awx/ui_next/Makefile @@ -1,8 +1,9 @@ UI_NEXT_MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) -UI_NEXT_DIR := $(subst $(CURDIR)/,, $(UI_NEXT_MKFILE_PATH)) +UI_NEXT_MKFILE_DIR := $(dir $(UI_NEXT_MKFILE_PATH)) +UI_NEXT_DIR := $(subst $(CURDIR)/,, $(UI_NEXT_MKFILE_DIR)) -UI_NEXT_SRC_DIR := $(UI_NEXT_DIR)/src -UI_NEXT_BUILD_DIR := $(UI_NEXT_DIR)/build +UI_NEXT_SRC_DIR := $(UI_NEXT_DIR)src +UI_NEXT_BUILD_DIR := $(UI_NEXT_DIR)build # Path to your local clone of the UI_NEXT repo UI_NEXT_LOCAL ?= @@ -75,14 +76,25 @@ ui_next/build: ui_next/src/build $(UI_NEXT_BUILD_DIR): $(MAKE) ui_next/build +## Alias for ui_next/clean +$(UI_NEXT_DIR)clean: + rm -rf $(UI_NEXT_DIR)/src + rm -rf $(UI_NEXT_DIR)/build + .PHONY: ui_next/clean ## Clean ui_next ui_next/clean: ui_next/clean/build - rm -rf $(UI_NEXT_SRC_DIR) + rm -rf $(UI_NEXT_DIR)/src + +.PHONY: ui_next/clean/src +## Clean ui_next src +ui_next/clean/src: + rm -rf $(UI_NEXT_DIR)/src .PHONY: ui_next/clean/build ## Clean ui_next build ui_next/clean/build: - rm -rf $(UI_NEXT_BUILD_DIR) - + rm -rf $(UI_NEXT_DIR)/build +print-%: + @echo $($*) \ No newline at end of file From e7100389c69c0ad8d6946eb5aca7b97af8752fcf Mon Sep 17 00:00:00 2001 From: Hao Liu Date: Mon, 6 Mar 2023 17:19:33 -0500 Subject: [PATCH 13/15] naming consistancy --- awx/ui_next/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/awx/ui_next/Makefile b/awx/ui_next/Makefile index 83ddd078ec..e55952fe4a 100644 --- a/awx/ui_next/Makefile +++ b/awx/ui_next/Makefile @@ -62,14 +62,14 @@ $(UI_NEXT_SRC_DIR): .PHONY: ui_next/build ## Build ui_next from source -ui_next/src/build: ui_next/src +ui_next/build: ui_next/src cd $(UI_NEXT_SRC_DIR) && \ npm install webpack && \ npm run build:awx .PHONY: ui_next/build -## Copy ui_next/src/build to ui_next/build -ui_next/build: ui_next/src/build +## Copy ui_next/build to ui_next/build +ui_next/build: ui_next/build cp -r $(UI_NEXT_SRC_DIR)/build $(UI_NEXT_BUILD_DIR) ## Alias for ui_next/build, will not run if build already exist From e24a12db2948ae7ef3f1e3634d24b1379a0b41db Mon Sep 17 00:00:00 2001 From: Hao Liu Date: Mon, 6 Mar 2023 17:22:13 -0500 Subject: [PATCH 14/15] Update Makefile --- awx/ui_next/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/awx/ui_next/Makefile b/awx/ui_next/Makefile index e55952fe4a..8f9e5f3275 100644 --- a/awx/ui_next/Makefile +++ b/awx/ui_next/Makefile @@ -2,6 +2,7 @@ UI_NEXT_MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) UI_NEXT_MKFILE_DIR := $(dir $(UI_NEXT_MKFILE_PATH)) UI_NEXT_DIR := $(subst $(CURDIR)/,, $(UI_NEXT_MKFILE_DIR)) +# NOTE: UI_NEXT_DIR swallowed the / because we want to be able to run `make src` from the ui_next dir UI_NEXT_SRC_DIR := $(UI_NEXT_DIR)src UI_NEXT_BUILD_DIR := $(UI_NEXT_DIR)build From d6f7309a881c255e292e7d088548296fd5895675 Mon Sep 17 00:00:00 2001 From: Hao Liu Date: Mon, 6 Mar 2023 17:22:18 -0500 Subject: [PATCH 15/15] Revert "naming consistancy" This reverts commit e7100389c69c0ad8d6946eb5aca7b97af8752fcf. --- awx/ui_next/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/awx/ui_next/Makefile b/awx/ui_next/Makefile index 8f9e5f3275..3927034460 100644 --- a/awx/ui_next/Makefile +++ b/awx/ui_next/Makefile @@ -63,14 +63,14 @@ $(UI_NEXT_SRC_DIR): .PHONY: ui_next/build ## Build ui_next from source -ui_next/build: ui_next/src +ui_next/src/build: ui_next/src cd $(UI_NEXT_SRC_DIR) && \ npm install webpack && \ npm run build:awx .PHONY: ui_next/build -## Copy ui_next/build to ui_next/build -ui_next/build: ui_next/build +## Copy ui_next/src/build to ui_next/build +ui_next/build: ui_next/src/build cp -r $(UI_NEXT_SRC_DIR)/build $(UI_NEXT_BUILD_DIR) ## Alias for ui_next/build, will not run if build already exist