Skip to content

Commit

Permalink
option to clear the local and session data on fatal
Browse files Browse the repository at this point in the history
  • Loading branch information
Spencer Alger committed Sep 25, 2014
1 parent 0259ab8 commit 97c5b75
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 14 deletions.
17 changes: 10 additions & 7 deletions src/kibana/components/notify/_notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ define(function (require) {
var clearTO = clearTimeout;
var consoleGroups = ('group' in window.console) && ('groupCollapsed' in window.console) && ('groupEnd' in window.console);

var fatalSplashScreen = require('text!components/notify/partials/fatal_splash_screen.html');

var log = _.noop;
if (typeof KIBANA_DIST === 'undefined') {
log = function () {
Expand Down Expand Up @@ -170,16 +172,17 @@ define(function (require) {
});

var $container = $('#fatal-splash-screen');
if ($container.size()) {
$container.append(html);
return;
}

// in case the app has not completed boot
$(document.body)
if (!$container.size()) {
$(document.body)
// in case the app has not completed boot
.removeAttr('ng-cloak')
.html('<div id="fatal-splash-screen" class="container-fuild">' + html + '</div>');
.html(fatalSplashScreen);

$container = $('#fatal-splash-screen');
}

$container.append(html);
console.error(err.stack);
};

Expand Down
3 changes: 0 additions & 3 deletions src/kibana/components/notify/partials/fatal.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ <h1><i class="fa fa-warning-triangle"></i></h1>
<div class="panel-heading">
<h1 class="panel-title">
<i class="fa fa-warning"></i> Fatal Error
<a class="pull-right" onclick="window.location.reload();" href="#">
Reload <i class="refresh fa fa-refresh"></i>
</a>
</h1>
</div>
<div class="panel-body"><%- msg %></div>
Expand Down
22 changes: 22 additions & 0 deletions src/kibana/components/notify/partials/fatal_splash_screen.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<div id="fatal-splash-screen-header" class="container">
<center>
<h1>Oops!</h1>
<p>
Looks like something went wrong. Refreshing may do the trick.
</p>

<p>
<button class="btn btn-success" onclick="window.location.reload();">
<i class="refresh fa fa-refresh"></i> Reload
</button>
or
<a
onclick="localStorage.clear(); sessionStorage.clear(); window.location.hash = ''; window.location.reload();"
href="#" >
clear your session
</a>
</p>
</center>
<div id="fatal-splash-screen">
</div>
</div>
4 changes: 0 additions & 4 deletions src/kibana/styles/_notify.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#fatal-splash-screen {
margin: 15px;
}

.toaster-container {
visibility: visible;
width: 100%;
Expand Down

0 comments on commit 97c5b75

Please sign in to comment.