From 18b3f76f0e65fd577ad188bf705e59d21bf99f79 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Mon, 10 Jun 2019 15:00:28 +0100 Subject: [PATCH] ui: We can't use move everything to javascript (#5941) Unfortuantely we can't seem to be able to use and rootURL together as URL paths will get doubled up (`ui/ui/`). This moves all the things that we need to interpolate with .ContentPath to the `startup` javascript so we can conditionally print out `{{.ContentPath}}` in lots of places (now we can't use base) --- ui-v2/app/index.html | 70 +----------------------------- ui-v2/lib/startup/index.js | 88 ++++++++++++++++++++++++++++++++++---- 2 files changed, 80 insertions(+), 78 deletions(-) diff --git a/ui-v2/app/index.html b/ui-v2/app/index.html index 6abc25987bf7..75e518e9b6c9 100644 --- a/ui-v2/app/index.html +++ b/ui-v2/app/index.html @@ -6,80 +6,12 @@ Consul by HashiCorp - + {{content-for "// all HTML content is populated via ./lib/startup/index"}} {{content-for "head"}} - - - - - - - {{content-for "head-footer"}} - {{content-for "body"}} - - - - {{content-for "body-footer"}} diff --git a/ui-v2/lib/startup/index.js b/ui-v2/lib/startup/index.js index 5a9e58f77d8e..732c95f396ec 100644 --- a/ui-v2/lib/startup/index.js +++ b/ui-v2/lib/startup/index.js @@ -4,21 +4,91 @@ module.exports = { name: 'startup', contentFor: function(type, config) { const enterprise = config.CONSUL_BINARY_TYPE !== 'oss' && config.CONSUL_BINARY_TYPE !== ''; + // .ContentPath here is populated via the go binary + const rootURL = config.environment === 'production' ? '{{.ContentPath}}' : config.rootURL; + const appName = config.modulePrefix; switch (type) { case 'head': return [ ``, - // .ContentPath here is populated via the go binary - ``, + ``, + ` + + + + `, ].join('\n'); case 'body': - return `${ - enterprise - ? `` - : '' - }`; + return [ + ` + + `, + `${ + enterprise + ? `` + : '' + }`, + ` + + + + + `, + ].join('\n'); case 'root-class': return 'ember-loading'; }