From 81af2d9fcc11b32b6195c1606e05fd0595943725 Mon Sep 17 00:00:00 2001 From: Sam Chow Date: Thu, 10 May 2018 13:22:53 -0400 Subject: [PATCH] Use different js bundle with base html --- endpoints/common.py | 6 +++--- endpoints/setup_web.py | 2 +- static/configappjs/index.js | 5 +++++ templates/config_index.html | 14 ++++++-------- webpack.config.js | 5 ++++- 5 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 static/configappjs/index.js diff --git a/endpoints/common.py b/endpoints/common.py index 82040bb06..a5113ca79 100644 --- a/endpoints/common.py +++ b/endpoints/common.py @@ -24,7 +24,7 @@ from _init import __version__ logger = logging.getLogger(__name__) -JS_BUNDLE_NAME = 'bundle' +JS_BUNDLE_NAME = 'main' def common_login(user_uuid, permanent_session=True): @@ -73,9 +73,9 @@ def _list_files(path, extension, contains=""): return [join_path(dp, f) for dp, _, files in os.walk(filepath) for f in files if matches(f)] -def render_page_template(name, route_data=None, **kwargs): +def render_page_template(name, route_data=None, js_bundle_name=JS_BUNDLE_NAME, **kwargs): """ Renders the page template with the given name as the response and returns its contents. """ - main_scripts = _list_files('build', 'js', JS_BUNDLE_NAME) + main_scripts = _list_files('build', 'js', js_bundle_name) use_cdn = app.config.get('USE_CDN', True) if request.args.get('use_cdn') is not None: diff --git a/endpoints/setup_web.py b/endpoints/setup_web.py index b99c3e2f8..acd2640f3 100644 --- a/endpoints/setup_web.py +++ b/endpoints/setup_web.py @@ -36,7 +36,7 @@ STATUS_TAGS = app.config['STATUS_TAGS'] @setup_web.route('/', methods=['GET'], defaults={'path': ''}) @no_cache def index(path, **kwargs): - return render_page_template_with_routedata('config_index.html', **kwargs) + return render_page_template_with_routedata('config_index.html', js_bundle_name='configapp', **kwargs) @setup_web.errorhandler(404) @setup_web.route('/404', methods=['GET']) diff --git a/static/configappjs/index.js b/static/configappjs/index.js new file mode 100644 index 000000000..9bac6fe97 --- /dev/null +++ b/static/configappjs/index.js @@ -0,0 +1,5 @@ + + +const setupPage = ''; +angular.module('quay', [setupPage]); +console.log('Hello world! I\'m the config app'); \ No newline at end of file diff --git a/templates/config_index.html b/templates/config_index.html index 3abcccfec..f81ae7935 100644 --- a/templates/config_index.html +++ b/templates/config_index.html @@ -1,13 +1,11 @@ - - - - +{% extends "base.html" %} + +{% block title %} Config mode - - +{% endblock %} +{% block body_content %}

What is my purpose?
You create tarballs

- - \ No newline at end of file +{% endblock %} diff --git a/webpack.config.js b/webpack.config.js index 6944a3a64..51df57480 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -3,7 +3,10 @@ const path = require('path'); let config = { - entry: "./static/js/main.ts", + entry: { + main: "./static/js/main.ts", + configapp: "./static/configappjs/index.js" + }, output: { path: path.resolve(__dirname, "static/build"), publicPath: "/static/build/",