diff --git a/testing/dialogTest/res/dialog-launch.html b/testing/dialogTest/res/dialog-launch.html
index 1b117c2ebf..bc56e6b4f2 100644
--- a/testing/dialogTest/res/dialog-launch.html
+++ b/testing/dialogTest/res/dialog-launch.html
@@ -3,7 +3,8 @@
Known |
Unknown |
- Error
+ Error |
+ Info
Dialogs
\ No newline at end of file
diff --git a/testing/dialogTest/res/notification-launch.html b/testing/dialogTest/res/notification-launch.html
index e9b7e8f84e..1e077bf3be 100644
--- a/testing/dialogTest/res/notification-launch.html
+++ b/testing/dialogTest/res/notification-launch.html
@@ -1,7 +1,7 @@
- Success |
+ Success |
Error |
Alert |
Progress
diff --git a/testing/dialogTest/src/DialogLaunchController.js b/testing/dialogTest/src/DialogLaunchController.js
index bc8cdcb419..42882a0dfe 100644
--- a/testing/dialogTest/src/DialogLaunchController.js
+++ b/testing/dialogTest/src/DialogLaunchController.js
@@ -26,7 +26,23 @@ define(
function (MessageSeverity) {
"use strict";
+ /**
+ * A controller for the dialog launch view. This view allows manual
+ * launching of dialogs for demonstration and testing purposes. It
+ * also demonstrates the use of the DialogService.
+ * @param $scope
+ * @param $timeout
+ * @param $log
+ * @param dialogService
+ * @param notificationService
+ * @constructor
+ */
function DialogLaunchController($scope, $timeout, $log, dialogService, notificationService) {
+
+ /*
+ Demonstrates launching a progress dialog and updating it
+ periodically with the progress of an ongoing process.
+ */
$scope.launchProgress = function (knownProgress) {
var model = {
title: "Progress Dialog Example",
@@ -72,6 +88,10 @@ define(
}
};
+
+ /*
+ Demonstrates launching an error dialog
+ */
$scope.launchError = function () {
var model = {
title: "Error Dialog Example",
@@ -100,87 +120,32 @@ define(
}
};
- $scope.launchMessages = function () {
+ /*
+ Demonstrates launching an error dialog
+ */
+ $scope.launchInfo = function () {
var model = {
- title: "Messages",
+ title: "Info Dialog Example",
+ actionText: "This is an example of a blocking info" +
+ " dialog. This dialog can be used to draw the user's" +
+ " attention to an event.",
severity: MessageSeverity.INFO,
actions: [
{
- label: "Done",
+ label: "OK",
action: function () {
+ $log.debug("OK Pressed");
dialogService.dismiss();
}
- }
- ],
- messages: []
+ },
+ ]
};
- function getExampleActionText() {
- var actionTexts = [
- "Adipiscing turpis mauris in enim elementu hac, enim aliquam etiam.",
- "Eros turpis, pulvinar turpis eros eu",
- "Lundium nascetur a, lectus montes ac, parturient in natoque, duis risus risus pulvinar pid rhoncus, habitasse auctor natoque!"
- ];
- return actionTexts[Math.floor(Math.random()*3)];
+ if (!dialogService.showBlockingMessage(model)) {
+ $log.error("Could not display modal dialog");
}
-
- function getExampleActions() {
- var actions = [
- {
- label: "Try Again",
- action: function () {
- $log.debug("Try Again pressed");
- }
- },
- {
- label: "Remove",
- action: function () {
- $log.debug("Remove pressed");
- }
- },
- {
- label: "Cancel",
- action: function () {
- $log.debug("Cancel pressed");
- }
- }
- ];
-
- // Randomly remove some actions off the top; leave at least one
- actions.splice(0,Math.floor(Math.random() * actions.length));
-
- return actions;
- }
-
- function getExampleSeverity() {
- var severities = [
- MessageSeverity.INFO,
- MessageSeverity.ALERT,
- MessageSeverity.ERROR
- ];
- return severities[Math.floor(Math.random() * severities.length)];
- }
-
- function createMessage (messageNumber) {
- var messageModel = {
- title: "Message Title " + messageNumber,
- actionText: getExampleActionText(),
- severity: getExampleSeverity(),
- actions: getExampleActions()
- };
- return messageModel;
- }
-
- function dismiss() {
- dialogService.dismiss();
- }
-
- model.messages = notificationService.notifications;
- dialogService.getDialogResponse('overlay-message-list', {
- dialog: model,
- cancel: dismiss
- });
};
+
}
return DialogLaunchController;
}
diff --git a/testing/dialogTest/src/DialogLaunchIndicator.js b/testing/dialogTest/src/DialogLaunchIndicator.js
index 47c516fc70..9330ce2194 100644
--- a/testing/dialogTest/src/DialogLaunchIndicator.js
+++ b/testing/dialogTest/src/DialogLaunchIndicator.js
@@ -26,6 +26,12 @@ define(
function () {
"use strict";
+ /**
+ * A tool for manually invoking dialogs. When included this
+ * indicator will allow for dialogs of different types to be
+ * launched for demonstration and testing purposes.
+ * @constructor
+ */
function DialogLaunchIndicator() {
}
diff --git a/testing/dialogTest/src/NotificationLaunchController.js b/testing/dialogTest/src/NotificationLaunchController.js
index 63b436a894..b45bbfc094 100644
--- a/testing/dialogTest/src/NotificationLaunchController.js
+++ b/testing/dialogTest/src/NotificationLaunchController.js
@@ -26,14 +26,21 @@ define(
function (MessageSeverity) {
"use strict";
+ /**
+ * Allows launching of notification messages for the purposes of
+ * demonstration and testing. Also demonstrates use of
+ * the NotificationService. Notifications are non-blocking messages that
+ * appear at the bottom of the screen to inform the user of events
+ * in a non-intrusive way. For more information see the
+ * {@link NotificationService}
+ * @param $scope
+ * @param $timeout
+ * @param $log
+ * @param notificationService
+ * @constructor
+ */
function NotificationLaunchController($scope, $timeout, $log, notificationService) {
var messageCounter = 1;
- $scope.newSuccess = function(){
-
- notificationService.info({
- title: "Success notification!"
- });
- };
function getExampleActionText() {
var actionTexts = [
@@ -80,11 +87,14 @@ define(
];
return severities[Math.floor(Math.random() * severities.length)];
}
-
+
+ /**
+ * Launch a new notification with a severity level of 'Error'.
+ */
$scope.newError = function(){
notificationService.notify({
- title: "Error notification " + messageCounter++ + "!",
+ title: "Example error notification " + messageCounter++,
hint: "An error has occurred",
severity: MessageSeverity.ERROR,
primaryAction: {
@@ -95,11 +105,13 @@ define(
},
actions: getExampleActions()});
};
-
+ /**
+ * Launch a new notification with a severity of 'Alert'.
+ */
$scope.newAlert = function(){
notificationService.notify({
- title: "Alert notification " + (messageCounter++) + "!",
+ title: "Alert notification " + (messageCounter++),
hint: "This is an alert message",
severity: MessageSeverity.ALERT,
primaryAction: {
@@ -111,17 +123,25 @@ define(
actions: getExampleActions()});
};
+
+ /**
+ * Launch a new notification with a progress bar that is updated
+ * periodically, tracking an ongoing process.
+ */
$scope.newProgress = function(){
var notification = {
- title: "Progress notification!",
+ title: "Progress notification example",
severity: MessageSeverity.INFO,
progress: 0,
actionText: getExampleActionText(),
unknownProgress: false
-
};
+ /**
+ * Simulate an ongoing process and update the progress bar.
+ * @param notification
+ */
function incrementProgress(notification) {
notification.progress = Math.min(100, Math.floor(notification.progress + Math.random() * 30));
notification.progressText = ["Estimated time remaining:" +
@@ -135,6 +155,16 @@ define(
incrementProgress(notification);
};
+ /**
+ * Launch a new notification with severity level of INFO.
+ */
+ $scope.newInfo = function(){
+
+ notificationService.info({
+ title: "Example Info notification " + messageCounter++
+ });
+ };
+
}
return NotificationLaunchController;
}