mirror of
https://github.com/nasa/openmct.git
synced 2024-12-19 05:07:52 +00:00
[Notifications] Remove custom autoDismiss
This commit is contained in:
parent
c9ac85089a
commit
d63c401e44
@ -61,7 +61,7 @@ define(
|
||||
* @property {boolean} [unknownProgress] a boolean indicating that the
|
||||
* progress of the underlying task is unknown. This will result in a
|
||||
* visually distinct progress bar.
|
||||
* @property {boolean | number} [autoDismiss] If truthy, dialog will
|
||||
* @property {boolean} [autoDismiss] If truthy, dialog will
|
||||
* be automatically minimized or dismissed (depending on severity).
|
||||
* Additionally, if the provided value is a number, it will be used
|
||||
* as the delay period before being dismissed.
|
||||
@ -384,9 +384,7 @@ define(
|
||||
* @private
|
||||
*/
|
||||
NotificationService.prototype.setActiveNotification = function (notification) {
|
||||
var timeout;
|
||||
var shouldAutoDismiss;
|
||||
var usesCustomTimeout;
|
||||
this.active.notification = notification;
|
||||
|
||||
if (!notification) {
|
||||
@ -394,19 +392,16 @@ define(
|
||||
return;
|
||||
}
|
||||
|
||||
usesCustomTimeout = typeof notification.model.autoDismiss === "number";
|
||||
|
||||
if (notification.model.severity === "info" || usesCustomTimeout) {
|
||||
if (notification.model.severity === "info") {
|
||||
shouldAutoDismiss = true;
|
||||
} else {
|
||||
shouldAutoDismiss = notification.model.autoDismiss;
|
||||
}
|
||||
|
||||
if (shouldAutoDismiss || this.selectNextNotification()) {
|
||||
timeout = usesCustomTimeout ? notification.model.autoDismiss : this.AUTO_DISMISS_TIMEOUT;
|
||||
this.active.timeout = this.$timeout(function () {
|
||||
notification.dismissOrMinimize();
|
||||
}, timeout);
|
||||
}, this.AUTO_DISMISS_TIMEOUT);
|
||||
} else {
|
||||
delete this.active.timeout;
|
||||
}
|
||||
|
@ -118,17 +118,6 @@ define(
|
||||
expect(notificationService.getActiveNotification()).toBeUndefined();
|
||||
expect(notificationService.notifications.length).toEqual(0);
|
||||
});
|
||||
|
||||
it("uses a custom auto-dismiss timeout value if provided", function () {
|
||||
var timeoutValueInModel = 1500;
|
||||
var timeoutValueUsedByService = 0;
|
||||
mockTimeout.andCallFake(function (callback, timeout) {
|
||||
timeoutValueUsedByService = timeout;
|
||||
});
|
||||
infoModel.autoDismiss = timeoutValueInModel;
|
||||
notificationService.info(infoModel);
|
||||
expect(timeoutValueUsedByService).toEqual(timeoutValueInModel);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when receiving alert notifications", function () {
|
||||
@ -162,17 +151,6 @@ define(
|
||||
expect(notificationService.notifications.length).toEqual(1);
|
||||
expect(notificationService.notifications[0]).toEqual(notification);
|
||||
});
|
||||
|
||||
it("uses a custom auto-dismiss timeout value if provided", function () {
|
||||
var timeoutValueInModel = 1500;
|
||||
var timeoutValueUsedByService = 0;
|
||||
mockTimeout.andCallFake(function (callback, timeout) {
|
||||
timeoutValueUsedByService = timeout;
|
||||
});
|
||||
alertModel.autoDismiss = timeoutValueInModel;
|
||||
notificationService.alert(alertModel);
|
||||
expect(timeoutValueUsedByService).toEqual(timeoutValueInModel);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when receiving error notifications", function () {
|
||||
@ -206,17 +184,6 @@ define(
|
||||
expect(notificationService.notifications.length).toEqual(1);
|
||||
expect(notificationService.notifications[0]).toEqual(notification);
|
||||
});
|
||||
|
||||
it("uses a custom auto-dismiss timeout value if provided", function () {
|
||||
var timeoutValueInModel = 1500;
|
||||
var timeoutValueUsedByService = 0;
|
||||
mockTimeout.andCallFake(function (callback, timeout) {
|
||||
timeoutValueUsedByService = timeout;
|
||||
});
|
||||
errorModel.autoDismiss = timeoutValueInModel;
|
||||
notificationService.error(errorModel);
|
||||
expect(timeoutValueUsedByService).toEqual(timeoutValueInModel);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when called with multiple notifications", function () {
|
||||
|
Loading…
Reference in New Issue
Block a user