forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request openshift#1325 from jwforres/error_handling
Merged by openshift-bot
- Loading branch information
Showing
11 changed files
with
884 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
'use strict'; | ||
|
||
angular.module('openshiftConsole') | ||
.factory('Notification', function($rootScope) { | ||
function Notification() { | ||
this.messenger = Messenger({ | ||
extraClasses: 'messenger-fixed messenger-on-top messenger-on-right', | ||
theme: 'block', | ||
messageDefaults: { | ||
showCloseButton: true, | ||
hideAfter: 10 | ||
} | ||
}); | ||
|
||
var self = this; | ||
$rootScope.$on( "$routeChangeStart", function(event, next, current) { | ||
self.clear(); | ||
}); | ||
} | ||
|
||
// Opts: | ||
// id - if an id is passed only one message with this id will ever be shown | ||
// mustDismiss - the user must explicitly dismiss the message, it will not auto-hide | ||
Notification.prototype.notify = function(type, message, opts) { | ||
opts = opts || {}; | ||
var notifyOpts = { | ||
type: type, | ||
message: message, | ||
id: opts.id, | ||
actions: opts.actions | ||
}; | ||
if (opts.mustDismiss) { | ||
notifyOpts.hideAfter = false; | ||
} | ||
this.messenger.post(notifyOpts); | ||
}; | ||
|
||
Notification.prototype.success = function(message, opts) { | ||
this.notify("success", message, opts); | ||
}; | ||
|
||
Notification.prototype.info = function(message, opts) { | ||
this.notify("info", message, opts); | ||
}; | ||
|
||
Notification.prototype.error = function(message, opts) { | ||
this.notify("error", message, opts); | ||
}; | ||
|
||
Notification.prototype.warning = function(message, opts) { | ||
this.notify("warning", message, opts); | ||
}; | ||
|
||
Notification.prototype.clear = function() { | ||
this.messenger.hideAll(); | ||
}; | ||
|
||
return new Notification();; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.