mirror of
https://github.com/nasa/openmct.git
synced 2025-06-14 05:08:15 +00:00
Notifications progress method (#2193)
* Added progress method to notifications so no longer dependent on reactive properties * Updated notification launch controller to use new progress method * Added progress function to Notifications API. Introduced NotificationService compatibility layer for legacy code
This commit is contained in:
committed by
Deep Tailor
parent
c3b7e7869e
commit
6f1b5b4ae3
@ -79,30 +79,34 @@ define(
|
||||
* periodically, tracking an ongoing process.
|
||||
*/
|
||||
$scope.newProgress = function () {
|
||||
let progress = 0;
|
||||
var notificationModel = {
|
||||
title: "Progress notification example",
|
||||
severity: "info",
|
||||
progress: 0,
|
||||
progress: progress,
|
||||
actionText: getExampleActionText()
|
||||
};
|
||||
let notification;
|
||||
|
||||
/**
|
||||
* Simulate an ongoing process and update the progress bar.
|
||||
* @param notification
|
||||
*/
|
||||
function incrementProgress() {
|
||||
notificationModel.progress = Math.min(100, Math.floor(notificationModel.progress + Math.random() * 30));
|
||||
notificationModel.progressText = ["Estimated time" +
|
||||
progress = Math.min(100, Math.floor(progress + Math.random() * 30))
|
||||
let progressText = ["Estimated time" +
|
||||
" remaining:" +
|
||||
" about ", 60 - Math.floor((notificationModel.progress / 100) * 60), " seconds"].join(" ");
|
||||
if (notificationModel.progress < 100) {
|
||||
" about ", 60 - Math.floor((progress / 100) * 60), " seconds"].join(" ");
|
||||
notification.progress(progress, progressText);
|
||||
|
||||
if (progress < 100) {
|
||||
$timeout(function () {
|
||||
incrementProgress(notificationModel);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
notificationService.notify(notificationModel);
|
||||
notification = notificationService.notify(notificationModel);
|
||||
incrementProgress();
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user