Serve PolyGerrit index.html from a Soy template
Rather than serving a static file, serve the PolyGerrit index HTML document from a Soy template. In this way, the path to load PG dependencies can be safely parameterized in two ways: * If Gerrit is not running on the root of the domain (e.g. listening on https://example.com/my-gerrit/) the path component of the Canonical Web URL is used to load PG dependencies. Instead of /elements/gr-app.js off the root of the domain it uses /my-gerrit/elements/gr-app.js * If the PolyGerrit static resources are to be served from a CDN rather than the Gerrit WAR, the `cdnPath` config in the [gerrit] section can be used. For example, if the server config says ... [gerrit] cdnPath = http://my-cdn.com/pg/version/123 ... then it uses the following style of path for PG dependencies. http://my-cdn.com/pg/version/123/my-gerrit/elements/gr-app.js If a CDN-path is configured, it supersedes subdirectories appearing in the Canonical-Web-URL for this purpose. Feature: Issue 5845 Change-Id: I2b2d704fe33c90ea2f2a2183fc79897642a48175
This commit is contained in:
@@ -27,7 +27,7 @@ limitations under the License.
|
||||
|
||||
<test-fixture id="basic">
|
||||
<template>
|
||||
<gr-app id="app"></gr-app>
|
||||
<gr-app id="app" canonical-path="/abc/def/ghi"></gr-app>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
@@ -41,6 +41,9 @@ limitations under the License.
|
||||
stub('gr-reporting', {
|
||||
appStarted: sandbox.stub(),
|
||||
});
|
||||
stub('gr-account-dropdown', {
|
||||
_getTopContent: sinon.stub(),
|
||||
});
|
||||
stub('gr-rest-api-interface', {
|
||||
getAccount: function() { return Promise.resolve({}); },
|
||||
getAccountCapabilities: function() { return Promise.resolve({}); },
|
||||
@@ -99,5 +102,9 @@ limitations under the License.
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('canonical-path', function() {
|
||||
assert.equal(Gerrit.CANONICAL_PATH, '/abc/def/ghi');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user