From 9a400f6fbaaee63b0d5dd934eea92402fc001d41 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 14 Jan 2015 10:44:59 -0800 Subject: [PATCH 01/12] [About] Add About bundle Add bundle platform/commonUI/about, and initial templates for the About dialog. WTD-667. --- bundles.json | 1 + platform/commonUI/about/README.md | 2 ++ platform/commonUI/about/bundle.json | 17 +++++++++++++++++ platform/commonUI/about/res/about-logo.html | 2 ++ platform/commonUI/about/res/app-logo.html | 1 + .../general/res/templates/bottombar.html | 2 +- 6 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 platform/commonUI/about/README.md create mode 100644 platform/commonUI/about/bundle.json create mode 100644 platform/commonUI/about/res/about-logo.html create mode 100644 platform/commonUI/about/res/app-logo.html diff --git a/bundles.json b/bundles.json index c0dbd4b974..6b0608cdff 100644 --- a/bundles.json +++ b/bundles.json @@ -2,6 +2,7 @@ "platform/framework", "platform/core", "platform/representation", + "platform/commonUI/about", "platform/commonUI/browse", "platform/commonUI/edit", "platform/commonUI/dialog", diff --git a/platform/commonUI/about/README.md b/platform/commonUI/about/README.md new file mode 100644 index 0000000000..da28ed68a7 --- /dev/null +++ b/platform/commonUI/about/README.md @@ -0,0 +1,2 @@ +The "about" bundle provides the default lower-right application logo, +as well as the dialog it launches when clicked. \ No newline at end of file diff --git a/platform/commonUI/about/bundle.json b/platform/commonUI/about/bundle.json new file mode 100644 index 0000000000..364df7e06d --- /dev/null +++ b/platform/commonUI/about/bundle.json @@ -0,0 +1,17 @@ +{ + "name": "About Open MCT Web", + "extensions": { + "templates": [ + { + "key": "app-logo", + "priority": "optional", + "templateUrl": "app-logo.html" + }, + { + "key": "about-logo", + "priority": "preferred", + "templateUrl": "about-logo.html" + } + ] + } +} \ No newline at end of file diff --git a/platform/commonUI/about/res/about-logo.html b/platform/commonUI/about/res/about-logo.html new file mode 100644 index 0000000000..323fc517fb --- /dev/null +++ b/platform/commonUI/about/res/about-logo.html @@ -0,0 +1,2 @@ + + diff --git a/platform/commonUI/about/res/app-logo.html b/platform/commonUI/about/res/app-logo.html new file mode 100644 index 0000000000..8b3cefb5c0 --- /dev/null +++ b/platform/commonUI/about/res/app-logo.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/platform/commonUI/general/res/templates/bottombar.html b/platform/commonUI/general/res/templates/bottombar.html index 1036fbc336..e7c326d992 100644 --- a/platform/commonUI/general/res/templates/bottombar.html +++ b/platform/commonUI/general/res/templates/bottombar.html @@ -5,5 +5,5 @@ key="indicator.template"> - + \ No newline at end of file From b5ebe5b27fbe244ebba355b165ba6c91ef9407fe Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 14 Jan 2015 10:51:38 -0800 Subject: [PATCH 02/12] [About] Support priority from mct-include Support priority ordering from the mct-include directive (such that the highest-priority template for a given key is what gets included.) Needed to support variations among application logos in the bottom right (depending on deployment.) WTD-667. --- platform/representation/src/MCTInclude.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/platform/representation/src/MCTInclude.js b/platform/representation/src/MCTInclude.js index 78ac424180..460fac489b 100644 --- a/platform/representation/src/MCTInclude.js +++ b/platform/representation/src/MCTInclude.js @@ -37,12 +37,14 @@ define( // Prepopulate templateMap for easy look up by key templates.forEach(function (template) { - var path = [ - template.bundle.path, - template.bundle.resources, - template.templateUrl - ].join("/"); - templateMap[template.key] = path; + var key = template.key, + path = [ + template.bundle.path, + template.bundle.resources, + template.templateUrl + ].join("/"); + // First found should win (priority ordering) + templateMap[key] = templateMap[key] || path; }); function controller($scope) { From 97d4f34ae2e97bfc0502903705d5495f1f7e48c4 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 14 Jan 2015 11:49:35 -0800 Subject: [PATCH 03/12] [About] Refactor overlay templates Refactor overlay templates to separate out the overlay container from the inner dialog containing the form; this permits the easy reuse of that overlay container to supply a non-form-like About dialog, WTD-667. --- platform/commonUI/dialog/bundle.json | 10 ++++++ .../commonUI/dialog/res/templates/dialog.html | 25 +++++++++++++++ .../dialog/res/templates/overlay-dialog.html | 4 +++ .../dialog/res/templates/overlay.html | 32 ++++--------------- 4 files changed, 45 insertions(+), 26 deletions(-) create mode 100644 platform/commonUI/dialog/res/templates/dialog.html create mode 100644 platform/commonUI/dialog/res/templates/overlay-dialog.html diff --git a/platform/commonUI/dialog/bundle.json b/platform/commonUI/dialog/bundle.json index feeb0d9e12..ae1c89cc05 100644 --- a/platform/commonUI/dialog/bundle.json +++ b/platform/commonUI/dialog/bundle.json @@ -15,6 +15,16 @@ "templates": [ { "key": "overlay-dialog", + "templateUrl": "templates/overlay-dialog.html" + }, + { + "key": "form-dialog", + "templateUrl": "templates/dialog.html" + } + ], + "containers": [ + { + "key": "overlay", "templateUrl": "templates/overlay.html" } ] diff --git a/platform/commonUI/dialog/res/templates/dialog.html b/platform/commonUI/dialog/res/templates/dialog.html new file mode 100644 index 0000000000..87cf45d2d6 --- /dev/null +++ b/platform/commonUI/dialog/res/templates/dialog.html @@ -0,0 +1,25 @@ +
+
{{ngModel.title}}
+
+ All fields marked * are required. +
+
+
+
+ + +
+
+ \ No newline at end of file diff --git a/platform/commonUI/dialog/res/templates/overlay-dialog.html b/platform/commonUI/dialog/res/templates/overlay-dialog.html new file mode 100644 index 0000000000..74ec58a075 --- /dev/null +++ b/platform/commonUI/dialog/res/templates/overlay-dialog.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/platform/commonUI/dialog/res/templates/overlay.html b/platform/commonUI/dialog/res/templates/overlay.html index d5e0d7de51..00636d5d90 100644 --- a/platform/commonUI/dialog/res/templates/overlay.html +++ b/platform/commonUI/dialog/res/templates/overlay.html @@ -3,32 +3,12 @@
x -
-
-
{{ngModel.title}}
-
All fields marked * are required.
-
-
-
- - - -
-
- + ng-if="ngModel.cancel" + class="btn normal outline ui-symbol close"> + x + +
+
\ No newline at end of file From 553eb2dd75088b9f5341a0f807f39db922977fe6 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 14 Jan 2015 11:53:51 -0800 Subject: [PATCH 04/12] [About] Provide default cancel for overlays For overlays that do not need to do special things when a window is dismissed, provide a default cancel function. This simplifies implementation of the information-only dialogs, such as the About dialog, WTD-667. --- platform/commonUI/dialog/src/DialogService.js | 4 ++-- .../commonUI/dialog/src/OverlayService.js | 24 ++++++++++++------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/platform/commonUI/dialog/src/DialogService.js b/platform/commonUI/dialog/src/DialogService.js index b606c1743e..344a407b94 100644 --- a/platform/commonUI/dialog/src/DialogService.js +++ b/platform/commonUI/dialog/src/DialogService.js @@ -76,8 +76,8 @@ define( // Add the overlay using the OverlayService, which // will handle actual insertion into the DOM overlay = overlayService.createOverlay( - overlayModel, - "overlay-dialog" + "overlay-dialog", + overlayModel ); // Track that a dialog is already visible, to diff --git a/platform/commonUI/dialog/src/OverlayService.js b/platform/commonUI/dialog/src/OverlayService.js index 580595162d..32fd0c54b4 100644 --- a/platform/commonUI/dialog/src/OverlayService.js +++ b/platform/commonUI/dialog/src/OverlayService.js @@ -25,11 +25,21 @@ define( * @constructor */ function OverlayService($document, $compile, $rootScope) { - function createOverlay(overlayModel, key) { + function createOverlay(key, overlayModel) { // Create a new scope for this overlay var scope = $rootScope.$new(), element; + // Stop showing the overlay; additionally, release the scope + // that it uses. + function dismiss() { + scope.$destroy(); + element.remove(); + } + + // If no model is supplied, just fill in a default "cancel" + overlayModel = overlayModel || { cancel: dismiss }; + // Populate the scope; will be passed directly to the template scope.overlay = overlayModel; scope.key = key; @@ -38,12 +48,7 @@ define( element = $compile(TEMPLATE)(scope); $document.find('body').prepend(element); - // Stop showing the overlay; additionally, release the scope - // that it uses. - function dismiss() { - scope.$destroy(); - element.remove(); - } + return { dismiss: dismiss @@ -57,11 +62,12 @@ define( * template (as pointed to by the `key` argument) is * responsible for having a useful z-order, and for * blocking user interactions if appropriate. + * + * @param {string} key the symbolic key which identifies + * the template of the overlay to be shown * @param {object} overlayModel the model to pass to the * included overlay template (this will be passed * in via ng-model) - * @param {string} key the symbolic key which identifies - * the template of the overlay to be shown */ createOverlay: createOverlay }; From 150787b25ff6c20add28a7d66e642c226e1249c7 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 14 Jan 2015 12:06:05 -0800 Subject: [PATCH 05/12] [About] Add controllers Add initial implementations of controllers to support showing the About dialog on logo click, WTD-667. --- platform/commonUI/about/res/about-logo.html | 6 ++++-- .../commonUI/about/src/AboutController.js | 21 +++++++++++++++++++ platform/commonUI/about/src/LogoController.js | 18 ++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 platform/commonUI/about/src/AboutController.js create mode 100644 platform/commonUI/about/src/LogoController.js diff --git a/platform/commonUI/about/res/about-logo.html b/platform/commonUI/about/res/about-logo.html index 323fc517fb..c31a7d55a7 100644 --- a/platform/commonUI/about/res/about-logo.html +++ b/platform/commonUI/about/res/about-logo.html @@ -1,2 +1,4 @@ - - + + + + diff --git a/platform/commonUI/about/src/AboutController.js b/platform/commonUI/about/src/AboutController.js new file mode 100644 index 0000000000..88fd95d99c --- /dev/null +++ b/platform/commonUI/about/src/AboutController.js @@ -0,0 +1,21 @@ +/*global define*/ + +define( + [], + function () { + "use strict"; + + function AboutController(versions, $window) { + return { + versions: function () { + return versions; + }, + openLicenses: function () { + $window.open("#/licenses", "_blank"); + } + }; + } + + return AboutController; + } +); \ No newline at end of file diff --git a/platform/commonUI/about/src/LogoController.js b/platform/commonUI/about/src/LogoController.js new file mode 100644 index 0000000000..93f425d1d7 --- /dev/null +++ b/platform/commonUI/about/src/LogoController.js @@ -0,0 +1,18 @@ +/*global define*/ + +define( + [], + function () { + "use strict"; + + function LogoController(overlayService) { + return { + showAboutDialog: function () { + overlayService.createOverlay("overlay-about"); + } + }; + } + + return LogoController; + } +); \ No newline at end of file From f7818b7e760fee4262188f1410e3935527959e9d Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 14 Jan 2015 12:06:39 -0800 Subject: [PATCH 06/12] [About] Organize templates Move templates into an appropriately-named folder; WTD-667. --- platform/commonUI/about/res/{ => templates}/about-logo.html | 0 platform/commonUI/about/res/{ => templates}/app-logo.html | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename platform/commonUI/about/res/{ => templates}/about-logo.html (100%) rename platform/commonUI/about/res/{ => templates}/app-logo.html (100%) diff --git a/platform/commonUI/about/res/about-logo.html b/platform/commonUI/about/res/templates/about-logo.html similarity index 100% rename from platform/commonUI/about/res/about-logo.html rename to platform/commonUI/about/res/templates/about-logo.html diff --git a/platform/commonUI/about/res/app-logo.html b/platform/commonUI/about/res/templates/app-logo.html similarity index 100% rename from platform/commonUI/about/res/app-logo.html rename to platform/commonUI/about/res/templates/app-logo.html From b4a8940fe8367aea7fded72cccdf990ea4a0ab9e Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 14 Jan 2015 12:10:09 -0800 Subject: [PATCH 07/12] [About] Expose controllers, routes Expose controllers for use in the About dialog, WTD-667. --- platform/commonUI/about/bundle.json | 22 +++++++++++++++++-- .../commonUI/about/src/AboutController.js | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/platform/commonUI/about/bundle.json b/platform/commonUI/about/bundle.json index 364df7e06d..663d2550eb 100644 --- a/platform/commonUI/about/bundle.json +++ b/platform/commonUI/about/bundle.json @@ -5,12 +5,30 @@ { "key": "app-logo", "priority": "optional", - "templateUrl": "app-logo.html" + "templateUrl": "templates/app-logo.html" }, { "key": "about-logo", "priority": "preferred", - "templateUrl": "about-logo.html" + "templateUrl": "templates/about-logo.html" + } + ], + "controllers": [ + { + "key": "LogoController", + "depends": [ "overlayService" ], + "implementation": "LogoController.js" + }, + { + "key": "AboutController", + "depends": [ "versions[]", "$window" ], + "implementation": "AboutController.js" + } + ], + "routes": [ + { + "when": "/licenses", + "templateUrl": "templates/licenses.html" } ] } diff --git a/platform/commonUI/about/src/AboutController.js b/platform/commonUI/about/src/AboutController.js index 88fd95d99c..6eb2171d34 100644 --- a/platform/commonUI/about/src/AboutController.js +++ b/platform/commonUI/about/src/AboutController.js @@ -11,7 +11,7 @@ define( return versions; }, openLicenses: function () { - $window.open("#/licenses", "_blank"); + $window.open("#/licenses"); } }; } From c628d88b3ec0fafafd554767e13978743a0d2062 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 14 Jan 2015 12:28:25 -0800 Subject: [PATCH 08/12] [About] Implement placeholder dialog Implement a placeholder for the About dialog, including some minimal version information. WTD-667. --- platform/commonUI/about/bundle.json | 8 ++++++++ .../commonUI/about/res/templates/about-dialog.html | 12 ++++++++++++ .../commonUI/about/res/templates/about-logo.html | 2 +- platform/commonUI/about/res/templates/licenses.html | 1 + .../commonUI/about/res/templates/overlay-about.html | 4 ++++ platform/core/bundle.json | 13 +++++++++++++ platform/framework/bundle.json | 3 ++- 7 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 platform/commonUI/about/res/templates/about-dialog.html create mode 100644 platform/commonUI/about/res/templates/licenses.html create mode 100644 platform/commonUI/about/res/templates/overlay-about.html diff --git a/platform/commonUI/about/bundle.json b/platform/commonUI/about/bundle.json index 663d2550eb..142241449c 100644 --- a/platform/commonUI/about/bundle.json +++ b/platform/commonUI/about/bundle.json @@ -11,6 +11,14 @@ "key": "about-logo", "priority": "preferred", "templateUrl": "templates/about-logo.html" + }, + { + "key": "about-dialog", + "templateUrl": "templates/about-dialog.html" + }, + { + "key": "overlay-about", + "templateUrl": "templates/overlay-about.html" } ], "controllers": [ diff --git a/platform/commonUI/about/res/templates/about-dialog.html b/platform/commonUI/about/res/templates/about-dialog.html new file mode 100644 index 0000000000..7840b8860b --- /dev/null +++ b/platform/commonUI/about/res/templates/about-dialog.html @@ -0,0 +1,12 @@ +
+ This is a placeholder for the about dialog. + + Show licenses. + +

+ + {{version.name}} + {{version.value}} + +

+
diff --git a/platform/commonUI/about/res/templates/about-logo.html b/platform/commonUI/about/res/templates/about-logo.html index c31a7d55a7..2b658c2696 100644 --- a/platform/commonUI/about/res/templates/about-logo.html +++ b/platform/commonUI/about/res/templates/about-logo.html @@ -1,4 +1,4 @@ - + diff --git a/platform/commonUI/about/res/templates/licenses.html b/platform/commonUI/about/res/templates/licenses.html new file mode 100644 index 0000000000..c3af087cd9 --- /dev/null +++ b/platform/commonUI/about/res/templates/licenses.html @@ -0,0 +1 @@ +Placeholder for open source licenses. \ No newline at end of file diff --git a/platform/commonUI/about/res/templates/overlay-about.html b/platform/commonUI/about/res/templates/overlay-about.html new file mode 100644 index 0000000000..f9af8cd923 --- /dev/null +++ b/platform/commonUI/about/res/templates/overlay-about.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/platform/core/bundle.json b/platform/core/bundle.json index 6cb0f329f6..3ae730083c 100644 --- a/platform/core/bundle.json +++ b/platform/core/bundle.json @@ -3,6 +3,19 @@ "description": "Defines core concepts of Open MCT Web.", "sources": "src", "extensions": { + "versions": [ + { + "name": "Open MCT Web", + "value": "0.3.0-dev", + "priority": 1000 + }, + { + "name": "Built", + "value": "YYYY-MM-DDTHH:MM:ssZ", + "description": "The date on which this version of the client was built.", + "priority": 990 + } + ], "components": [ { "provides": "objectService", diff --git a/platform/framework/bundle.json b/platform/framework/bundle.json index a09bea185c..057e9287d0 100644 --- a/platform/framework/bundle.json +++ b/platform/framework/bundle.json @@ -12,5 +12,6 @@ } } }, - "extensions": {} + "extensions": { + } } \ No newline at end of file From 95393b269ee175a964b03d606beb36d184b05d7d Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 14 Jan 2015 13:09:41 -0800 Subject: [PATCH 09/12] [About] Update dialog specs Update tests for dialog/overlay services to match changes introduced to simplify implementation of information overlays, such as the About dialog, WTD-667. --- platform/commonUI/dialog/test/DialogServiceSpec.js | 6 +++--- platform/commonUI/dialog/test/OverlayServiceSpec.js | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/commonUI/dialog/test/DialogServiceSpec.js b/platform/commonUI/dialog/test/DialogServiceSpec.js index 584e793398..9f3635cd9e 100644 --- a/platform/commonUI/dialog/test/DialogServiceSpec.js +++ b/platform/commonUI/dialog/test/DialogServiceSpec.js @@ -56,7 +56,7 @@ define( it("allows user input to be canceled", function () { dialogService.getUserInput({}, { someKey: "some value" }); - mockOverlayService.createOverlay.mostRecentCall.args[0].cancel(); + mockOverlayService.createOverlay.mostRecentCall.args[1].cancel(); expect(mockDeferred.reject).toHaveBeenCalled(); expect(mockDeferred.resolve).not.toHaveBeenCalled(); }); @@ -64,7 +64,7 @@ define( it("passes back the result of user input when confirmed", function () { var value = { someKey: 42 }; dialogService.getUserInput({}, value); - mockOverlayService.createOverlay.mostRecentCall.args[0].confirm(); + mockOverlayService.createOverlay.mostRecentCall.args[1].confirm(); expect(mockDeferred.reject).not.toHaveBeenCalled(); expect(mockDeferred.resolve).toHaveBeenCalledWith(value); }); @@ -80,7 +80,7 @@ define( it("can show multiple dialogs if prior ones are dismissed", function () { dialogService.getUserInput({}, {}); expect(mockLog.warn).not.toHaveBeenCalled(); - mockOverlayService.createOverlay.mostRecentCall.args[0].confirm(); + mockOverlayService.createOverlay.mostRecentCall.args[1].confirm(); dialogService.getUserInput({}, {}); expect(mockLog.warn).not.toHaveBeenCalled(); expect(mockDeferred.reject).not.toHaveBeenCalled(); diff --git a/platform/commonUI/dialog/test/OverlayServiceSpec.js b/platform/commonUI/dialog/test/OverlayServiceSpec.js index 0adde5a0ea..5506098571 100644 --- a/platform/commonUI/dialog/test/OverlayServiceSpec.js +++ b/platform/commonUI/dialog/test/OverlayServiceSpec.js @@ -8,7 +8,7 @@ define( function (OverlayService) { "use strict"; - describe("The dialog service", function () { + describe("The overlay service", function () { var mockDocument, mockCompile, mockRootScope, @@ -40,19 +40,19 @@ define( }); it("prepends an mct-include to create overlays", function () { - overlayService.createOverlay({}, "test"); + overlayService.createOverlay("test", {}); expect(mockCompile).toHaveBeenCalled(); expect(mockCompile.mostRecentCall.args[0].indexOf("mct-include")) .not.toEqual(-1); }); it("adds the templated element to the body", function () { - overlayService.createOverlay({}, "test"); + overlayService.createOverlay("test", {}); expect(mockBody.prepend).toHaveBeenCalledWith(mockElement); }); it("places the provided model/key in its template's scope", function () { - overlayService.createOverlay({ someKey: 42 }, "test"); + overlayService.createOverlay("test", { someKey: 42 }); expect(mockScope.overlay).toEqual({ someKey: 42 }); expect(mockScope.key).toEqual("test"); @@ -61,7 +61,7 @@ define( }); it("removes the prepended element on request", function () { - var overlay = overlayService.createOverlay({}, "test"); + var overlay = overlayService.createOverlay("test", {}); // Verify precondition expect(mockElement.remove).not.toHaveBeenCalled(); From d33344dacdd094c339f5594dabf17f237b747975 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 14 Jan 2015 13:10:05 -0800 Subject: [PATCH 10/12] [About] Add tests for controllers Add tests for controllers introduced to support a minimal implementation of an About dialog, WTD-667. --- .../about/test/AboutControllerSpec.js | 39 +++++++++++++++++++ .../commonUI/about/test/LogoControllerSpec.js | 32 +++++++++++++++ platform/commonUI/about/test/suite.json | 4 ++ 3 files changed, 75 insertions(+) create mode 100644 platform/commonUI/about/test/AboutControllerSpec.js create mode 100644 platform/commonUI/about/test/LogoControllerSpec.js create mode 100644 platform/commonUI/about/test/suite.json diff --git a/platform/commonUI/about/test/AboutControllerSpec.js b/platform/commonUI/about/test/AboutControllerSpec.js new file mode 100644 index 0000000000..1587b42054 --- /dev/null +++ b/platform/commonUI/about/test/AboutControllerSpec.js @@ -0,0 +1,39 @@ +/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ + +define( + ['../src/AboutController'], + function (AboutController) { + "use strict"; + + describe("The About controller", function () { + var testVersions, + mockWindow, + controller; + + beforeEach(function () { + testVersions = [ + { name: "Some name", value: "1.2.3" }, + { name: "Some other name", value: "3.2.1" } + ]; + mockWindow = jasmine.createSpyObj("$window", ["open"]); + controller = new AboutController(testVersions, mockWindow); + }); + + it("exposes version information", function () { + // This will be injected, so it should just give back + // what it got in. + expect(controller.versions()).toEqual(testVersions); + }); + + it("opens license information in a window", function () { + //Verify precondition + expect(mockWindow.open).not.toHaveBeenCalled(); + controller.openLicenses(); + expect(mockWindow.open).toHaveBeenCalledWith("#/licenses"); + }); + + + }); + + } +); \ No newline at end of file diff --git a/platform/commonUI/about/test/LogoControllerSpec.js b/platform/commonUI/about/test/LogoControllerSpec.js new file mode 100644 index 0000000000..f3afb2ab57 --- /dev/null +++ b/platform/commonUI/about/test/LogoControllerSpec.js @@ -0,0 +1,32 @@ +/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ + +define( + ['../src/LogoController'], + function (LogoController) { + "use strict"; + + describe("The About controller", function () { + var mockOverlayService, + controller; + + beforeEach(function () { + mockOverlayService = jasmine.createSpyObj( + "overlayService", + ["createOverlay"] + ); + controller = new LogoController(mockOverlayService); + }); + + it("shows the about dialog", function () { + //Verify precondition + expect(mockOverlayService.createOverlay) + .not.toHaveBeenCalled(); + controller.showAboutDialog(); + expect(mockOverlayService.createOverlay) + .toHaveBeenCalledWith("overlay-about"); + }); + + }); + + } +); \ No newline at end of file diff --git a/platform/commonUI/about/test/suite.json b/platform/commonUI/about/test/suite.json new file mode 100644 index 0000000000..e626ff9b7a --- /dev/null +++ b/platform/commonUI/about/test/suite.json @@ -0,0 +1,4 @@ +[ + "AboutController", + "LogoController" +] \ No newline at end of file From f7a33659b40ab3151369b4b618ac563f4b5ac2d4 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 14 Jan 2015 13:15:24 -0800 Subject: [PATCH 11/12] [About] Add JSDoc Add in-line documentation to controllers introduced to support the About dialog. WTD-667. --- .../commonUI/about/src/AboutController.js | 21 +++++++++++++++++++ platform/commonUI/about/src/LogoController.js | 10 +++++++++ 2 files changed, 31 insertions(+) diff --git a/platform/commonUI/about/src/AboutController.js b/platform/commonUI/about/src/AboutController.js index 6eb2171d34..77c6ede2cb 100644 --- a/platform/commonUI/about/src/AboutController.js +++ b/platform/commonUI/about/src/AboutController.js @@ -5,12 +5,33 @@ define( function () { "use strict"; + /** + * The AboutController provides information to populate the + * About dialog. + * @constructor + * @param {object[]} versions an array of version extensions; + * injected from `versions[]` + * @param $window Angular-injected window object + */ function AboutController(versions, $window) { return { + /** + * Get version info. This is given as an array of + * objects, where each object is intended to appear + * as a line-item in the version information listing. + * @memberof AboutController# + * @returns {object[]} version information + */ versions: function () { return versions; }, + /** + * Open a new window (or tab, depending on browser + * configuration) containing open source licenses. + * @memberof AboutController# + */ openLicenses: function () { + // Open a new browser window at the licenses route $window.open("#/licenses"); } }; diff --git a/platform/commonUI/about/src/LogoController.js b/platform/commonUI/about/src/LogoController.js index 93f425d1d7..1ff6b7602f 100644 --- a/platform/commonUI/about/src/LogoController.js +++ b/platform/commonUI/about/src/LogoController.js @@ -5,8 +5,18 @@ define( function () { "use strict"; + /** + * The LogoController provides functionality to the application + * logo in the bottom-right of the user interface. + * @constructor + * @param {OverlayService} overlayService the overlay service + */ function LogoController(overlayService) { return { + /** + * Display the About dialog. + * @memberof LogoController# + */ showAboutDialog: function () { overlayService.createOverlay("overlay-about"); } From c164ba8ec8b2f99e6df29588be596498be9205b7 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 14 Jan 2015 13:22:33 -0800 Subject: [PATCH 12/12] [About] Fill in README Add details about the versions category-of-extension to the README for the About bundle. WTD-667 --- platform/commonUI/about/README.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/platform/commonUI/about/README.md b/platform/commonUI/about/README.md index da28ed68a7..05bcfe22cd 100644 --- a/platform/commonUI/about/README.md +++ b/platform/commonUI/about/README.md @@ -1,2 +1,26 @@ The "about" bundle provides the default lower-right application logo, -as well as the dialog it launches when clicked. \ No newline at end of file +as well as the dialog it launches when clicked. + +# Extensions + +The About dialog contains several line items to display different +version properties (e.g. when built, et cetera.) Plug-ins may wish +to introduce additional line items here, in particular if the +platform is used to build a separately-branded piece of software. + +This bundle introduces the `versions` extension category to support this. +An extension of this category is implementation-less (all information +is contained within its declaration) and should include the following +fields: + +* `name`: The name to display for this version line-item; this may + be the name of the software, or something else such as "Built". +* `value`: The value to display corresponding to this line-item; + this is typically a version number, revision identifier, or + human-readable date. +* `description`: Optional; a longer-form description of this line + item, to display in a tooltip. + +Ordering of these line items is handled by extension priority; see framework +documentation (`platform/framework/README.md`) for information on how +this ordering is handled.