mirror of
https://github.com/nasa/openmct.git
synced 2025-02-01 00:45:41 +00:00
Begun integration of Notifications framework with Charles' code
This commit is contained in:
parent
4a913376ac
commit
8267058487
@ -1,12 +1,18 @@
|
||||
<div class="l-message-banner s-message-banner">
|
||||
<span class="banner-elem label">
|
||||
Objects not saved
|
||||
</span><mct-include key="'progress-bar'"
|
||||
class="banner-elem"
|
||||
ng-model="ngModel"
|
||||
ng-hide-x="ngModel.dialog.progress === undefined"></mct-include><a class="banner-elem l-action s-action">
|
||||
Try Again
|
||||
</a><a class="banner-elem ui-symbol close">
|
||||
x
|
||||
</a>
|
||||
<div ng-controller="BannerController">
|
||||
<div ng-show="active.notification"
|
||||
class="l-message-banner s-message-banner">
|
||||
<span class="banner-elem label">
|
||||
{{active.notification.title}}
|
||||
</span><mct-include key="'progress-bar'"
|
||||
class="banner-elem"
|
||||
ng-model="ngModel"
|
||||
ng-hide-x="ngModel.dialog.progress === undefined">
|
||||
|
||||
</mct-include>
|
||||
<a ng-hide="active.notification.progress === undefined"
|
||||
class="banner-elem l-action s-action">
|
||||
Try Again
|
||||
</a>
|
||||
<a class="banner-elem ui-symbol close">x</a>
|
||||
</div>
|
||||
</div>
|
@ -26,7 +26,7 @@ define(
|
||||
function () {
|
||||
"use strict";
|
||||
function BannerController($scope, notificationService){
|
||||
$scope.activeNotification = notificationService.active.Notification;
|
||||
$scope.active = notificationService.active;
|
||||
}
|
||||
return BannerController;
|
||||
});
|
@ -3,7 +3,7 @@
|
||||
"constants": [
|
||||
{
|
||||
"key": "DEFAULT_AUTO_DISMISS",
|
||||
"value": 2000
|
||||
"value": 3000
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
|
@ -93,8 +93,7 @@ define(
|
||||
* A context in which to hold the active notification and a
|
||||
* handle to its timeout.
|
||||
*/
|
||||
this.active = {
|
||||
};
|
||||
this.active = {};
|
||||
}
|
||||
|
||||
/**
|
||||
@ -113,7 +112,7 @@ define(
|
||||
*/
|
||||
NotificationService.prototype.success = function (notification) {
|
||||
notification.autoDismiss = notification.autoDismiss || true;
|
||||
NotificationService.prototype.notify(notification);
|
||||
this.notify(notification);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -126,7 +125,12 @@ define(
|
||||
NotificationService.prototype.notify = function (notification) {
|
||||
/*var notification = new Notification(model),
|
||||
that=this; */
|
||||
var that = this;
|
||||
var that = this,
|
||||
timeout;
|
||||
|
||||
if (notification.autoDismiss === true){
|
||||
notification.autoDismiss = this.DEFAULT_AUTO_DISMISS;
|
||||
}
|
||||
|
||||
this.notifications.push(notification);
|
||||
/*
|
||||
@ -145,9 +149,12 @@ define(
|
||||
This notifcation has been added to queue and will be
|
||||
serviced as soon as possible.
|
||||
*/
|
||||
timeout = notification.autoDismiss ?
|
||||
notification.autoDismiss :
|
||||
this.DEFAULT_AUTO_DISMISS;
|
||||
this.active.timeout = this.$timeout(function () {
|
||||
that.dismissOrMinimize(that.active.notification);
|
||||
});
|
||||
}, timeout);
|
||||
}
|
||||
|
||||
};
|
||||
@ -171,9 +178,9 @@ define(
|
||||
*/
|
||||
if (notification && (notification.autoDismiss
|
||||
|| this.selectNextNotification())) {
|
||||
timeout = isNaN(notification.autoDismiss) ?
|
||||
this.DEFAULT_AUTO_DISMISS :
|
||||
notification.autoDismiss;
|
||||
timeout = notification.autoDismiss ?
|
||||
notification.autoDismiss :
|
||||
this.DEFAULT_AUTO_DISMISS;
|
||||
|
||||
this.active.timeout = this.$timeout(function () {
|
||||
that.dismissOrMinimize(notification);
|
||||
@ -258,5 +265,7 @@ define(
|
||||
this.dismiss(notification);
|
||||
}
|
||||
};
|
||||
|
||||
return NotificationService;
|
||||
});
|
||||
}
|
||||
);
|
@ -4,6 +4,10 @@
|
||||
{
|
||||
"key": "dialogLaunchTemplate",
|
||||
"templateUrl": "dialog-launch.html"
|
||||
},
|
||||
{
|
||||
"key": "notificationLaunchTemplate",
|
||||
"templateUrl": "notification-launch.html"
|
||||
}
|
||||
],
|
||||
"controllers": [
|
||||
@ -17,11 +21,22 @@
|
||||
"$log",
|
||||
"messageSeverity"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "NotificationLaunchController",
|
||||
"implementation": "NotificationLaunchController.js",
|
||||
"depends": [
|
||||
"$scope",
|
||||
"notificationService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"indicators": [
|
||||
{
|
||||
"implementation": "DialogLaunchIndicator.js"
|
||||
},
|
||||
{
|
||||
"implementation": "NotificationLaunchIndicator.js"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
9
testing/dialogTest/res/notification-launch.html
Normal file
9
testing/dialogTest/res/notification-launch.html
Normal file
@ -0,0 +1,9 @@
|
||||
<span class="status block ok" ng-controller="NotificationLaunchController">
|
||||
<span class="ui-symbol status-indicator"></span>
|
||||
<span class="label">
|
||||
<a ng-click="newSuccess()">Success</a> |
|
||||
<a ng-click="newError()">Error</a> |
|
||||
<a ng-click="newProgress()">Progress</a>
|
||||
</span>
|
||||
<span class="count">Notifications</span>
|
||||
</span>
|
44
testing/dialogTest/src/NotificationLaunchController.js
Normal file
44
testing/dialogTest/src/NotificationLaunchController.js
Normal file
@ -0,0 +1,44 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function NotificationLaunchController($scope, notificationService) {
|
||||
/**
|
||||
* <a ng-click="newSuccess()">Success</a> |
|
||||
<a ng-click="newError()">Error</a> |
|
||||
<a ng-click="newProgress()">Progress</a>
|
||||
*/
|
||||
$scope.newSuccess = function(){
|
||||
|
||||
notificationService.success({
|
||||
title: "Success notification!"
|
||||
})
|
||||
};
|
||||
}
|
||||
return NotificationLaunchController;
|
||||
}
|
||||
);
|
50
testing/dialogTest/src/NotificationLaunchIndicator.js
Normal file
50
testing/dialogTest/src/NotificationLaunchIndicator.js
Normal file
@ -0,0 +1,50 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,window*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function NotificationLaunchIndicator() {
|
||||
|
||||
}
|
||||
|
||||
NotificationLaunchIndicator.template = 'notificationLaunchTemplate';
|
||||
|
||||
NotificationLaunchIndicator.prototype.getGlyph = function () {
|
||||
return "i";
|
||||
};
|
||||
NotificationLaunchIndicator.prototype.getGlyphClass = function () {
|
||||
return 'caution';
|
||||
};
|
||||
NotificationLaunchIndicator.prototype.getText = function () {
|
||||
return "Launch notification";
|
||||
};
|
||||
NotificationLaunchIndicator.prototype.getDescription = function () {
|
||||
return "Launch notification";
|
||||
};
|
||||
|
||||
return NotificationLaunchIndicator;
|
||||
}
|
||||
);
|
Loading…
x
Reference in New Issue
Block a user