Skip to content

Commit

Permalink
Move toastr initialization to a better spot
Browse files Browse the repository at this point in the history
  • Loading branch information
gashcrumb committed Nov 5, 2013
1 parent 794ede8 commit 46f8168
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
10 changes: 9 additions & 1 deletion hawtio-web/src/main/webapp/app/core/js/corePlugin.ts
Expand Up @@ -279,7 +279,7 @@ angular.module('hawtioCore', ['bootstrap', 'ngResource', 'ui', 'ui.bootstrap.dia
filter("valueToHtml", () => Core.valueToHtml).
filter('humanize',() => humanizeValue).

run(($rootScope, $routeParams, jolokia, workspace, localStorage, viewRegistry, layoutFull, helpRegistry, pageTitle:Core.PageTitle, branding) => {
run(($rootScope, $routeParams, jolokia, workspace, localStorage, viewRegistry, layoutFull, helpRegistry, pageTitle:Core.PageTitle, branding, toastr) => {

$.support.cors = true;

Expand Down Expand Up @@ -359,6 +359,14 @@ angular.module('hawtioCore', ['bootstrap', 'ngResource', 'ui', 'ui.bootstrap.dia
CodeEditor.GlobalCodeMirrorOptions = angular.extend(CodeEditor.GlobalCodeMirrorOptions, opts);
}


toastr.options = {
'closeButton': true,
'showMethod': 'slideDown',
'hideMethod': 'slideUp'
};


window['logInterceptors'].push((level, message) => {
if (level === "WARN") {
notification('warning', message);
Expand Down
20 changes: 7 additions & 13 deletions hawtio-web/src/main/webapp/app/core/js/helpers.ts
Expand Up @@ -217,13 +217,6 @@ function escapeTreeCssStyles(text:string) {
return escapeDots(text).replace(/span/g, 'sp-an');
}

/**
* Displays an alert message which is typically the result of some asynchronous operation
*
* @param type which is usually "success" or "error" and matches css alert-* css styles
* @param message the text to display
*/

function showLogPanel() {
var log = $("#log-panel");
var body = $('body');
Expand All @@ -234,12 +227,13 @@ function showLogPanel() {
});
}

var w:any = window;
w.toastr.options = {
'closeButton': true,
'showMethod': 'slideDown',
'hideMethod': 'slideUp'
};

/**
* Displays an alert message which is typically the result of some asynchronous operation
*
* @param type which is usually "success" or "error" and matches css alert-* css styles
* @param message the text to display
*/

function notification (type:string, message:string, options:any = null) {
var w:any = window;
Expand Down

0 comments on commit 46f8168

Please sign in to comment.