Skip to content

Commit

Permalink
Merge pull request #5870 from spalger/implement/fileLoadingErrorDisplay
Browse files Browse the repository at this point in the history
[uiAppTemplate] display errors on screen when resources fail to load
  • Loading branch information
spalger committed Jan 11, 2016
2 parents a727488 + 5b759c0 commit ab4746a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/ui/views/ui_app.jade
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,25 @@ block content
var file = files.shift();
if (!file) return;

var failure = function () {
// make subsequent calls to failure() noop
failure = function () {};

var err = document.createElement('h1');
err.style['color'] = 'white';
err.style['font-family'] = 'monospace';
err.style['text-align'] = 'center';
err.style['background'] = '#F44336';
err.style['padding'] = '25px';
err.innerText = 'Kibana did not load properly. Check the server output for more information.';

document.body.innerHTML = err.outerHTML;
}

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

if (type === 'script') {
dom.setAttribute('src', file);
Expand Down

0 comments on commit ab4746a

Please sign in to comment.