[kibana] use relative paths on the front-end, and basePath on the back-end
This commit is contained in:
parent
66535c4dcf
commit
0ed8889de1
|
@ -16,6 +16,7 @@ let babelExclude = [/[\/\\](webpackShims|node_modules|bower_components)[\/\\]/];
|
|||
class BaseOptimizer {
|
||||
constructor(opts) {
|
||||
this.env = opts.env;
|
||||
this.urlBasePath = opts.urlBasePath;
|
||||
this.bundles = opts.bundles;
|
||||
this.profile = opts.profile || false;
|
||||
|
||||
|
@ -74,7 +75,7 @@ class BaseOptimizer {
|
|||
path: this.env.workingDir,
|
||||
filename: '[name].bundle.js',
|
||||
sourceMapFilename: '[file].map',
|
||||
publicPath: '/bundles/',
|
||||
publicPath: this.urlBasePath + '/bundles/',
|
||||
devtoolModuleFilenameTemplate: '[absolute-resource-path]'
|
||||
},
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ module.exports = async (kbnServer, server, config) => {
|
|||
env: bundles.env,
|
||||
bundles: bundles,
|
||||
profile: config.get('optimize.profile'),
|
||||
urlBasePath: config.get('server.basePath'),
|
||||
sourceMaps: config.get('optimize.sourceMaps'),
|
||||
unsafeCache: config.get('optimize.unsafeCache'),
|
||||
});
|
||||
|
|
|
@ -15,6 +15,7 @@ module.exports = async (kbnServer, kibanaHapiServer, config) => {
|
|||
profile: config.get('optimize.profile'),
|
||||
sourceMaps: config.get('optimize.sourceMaps'),
|
||||
prebuild: config.get('optimize.lazyPrebuild'),
|
||||
urlBasePath: config.get('server.basePath'),
|
||||
unsafeCache: config.get('optimize.unsafeCache'),
|
||||
})
|
||||
);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="kbn-settings-about container" ng-controller="settingsAbout">
|
||||
<div class="col-md-4 col-md-offset-4 jumbotron">
|
||||
<center>
|
||||
<img src='/plugins/kibana/settings/sections/about/barcode.svg' alt="Kibana Barcode Logo" width="128" height="128"><br>
|
||||
<img src='../plugins/kibana/settings/sections/about/barcode.svg' alt="Kibana Barcode Logo" width="128" height="128"><br>
|
||||
<h1>Kibana</h1>
|
||||
<p>
|
||||
<table class="table table-condensed kbn-settings-about-versions">
|
||||
|
|
|
@ -5,6 +5,6 @@ define(function (require) {
|
|||
order: 3,
|
||||
name: 'status',
|
||||
display: 'Status',
|
||||
url: '/status'
|
||||
url: '../status'
|
||||
};
|
||||
});
|
||||
|
|
|
@ -23,7 +23,7 @@ require('ui/chrome')
|
|||
|
||||
// go ahead and get the info you want
|
||||
return $http
|
||||
.get('/api/status')
|
||||
.get('./api/status')
|
||||
.then(function (resp) {
|
||||
|
||||
if (ui.fetchError) {
|
||||
|
|
|
@ -19,7 +19,7 @@ class UiApp {
|
|||
this.hidden = this.spec.hidden;
|
||||
this.autoloadOverrides = this.spec.autoload;
|
||||
this.templateName = this.spec.templateName || 'uiApp';
|
||||
this.url = this.spec.url || '/app/' + this.id;
|
||||
this.url = (spec.urlBasePath || '') + (this.spec.url || '/app/' + this.id);
|
||||
|
||||
// once this resolves, no reason to run it again
|
||||
this.getModules = _.once(this.getModules);
|
||||
|
|
|
@ -4,9 +4,10 @@ var minimatch = require('minimatch');
|
|||
var UiAppCollection = require('./UiAppCollection');
|
||||
|
||||
class UiExports {
|
||||
constructor(kbnServer) {
|
||||
constructor({ urlBasePath }) {
|
||||
this.apps = new UiAppCollection(this);
|
||||
this.aliases = {};
|
||||
this.urlBasePath = urlBasePath;
|
||||
this.exportConsumer = _.memoize(this.exportConsumer);
|
||||
this.consumers = [];
|
||||
this.bundleProviders = [];
|
||||
|
@ -48,7 +49,10 @@ class UiExports {
|
|||
case 'apps':
|
||||
return (plugin, specs) => {
|
||||
for (let spec of [].concat(specs || [])) {
|
||||
let app = this.apps.new(_.defaults({}, spec, { id: plugin.id }));
|
||||
let app = this.apps.new(_.defaults({}, spec, {
|
||||
id: plugin.id,
|
||||
urlBasePath: this.urlBasePath
|
||||
}));
|
||||
plugin.apps.add(app);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -12,10 +12,13 @@ module.exports = async (kbnServer, server, config) => {
|
|||
let UiBundlerEnv = require('./UiBundlerEnv');
|
||||
let loadingGif = readFile(fromRoot('src/ui/public/loading.gif'), { encoding: 'base64'});
|
||||
|
||||
let uiExports = kbnServer.uiExports = new UiExports(kbnServer);
|
||||
let uiExports = kbnServer.uiExports = new UiExports({
|
||||
urlBasePath: config.get('server.basePath')
|
||||
});
|
||||
|
||||
let bundlerEnv = new UiBundlerEnv(config.get('optimize.bundleDir'));
|
||||
bundlerEnv.addContext('env', config.get('env.name'));
|
||||
bundlerEnv.addContext('urlBasePath', config.get('server.basePath'));
|
||||
bundlerEnv.addContext('sourceMaps', config.get('optimize.sourceMaps'));
|
||||
bundlerEnv.addContext('kbnVersion', config.get('pkg.version'));
|
||||
bundlerEnv.addContext('buildNum', config.get('pkg.buildNum'));
|
||||
|
@ -72,13 +75,15 @@ module.exports = async (kbnServer, server, config) => {
|
|||
version: kbnServer.version,
|
||||
buildNum: config.get('pkg.buildNum'),
|
||||
buildSha: config.get('pkg.buildSha'),
|
||||
basePath: config.get('server.basePath'),
|
||||
vars: defaults(app.getInjectedVars(), defaultInjectedVars),
|
||||
};
|
||||
|
||||
return this.view(app.templateName, {
|
||||
app: app,
|
||||
loadingGif: loadingGif,
|
||||
kibanaPayload: payload
|
||||
kibanaPayload: payload,
|
||||
bundlePath: config.get('server.basePath') + '/bundles',
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
2
src/ui/public/chrome/api/angular.js
vendored
2
src/ui/public/chrome/api/angular.js
vendored
|
@ -21,7 +21,7 @@ module.exports = function (chrome, internals) {
|
|||
.value('sessionId', Date.now())
|
||||
.value('esUrl', (function () {
|
||||
var a = document.createElement('a');
|
||||
a.href = '/elasticsearch';
|
||||
a.href = '../elasticsearch';
|
||||
return a.href;
|
||||
}()))
|
||||
.directive('kbnChrome', function ($rootScope) {
|
||||
|
|
|
@ -9,7 +9,6 @@ require('ui/private');
|
|||
require('ui/promises');
|
||||
|
||||
var metadata = require('ui/metadata');
|
||||
var TabCollection = require('ui/chrome/TabCollection');
|
||||
|
||||
var chrome = {};
|
||||
var internals = _.defaults(
|
||||
|
|
|
@ -38,11 +38,17 @@ block content
|
|||
loading.removeChild(loading.lastChild);
|
||||
}
|
||||
|
||||
function bundleFile(filename) {
|
||||
var anchor = document.createElement('a');
|
||||
anchor.setAttribute('href', !{JSON.stringify(bundlePath)} + '/' + filename);
|
||||
return anchor.href;
|
||||
}
|
||||
|
||||
var files = [
|
||||
'/bundles/commons.style.css',
|
||||
'/bundles/#{app.id}.style.css',
|
||||
'/bundles/commons.bundle.js',
|
||||
'/bundles/#{app.id}.bundle.js'
|
||||
bundleFile('commons.style.css'),
|
||||
bundleFile('#{app.id}.style.css'),
|
||||
bundleFile('commons.bundle.js'),
|
||||
bundleFile('#{app.id}.bundle.js')
|
||||
];
|
||||
|
||||
(function next() {
|
||||
|
|
Loading…
Reference in a new issue