mirror of
https://github.com/nasa/openmct.git
synced 2025-06-21 00:23:01 +00:00
Added convenience methods for alert and error to the NotificationService
This commit is contained in:
@ -216,18 +216,51 @@ define(
|
|||||||
* A convenience method for info notifications. Notifications
|
* A convenience method for info notifications. Notifications
|
||||||
* created via this method will be auto-dismissed after a default
|
* created via this method will be auto-dismissed after a default
|
||||||
* wait period
|
* wait period
|
||||||
* @param {NotificationModel} notificationModel Options describing the
|
* @param {NotificationModel | string} message either a string for
|
||||||
* notification to display
|
* the title of the notification message, or a {@link NotificationModel}
|
||||||
|
* defining the options notification to display
|
||||||
* @returns {Notification} the provided notification decorated with
|
* @returns {Notification} the provided notification decorated with
|
||||||
* functions to dismiss or minimize
|
* functions to dismiss or minimize
|
||||||
*/
|
*/
|
||||||
NotificationService.prototype.info = function (model) {
|
NotificationService.prototype.info = function (notification) {
|
||||||
var notificationModel = typeof model === "string" ? {title: model} : model
|
var notificationModel = typeof model === "string" ? {title: model} : model
|
||||||
notificationModel.autoDismiss = notificationModel.autoDismiss || true;
|
notificationModel.autoDismiss = notificationModel.autoDismiss || true;
|
||||||
notificationModel.severity = "info";
|
notificationModel.severity = "info";
|
||||||
return this.notify(notificationModel);
|
return this.notify(notificationModel);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A convenience method for alert notifications. Notifications
|
||||||
|
* created via this method will will have severity of "alert" enforced
|
||||||
|
* @param {NotificationModel | string} message either a string for
|
||||||
|
* the title of the alert message with default options, or a
|
||||||
|
* {@link NotificationModel} defining the options notification to
|
||||||
|
* display
|
||||||
|
* @returns {Notification} the provided notification decorated with
|
||||||
|
* functions to dismiss or minimize
|
||||||
|
*/
|
||||||
|
NotificationService.prototype.alert = function (model) {
|
||||||
|
var notificationModel = typeof model === "string" ? {title: model} : model
|
||||||
|
notificationModel.severity = "alert";
|
||||||
|
return this.notify(notificationModel);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A convenience method for error notifications. Notifications
|
||||||
|
* created via this method will will have severity of "error" enforced
|
||||||
|
* @param {NotificationModel | string} message either a string for
|
||||||
|
* the title of the error message with default options, or a
|
||||||
|
* {@link NotificationModel} defining the options notification to
|
||||||
|
* display
|
||||||
|
* @returns {Notification} the provided notification decorated with
|
||||||
|
* functions to dismiss or minimize
|
||||||
|
*/
|
||||||
|
NotificationService.prototype.error = function (model) {
|
||||||
|
var notificationModel = typeof model === "string" ? {title: model} : model
|
||||||
|
notificationModel.severity = "error";
|
||||||
|
return this.notify(notificationModel);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies the user of an event. If there is a banner notification
|
* Notifies the user of an event. If there is a banner notification
|
||||||
* already active, then it will be dismissed or minimized automatically,
|
* already active, then it will be dismissed or minimized automatically,
|
||||||
|
Reference in New Issue
Block a user