mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 13:43:09 +00:00
Integrated notifications list
This commit is contained in:
parent
85300d3743
commit
82ae9e72c1
@ -1,16 +1,5 @@
|
||||
{
|
||||
"extensions": {
|
||||
"constants": [
|
||||
{
|
||||
"key": "messageSeverity",
|
||||
"value": {
|
||||
"ALERT": "alert",
|
||||
"ERROR": "error",
|
||||
"INFO": "info",
|
||||
"SUCCESS": "success"
|
||||
}
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
{
|
||||
"key": "dialogService",
|
||||
|
@ -1,4 +1,9 @@
|
||||
<div class="l-message message-severity-{{ngModel.severity}}">
|
||||
<div ng-controller="MessageController"
|
||||
class="l-message"
|
||||
title="{{MessageSeverity}}"
|
||||
ng-class="{'message-severity-info': ngModel.severity===MessageSeverity.INFO,
|
||||
'message-severity-error': ngModel.severity===MessageSeverity.ERROR,
|
||||
'message-severity-alert': ngModel.severity===MessageSeverity.ALERT}">
|
||||
<div class="ui-symbol type-icon message-type"></div>
|
||||
<div class="message-contents">
|
||||
<div class="top-bar">
|
||||
|
@ -6,6 +6,13 @@
|
||||
"value": 3000
|
||||
}
|
||||
],
|
||||
"controllers": [
|
||||
{
|
||||
"key": "MessageController",
|
||||
"implementation": "MessageController.js",
|
||||
"depends": ["$scope"]
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
{
|
||||
"key": "notificationService",
|
||||
|
34
platform/commonUI/notification/src/MessageController.js
Normal file
34
platform/commonUI/notification/src/MessageController.js
Normal file
@ -0,0 +1,34 @@
|
||||
/*****************************************************************************
|
||||
* 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(
|
||||
['./MessageSeverity'],
|
||||
function (MessageSeverity) {
|
||||
"use strict";
|
||||
|
||||
function MessageController($scope) {
|
||||
$scope.MessageSeverity = MessageSeverity;
|
||||
}
|
||||
return MessageController;
|
||||
}
|
||||
);
|
@ -4,8 +4,8 @@
|
||||
/*global define*/
|
||||
define(function(){
|
||||
return {
|
||||
SUCCESS: 0,
|
||||
INFO: 1,
|
||||
INFO: 0,
|
||||
ALERT: 1,
|
||||
ERROR: 2
|
||||
};
|
||||
});
|
@ -112,7 +112,7 @@ define(
|
||||
*/
|
||||
NotificationService.prototype.success = function (notification) {
|
||||
notification.autoDismiss = notification.autoDismiss || true;
|
||||
notification.severity = MessageSeverity.SUCCESS;
|
||||
notification.severity = MessageSeverity.INFO;
|
||||
this.notify(notification);
|
||||
};
|
||||
|
||||
@ -260,7 +260,7 @@ define(
|
||||
* @param notification
|
||||
*/
|
||||
NotificationService.prototype.dismissOrMinimize = function (notification){
|
||||
if (notification.severity > MessageSeverity.SUCCESS){
|
||||
if (notification.severity > MessageSeverity.INFO){
|
||||
this.minimize(notification);
|
||||
} else {
|
||||
this.dismiss(notification);
|
||||
|
@ -16,10 +16,10 @@
|
||||
"implementation": "DialogLaunchController.js",
|
||||
"depends": [
|
||||
"$scope",
|
||||
"dialogService",
|
||||
"$timeout",
|
||||
"$log",
|
||||
"messageSeverity"
|
||||
"dialogService",
|
||||
"notificationService"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -22,11 +22,11 @@
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
['../../../platform/commonUI/notification/src/MessageSeverity'],
|
||||
function (MessageSeverity) {
|
||||
"use strict";
|
||||
|
||||
function DialogLaunchController($scope, dialogService, $timeout, $log, messageSeverity) {
|
||||
function DialogLaunchController($scope, $timeout, $log, dialogService, notificationService) {
|
||||
$scope.launchProgress = function (knownProgress) {
|
||||
var model = {
|
||||
title: "Progress Dialog Example",
|
||||
@ -35,7 +35,7 @@ define(
|
||||
actionText: "Calculating...",
|
||||
unknownProgress: !knownProgress,
|
||||
unknownDuration: false,
|
||||
severity: messageSeverity.INFO,
|
||||
severity: MessageSeverity.INFO,
|
||||
actions: [
|
||||
{
|
||||
label: "Cancel Operation",
|
||||
@ -76,7 +76,7 @@ define(
|
||||
var model = {
|
||||
title: "Error Dialog Example",
|
||||
actionText: "Something happened, and it was not good.",
|
||||
severity: messageSeverity.ERROR,
|
||||
severity: MessageSeverity.ERROR,
|
||||
actions: [
|
||||
{
|
||||
label: "Try Again",
|
||||
@ -103,7 +103,7 @@ define(
|
||||
$scope.launchMessages = function () {
|
||||
var model = {
|
||||
title: "Messages",
|
||||
severity: messageSeverity.MESSAGES,
|
||||
severity: MessageSeverity.INFO,
|
||||
actions: [
|
||||
{
|
||||
label: "Done",
|
||||
@ -155,9 +155,9 @@ define(
|
||||
|
||||
function getExampleSeverity() {
|
||||
var severities = [
|
||||
messageSeverity.INFO,
|
||||
messageSeverity.ALERT,
|
||||
messageSeverity.ERROR
|
||||
MessageSeverity.INFO,
|
||||
MessageSeverity.ALERT,
|
||||
MessageSeverity.ERROR
|
||||
];
|
||||
return severities[Math.floor(Math.random() * severities.length)];
|
||||
}
|
||||
@ -177,26 +177,16 @@ define(
|
||||
element.remove();
|
||||
}
|
||||
|
||||
for (var i = 0; i < 10; i++) {
|
||||
model.messages.push(createMessage(i));
|
||||
}
|
||||
//for (var i = 0; i < 10; i++) {
|
||||
// model.messages.push(createMessage(i));
|
||||
//}
|
||||
model.messages = notificationService.notifications;
|
||||
dialogService.getDialogResponse('overlay-message-list', {
|
||||
dialog: model,
|
||||
cancel: function(){
|
||||
dialogService.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
if (dialogService.showMessageList(model)) {
|
||||
//Do processing here
|
||||
for (var i = 0; i < 10; i++) {
|
||||
model.messages.push(createMessage(i));
|
||||
}
|
||||
} else {
|
||||
$log.error("Could not display modal dialog");
|
||||
}
|
||||
*/
|
||||
};
|
||||
}
|
||||
return DialogLaunchController;
|
||||
|
Loading…
Reference in New Issue
Block a user