This commit is contained in:
Hao Liu
2023-02-27 15:23:46 -05:00
parent 5fbb6c79b3
commit 729414d5fa
10 changed files with 90 additions and 99 deletions

2
.gitignore vendored
View File

@@ -162,4 +162,4 @@ use_dev_supervisor.txt
/_build_kube_dev/ /_build_kube_dev/
/Dockerfile.kube-dev /Dockerfile.kube-dev
awx/ui-next/ansible-ui awx/ui_next/src

View File

@@ -6,7 +6,7 @@ recursive-include awx/templates *.html
recursive-include awx/api/templates *.md *.html *.yml recursive-include awx/api/templates *.md *.html *.yml
recursive-include awx/ui/build *.html recursive-include awx/ui/build *.html
recursive-include awx/ui/build * 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/playbooks *.yml
recursive-include awx/lib/site-packages * recursive-include awx/lib/site-packages *
recursive-include awx/plugins *.ps1 recursive-include awx/plugins *.ps1

View File

@@ -1,4 +1,4 @@
include awx/ui-next/Makefile include awx/ui_next/Makefile
PYTHON ?= python3.9 PYTHON ?= python3.9
OFFICIAL ?= no OFFICIAL ?= no
@@ -460,7 +460,7 @@ HEADLESS ?= no
ifeq ($(HEADLESS), yes) ifeq ($(HEADLESS), yes)
dist/$(SDIST_TAR_FILE): dist/$(SDIST_TAR_FILE):
else 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 endif
$(PYTHON) -m build -s $(PYTHON) -m build -s
ln -sf $(SDIST_TAR_FILE) dist/awx.tar.gz ln -sf $(SDIST_TAR_FILE) dist/awx.tar.gz

View File

@@ -85,7 +85,7 @@ USE_TZ = True
STATICFILES_DIRS = [ STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'ui', 'build', 'static'), 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'), os.path.join(BASE_DIR, 'static'),
] ]
@@ -298,7 +298,7 @@ TEMPLATES = [
os.path.join(BASE_DIR, 'templates'), os.path.join(BASE_DIR, 'templates'),
os.path.join(BASE_DIR, 'ui', 'build'), os.path.join(BASE_DIR, 'ui', 'build'),
os.path.join(BASE_DIR, 'ui', 'public'), 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'),
], ],
}, },
] ]

View File

@@ -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

View File

@@ -1,9 +0,0 @@
{
"name": "ui-next",
"homepage": ".",
"private": true,
"engines": {
"node": ">=16.13.1"
},
}

80
awx/ui_next/Makefile Normal file
View File

@@ -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

View File

@@ -6,9 +6,10 @@ from awx.main.utils.licensing import server_product_name
class IndexView(TemplateView): class IndexView(TemplateView):
template_name = 'index_controller.html' template_name = 'index_awx.html'
# TODO: Hao fix this
class MigrationsNotran(TemplateView): class MigrationsNotran(TemplateView):
template_name = 'installing.html' template_name = 'installing.html'
@@ -23,7 +24,7 @@ class MigrationsNotran(TemplateView):
return context return context
app_name = 'ui-next' app_name = 'ui_next'
urlpatterns = [ urlpatterns = [
re_path(r'^$', IndexView.as_view(), name='index'), re_path(r'^$', IndexView.as_view(), name='index'),

View File

@@ -9,8 +9,7 @@ from awx.main.views import handle_400, handle_403, handle_404, handle_500, handl
urlpatterns = [ urlpatterns = [
re_path(r'', include('awx.ui.urls', namespace='ui')), 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'^api/', include('awx.api.urls', namespace='api')),
re_path(r'^sso/', include('awx.sso.urls', namespace='sso')), re_path(r'^sso/', include('awx.sso.urls', namespace='sso')),
re_path(r'^sso/', include('social_django.urls', namespace='social')), re_path(r'^sso/', include('social_django.urls', namespace='social')),