Use different js bundle with base html

This commit is contained in:
Sam Chow 2018-05-10 13:22:53 -04:00
parent 708b7ee669
commit 81af2d9fcc
5 changed files with 19 additions and 13 deletions

View file

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

View file

@ -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'])

View file

@ -0,0 +1,5 @@
const setupPage = '';
angular.module('quay', [setupPage]);
console.log('Hello world! I\'m the config app');

View file

@ -1,13 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
{% extends "base.html" %}
{% block title %}
<title>Config mode</title>
</head>
<body>
{% endblock %}
{% block body_content %}
<p>
<div>What is my purpose?</div>
<div>You create tarballs</div>
</p>
</body>
</html>
{% endblock %}

View file

@ -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/",