Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement dev live optimizer #4611

Merged
merged 57 commits into from
Aug 11, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
240242d
Merge branch 'lint/es7Support' into implement/simpleAndLazyOptimizer
Aug 5, 2015
dc6f7f8
Merge branch 'fix/serverBabelOpts' into implement/simpleAndLazyOptimizer
Aug 5, 2015
b3e65eb
Merge branch 'tests/addTimeoutToKbnServerStart' into implement/simple…
Aug 5, 2015
1f95e66
Merge branch 'master' of github.com:elastic/kibana into implement/sim…
Aug 5, 2015
70ef012
Move from watching optimizer to live optimizer
Aug 7, 2015
671319a
Merge branch 'master' of github.com:elastic/kibana into implement/dev…
Aug 7, 2015
cd5b665
fixed the test bundling
Aug 7, 2015
2fe09cb
do not require lazy config option
Aug 7, 2015
ae91063
add no-watch option back to the cli as no-dev-watch
Aug 7, 2015
37b1c3a
added profiling capability and Commons chunk
Aug 7, 2015
b4fe366
inline babel runtime and preload some visualize modules
Aug 7, 2015
12466d6
update babel
Aug 7, 2015
25bd4ec
switch back to a file based optimizer in dev mode
Aug 7, 2015
7c50b7e
restore the loading screen
Aug 7, 2015
dd91047
move babel compilation to .babel.js files
Aug 8, 2015
6cd6399
fix the optimize logging message
Aug 8, 2015
f239b60
when optimizing tests, only optimize tests by default
Aug 8, 2015
41ab382
improve karma support
Aug 9, 2015
f09ef37
support exporting multiple apps
Aug 9, 2015
7b0b24a
Merge branch 'master' of github.com:elastic/kibana into implement/dev…
Aug 9, 2015
830ce37
better match the previous loading screen
Aug 9, 2015
3c2802f
fix cors config for karma
Aug 9, 2015
98f40f6
clean up error propogation and reporting
Aug 10, 2015
f70720a
improve the lazy optimizers handling of edge cases
Aug 10, 2015
c0400a1
english
Aug 10, 2015
ca49a03
ensure that cli actions don't swallow promises
Aug 10, 2015
ea15e00
wait for the lazy optimizer before initializing the lazy proxy
Aug 10, 2015
4006bbb
with watching in the lazy optimizer, prebuild by default
Aug 10, 2015
e79d55b
force the installed plugins directory into git
Aug 10, 2015
c2e169f
--no-dev-watch isn't intuitive
Aug 10, 2015
1c0720a
goodbye mocha timeouts
Aug 10, 2015
2a414b8
transition to all on non-punctuated log messages
Aug 10, 2015
a651f51
read correct watch option
Aug 10, 2015
57e5952
rename Plugins class to PluginCollection
Aug 10, 2015
7743f46
commit to the Class < ClassCollection style
Aug 10, 2015
bd68ae5
Sets can not be accessed by index
Aug 10, 2015
7bc40f0
include forward slashes in regexps
Aug 11, 2015
6793c9f
revert accidental color change
Aug 11, 2015
7e0540c
enable profiling for all optimizers
Aug 11, 2015
82ed06f
added additional preloading
Aug 11, 2015
5821ea8
expose unsafeCache setting, which accelerates build time significatly
Aug 11, 2015
68f6ca8
save
Aug 11, 2015
afc4cbd
fix reference to status page app
Aug 11, 2015
c31109e
Merge branch 'master' of github.com:elastic/kibana into implement/dev…
Aug 11, 2015
8c546bf
support uncommitted kibana.yml additions next to the kibana.yml file
Aug 11, 2015
66e82d8
expand unsafeCache and sourceMaps config schemas
Aug 11, 2015
c5b265c
remove .babel.js extension, compile all files with babel
Aug 11, 2015
1e5c52a
fix angular-nvd3 bundled lib
Aug 11, 2015
7992b6c
disable preload by default, but still start the build immediately
Aug 11, 2015
900e50a
only use kibana.dev.yml in development
Aug 11, 2015
08b9068
manually preload to prevent sourcemap error
Aug 11, 2015
e588977
Merge branch 'master' of github.com:elastic/kibana into implement/dev…
Aug 11, 2015
893c6f8
remove optimize.watch option, dev mode uses the lazy optimizer and pr…
Aug 11, 2015
d9d1e72
fix punctuation in log message
Aug 11, 2015
e4fe82d
older lines
Aug 11, 2015
2140247
Merge branch 'master' of github.com:elastic/kibana into implement/dev…
Aug 11, 2015
a016f53
use fs optimizer in test server
Aug 11, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
restore the loading screen
  • Loading branch information
spalger committed Aug 8, 2015
commit 7c50b7e07358c74d71af2f791e7cd4bb8231faa8
4 changes: 3 additions & 1 deletion src/optimize/BaseOptimizer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
let { inherits } = require('util');
let _ = require('lodash');
let { join } = require('path');
let { resolve } = require('path');
let write = require('fs').writeFileSync;
let webpack = require('webpack');
let DirectoryNameAsMain = require('webpack-directory-name-as-main');
Expand Down Expand Up @@ -41,6 +41,8 @@ class BaseOptimizer {
devtoolModuleFilenameTemplate: '[absolute-resource-path]'
},

recordsPath: resolve(this.env.workingDir, 'webpack.records'),

plugins: [
new webpack.ResolverPlugin([
new DirectoryNameAsMain()
Expand Down
6 changes: 0 additions & 6 deletions src/optimize/FsOptimizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,4 @@ module.exports = class FsOptimizer extends BaseOptimizer {
});
}
}

getConfig() {
let config = BaseOptimizer.prototype.getConfig.call(this);
config.cache = true;
return config;
}
};
3 changes: 2 additions & 1 deletion src/optimize/lazy/LazyOptimizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ module.exports = class LazyOptimizer extends FsOptimizer {
if (e.stats && this.current === prom) {
this.log(['warning', 'optimize'], e.stats.toString({ colors: true }));
}
// TODO: rebuild on errors
throw e;
}
}())
.then(() => {
let seconds = ((Date.now() - start) / 1000).toFixed(2);
this.log(['info', 'optimize'], `live optimization complete in ${seconds} seconds.`);
this.log(['info', 'optimize'], `lazy optimization complete in ${seconds} seconds.`);
});

return prom;
Expand Down
11 changes: 8 additions & 3 deletions src/ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ module.exports = async (kbnServer, server, config) => {
let _ = require('lodash');
let Boom = require('boom');
let formatUrl = require('url').format;
let { join, resolve } = require('path');
let { resolve } = require('path');
let readFile = require('fs').readFileSync;

let fromRoot = require('../utils/fromRoot');
let UiExports = require('./UiExports');
let UiBundle = require('./UiBundle');
let UiBundleCollection = require('./UiBundleCollection');
let UiBundlerEnv = require('./UiBundlerEnv');
let loadingGif = readFile(fromRoot('src/ui/public/loading.gif'), { encoding: 'base64'});

let uiExports = kbnServer.uiExports = new UiExports(kbnServer);

Expand Down Expand Up @@ -35,6 +38,7 @@ module.exports = async (kbnServer, server, config) => {

// render all views from the ui/views directory
server.setupViews(resolve(__dirname, 'views'));
server.exposeStaticFile('/loading.gif', resolve(__dirname, 'public/loading.gif'));

// serve the app switcher
server.route({
Expand Down Expand Up @@ -81,13 +85,14 @@ module.exports = async (kbnServer, server, config) => {
buildNumber: _.get(kbnServer, 'build.number', '@@buildNum'),
cacheBust: _.get(kbnServer, 'build.number', ''),
kbnIndex: config.get('kibana.index'),
esShardTimeout: config.get('elasticsearch.shardTimeout')
esShardTimeout: config.get('elasticsearch.shardTimeout'),
};

return this.view(app.templateName, {
app: app,
cacheBust: payload.cacheBust,
kibanaPayload: payload
kibanaPayload: payload,
loadingGif: loadingGif,
});
});
};
2 changes: 1 addition & 1 deletion src/ui/public/chrome/api/angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = function (chrome, internals) {
$app.html(internals.rootTemplate);
}

$el.append($content);
$el.html($content);
},
controllerAs: 'chrome',
controller: function ($scope, $rootScope, $location, $http) {
Expand Down
Binary file added src/ui/public/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions src/ui/public/styles/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,6 @@ textarea {
resize: vertical;
}

.initial-load {
margin-top: 60px;
}

.field-collapse-toggle {
color: #999;
margin-left: 10px !important;
Expand Down
65 changes: 59 additions & 6 deletions src/ui/views/uiApp.jade
Original file line number Diff line number Diff line change
@@ -1,9 +1,62 @@
extends ./chrome.jade

block head
link(rel='stylesheet', href='/bundles/commons.bundle.js.style.css')
link(rel='stylesheet', href='/bundles/#{app.id}.style.css')

block content
script(src='/bundles/commons.bundle.js' src-map='/bundles/commons.bundle.js.map')
script(src='/bundles/#{app.id}.bundle.js' src-map='/bundles/#{app.id}.bundle.js.map')
style.
.ui-app-loading {
width: 33%;
margin: 60px auto;
text-align: center;
font-family: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #444444;
padding-top: 45px;
background-size: 145px;
background-position: top center;
background-repeat: no-repeat;
background-image: url('data:image/gif;base64,#{loadingGif}');
}

.ui-app-loading small {
font-size: 65%;
font-weight: 400;
color: #777;
}


div.ui-app-loading
h1 Kibana
small(id="cache-message" style="display:none").
Give me a moment here. I'm loading a whole bunch of code. Don't worry, all this good stuff will be cached up for next time!

script.
window.onload = function () {

var showCacheMessage = !/#.*[?&]embed(&|$)/.test(window.location.href);
if (showCacheMessage) document.getElementById('cache-message').style.display = 'block';

var files = [
'/bundles/commons.bundle.js.style.css',
'/bundles/#{app.id}.style.css',
'/bundles/commons.bundle.js',
'/bundles/#{app.id}.bundle.js'
];

(function next() {
var file = files.shift();
if (!file) return;

var type = /\.js$/.test(file) ? 'script' : 'link';
var dom = document.createElement(type);
dom.setAttribute('async', '');

if (type === 'script') {
dom.setAttribute('src', file);
dom.addEventListener('load', next);
document.head.appendChild(dom);
} else {
dom.setAttribute('rel', 'stylesheet');
dom.setAttribute('href', file);
document.head.appendChild(dom);
next();
}
}());
};