From e75146119417a3d4f6c51df836a2a55fc4bf277e Mon Sep 17 00:00:00 2001 From: steven mirecki Date: Sat, 3 Sep 2016 09:16:54 -0400 Subject: [PATCH 01/65] Typo corrections, I avoided making changes to words that have regional spelling differences. --- build-docs.sh | 2 +- docs/src/architecture/platform.md | 2 +- docs/src/design/proposals/APIRedesign.md | 4 ++-- docs/src/design/proposals/APIRedesign_PeteRichards.md | 2 +- docs/src/tutorials/index.md | 2 +- example/eventGenerator/data/transcript.json | 2 +- platform/commonUI/dialog/src/DialogService.js | 2 +- platform/commonUI/edit/test/creation/CreationServiceSpec.js | 2 +- .../commonUI/edit/test/representers/EditRepresenterSpec.js | 2 +- .../edit/test/representers/EditToolbarRepresenterSpec.js | 2 +- .../general/src/controllers/ObjectInspectorController.js | 4 ++-- platform/commonUI/general/src/filters/ReverseFilter.js | 2 +- platform/commonUI/general/src/services/PopupService.js | 2 +- .../general/test/controllers/ClickAwayControllerSpec.js | 2 +- .../general/test/controllers/ToggleControllerSpec.js | 2 +- platform/commonUI/mobile/test/MCTDeviceSpec.js | 2 +- platform/commonUI/notification/src/NotificationService.js | 2 +- platform/containment/test/CapabilityTableSpec.js | 2 +- platform/containment/test/ContainmentTableSpec.js | 2 +- platform/core/src/models/ModelCacheService.js | 2 +- platform/core/src/models/RootModelProvider.js | 2 +- platform/core/src/models/StaticModelProvider.js | 2 +- platform/core/src/types/TypePropertyConversion.js | 2 +- platform/core/src/types/TypeProvider.js | 2 +- platform/entanglement/README.md | 2 +- platform/features/layout/src/FixedDragHandle.js | 2 +- platform/features/layout/src/LayoutController.js | 2 +- platform/features/layout/test/LayoutControllerSpec.js | 2 +- platform/features/plot/test/Canvas2DChartSpec.js | 2 +- platform/features/plot/test/GLChartSpec.js | 2 +- .../timeline/src/controllers/TimelineGanttController.js | 2 +- .../timeline/src/controllers/TimelineTickController.js | 2 +- .../timeline/src/controllers/drag/TimelineDragHandler.js | 2 +- .../timeline/src/controllers/drag/TimelineSnapHandler.js | 2 +- platform/framework/src/load/Bundle.js | 2 +- platform/persistence/couch/src/CouchDocument.js | 4 ++-- platform/persistence/couch/test/CouchIndicatorSpec.js | 6 +++--- platform/persistence/elastic/src/ElasticSearchProvider.js | 2 +- platform/persistence/elastic/test/ElasticIndicatorSpec.js | 4 ++-- platform/persistence/queue/src/PersistenceQueue.js | 2 +- platform/persistence/queue/src/PersistenceQueueHandler.js | 2 +- platform/search/src/services/GenericSearchProvider.js | 2 +- platform/search/test/controllers/SearchControllerSpec.js | 4 ++-- .../search/test/controllers/SearchMenuControllerSpec.js | 2 +- platform/telemetry/src/TelemetrySubscriber.js | 2 +- platform/telemetry/src/TelemetrySubscription.js | 2 +- 46 files changed, 53 insertions(+), 53 deletions(-) diff --git a/build-docs.sh b/build-docs.sh index 73d387bcff3..29841f921e4 100755 --- a/build-docs.sh +++ b/build-docs.sh @@ -32,7 +32,7 @@ WEBSITE_DIRECTORY="website" BUILD_SHA=`git rev-parse HEAD` # A remote will be created for the git repository we are pushing to. -# Don't worry, as this entire directory will get trashed inbetween builds. +# Don't worry, as this entire directory will get trashed in between builds. REMOTE_NAME="documentation" WEBSITE_BRANCH="master" diff --git a/docs/src/architecture/platform.md b/docs/src/architecture/platform.md index f7f0c48cdab..48ceebb9efa 100644 --- a/docs/src/architecture/platform.md +++ b/docs/src/architecture/platform.md @@ -616,7 +616,7 @@ follows: part of an action's extension definition. * `CreateActionProvider` provides the various Create actions which populate the Create menu. These are driven by the available types, - so do not map easily ot extension category `actions`; instead, these + so do not map easily to extension category `actions`; instead, these are generated after looking up which actions are available from the [`TypeService`](#type-service). * `ActionAggregator` merges together actions from multiple providers. diff --git a/docs/src/design/proposals/APIRedesign.md b/docs/src/design/proposals/APIRedesign.md index e6230823ed6..03ce2f212fe 100644 --- a/docs/src/design/proposals/APIRedesign.md +++ b/docs/src/design/proposals/APIRedesign.md @@ -98,7 +98,7 @@ Worked on bug fixes in the platform and a plugin for search. It is hard to figure out what the difference between the various ways of dealing with telemetry are. e.g., what is the difference between just "Telemetry" and the "Telemetry Service"? There are many - "Telemetry Thing"s which seem related, but in an unclear way. + "Telemetry Things" which seem related, but in an unclear way. ### Developer Intern 2 @@ -456,7 +456,7 @@ Instead, propose that: For parity with actions, a `View` would be a constructor which takes an `ActionContext` as a parameter (with similarly-defined properties) and exposes a method to retrieve the HTML elements -associateed with it. +associated with it. The platform would then additionally expose an `AngularView` implementation to improve compatibility with existing diff --git a/docs/src/design/proposals/APIRedesign_PeteRichards.md b/docs/src/design/proposals/APIRedesign_PeteRichards.md index dce80c41aec..517d61cc505 100644 --- a/docs/src/design/proposals/APIRedesign_PeteRichards.md +++ b/docs/src/design/proposals/APIRedesign_PeteRichards.md @@ -99,7 +99,7 @@ To reduce interface depth, we can replace our own provider and registry patterns ## More angular: for all services -Increasing our commitment to angular would mean using more of the angular factorys, services, etc, and less of our home grown tools. We'd implement our services and extension points as angular providers, and make them configurable via app.config. +Increasing our commitment to angular would mean using more of the angular factories, services, etc, and less of our home grown tools. We'd implement our services and extension points as angular providers, and make them configurable via app.config. As an example, registering a specific type of model provider in angular would look like: diff --git a/docs/src/tutorials/index.md b/docs/src/tutorials/index.md index 0e48fcf11fc..d8842de9d77 100644 --- a/docs/src/tutorials/index.md +++ b/docs/src/tutorials/index.md @@ -3238,7 +3238,7 @@ define( __tutorials/telemetry/src/ExampleTelemetryServerAdapter.js__ Here, we have added `subscribe` and `unsubscribe` methods which issue the -corresponding requests to the server. Seperately, we introduce the ability to +corresponding requests to the server. Separately, we introduce the ability to listen for `data` messages as they come in: These will contain the data associated with these subscriptions. diff --git a/example/eventGenerator/data/transcript.json b/example/eventGenerator/data/transcript.json index 0416220e71d..ce787353303 100644 --- a/example/eventGenerator/data/transcript.json +++ b/example/eventGenerator/data/transcript.json @@ -10,7 +10,7 @@ "LMP: 47 degrees.", "CC: Eagle, looking great. You're GO.", "CC: Roger. 1202. We copy it.", - "O1: LMP 35 degrees. 35 degrees. 750. Coming aown to 23.fl", + "O1: LMP 35 degrees. 35 degrees. 750. Coming down to 23.fl", "LMP: 700 feet, 21 down, 33 degrees.", "LMP: 600 feet, down at 19.", "LMP: 540 feet, down at - 30. Down at 15.", diff --git a/platform/commonUI/dialog/src/DialogService.js b/platform/commonUI/dialog/src/DialogService.js index ca0a4b09b71..071710fb682 100644 --- a/platform/commonUI/dialog/src/DialogService.js +++ b/platform/commonUI/dialog/src/DialogService.js @@ -187,7 +187,7 @@ define( /** * A description of the model options that may be passed to the - * showBlockingMessage method. Note that the DialogModel desribed + * showBlockingMessage method. Note that the DialogModel described * here is shared with the Notifications framework. * @see NotificationService * diff --git a/platform/commonUI/edit/test/creation/CreationServiceSpec.js b/platform/commonUI/edit/test/creation/CreationServiceSpec.js index 1cc6d55e1bf..090437b8c72 100644 --- a/platform/commonUI/edit/test/creation/CreationServiceSpec.js +++ b/platform/commonUI/edit/test/creation/CreationServiceSpec.js @@ -195,7 +195,7 @@ define( expect(failure).toHaveBeenCalled(); }); - it("logs an error when mutaton fails", function () { + it("logs an error when mutation fails", function () { // If mutation of the parent fails, we've lost the // created object - this is an error. var model = { someKey: "some value" }; diff --git a/platform/commonUI/edit/test/representers/EditRepresenterSpec.js b/platform/commonUI/edit/test/representers/EditRepresenterSpec.js index 7cb2626e648..7af3740fd65 100644 --- a/platform/commonUI/edit/test/representers/EditRepresenterSpec.js +++ b/platform/commonUI/edit/test/representers/EditRepresenterSpec.js @@ -112,7 +112,7 @@ define( expect(mockPersistence.persist).toHaveBeenCalled(); // Finally, check that the provided mutation function - // includes both model and configuratioon + // includes both model and configuration expect( mockDomainObject.useCapability.mostRecentCall.args[1]() ).toEqual({ diff --git a/platform/commonUI/edit/test/representers/EditToolbarRepresenterSpec.js b/platform/commonUI/edit/test/representers/EditToolbarRepresenterSpec.js index 0147601d7d5..7cc8314fc66 100644 --- a/platform/commonUI/edit/test/representers/EditToolbarRepresenterSpec.js +++ b/platform/commonUI/edit/test/representers/EditToolbarRepresenterSpec.js @@ -79,7 +79,7 @@ define( it("removes state from parent scope on destroy", function () { // Verify precondition expect(mockScope.$parent.testToolbar).toBeDefined(); - // Destroy the represeter + // Destroy the representer representer.destroy(); // Should have removed toolbar state from view expect(mockScope.$parent.testToolbar).toBeUndefined(); diff --git a/platform/commonUI/general/src/controllers/ObjectInspectorController.js b/platform/commonUI/general/src/controllers/ObjectInspectorController.js index eb164dc76be..ef066d67745 100644 --- a/platform/commonUI/general/src/controllers/ObjectInspectorController.js +++ b/platform/commonUI/general/src/controllers/ObjectInspectorController.js @@ -38,7 +38,7 @@ define( $scope.contextutalParents = []; //$scope.isLink = false; - // Gets an array of the contextual parents/anscestors of the selected object + // Gets an array of the contextual parents/ancestors of the selected object function getContextualPath() { var currentObj = $scope.ngModel.selectedObject, currentParent, @@ -61,7 +61,7 @@ define( $scope.contextutalParents = parents; } - // Gets an array of the parents/anscestors of the selected object's + // Gets an array of the parents/ancestors of the selected object's // primary location (locational of original non-link) function getPrimaryPath(current) { var location; diff --git a/platform/commonUI/general/src/filters/ReverseFilter.js b/platform/commonUI/general/src/filters/ReverseFilter.js index a951e940e4e..775d9fca862 100644 --- a/platform/commonUI/general/src/filters/ReverseFilter.js +++ b/platform/commonUI/general/src/filters/ReverseFilter.js @@ -25,7 +25,7 @@ define(function () { /** * Implements the `reverse` filter, which reverses text strings. * Useful in cases where text should be reversed for presentational - * reasons (e.g. in conjunction with CSS tricks involing text direction), + * reasons (e.g. in conjunction with CSS tricks involving text direction), * allowing such behavior to be handled independently from the controller * layer. * diff --git a/platform/commonUI/general/src/services/PopupService.js b/platform/commonUI/general/src/services/PopupService.js index b87c553ccd9..3f65106fb02 100644 --- a/platform/commonUI/general/src/services/PopupService.js +++ b/platform/commonUI/general/src/services/PopupService.js @@ -35,7 +35,7 @@ define( } /** - * Options controlling how the popup is displaed. + * Options controlling how the popup is displayed. * * @typedef PopupOptions * @memberof platform/commonUI/general diff --git a/platform/commonUI/general/test/controllers/ClickAwayControllerSpec.js b/platform/commonUI/general/test/controllers/ClickAwayControllerSpec.js index 22b4035919c..8b114f9948d 100644 --- a/platform/commonUI/general/test/controllers/ClickAwayControllerSpec.js +++ b/platform/commonUI/general/test/controllers/ClickAwayControllerSpec.js @@ -60,7 +60,7 @@ define( expect(controller.isActive()).toBe(false); }); - it("allows active state to be explictly specified", function () { + it("allows active state to be explicitly specified", function () { controller.setState(true); expect(controller.isActive()).toBe(true); controller.setState(true); diff --git a/platform/commonUI/general/test/controllers/ToggleControllerSpec.js b/platform/commonUI/general/test/controllers/ToggleControllerSpec.js index 32a9568200f..b51e2f0920a 100644 --- a/platform/commonUI/general/test/controllers/ToggleControllerSpec.js +++ b/platform/commonUI/general/test/controllers/ToggleControllerSpec.js @@ -46,7 +46,7 @@ define( expect(controller.isActive()).toBe(false); }); - it("allows active state to be explictly specified", function () { + it("allows active state to be explicitly specified", function () { controller.setState(true); expect(controller.isActive()).toBe(true); controller.setState(true); diff --git a/platform/commonUI/mobile/test/MCTDeviceSpec.js b/platform/commonUI/mobile/test/MCTDeviceSpec.js index 4d130c56eed..421d3d7aca3 100644 --- a/platform/commonUI/mobile/test/MCTDeviceSpec.js +++ b/platform/commonUI/mobile/test/MCTDeviceSpec.js @@ -72,7 +72,7 @@ define( expect(directive.restrict).toEqual("A"); }); - it("transcludes at the elmeent level", function () { + it("transcludes at the element level", function () { expect(directive.transclude).toEqual('element'); }); diff --git a/platform/commonUI/notification/src/NotificationService.js b/platform/commonUI/notification/src/NotificationService.js index 5412eb951ed..e37571759aa 100644 --- a/platform/commonUI/notification/src/NotificationService.js +++ b/platform/commonUI/notification/src/NotificationService.js @@ -361,7 +361,7 @@ define( autodismiss specified), leave it to run. Otherwise force a timeout. - This notifcation has been added to queue and will be + This notification has been added to queue and will be serviced as soon as possible. */ this.active.timeout = this.$timeout(function () { diff --git a/platform/containment/test/CapabilityTableSpec.js b/platform/containment/test/CapabilityTableSpec.js index 851ac2f99f2..646ef828823 100644 --- a/platform/containment/test/CapabilityTableSpec.js +++ b/platform/containment/test/CapabilityTableSpec.js @@ -45,7 +45,7 @@ define( ['getKey', 'getDefinition', 'getInitialModel'] ); mockType.getKey.andReturn(type); - // Return a model to drive apparant capabilities + // Return a model to drive apparent capabilities mockType.getInitialModel.andReturn({ id: type }); return mockType; }); diff --git a/platform/containment/test/ContainmentTableSpec.js b/platform/containment/test/ContainmentTableSpec.js index d0ab71b4599..a83d9c1c827 100644 --- a/platform/containment/test/ContainmentTableSpec.js +++ b/platform/containment/test/ContainmentTableSpec.js @@ -50,7 +50,7 @@ define( // third one defines no containership rules contains: (index < 2) ? [{ has: 'b' }] : undefined }); - // Return a model to drive apparant capabilities + // Return a model to drive apparent capabilities mockType.getInitialModel.andReturn({ id: type }); return mockType; }); diff --git a/platform/core/src/models/ModelCacheService.js b/platform/core/src/models/ModelCacheService.js index a204ef0b873..783509a774b 100644 --- a/platform/core/src/models/ModelCacheService.js +++ b/platform/core/src/models/ModelCacheService.js @@ -24,7 +24,7 @@ define([], function () { /** * Provides a cache for domain object models which exist in memory, - * but may or may not exist in backing persistene stores. + * but may or may not exist in backing persistence stores. * @constructor * @memberof platform/core */ diff --git a/platform/core/src/models/RootModelProvider.js b/platform/core/src/models/RootModelProvider.js index 0dfb656c316..205d41e66bf 100644 --- a/platform/core/src/models/RootModelProvider.js +++ b/platform/core/src/models/RootModelProvider.js @@ -42,7 +42,7 @@ define( * @implements {ModelService} * @param {Array} roots all `roots[]` extensions * @param $q Angular's $q, for promises - * @param $log Anuglar's $log, for logging + * @param $log Angular's $log, for logging */ function RootModelProvider(roots, $q, $log) { // Pull out identifiers to used as ROOT's diff --git a/platform/core/src/models/StaticModelProvider.js b/platform/core/src/models/StaticModelProvider.js index 45d89dbe2f1..e20f9232fb1 100644 --- a/platform/core/src/models/StaticModelProvider.js +++ b/platform/core/src/models/StaticModelProvider.js @@ -49,7 +49,7 @@ define( } } - // Prepoulate maps with models to make subsequent lookup faster. + // Prepopulate maps with models to make subsequent lookup faster. models.forEach(addModelToMap); this.modelMap = modelMap; diff --git a/platform/core/src/types/TypePropertyConversion.js b/platform/core/src/types/TypePropertyConversion.js index 84fba54e02a..fcf71b20116 100644 --- a/platform/core/src/types/TypePropertyConversion.js +++ b/platform/core/src/types/TypePropertyConversion.js @@ -43,7 +43,7 @@ define( }, ARRAY_SUFFIX = '[]'; - // Utility function to handle arrays of conversiions + // Utility function to handle arrays of conversions function ArrayConversion(conversion) { return { toModelValue: function (formValue) { diff --git a/platform/core/src/types/TypeProvider.js b/platform/core/src/types/TypeProvider.js index c3256c57ba3..e8cf83f3e24 100644 --- a/platform/core/src/types/TypeProvider.js +++ b/platform/core/src/types/TypeProvider.js @@ -68,7 +68,7 @@ define( }) : array; } - // Reduce an array of type definitions to a single type definiton, + // Reduce an array of type definitions to a single type definition, // which has merged all properties in order. function collapse(typeDefs) { var collapsed = typeDefs.reduce(function (a, b) { diff --git a/platform/entanglement/README.md b/platform/entanglement/README.md index f3685bad05e..aaf517decf2 100644 --- a/platform/entanglement/README.md +++ b/platform/entanglement/README.md @@ -3,7 +3,7 @@ Entanglement is the process of moving, copying, and linking domain objects in such a way that their relationships are impossible to discern. -This bundle provides move, copy, and link functionality. Acheiving a state of +This bundle provides move, copy, and link functionality. Achieving a state of entanglement is left up to the end user. diff --git a/platform/features/layout/src/FixedDragHandle.js b/platform/features/layout/src/FixedDragHandle.js index de4b8ec92dc..86fa4fb8c3b 100644 --- a/platform/features/layout/src/FixedDragHandle.js +++ b/platform/features/layout/src/FixedDragHandle.js @@ -94,7 +94,7 @@ define( }; /** - * End a drag gesture. This should be callled when a drag + * End a drag gesture. This should be called when a drag * concludes to trigger commit of changes. */ FixedDragHandle.prototype.endDrag = function () { diff --git a/platform/features/layout/src/LayoutController.js b/platform/features/layout/src/LayoutController.js index 80470f25b3a..88eae7462c8 100644 --- a/platform/features/layout/src/LayoutController.js +++ b/platform/features/layout/src/LayoutController.js @@ -152,7 +152,7 @@ define( } // Convert from { positions: ..., dimensions: ... } to an - // apropriate ng-style argument, to position frames. + // appropriate ng-style argument, to position frames. LayoutController.prototype.convertPosition = function (raw) { var gridSize = this.gridSize; // Multiply position/dimensions by grid size diff --git a/platform/features/layout/test/LayoutControllerSpec.js b/platform/features/layout/test/LayoutControllerSpec.js index dbc79e27696..6a23a29c049 100644 --- a/platform/features/layout/test/LayoutControllerSpec.js +++ b/platform/features/layout/test/LayoutControllerSpec.js @@ -164,7 +164,7 @@ define( // Populate scope mockScope.$watchCollection.mostRecentCall.args[1](); - // Verify precondtion + // Verify precondition expect(testConfiguration.panels.b).not.toBeDefined(); // Do a drag diff --git a/platform/features/plot/test/Canvas2DChartSpec.js b/platform/features/plot/test/Canvas2DChartSpec.js index b20d7b9c705..446c07d8419 100644 --- a/platform/features/plot/test/Canvas2DChartSpec.js +++ b/platform/features/plot/test/Canvas2DChartSpec.js @@ -59,7 +59,7 @@ define( expect(mock2d.clearRect).toHaveBeenCalled(); }); - it("doees not construct if 2D is unavailable", function () { + it("does not construct if 2D is unavailable", function () { mockCanvas.getContext.andReturn(undefined); expect(function () { return new Canvas2DChart(mockCanvas); diff --git a/platform/features/plot/test/GLChartSpec.js b/platform/features/plot/test/GLChartSpec.js index fb575d7709c..1ab0e6ea0a2 100644 --- a/platform/features/plot/test/GLChartSpec.js +++ b/platform/features/plot/test/GLChartSpec.js @@ -82,7 +82,7 @@ define( expect(mockGL.clear).toHaveBeenCalled(); }); - it("doees not construct if WebGL is unavailable", function () { + it("does not construct if WebGL is unavailable", function () { mockCanvas.getContext.andReturn(undefined); expect(function () { return new GLChart(mockCanvas); diff --git a/platform/features/timeline/src/controllers/TimelineGanttController.js b/platform/features/timeline/src/controllers/TimelineGanttController.js index 7c3ee03244f..6153064ebe9 100644 --- a/platform/features/timeline/src/controllers/TimelineGanttController.js +++ b/platform/features/timeline/src/controllers/TimelineGanttController.js @@ -26,7 +26,7 @@ define( /** * Control for Gantt bars in a timeline view. - * Primarily reesponsible for supporting the positioning of Gantt + * Primarily responsible for supporting the positioning of Gantt * bars; particularly, this ensures that the left and right edges * never go to far off screen, because in some environments this * will effect rendering performance without visible results. diff --git a/platform/features/timeline/src/controllers/TimelineTickController.js b/platform/features/timeline/src/controllers/TimelineTickController.js index 41c57dedbf3..fb1f2ad6b83 100644 --- a/platform/features/timeline/src/controllers/TimelineTickController.js +++ b/platform/features/timeline/src/controllers/TimelineTickController.js @@ -28,7 +28,7 @@ define( /** * Provides labels for the tick mark area of a timeline view. - * Since the tick mark regin is potentially extremeley large, + * Since the tick mark reign is potentially extremely large, * only the subset of ticks which will actually be shown in * view are provided. * @constructor diff --git a/platform/features/timeline/src/controllers/drag/TimelineDragHandler.js b/platform/features/timeline/src/controllers/drag/TimelineDragHandler.js index 7a356d91dc1..745c3cc5cff 100644 --- a/platform/features/timeline/src/controllers/drag/TimelineDragHandler.js +++ b/platform/features/timeline/src/controllers/drag/TimelineDragHandler.js @@ -148,7 +148,7 @@ define( var timespan = timespans[toId(id)]; // Use as setter if argument is present if ((typeof value === 'number') && timespan) { - // Set the end (ensuring it doesn't preceed start) + // Set the end (ensuring it doesn't precede start) timespan.setEnd( Math.max(value, timespan.getStart()) ); diff --git a/platform/features/timeline/src/controllers/drag/TimelineSnapHandler.js b/platform/features/timeline/src/controllers/drag/TimelineSnapHandler.js index 70d854d008e..42d13b86811 100644 --- a/platform/features/timeline/src/controllers/drag/TimelineSnapHandler.js +++ b/platform/features/timeline/src/controllers/drag/TimelineSnapHandler.js @@ -41,7 +41,7 @@ define( ids, candidates; - // Filter an id for inclustion + // Filter an id for inclusion function include(id) { return id !== exclude; } diff --git a/platform/framework/src/load/Bundle.js b/platform/framework/src/load/Bundle.js index a97dc3af5be..91bd9667548 100644 --- a/platform/framework/src/load/Bundle.js +++ b/platform/framework/src/load/Bundle.js @@ -174,7 +174,7 @@ define( * category. * * @param {string} category name of the extension category - * @returns {Array} extension definitions of that cataegory + * @returns {Array} extension definitions of that category */ Bundle.prototype.getExtensions = function (category) { var extensions = this.definition.extensions[category] || [], diff --git a/platform/persistence/couch/src/CouchDocument.js b/platform/persistence/couch/src/CouchDocument.js index 59fa3bfa3f2..c16ca27f5c2 100644 --- a/platform/persistence/couch/src/CouchDocument.js +++ b/platform/persistence/couch/src/CouchDocument.js @@ -27,7 +27,7 @@ define( /** * A CouchDocument describes domain object model in a format * which is easily read-written to CouchDB. This includes - * Couch's _id and _rev fields, as well as a sseparate + * Couch's _id and _rev fields, as well as a separate * metadata field which contains a subset of information found * in the model itself (to support search optimization with * CouchDB views.) @@ -37,7 +37,7 @@ define( * @param {object} model the model to store * @param {string} rev the revision to include (or undefined, * if no revision should be noted for couch) - * @param {boolean} whether or not to mark this documnet as + * @param {boolean} whether or not to mark this document as * deleted (see CouchDB docs for _deleted) */ function CouchDocument(id, model, rev, markDeleted) { diff --git a/platform/persistence/couch/test/CouchIndicatorSpec.js b/platform/persistence/couch/test/CouchIndicatorSpec.js index 01fb3d7d239..166b8fc82ad 100644 --- a/platform/persistence/couch/test/CouchIndicatorSpec.js +++ b/platform/persistence/couch/test/CouchIndicatorSpec.js @@ -69,7 +69,7 @@ define( initialDescrption = indicator.getDescription(), initialGlyphClass = indicator.getGlyphClass(); - // Nominal just means getting back an objeect, without + // Nominal just means getting back an object, without // an error field. mockPromise.then.mostRecentCall.args[0]({ data: {} }); @@ -88,7 +88,7 @@ define( initialDescrption = indicator.getDescription(), initialGlyphClass = indicator.getGlyphClass(); - // Nominal just means getting back an objeect, with + // Nominal just means getting back an object, with // an error field. mockPromise.then.mostRecentCall.args[0]( { data: { error: "Uh oh." } } @@ -110,7 +110,7 @@ define( initialDescrption = indicator.getDescription(), initialGlyphClass = indicator.getGlyphClass(); - // Nominal just means getting back an objeect, without + // Nominal just means getting back an object, without // an error field. mockPromise.then.mostRecentCall.args[1]({ data: {} }); diff --git a/platform/persistence/elastic/src/ElasticSearchProvider.js b/platform/persistence/elastic/src/ElasticSearchProvider.js index 4bc05047607..c0930c70252 100644 --- a/platform/persistence/elastic/src/ElasticSearchProvider.js +++ b/platform/persistence/elastic/src/ElasticSearchProvider.js @@ -51,7 +51,7 @@ define([ * Search for domain objects using elasticsearch as a search provider. * * @param {String} searchTerm the term to search by. - * @param {Number} [maxResults] the max numer of results to return. + * @param {Number} [maxResults] the max number of results to return. * @returns {Promise} promise for a modelResults object. */ ElasticSearchProvider.prototype.query = function (searchTerm, maxResults) { diff --git a/platform/persistence/elastic/test/ElasticIndicatorSpec.js b/platform/persistence/elastic/test/ElasticIndicatorSpec.js index 3086b52c661..bfc3effcd0f 100644 --- a/platform/persistence/elastic/test/ElasticIndicatorSpec.js +++ b/platform/persistence/elastic/test/ElasticIndicatorSpec.js @@ -71,7 +71,7 @@ define( initialDescrption = indicator.getDescription(), initialGlyphClass = indicator.getGlyphClass(); - // Nominal just means getting back an objeect, without + // Nominal just means getting back an object, without // an error field. mockPromise.then.mostRecentCall.args[0]({ data: {} }); @@ -90,7 +90,7 @@ define( initialDescrption = indicator.getDescription(), initialGlyphClass = indicator.getGlyphClass(); - // Nominal just means getting back an objeect, without + // Nominal just means getting back an object, without // an error field. mockPromise.then.mostRecentCall.args[1]({ data: {} }); diff --git a/platform/persistence/queue/src/PersistenceQueue.js b/platform/persistence/queue/src/PersistenceQueue.js index de9ede2cfee..d0d4671f720 100644 --- a/platform/persistence/queue/src/PersistenceQueue.js +++ b/platform/persistence/queue/src/PersistenceQueue.js @@ -35,7 +35,7 @@ define( /** * The PersistenceQueue is used by the QueuingPersistenceCapability - * to aggregrate calls for object persistence. These are then issued + * to aggregate calls for object persistence. These are then issued * in a group, such that if some or all are rejected, this result can * be shown to the user (again, in a group.) * diff --git a/platform/persistence/queue/src/PersistenceQueueHandler.js b/platform/persistence/queue/src/PersistenceQueueHandler.js index 958b954e8f1..679fbbb8df7 100644 --- a/platform/persistence/queue/src/PersistenceQueueHandler.js +++ b/platform/persistence/queue/src/PersistenceQueueHandler.js @@ -25,7 +25,7 @@ define( function () { /** - * Handles actual persistence invocations for queeud persistence + * Handles actual persistence invocations for queued persistence * attempts, in a group. Handling in a group in this manner * also allows failure to be handled in a group (e.g. in a single * summary dialog.) diff --git a/platform/search/src/services/GenericSearchProvider.js b/platform/search/src/services/GenericSearchProvider.js index 8e35373fbb0..6c8ce257ef7 100644 --- a/platform/search/src/services/GenericSearchProvider.js +++ b/platform/search/src/services/GenericSearchProvider.js @@ -246,7 +246,7 @@ define([ /** * @private - * @returns {Number} a unique, unusued query Id. + * @returns {Number} a unique, unused query Id. */ GenericSearchProvider.prototype.makeQueryId = function () { var queryId = Math.ceil(Math.random() * 100000); diff --git a/platform/search/test/controllers/SearchControllerSpec.js b/platform/search/test/controllers/SearchControllerSpec.js index bcb7b01dd0b..b8c5c0c496d 100644 --- a/platform/search/test/controllers/SearchControllerSpec.js +++ b/platform/search/test/controllers/SearchControllerSpec.js @@ -123,7 +123,7 @@ define([ expect(mockScope.results).toContain('a'); }); - it('is loading until the service\'s promise fufills', function () { + it('is loading until the service\'s promise fulfills', function () { expect(mockScope.loading).toBeTruthy(); // Then resolve the promises @@ -163,7 +163,7 @@ define([ // Flag should be true with nonempty input expect(mockScope.ngModel.search).toEqual(true); - // Flag should be flase with empty input + // Flag should be false with empty input mockScope.ngModel.input = ''; controller.search(); mockPromise.then.mostRecentCall.args[0]({hits: [], total: 0}); diff --git a/platform/search/test/controllers/SearchMenuControllerSpec.js b/platform/search/test/controllers/SearchMenuControllerSpec.js index 611f0d5a087..e4d566431c2 100644 --- a/platform/search/test/controllers/SearchMenuControllerSpec.js +++ b/platform/search/test/controllers/SearchMenuControllerSpec.js @@ -54,7 +54,7 @@ define( controller = new SearchMenuController(mockScope, mockTypes); }); - it("gets types on initiliztion", function () { + it("gets types on initialization", function () { expect(mockScope.ngModel.types).toBeDefined(); }); diff --git a/platform/telemetry/src/TelemetrySubscriber.js b/platform/telemetry/src/TelemetrySubscriber.js index 9cf17b5fa77..64665664230 100644 --- a/platform/telemetry/src/TelemetrySubscriber.js +++ b/platform/telemetry/src/TelemetrySubscriber.js @@ -31,7 +31,7 @@ define( * `telemetrySubscriber`. * * Subscriptions may also be made directly using the - * `telemetry` capability of a domain objcet; the subscriber + * `telemetry` capability of a domain object; the subscriber * uses this as well, but additionally handles delegation * (e.g. for telemetry panels) as well as latest-value * extraction. diff --git a/platform/telemetry/src/TelemetrySubscription.js b/platform/telemetry/src/TelemetrySubscription.js index ca0f11125df..dd5e4d31911 100644 --- a/platform/telemetry/src/TelemetrySubscription.js +++ b/platform/telemetry/src/TelemetrySubscription.js @@ -57,7 +57,7 @@ define( * `telemetrySubscriber` service. * * Subscriptions may also be made directly using the - * `telemetry` capability of a domain objcet; the subscriber + * `telemetry` capability of a domain object; the subscriber * uses this as well, but additionally handles delegation * (e.g. for telemetry panels) as well as latest-value * extraction. From 9847c40e3421b2d580c360c893c10c0be83daf71 Mon Sep 17 00:00:00 2001 From: Alex M Date: Thu, 1 Sep 2016 23:01:57 +0300 Subject: [PATCH 02/65] [Edit] SaveAction not navigating anymore --- .../commonUI/edit/src/actions/SaveAction.js | 29 ++++--------------- .../edit/test/actions/SaveActionSpec.js | 6 ---- 2 files changed, 5 insertions(+), 30 deletions(-) diff --git a/platform/commonUI/edit/src/actions/SaveAction.js b/platform/commonUI/edit/src/actions/SaveAction.js index 6f96e841922..8d3ea7f509d 100644 --- a/platform/commonUI/edit/src/actions/SaveAction.js +++ b/platform/commonUI/edit/src/actions/SaveAction.js @@ -25,9 +25,8 @@ define( function (SaveInProgressDialog) { /** - * The "Save" action; the action triggered by clicking Save from - * Edit Mode. Exits the editing user interface and invokes object - * capabilities to persist the changes that have been made. + * The "Save" action; it invokes object capabilities to persist + * the changes that have been made. * @constructor * @implements {Action} * @memberof platform/commonUI/edit @@ -41,7 +40,7 @@ define( } /** - * Save changes and conclude editing. + * Save changes. * * @returns {Promise} a promise that will be fulfilled when * cancellation has completed @@ -51,40 +50,22 @@ define( var domainObject = this.domainObject, dialog = new SaveInProgressDialog(this.dialogService); - function resolveWith(object) { - return function () { - return object; - }; - } - // Invoke any save behavior introduced by the editor capability; // this is introduced by EditableDomainObject which is // used to insulate underlying objects from changes made // during editing. function doSave() { - return domainObject.getCapability("editor").save() - .then(resolveWith(domainObject)); - } - - // Discard the current root view (which will be the editing - // UI, which will have been pushed atop the Browse UI.) - function returnToBrowse(object) { - if (object) { - object.getCapability("action").perform("navigate"); - } - return object; + return domainObject.getCapability("editor").save(); } - function hideBlockingDialog(object) { + function hideBlockingDialog() { dialog.hide(); - return object; } dialog.show(); return doSave() .then(hideBlockingDialog) - .then(returnToBrowse) .catch(hideBlockingDialog); }; diff --git a/platform/commonUI/edit/test/actions/SaveActionSpec.js b/platform/commonUI/edit/test/actions/SaveActionSpec.js index 0243f89a118..7324b53085f 100644 --- a/platform/commonUI/edit/test/actions/SaveActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveActionSpec.js @@ -105,12 +105,6 @@ define( expect(mockEditorCapability.save).toHaveBeenCalled(); }); - it("navigates to the object after saving", - function () { - action.perform(); - expect(mockActionCapability.perform).toHaveBeenCalledWith("navigate"); - }); - describe("a blocking dialog", function () { var mockDialogHandle; From 90c13a3959c695fd30e43c6a69a848fee692c2a7 Mon Sep 17 00:00:00 2001 From: Alex M Date: Thu, 1 Sep 2016 23:16:31 +0300 Subject: [PATCH 03/65] [Edit] EditorCapability continues edit on save --- .../commonUI/edit/src/capabilities/EditorCapability.js | 10 +++++----- .../edit/test/capabilities/EditorCapabilitySpec.js | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index aa7670d8aa1..a997eb3033a 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -81,14 +81,14 @@ define( }; /** - * Save any changes from this editing session. This will flush all - * pending persists and end the current transaction + * Save any unsaved changes from this editing session. This will + * end the current transaction and continue with a new one. * @returns {*} */ EditorCapability.prototype.save = function () { - var domainObject = this.domainObject; - return this.transactionService.commit().then(function () { - domainObject.getCapability('status').set('editing', false); + var transactionService = this.transactionService; + return transactionService.commit().then(function () { + transactionService.startTransaction(); }); }; diff --git a/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js index 3ffb81921d6..e72793be53b 100644 --- a/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js +++ b/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js @@ -134,8 +134,8 @@ define( it("commits the transaction", function () { expect(mockTransactionService.commit).toHaveBeenCalled(); }); - it("resets the edit state", function () { - expect(mockStatusCapability.set).toHaveBeenCalledWith('editing', false); + it("begins a new transaction", function () { + expect(mockTransactionService.startTransaction).toHaveBeenCalled(); }); }); From ab4ce0caba1cac308d0db3f2fc2334a490bf1e5f Mon Sep 17 00:00:00 2001 From: Alex M Date: Sat, 3 Sep 2016 17:25:21 +0300 Subject: [PATCH 04/65] [Edit] Introduced SaveAndStopEditingAction It replaces SaveAction in the bundle. --- platform/commonUI/edit/bundle.js | 6 +- .../src/actions/SaveAndStopEditingAction.js | 73 +++++++++++ .../actions/SaveAndStopEditingActionSpec.js | 118 ++++++++++++++++++ 3 files changed, 194 insertions(+), 3 deletions(-) create mode 100644 platform/commonUI/edit/src/actions/SaveAndStopEditingAction.js create mode 100644 platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js diff --git a/platform/commonUI/edit/bundle.js b/platform/commonUI/edit/bundle.js index 2c5a79bda3a..b81e0577648 100644 --- a/platform/commonUI/edit/bundle.js +++ b/platform/commonUI/edit/bundle.js @@ -30,7 +30,7 @@ define([ "./src/actions/EditAction", "./src/actions/PropertiesAction", "./src/actions/RemoveAction", - "./src/actions/SaveAction", + "./src/actions/SaveAndStopEditingAction", "./src/actions/SaveAsAction", "./src/actions/CancelAction", "./src/policies/EditActionPolicy", @@ -69,7 +69,7 @@ define([ EditAction, PropertiesAction, RemoveAction, - SaveAction, + SaveAndStopEditingAction, SaveAsAction, CancelAction, EditActionPolicy, @@ -205,7 +205,7 @@ define([ { "key": "save", "category": "conclude-editing", - "implementation": SaveAction, + "implementation": SaveAndStopEditingAction, "name": "Save", "cssclass": "icon-save labeled", "description": "Save changes made to these objects.", diff --git a/platform/commonUI/edit/src/actions/SaveAndStopEditingAction.js b/platform/commonUI/edit/src/actions/SaveAndStopEditingAction.js new file mode 100644 index 00000000000..a6a1eb9e62f --- /dev/null +++ b/platform/commonUI/edit/src/actions/SaveAndStopEditingAction.js @@ -0,0 +1,73 @@ +/***************************************************************************** + * Open MCT, Copyright (c) 2014-2016, United States Government + * as represented by the Administrator of the National Aeronautics and Space + * Administration. All rights reserved. + * + * Open MCT 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 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. + *****************************************************************************/ + +define( + ["./SaveAction"], + function (SaveAction) { + + /** + * The "Save and Stop Editing" action performs a [Save action]{@link SaveAction} + * on the object under edit followed by exiting the edit user interface. + * @constructor + * @implements {Action} + * @memberof platform/commonUI/edit + */ + function SaveAndStopEditingAction( + dialogService, + context + ) { + this.context = context; + this.domainObject = (context || {}).domainObject; + this.dialogService = dialogService; + } + + /** + * Trigger a save operation and exit edit mode. + * + * @returns {Promise} a promise that will be fulfilled when + * cancellation has completed + * @memberof platform/commonUI/edit.SaveAndStopEditingAction# + */ + SaveAndStopEditingAction.prototype.perform = function () { + var domainObject = this.domainObject, + saveAction = new SaveAction(this.dialogService, this.context); + + function closeEditor() { + return domainObject.getCapability("editor").cancel(); + } + + return saveAction.perform() + .then(closeEditor) + .catch(closeEditor); + }; + + /** + * Check if this action is applicable in a given context. + * This will ensure that a domain object is present in the context, + * and that this domain object is in Edit mode. + * @returns true if applicable + */ + SaveAndStopEditingAction.appliesTo = SaveAction.appliesTo; + + return SaveAndStopEditingAction; + } +); \ No newline at end of file diff --git a/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js b/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js new file mode 100644 index 00000000000..a5d14e3d6da --- /dev/null +++ b/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js @@ -0,0 +1,118 @@ +/***************************************************************************** + * Open MCT, Copyright (c) 2014-2016, United States Government + * as represented by the Administrator of the National Aeronautics and Space + * Administration. All rights reserved. + * + * Open MCT 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 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. + *****************************************************************************/ + +define( + ["../../src/actions/SaveAndStopEditingAction"], + function (SaveAndStopEditingAction) { + + describe("The Save and Stop Editing action", function () { + + var mockDomainObject, + mockEditorCapability, + actionContext, + dialogService, + mockActionCapability, + capabilities = {}, + action; + + function mockPromise(value) { + return { + then: function (callback) { + return mockPromise(callback(value)); + }, + catch: function (callback) { + return mockPromise(callback(value)); + } + }; + } + + beforeEach(function () { + mockDomainObject = jasmine.createSpyObj( + "domainObject", + [ + "getCapability", + "hasCapability", + "getModel", + "getOriginalObject" + ] + ); + mockEditorCapability = jasmine.createSpyObj( + "editor", + ["save", "cancel", "isEditContextRoot"] + ); + mockActionCapability = jasmine.createSpyObj( + "actionCapability", + ["perform"] + ); + capabilities.editor = mockEditorCapability; + capabilities.action = mockActionCapability; + + actionContext = { + domainObject: mockDomainObject + }; + dialogService = jasmine.createSpyObj( + "dialogService", + ["showBlockingMessage"] + ); + + mockDomainObject.hasCapability.andReturn(true); + mockDomainObject.getCapability.andCallFake(function (capability) { + return capabilities[capability]; + }); + mockDomainObject.getModel.andReturn({ persisted: 0 }); + mockEditorCapability.save.andReturn(mockPromise(true)); + mockEditorCapability.isEditContextRoot.andReturn(true); + + action = new SaveAndStopEditingAction(dialogService, actionContext); + }); + + + it("only applies to domain object with an editor capability", function () { + expect(SaveAndStopEditingAction.appliesTo(actionContext)).toBe(true); + expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor"); + + mockDomainObject.hasCapability.andReturn(false); + mockDomainObject.getCapability.andReturn(undefined); + expect(SaveAndStopEditingAction.appliesTo(actionContext)).toBe(false); + }); + + it("only applies to domain object that has already been persisted", function () { + mockDomainObject.getModel.andReturn({ persisted: undefined }); + expect(SaveAndStopEditingAction.appliesTo(actionContext)).toBe(false); + }); + + it("does not close the editor before completing the save", function () { + mockEditorCapability.save.andReturn(new Promise(function () { + })); + action.perform(); + expect(mockEditorCapability.save).toHaveBeenCalled(); + expect(mockEditorCapability.cancel).not.toHaveBeenCalled(); + }); + + it("closes the editor after saving", function () { + action.perform(); + expect(mockEditorCapability.save).toHaveBeenCalled(); + expect(mockEditorCapability.cancel).toHaveBeenCalled(); + }); + }); + } +); \ No newline at end of file From ded52b8d199ec96c787db78e94d5920786836f9e Mon Sep 17 00:00:00 2001 From: Alex M Date: Sat, 3 Sep 2016 17:45:23 +0300 Subject: [PATCH 05/65] [Edit] Rename cancel() to finish() --- platform/commonUI/edit/src/actions/CancelAction.js | 2 +- .../commonUI/edit/src/actions/SaveAndStopEditingAction.js | 2 +- .../commonUI/edit/src/capabilities/EditorCapability.js | 4 ++-- platform/commonUI/edit/test/actions/CancelActionSpec.js | 8 ++++---- .../edit/test/actions/SaveAndStopEditingActionSpec.js | 6 +++--- .../edit/test/capabilities/EditorCapabilitySpec.js | 6 +++--- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/platform/commonUI/edit/src/actions/CancelAction.js b/platform/commonUI/edit/src/actions/CancelAction.js index 13b005958e8..a48ceec996f 100644 --- a/platform/commonUI/edit/src/actions/CancelAction.js +++ b/platform/commonUI/edit/src/actions/CancelAction.js @@ -62,7 +62,7 @@ define( } function cancel(allowed) { - return allowed && domainObject.getCapability("editor").cancel(); + return allowed && domainObject.getCapability("editor").finish(); } //Do navigation first in order to trigger unsaved changes dialog diff --git a/platform/commonUI/edit/src/actions/SaveAndStopEditingAction.js b/platform/commonUI/edit/src/actions/SaveAndStopEditingAction.js index a6a1eb9e62f..6145ecd05b2 100644 --- a/platform/commonUI/edit/src/actions/SaveAndStopEditingAction.js +++ b/platform/commonUI/edit/src/actions/SaveAndStopEditingAction.js @@ -52,7 +52,7 @@ define( saveAction = new SaveAction(this.dialogService, this.context); function closeEditor() { - return domainObject.getCapability("editor").cancel(); + return domainObject.getCapability("editor").finish(); } return saveAction.perform() diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index a997eb3033a..53dea8c91c6 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -95,11 +95,11 @@ define( EditorCapability.prototype.invoke = EditorCapability.prototype.edit; /** - * Cancel the current editing session. This will discard any pending + * Finish the current editing session. This will discard any pending * persist operations * @returns {*} */ - EditorCapability.prototype.cancel = function () { + EditorCapability.prototype.finish = function () { var domainObject = this.domainObject; return this.transactionService.cancel().then(function () { domainObject.getCapability("status").set("editing", false); diff --git a/platform/commonUI/edit/test/actions/CancelActionSpec.js b/platform/commonUI/edit/test/actions/CancelActionSpec.js index 3bd0cee72fa..7fdc51b0e99 100644 --- a/platform/commonUI/edit/test/actions/CancelActionSpec.js +++ b/platform/commonUI/edit/test/actions/CancelActionSpec.js @@ -63,7 +63,7 @@ define( capabilities.editor = jasmine.createSpyObj( "editor", - ["save", "cancel", "isEditContextRoot"] + ["save", "finish", "isEditContextRoot"] ); capabilities.action = jasmine.createSpyObj( "actionCapability", @@ -105,7 +105,7 @@ define( return !!capabilities[name]; }); - capabilities.editor.cancel.andReturn(mockPromise(true)); + capabilities.editor.finish.andReturn(mockPromise(true)); action = new CancelAction(actionContext); @@ -130,8 +130,8 @@ define( capabilities.action.perform.andReturn(mockPromise(true)); action.perform(); - // Should have called cancel - expect(capabilities.editor.cancel).toHaveBeenCalled(); + // Should have called finish + expect(capabilities.editor.finish).toHaveBeenCalled(); // Definitely shouldn't call save! expect(capabilities.editor.save).not.toHaveBeenCalled(); diff --git a/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js b/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js index a5d14e3d6da..6570dd60371 100644 --- a/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js @@ -57,7 +57,7 @@ define( ); mockEditorCapability = jasmine.createSpyObj( "editor", - ["save", "cancel", "isEditContextRoot"] + ["save", "finish", "isEditContextRoot"] ); mockActionCapability = jasmine.createSpyObj( "actionCapability", @@ -105,13 +105,13 @@ define( })); action.perform(); expect(mockEditorCapability.save).toHaveBeenCalled(); - expect(mockEditorCapability.cancel).not.toHaveBeenCalled(); + expect(mockEditorCapability.finish).not.toHaveBeenCalled(); }); it("closes the editor after saving", function () { action.perform(); expect(mockEditorCapability.save).toHaveBeenCalled(); - expect(mockEditorCapability.cancel).toHaveBeenCalled(); + expect(mockEditorCapability.finish).toHaveBeenCalled(); }); }); } diff --git a/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js index e72793be53b..77fbd9b74f6 100644 --- a/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js +++ b/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js @@ -139,10 +139,10 @@ define( }); }); - describe("cancel", function () { + describe("finish", function () { beforeEach(function () { capability.edit(); - capability.cancel(); + capability.finish(); }); it("cancels the transaction", function () { expect(mockTransactionService.cancel).toHaveBeenCalled(); @@ -158,7 +158,7 @@ define( beforeEach(function () { mockDomainObject.getModel.andReturn(model); capability.edit(); - capability.cancel(); + capability.finish(); }); it("returns true if the object has been modified since it" + " was last persisted", function () { From 7d52d348b25a6f318de902bf953faf74b3a70bea Mon Sep 17 00:00:00 2001 From: Alex M Date: Sat, 3 Sep 2016 18:33:27 +0300 Subject: [PATCH 06/65] [Edit] Fix style issues --- .../commonUI/edit/src/actions/SaveAndStopEditingAction.js | 4 ++-- platform/commonUI/edit/src/capabilities/EditorCapability.js | 2 +- .../edit/test/actions/SaveAndStopEditingActionSpec.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/commonUI/edit/src/actions/SaveAndStopEditingAction.js b/platform/commonUI/edit/src/actions/SaveAndStopEditingAction.js index 6145ecd05b2..a0a0583048a 100644 --- a/platform/commonUI/edit/src/actions/SaveAndStopEditingAction.js +++ b/platform/commonUI/edit/src/actions/SaveAndStopEditingAction.js @@ -50,7 +50,7 @@ define( SaveAndStopEditingAction.prototype.perform = function () { var domainObject = this.domainObject, saveAction = new SaveAction(this.dialogService, this.context); - + function closeEditor() { return domainObject.getCapability("editor").finish(); } @@ -70,4 +70,4 @@ define( return SaveAndStopEditingAction; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index 53dea8c91c6..2280b04e0c1 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -81,7 +81,7 @@ define( }; /** - * Save any unsaved changes from this editing session. This will + * Save any unsaved changes from this editing session. This will * end the current transaction and continue with a new one. * @returns {*} */ diff --git a/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js b/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js index 6570dd60371..cfed63c0d39 100644 --- a/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js @@ -115,4 +115,4 @@ define( }); }); } -); \ No newline at end of file +); From 3dee0821410becb0e89209c376a3051cd5f5f925 Mon Sep 17 00:00:00 2001 From: Alex M Date: Sat, 3 Sep 2016 19:02:05 +0300 Subject: [PATCH 07/65] [Edit] Add reason for redundant mocks --- .../edit/test/actions/SaveAndStopEditingActionSpec.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js b/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js index cfed63c0d39..1fb8fa64929 100644 --- a/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveAndStopEditingActionSpec.js @@ -26,6 +26,11 @@ define( describe("The Save and Stop Editing action", function () { + // Some mocks appear unused because the + // underlying SaveAction that this action + // depends on is not mocked, so we mock some + // of SaveAction's own dependencies to make + // it run. var mockDomainObject, mockEditorCapability, actionContext, From 24cb72e5b53da4c19d151e7e5757134d3114854a Mon Sep 17 00:00:00 2001 From: David Hudson Date: Mon, 12 Sep 2016 15:28:04 +0900 Subject: [PATCH 08/65] [Frontend] Delay visibility of progress bar Resolves #1168 --- .../commonUI/general/res/sass/overlay/_overlay.scss | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platform/commonUI/general/res/sass/overlay/_overlay.scss b/platform/commonUI/general/res/sass/overlay/_overlay.scss index 018197dac00..34bd1fd46ff 100644 --- a/platform/commonUI/general/res/sass/overlay/_overlay.scss +++ b/platform/commonUI/general/res/sass/overlay/_overlay.scss @@ -19,8 +19,18 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ + .overlay { font-size: 90%; + z-index: 5; + @include keyframes(fadeInFromNone) { + 0% { display: none; opacity: 0; } + 1% { display: block; opacity: 0; } + 95% { display: block; opacity: 0; } + 100% { display: block; opacity: 1; } + } + @include animation(fadeInFromNone 100ms ease-in); + .blocker { background: $colorOvrBlocker; z-index: 100; From 2740b6f9572a8a209c7239fd6f5e290a1332e336 Mon Sep 17 00:00:00 2001 From: David Hudson Date: Tue, 13 Sep 2016 16:36:25 +0900 Subject: [PATCH 09/65] [Frontend] Add optional delay parameter to dialog service Issue #1168 --- .../commonUI/dialog/res/templates/overlay.html | 2 +- platform/commonUI/dialog/src/DialogService.js | 3 +++ .../edit/src/actions/SaveInProgressDialog.js | 3 ++- .../commonUI/general/res/sass/_constants.scss | 3 +++ .../general/res/sass/overlay/_overlay.scss | 15 +++++++-------- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/platform/commonUI/dialog/res/templates/overlay.html b/platform/commonUI/dialog/res/templates/overlay.html index 825d8fe4f46..dcc847029d3 100644 --- a/platform/commonUI/dialog/res/templates/overlay.html +++ b/platform/commonUI/dialog/res/templates/overlay.html @@ -19,7 +19,7 @@ this source code distribution or the Licensing information page available at runtime from the About dialog for additional information. --> -
+
Date: Tue, 13 Sep 2016 21:24:20 +0300 Subject: [PATCH 10/65] [Edit] SaveAs now calls finish() --- platform/commonUI/edit/src/actions/SaveAsAction.js | 10 ++++++++-- .../commonUI/edit/test/actions/SaveAsActionSpec.js | 3 +-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/platform/commonUI/edit/src/actions/SaveAsAction.js b/platform/commonUI/edit/src/actions/SaveAsAction.js index 57a055429a4..402fccb86cf 100644 --- a/platform/commonUI/edit/src/actions/SaveAsAction.js +++ b/platform/commonUI/edit/src/actions/SaveAsAction.js @@ -166,11 +166,16 @@ define([ .then(resolveWith(object)); } - function commitEditingAfterClone(clonedObject) { + function saveAfterClone(clonedObject) { return domainObject.getCapability("editor").save() .then(resolveWith(clonedObject)); } + function finishEditing(clonedObject) { + return domainObject.getCapability("editor").finish() + .then(resolveWith(clonedObject)); + } + function onFailure() { hideBlockingDialog(); return false; @@ -182,7 +187,8 @@ define([ .then(getParent) .then(cloneIntoParent) .then(undirtyOriginals) - .then(commitEditingAfterClone) + .then(saveAfterClone) + .then(finishEditing) .then(hideBlockingDialog) .catch(onFailure); }; diff --git a/platform/commonUI/edit/test/actions/SaveAsActionSpec.js b/platform/commonUI/edit/test/actions/SaveAsActionSpec.js index fd8ce18c076..6bf631feedb 100644 --- a/platform/commonUI/edit/test/actions/SaveAsActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveAsActionSpec.js @@ -78,9 +78,8 @@ define( mockEditorCapability = jasmine.createSpyObj( "editor", - ["save", "cancel", "isEditContextRoot"] + ["save", "isEditContextRoot"] ); - mockEditorCapability.cancel.andReturn(mockPromise(undefined)); mockEditorCapability.save.andReturn(mockPromise(true)); mockEditorCapability.isEditContextRoot.andReturn(true); capabilities.editor = mockEditorCapability; From 438274501231e46a2049054312fa67e2085385d5 Mon Sep 17 00:00:00 2001 From: Alex M Date: Tue, 13 Sep 2016 22:35:11 +0300 Subject: [PATCH 11/65] [Edit] Final two actions now use finish() --- platform/commonUI/edit/src/actions/EditAction.js | 2 +- platform/commonUI/edit/src/creation/CreateAction.js | 2 +- platform/commonUI/edit/test/actions/EditActionSpec.js | 6 +++--- platform/commonUI/edit/test/creation/CreateActionSpec.js | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/commonUI/edit/src/actions/EditAction.js b/platform/commonUI/edit/src/actions/EditAction.js index bd30968289f..9c14abad2ae 100644 --- a/platform/commonUI/edit/src/actions/EditAction.js +++ b/platform/commonUI/edit/src/actions/EditAction.js @@ -71,7 +71,7 @@ define( EditAction.prototype.perform = function () { var self = this; function cancelEditing() { - self.domainObject.getCapability('editor').cancel(); + self.domainObject.getCapability('editor').finish(); self.navigationService.removeListener(cancelEditing); } //If this is not the currently navigated object, then navigate diff --git a/platform/commonUI/edit/src/creation/CreateAction.js b/platform/commonUI/edit/src/creation/CreateAction.js index 14b8443462f..3cfbdb0ef93 100644 --- a/platform/commonUI/edit/src/creation/CreateAction.js +++ b/platform/commonUI/edit/src/creation/CreateAction.js @@ -72,7 +72,7 @@ define( } function onCancel() { - return editorCapability.cancel(); + return editorCapability.finish(); } newModel.type = this.type.getKey(); diff --git a/platform/commonUI/edit/test/actions/EditActionSpec.js b/platform/commonUI/edit/test/actions/EditActionSpec.js index c896e83dd1f..5e54b67e151 100644 --- a/platform/commonUI/edit/test/actions/EditActionSpec.js +++ b/platform/commonUI/edit/test/actions/EditActionSpec.js @@ -58,7 +58,7 @@ define( ); mockEditor = jasmine.createSpyObj( "editorCapability", - ["edit", "isEditContextRoot", "cancel"] + ["edit", "isEditContextRoot", "finish"] ); capabilities = { @@ -98,11 +98,11 @@ define( expect(EditAction.appliesTo(actionContext)).toBe(false); }); - it ("cancels editing when user navigates away", function () { + it ("finishes editing when user navigates away", function () { action.perform(); expect(mockNavigationService.addListener).toHaveBeenCalled(); mockNavigationService.addListener.mostRecentCall.args[0](); - expect(mockEditor.cancel).toHaveBeenCalled(); + expect(mockEditor.finish).toHaveBeenCalled(); }); it ("invokes the Edit capability on the object", function () { diff --git a/platform/commonUI/edit/test/creation/CreateActionSpec.js b/platform/commonUI/edit/test/creation/CreateActionSpec.js index d65621f9a8b..19dc46896f3 100644 --- a/platform/commonUI/edit/test/creation/CreateActionSpec.js +++ b/platform/commonUI/edit/test/creation/CreateActionSpec.js @@ -103,7 +103,7 @@ define( [ "edit", "save", - "cancel" + "finish" ] ); @@ -178,10 +178,10 @@ define( expect(capabilities.editor.save).toHaveBeenCalled(); }); - it("to cancel the edit if user cancels dialog", function () { + it("to finish the edit if user cancels dialog", function () { action.perform(); promise.then.mostRecentCall.args[1](); - expect(capabilities.editor.cancel).toHaveBeenCalled(); + expect(capabilities.editor.finish).toHaveBeenCalled(); }); }); }); From d87ed1414e41e3a8fa4555c910aa615ac5da52c5 Mon Sep 17 00:00:00 2001 From: Alex M Date: Tue, 13 Sep 2016 22:36:27 +0300 Subject: [PATCH 12/65] [Edit] Update EditorCapability comments --- platform/commonUI/edit/src/capabilities/EditorCapability.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index 2280b04e0c1..1cbf239d7d0 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -28,8 +28,8 @@ define( * A capability that implements an editing 'session' for a domain * object. An editing session is initiated via a call to .edit(). * Once initiated, any persist operations will be queued pending a - * subsequent call to [.save()](@link #save) or [.cancel()](@link - * #cancel). + * subsequent call to [.save()](@link #save) or [.finish()](@link + * #finish). * @param transactionService * @param domainObject * @constructor @@ -45,7 +45,7 @@ define( /** * Initiate an editing session. This will start a transaction during * which any persist operations will be deferred until either save() - * or cancel() are called. + * or finish() are called. */ EditorCapability.prototype.edit = function () { this.transactionService.startTransaction(); From 0be84a4e5166d8f5eacc0b98df9bd1ddab3df2b1 Mon Sep 17 00:00:00 2001 From: Alex M Date: Tue, 13 Sep 2016 23:59:28 +0300 Subject: [PATCH 13/65] [Edit] CreateAction closes editor after save --- .../commonUI/edit/src/capabilities/EditorCapability.js | 1 - platform/commonUI/edit/src/creation/CreateAction.js | 9 +++++++-- platform/commonUI/edit/test/creation/CreateActionSpec.js | 4 +++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index 1cbf239d7d0..2ea532f6a62 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -103,7 +103,6 @@ define( var domainObject = this.domainObject; return this.transactionService.cancel().then(function () { domainObject.getCapability("status").set("editing", false); - return domainObject; }); }; diff --git a/platform/commonUI/edit/src/creation/CreateAction.js b/platform/commonUI/edit/src/creation/CreateAction.js index 3cfbdb0ef93..711e4001a64 100644 --- a/platform/commonUI/edit/src/creation/CreateAction.js +++ b/platform/commonUI/edit/src/creation/CreateAction.js @@ -67,12 +67,17 @@ define( editAction, editorCapability; + function closeEditor() { + return editorCapability.finish(); + } + function onSave() { - return editorCapability.save(); + return editorCapability.save() + .then(closeEditor); } function onCancel() { - return editorCapability.finish(); + return closeEditor(); } newModel.type = this.type.getKey(); diff --git a/platform/commonUI/edit/test/creation/CreateActionSpec.js b/platform/commonUI/edit/test/creation/CreateActionSpec.js index 19dc46896f3..60040b5410f 100644 --- a/platform/commonUI/edit/test/creation/CreateActionSpec.js +++ b/platform/commonUI/edit/test/creation/CreateActionSpec.js @@ -142,6 +142,7 @@ define( }); describe("the perform function", function () { + var promise = jasmine.createSpyObj("promise", ["then"]); beforeEach(function () { capabilities.action.getActions.andReturn([mockEditAction]); }); @@ -160,15 +161,16 @@ define( " available", function () { capabilities.action.getActions.andReturn([]); capabilities.action.perform.andReturn(mockPromise(undefined)); + capabilities.editor.save.andReturn(promise); action.perform(); expect(capabilities.action.perform).toHaveBeenCalledWith("save"); }); describe("uses to editor capability", function () { - var promise = jasmine.createSpyObj("promise", ["then"]); beforeEach(function () { capabilities.action.getActions.andReturn([]); capabilities.action.perform.andReturn(promise); + capabilities.editor.save.andReturn(promise); }); it("to save the edit if user saves dialog", function () { From 1ea7fa30842dcaa387c9263939d3f1408d23814a Mon Sep 17 00:00:00 2001 From: Alex M Date: Thu, 15 Sep 2016 20:28:29 +0300 Subject: [PATCH 14/65] [Edit] SaveAsAction tests cover save and finish --- .../edit/test/actions/SaveAsActionSpec.js | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/platform/commonUI/edit/test/actions/SaveAsActionSpec.js b/platform/commonUI/edit/test/actions/SaveAsActionSpec.js index 6bf631feedb..a51e1656886 100644 --- a/platform/commonUI/edit/test/actions/SaveAsActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveAsActionSpec.js @@ -19,7 +19,7 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global describe,it,expect,beforeEach,jasmine*/ +/*global describe,it,expect,beforeEach,jasmine,runs,waitsFor,spyOn*/ define( ["../../src/actions/SaveAsAction"], @@ -78,9 +78,10 @@ define( mockEditorCapability = jasmine.createSpyObj( "editor", - ["save", "isEditContextRoot"] + ["save", "finish", "isEditContextRoot"] ); mockEditorCapability.save.andReturn(mockPromise(true)); + mockEditorCapability.finish.andReturn(mockPromise(true)); mockEditorCapability.isEditContextRoot.andReturn(true); capabilities.editor = mockEditorCapability; @@ -154,6 +155,28 @@ define( mockDomainObject.getModel.andReturn({persisted: 0}); expect(SaveAsAction.appliesTo(actionContext)).toBe(false); }); + + it("uses the editor capability to save the object", function () { + mockEditorCapability.save.andReturn(new Promise(function () {})); + runs(function () { + action.perform(); + }); + waitsFor(function () { + return mockEditorCapability.save.calls.length > 0; + }, "perform() should call EditorCapability.save"); + runs(function () { + expect(mockEditorCapability.finish).not.toHaveBeenCalled(); + }); + }); + + it("uses the editor capability to finish editing the object", function () { + runs(function () { + action.perform(); + }); + waitsFor(function () { + return mockEditorCapability.finish.calls.length > 0; + }, "perform() should call EditorCapability.finish"); + }); it("returns to browse after save", function () { spyOn(action, "save"); From 31ee92b7110b52ce432994a3dcc126eef2daf844 Mon Sep 17 00:00:00 2001 From: Alex M Date: Thu, 15 Sep 2016 20:39:02 +0300 Subject: [PATCH 15/65] [Edit] Remove editor.cancel from SaveActionSpec --- platform/commonUI/edit/test/actions/SaveActionSpec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/commonUI/edit/test/actions/SaveActionSpec.js b/platform/commonUI/edit/test/actions/SaveActionSpec.js index 7324b53085f..7230c094489 100644 --- a/platform/commonUI/edit/test/actions/SaveActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveActionSpec.js @@ -56,7 +56,7 @@ define( ); mockEditorCapability = jasmine.createSpyObj( "editor", - ["save", "cancel", "isEditContextRoot"] + ["save", "isEditContextRoot"] ); mockActionCapability = jasmine.createSpyObj( "actionCapability", From d1f67fd8b9f8eaa82cc1c1b04504a2c4210e1cd8 Mon Sep 17 00:00:00 2001 From: Alex M Date: Thu, 15 Sep 2016 22:40:02 +0300 Subject: [PATCH 16/65] [Edit] Introduce dropdown Save menu And fix style issues in SaveAsActionSpec --- platform/commonUI/edit/bundle.js | 24 +++++-- .../res/templates/edit-action-buttons.html | 23 ++++++- .../src/controllers/EditActionController.js | 30 +++++++-- .../edit/test/actions/SaveAsActionSpec.js | 2 +- .../controllers/EditActionControllerSpec.js | 66 +++++++++++++++++-- 5 files changed, 124 insertions(+), 21 deletions(-) diff --git a/platform/commonUI/edit/bundle.js b/platform/commonUI/edit/bundle.js index 787f02d9c4d..b1af2f6f504 100644 --- a/platform/commonUI/edit/bundle.js +++ b/platform/commonUI/edit/bundle.js @@ -30,6 +30,7 @@ define([ "./src/actions/EditAction", "./src/actions/PropertiesAction", "./src/actions/RemoveAction", + "./src/actions/SaveAction", "./src/actions/SaveAndStopEditingAction", "./src/actions/SaveAsAction", "./src/actions/CancelAction", @@ -69,6 +70,7 @@ define([ EditAction, PropertiesAction, RemoveAction, + SaveAction, SaveAndStopEditingAction, SaveAsAction, CancelAction, @@ -203,20 +205,30 @@ define([ ] }, { - "key": "save", - "category": "conclude-editing", + "key": "save-and-stop-editing", + "category": "save", "implementation": SaveAndStopEditingAction, - "name": "Save", + "name": "Save and Done Editing", "cssclass": "icon-save labeled", "description": "Save changes made to these objects.", "depends": [ "dialogService" - ], - "priority": "mandatory" + ] }, { "key": "save", - "category": "conclude-editing", + "category": "save", + "implementation": SaveAction, + "name": "Save and Continue Editing", + "cssclass": "icon-save labeled", + "description": "Save changes made to these objects.", + "depends": [ + "dialogService" + ] + }, + { + "key": "save-as", + "category": "save", "implementation": SaveAsAction, "name": "Save As...", "cssclass": "icon-save labeled", diff --git a/platform/commonUI/edit/res/templates/edit-action-buttons.html b/platform/commonUI/edit/res/templates/edit-action-buttons.html index fc46b31f572..7884373d181 100644 --- a/platform/commonUI/edit/res/templates/edit-action-buttons.html +++ b/platform/commonUI/edit/res/templates/edit-action-buttons.html @@ -20,11 +20,30 @@ at runtime from the About dialog for additional information. --> - + + + + {{saveActions[0].getMetadata().name}} + + + + + + + + + + ng-class="{ major: $index === 0 && saveActions.length === 0 }"> {{currentAction.getMetadata().name}} diff --git a/platform/commonUI/edit/src/controllers/EditActionController.js b/platform/commonUI/edit/src/controllers/EditActionController.js index 19fddf931d7..7c33799ebbd 100644 --- a/platform/commonUI/edit/src/controllers/EditActionController.js +++ b/platform/commonUI/edit/src/controllers/EditActionController.js @@ -27,7 +27,8 @@ define( [], function () { - var ACTION_CONTEXT = { category: 'conclude-editing' }; + var SAVE_ACTION_CONTEXT = { category: 'save' }; + var OTHERS_ACTION_CONTEXT = { category: 'conclude-editing' }; /** * Controller which supplies action instances for Save/Cancel. @@ -35,11 +36,30 @@ define( * @constructor */ function EditActionController($scope) { - // Maintain all "conclude-editing" actions in the present - // context. + + function actionToMenuOption(action) { + return { + key: action, + name: action.getMetadata().name, + cssclass: action.getMetadata().cssclass + }; + } + + // Maintain all "conclude-editing" and "save" actions in the + // present context. function updateActions() { - $scope.editActions = $scope.action ? - $scope.action.getActions(ACTION_CONTEXT) : + $scope.saveActions = $scope.action ? + $scope.action.getActions(SAVE_ACTION_CONTEXT) : + []; + + $scope.saveActionsAsMenuOptions = $scope.saveActions.map(actionToMenuOption); + + $scope.saveActionMenuClickHandler = function (clickedAction) { + clickedAction.perform(); + }; + + $scope.otherEditActions = $scope.action ? + $scope.action.getActions(OTHERS_ACTION_CONTEXT) : []; } diff --git a/platform/commonUI/edit/test/actions/SaveAsActionSpec.js b/platform/commonUI/edit/test/actions/SaveAsActionSpec.js index a51e1656886..a175118f168 100644 --- a/platform/commonUI/edit/test/actions/SaveAsActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveAsActionSpec.js @@ -155,7 +155,7 @@ define( mockDomainObject.getModel.andReturn({persisted: 0}); expect(SaveAsAction.appliesTo(actionContext)).toBe(false); }); - + it("uses the editor capability to save the object", function () { mockEditorCapability.save.andReturn(new Promise(function () {})); runs(function () { diff --git a/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js b/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js index 36faf7beb83..7905368e058 100644 --- a/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js +++ b/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js @@ -19,22 +19,54 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ +/*global describe,it,expect,beforeEach,jasmine,spyOn*/ define( ["../../src/controllers/EditActionController"], function (EditActionController) { describe("The Edit Action controller", function () { + function FakeSaveAction() { + } + + var fakeSaveActionMetadata = { + name: "mocked-save-action", + cssclass: "mocked-save-action-css" + }; + + FakeSaveAction.prototype.getMetadata = function () { + return fakeSaveActionMetadata; + }; + + FakeSaveAction.prototype.perform = function () { + }; + + function fakeGetActions(actionContext) { + if (actionContext.category === "save") { + return [new FakeSaveAction(), new FakeSaveAction()]; + } else if (actionContext.category === "conclude-editing") { + return ["a", "b", "c"]; + } else { + throw "EditActionController uses a context that's not covered by tests."; + } + } + var mockScope, mockActions, controller; beforeEach(function () { mockActions = jasmine.createSpyObj("action", ["getActions"]); + mockActions.getActions.andCallFake(fakeGetActions); mockScope = jasmine.createSpyObj("$scope", ["$watch"]); + mockScope.action = mockActions; controller = new EditActionController(mockScope); }); + function makeControllerUpdateActions() { + mockScope.$watch.mostRecentCall.args[1](); + } + it("watches scope that may change applicable actions", function () { // The action capability expect(mockScope.$watch).toHaveBeenCalledWith( @@ -43,16 +75,36 @@ define( ); }); - it("populates the scope with grouped and ungrouped actions", function () { - mockScope.action = mockActions; + it("populates the scope with 'save' actions", function () { + makeControllerUpdateActions(); + expect(mockScope.saveActions.length).toEqual(2); + }); - mockActions.getActions.andReturn(["a", "b", "c"]); + it("converts 'save' actions to their menu counterparts", function () { + makeControllerUpdateActions(); + var menuOptions = mockScope.saveActionsAsMenuOptions; - // Call the watch - mockScope.$watch.mostRecentCall.args[1](); + expect(menuOptions.length).toEqual(2); + expect(menuOptions[0].key).toEqual(mockScope.saveActions[0]); + expect(menuOptions[1].key).toEqual(mockScope.saveActions[1]); + menuOptions.forEach(function (option) { + expect(option.name).toEqual(fakeSaveActionMetadata.name); + expect(option.cssclass).toEqual(fakeSaveActionMetadata.cssclass); + }); + }); + + it("uses a click handler to perform the clicked action", function () { + makeControllerUpdateActions(); + var sampleSaveAction = mockScope.saveActions[0]; + + spyOn(sampleSaveAction, "perform"); + mockScope.saveActionMenuClickHandler(sampleSaveAction); + expect(sampleSaveAction.perform).toHaveBeenCalled(); + }); - // Should have grouped and ungrouped actions in scope now - expect(mockScope.editActions.length).toEqual(3); + it("populates the scope with other 'conclude-editing' actions", function () { + makeControllerUpdateActions(); + expect(mockScope.otherEditActions).toEqual(["a", "b", "c"]); }); }); } From d3db26499c6cc3c7e5ff67c0b490c55988b9de48 Mon Sep 17 00:00:00 2001 From: Alex M Date: Thu, 15 Sep 2016 23:14:12 +0300 Subject: [PATCH 17/65] [Edit] CreateAction needs to perform("save-as") --- platform/commonUI/edit/src/creation/CreateAction.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/commonUI/edit/src/creation/CreateAction.js b/platform/commonUI/edit/src/creation/CreateAction.js index 711e4001a64..b83351544f9 100644 --- a/platform/commonUI/edit/src/creation/CreateAction.js +++ b/platform/commonUI/edit/src/creation/CreateAction.js @@ -90,9 +90,9 @@ define( if (editAction) { return editAction.perform(); } else if (editorCapability) { - //otherwise, use the save action + //otherwise, use the save as action editorCapability.edit(); - return newObject.getCapability("action").perform("save").then(onSave, onCancel); + return newObject.getCapability("action").perform("save-as").then(onSave, onCancel); } }; From f03003b366c21c8e3aba882f7853c407deddd471 Mon Sep 17 00:00:00 2001 From: Alex M Date: Thu, 15 Sep 2016 23:18:53 +0300 Subject: [PATCH 18/65] [Edit] Fix CreateActionSpec --- platform/commonUI/edit/test/creation/CreateActionSpec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/commonUI/edit/test/creation/CreateActionSpec.js b/platform/commonUI/edit/test/creation/CreateActionSpec.js index 60040b5410f..cd3d3fbc91f 100644 --- a/platform/commonUI/edit/test/creation/CreateActionSpec.js +++ b/platform/commonUI/edit/test/creation/CreateActionSpec.js @@ -157,13 +157,13 @@ define( expect(mockEditAction.perform).toHaveBeenCalled(); }); - it("uses the save action if object does not have an edit action" + + it("uses the save-as action if object does not have an edit action" + " available", function () { capabilities.action.getActions.andReturn([]); capabilities.action.perform.andReturn(mockPromise(undefined)); capabilities.editor.save.andReturn(promise); action.perform(); - expect(capabilities.action.perform).toHaveBeenCalledWith("save"); + expect(capabilities.action.perform).toHaveBeenCalledWith("save-as"); }); describe("uses to editor capability", function () { From 1446b16e77f1df668784e05c8047f591deba07c2 Mon Sep 17 00:00:00 2001 From: Alex M Date: Fri, 16 Sep 2016 03:15:10 +0300 Subject: [PATCH 19/65] [Edit] Using spy objects as save action mocks --- .../controllers/EditActionControllerSpec.js | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js b/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js index 7905368e058..6b7b52debc5 100644 --- a/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js +++ b/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js @@ -26,24 +26,21 @@ define( function (EditActionController) { describe("The Edit Action controller", function () { - function FakeSaveAction() { - } - - var fakeSaveActionMetadata = { + var mockSaveActionMetadata = { name: "mocked-save-action", cssclass: "mocked-save-action-css" }; - FakeSaveAction.prototype.getMetadata = function () { - return fakeSaveActionMetadata; - }; - - FakeSaveAction.prototype.perform = function () { - }; - function fakeGetActions(actionContext) { if (actionContext.category === "save") { - return [new FakeSaveAction(), new FakeSaveAction()]; + var mockedSaveActions = [ + jasmine.createSpyObj("mockSaveAction", ["getMetadata", "perform"]), + jasmine.createSpyObj("mockSaveAction", ["getMetadata", "perform"]) + ]; + mockedSaveActions.forEach(function (action) { + action.getMetadata.andReturn(mockSaveActionMetadata); + }); + return mockedSaveActions; } else if (actionContext.category === "conclude-editing") { return ["a", "b", "c"]; } else { @@ -88,21 +85,19 @@ define( expect(menuOptions[0].key).toEqual(mockScope.saveActions[0]); expect(menuOptions[1].key).toEqual(mockScope.saveActions[1]); menuOptions.forEach(function (option) { - expect(option.name).toEqual(fakeSaveActionMetadata.name); - expect(option.cssclass).toEqual(fakeSaveActionMetadata.cssclass); + expect(option.name).toEqual(mockSaveActionMetadata.name); + expect(option.cssclass).toEqual(mockSaveActionMetadata.cssclass); }); }); it("uses a click handler to perform the clicked action", function () { makeControllerUpdateActions(); var sampleSaveAction = mockScope.saveActions[0]; - - spyOn(sampleSaveAction, "perform"); mockScope.saveActionMenuClickHandler(sampleSaveAction); expect(sampleSaveAction.perform).toHaveBeenCalled(); }); - it("populates the scope with other 'conclude-editing' actions", function () { + it("populates the scope with other editing actions", function () { makeControllerUpdateActions(); expect(mockScope.otherEditActions).toEqual(["a", "b", "c"]); }); From 2a2e9ef99df364a9b9c2780178caff40c174833f Mon Sep 17 00:00:00 2001 From: Alex M Date: Fri, 16 Sep 2016 03:24:00 +0300 Subject: [PATCH 20/65] [Edit] Make linter happy --- .../commonUI/edit/test/controllers/EditActionControllerSpec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js b/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js index 6b7b52debc5..bd5c8a9524d 100644 --- a/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js +++ b/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js @@ -19,7 +19,7 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global describe,it,expect,beforeEach,jasmine,spyOn*/ +/*global describe,it,expect,beforeEach,jasmine*/ define( ["../../src/controllers/EditActionController"], From 0ec27350e09279de163d1c38a43a6882a1d415df Mon Sep 17 00:00:00 2001 From: smirecki Date: Fri, 16 Sep 2016 16:50:11 -0400 Subject: [PATCH 21/65] Update TimelineTickController.js One correction by @akhenry, "region, not reign". --- .../features/timeline/src/controllers/TimelineTickController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/features/timeline/src/controllers/TimelineTickController.js b/platform/features/timeline/src/controllers/TimelineTickController.js index fb1f2ad6b83..56275a6d166 100644 --- a/platform/features/timeline/src/controllers/TimelineTickController.js +++ b/platform/features/timeline/src/controllers/TimelineTickController.js @@ -28,7 +28,7 @@ define( /** * Provides labels for the tick mark area of a timeline view. - * Since the tick mark reign is potentially extremely large, + * Since the tick mark region is potentially extremely large, * only the subset of ticks which will actually be shown in * view are provided. * @constructor From ae89dcd62dd013db63dcda4e9a09ea1126003b5e Mon Sep 17 00:00:00 2001 From: Alex M Date: Sat, 17 Sep 2016 00:39:49 +0300 Subject: [PATCH 22/65] [Edit] Make single save button use mct-control --- .../edit/res/templates/edit-action-buttons.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/platform/commonUI/edit/res/templates/edit-action-buttons.html b/platform/commonUI/edit/res/templates/edit-action-buttons.html index 7884373d181..0cc21b02ca6 100644 --- a/platform/commonUI/edit/res/templates/edit-action-buttons.html +++ b/platform/commonUI/edit/res/templates/edit-action-buttons.html @@ -22,11 +22,13 @@ - - {{saveActions[0].getMetadata().name}} - + + @@ -39,7 +41,7 @@ - + Date: Sat, 17 Sep 2016 01:05:46 +0300 Subject: [PATCH 23/65] [Edit] Rename action to Save and Finish Editing --- platform/commonUI/edit/bundle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/commonUI/edit/bundle.js b/platform/commonUI/edit/bundle.js index b1af2f6f504..48f38d7ee9b 100644 --- a/platform/commonUI/edit/bundle.js +++ b/platform/commonUI/edit/bundle.js @@ -208,7 +208,7 @@ define([ "key": "save-and-stop-editing", "category": "save", "implementation": SaveAndStopEditingAction, - "name": "Save and Done Editing", + "name": "Save and Finish Editing", "cssclass": "icon-save labeled", "description": "Save changes made to these objects.", "depends": [ From 48b25fe842756f871395903fe52b9ccd4bfc804b Mon Sep 17 00:00:00 2001 From: David Hudson Date: Sat, 17 Sep 2016 16:32:26 +0900 Subject: [PATCH 24/65] [Formatting] Remove double negative logic Issue #1168 --- platform/commonUI/dialog/res/templates/overlay.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/commonUI/dialog/res/templates/overlay.html b/platform/commonUI/dialog/res/templates/overlay.html index dcc847029d3..215fe97aac5 100644 --- a/platform/commonUI/dialog/res/templates/overlay.html +++ b/platform/commonUI/dialog/res/templates/overlay.html @@ -19,7 +19,7 @@ this source code distribution or the Licensing information page available at runtime from the About dialog for additional information. --> -
+
Date: Sat, 17 Sep 2016 16:36:55 +0900 Subject: [PATCH 25/65] [Frontend] Shorten overlay fade duration Issue #1168 --- platform/commonUI/general/res/sass/_constants.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/commonUI/general/res/sass/_constants.scss b/platform/commonUI/general/res/sass/_constants.scss index 4cb240850b2..1e609cc0381 100644 --- a/platform/commonUI/general/res/sass/_constants.scss +++ b/platform/commonUI/general/res/sass/_constants.scss @@ -63,7 +63,7 @@ $ovrTopBarH: 45px; $ovrFooterH: 24px; $overlayMargin: 25px; /*************** Progress Overlay */ -$durEntryMs: 100ms; +$durEntryMs: 50ms; $delayEntryMs: 100ms; /*************** Items */ $ueBrowseGridItemLg: 200px; From 56e321f6d91c21d6bc2bbfc65b08455cbd12025f Mon Sep 17 00:00:00 2001 From: David Hudson Date: Sun, 18 Sep 2016 01:18:02 +0900 Subject: [PATCH 26/65] [Forms] Add textarea template Issue #1184 --- platform/forms/bundle.js | 6 ++++ .../res/templates/controls/textarea.html | 31 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 platform/forms/res/templates/controls/textarea.html diff --git a/platform/forms/bundle.js b/platform/forms/bundle.js index daa7063ffe8..d3ee14f440d 100644 --- a/platform/forms/bundle.js +++ b/platform/forms/bundle.js @@ -32,6 +32,7 @@ define([ "text!./res/templates/controls/datetime.html", "text!./res/templates/controls/select.html", "text!./res/templates/controls/textfield.html", + "text!./res/templates/controls/textarea.html", "text!./res/templates/controls/button.html", "text!./res/templates/controls/color.html", "text!./res/templates/controls/composite.html", @@ -51,6 +52,7 @@ define([ datetimeTemplate, selectTemplate, textfieldTemplate, + textareaTemplate, buttonTemplate, colorTemplate, compositeTemplate, @@ -103,6 +105,10 @@ define([ "key": "textfield", "template": textfieldTemplate }, + { + "key": "textarea", + "template": textareaTemplate + }, { "key": "button", "template": buttonTemplate diff --git a/platform/forms/res/templates/controls/textarea.html b/platform/forms/res/templates/controls/textarea.html new file mode 100644 index 00000000000..45c4db4e1ed --- /dev/null +++ b/platform/forms/res/templates/controls/textarea.html @@ -0,0 +1,31 @@ + + + + + + From 4429e847e8d148ef01d999e8aa9523b588cf4eed Mon Sep 17 00:00:00 2001 From: David Hudson Date: Sun, 18 Sep 2016 01:18:26 +0900 Subject: [PATCH 27/65] [Properties] Add notes field to all item types Issue #1184 --- platform/core/bundle.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/core/bundle.js b/platform/core/bundle.js index 8b4baf83ff5..8567d11fc39 100644 --- a/platform/core/bundle.js +++ b/platform/core/bundle.js @@ -252,6 +252,12 @@ define([ "pattern": "\\S+", "required": true, "cssclass": "l-input-lg" + }, + { + "name": "Notes", + "control": "textarea", + "required": false, + "cssclass": "field-notes" } ] }, From f9ce27def3a6625e9f531adc252484ef7cc8159a Mon Sep 17 00:00:00 2001 From: David Hudson Date: Sun, 18 Sep 2016 01:27:12 +0900 Subject: [PATCH 28/65] [Frontend] Add attributes for storing notes Issue #1184 --- platform/core/bundle.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/core/bundle.js b/platform/core/bundle.js index 8567d11fc39..0f2ba311c38 100644 --- a/platform/core/bundle.js +++ b/platform/core/bundle.js @@ -255,6 +255,8 @@ define([ }, { "name": "Notes", + "key": "notes", + "property": "notes", "control": "textarea", "required": false, "cssclass": "field-notes" From 56267095cba4425ddb70e2b70ab692db05db0132 Mon Sep 17 00:00:00 2001 From: David Hudson Date: Sun, 18 Sep 2016 01:47:07 +0900 Subject: [PATCH 29/65] [Forms] Add style for small textareas Issue #1184. This allows for a generically sized text area in forms. I am anticipating some potential feedback on this given the approach and the sizing I chose may or may not be ideal for your requirements. --- platform/commonUI/general/res/sass/controls/_controls.scss | 1 + platform/core/bundle.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/commonUI/general/res/sass/controls/_controls.scss b/platform/commonUI/general/res/sass/controls/_controls.scss index 7900739668e..d1935d8ce09 100644 --- a/platform/commonUI/general/res/sass/controls/_controls.scss +++ b/platform/commonUI/general/res/sass/controls/_controls.scss @@ -216,6 +216,7 @@ input[type="search"] { .l-input-lg input[type="text"] { width: 100% !important; } .l-input-med input[type="text"] { width: 200px !important; } .l-input-sm input[type="text"] { width: 50px !important; } +.l-textarea-sm textarea { position: relative; height: 50px; } .l-numeric input[type="text"] { text-align: right; } .input-labeled { diff --git a/platform/core/bundle.js b/platform/core/bundle.js index 0f2ba311c38..4b9e2b9adbb 100644 --- a/platform/core/bundle.js +++ b/platform/core/bundle.js @@ -259,7 +259,7 @@ define([ "property": "notes", "control": "textarea", "required": false, - "cssclass": "field-notes" + "cssclass": "l-textarea-sm" } ] }, From d913798d5b3c6a416a0a8857f4a6103f2155b6dd Mon Sep 17 00:00:00 2001 From: David Hudson Date: Sun, 18 Sep 2016 22:52:41 +0900 Subject: [PATCH 30/65] [Timeline] Add battery starting state-of-charge Issue #1185 --- platform/features/timeline/bundle.js | 10 ++++++++++ .../timeline/src/capabilities/GraphCapability.js | 2 +- .../timeline/test/capabilities/GraphCapabilitySpec.js | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/platform/features/timeline/bundle.js b/platform/features/timeline/bundle.js index 12effc50a3d..145a496f08a 100644 --- a/platform/features/timeline/bundle.js +++ b/platform/features/timeline/bundle.js @@ -182,6 +182,16 @@ define([ "capacity" ], "pattern": "^-?\\d+(\\.\\d*)?$" + }, + { + "name": "Battery Starting SOC", + "control": "textfield", + "required": false, + "conversion": "number", + "property": [ + "startingSOC" + ], + "pattern": "^-?\\d+(\\.\\d*)?$" } ], "model": { diff --git a/platform/features/timeline/src/capabilities/GraphCapability.js b/platform/features/timeline/src/capabilities/GraphCapability.js index d9810005a36..c4e5166f0e5 100644 --- a/platform/features/timeline/src/capabilities/GraphCapability.js +++ b/platform/features/timeline/src/capabilities/GraphCapability.js @@ -60,7 +60,7 @@ define( result.power, 0, domainObject.getModel().capacity, // Watts - domainObject.getModel().capacity, + domainObject.getModel().startingSOC, 1 / 3600000 // millis-to-hour (since units are watt-hours) ); } diff --git a/platform/features/timeline/test/capabilities/GraphCapabilitySpec.js b/platform/features/timeline/test/capabilities/GraphCapabilitySpec.js index 71a6de2ade2..e36724dbcbe 100644 --- a/platform/features/timeline/test/capabilities/GraphCapabilitySpec.js +++ b/platform/features/timeline/test/capabilities/GraphCapabilitySpec.js @@ -101,6 +101,7 @@ define( it("provides a battery graph for timelines with capacity", function () { var mockCallback = jasmine.createSpy('callback'); testModel.capacity = 1000; + testModel.startingSOC = 1000; testModel.type = "timeline"; mockDomainObject.useCapability.andReturn(asPromise([ { key: "power", start: 0, end: 15 } From b50278e92fa6217bc4c890458b8f7a447045ed51 Mon Sep 17 00:00:00 2001 From: Alex M Date: Mon, 19 Sep 2016 20:22:46 +0300 Subject: [PATCH 31/65] [Edit] Remove mocked unused UrlService --- platform/commonUI/edit/test/actions/SaveAsActionSpec.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/platform/commonUI/edit/test/actions/SaveAsActionSpec.js b/platform/commonUI/edit/test/actions/SaveAsActionSpec.js index a175118f168..c1b0eee0039 100644 --- a/platform/commonUI/edit/test/actions/SaveAsActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveAsActionSpec.js @@ -33,7 +33,6 @@ define( mockDialogService, mockCopyService, mockParent, - mockUrlService, actionContext, capabilities = {}, action; @@ -112,12 +111,7 @@ define( "perform" ] ); - - mockUrlService = jasmine.createSpyObj( - "urlService", - ["urlForLocation"] - ); - + actionContext = { domainObject: mockDomainObject }; From f60fc2ebad09085fd71d80d1d900483c2999e025 Mon Sep 17 00:00:00 2001 From: Alex M Date: Mon, 19 Sep 2016 20:33:12 +0300 Subject: [PATCH 32/65] [Edit] EditorCapability.finish returns domainObj --- platform/commonUI/edit/src/capabilities/EditorCapability.js | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index 2ea532f6a62..1cbf239d7d0 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -103,6 +103,7 @@ define( var domainObject = this.domainObject; return this.transactionService.cancel().then(function () { domainObject.getCapability("status").set("editing", false); + return domainObject; }); }; From e08704e6d30413cf5533e62be68f003334a3ff1c Mon Sep 17 00:00:00 2001 From: Alex M Date: Mon, 19 Sep 2016 20:39:54 +0300 Subject: [PATCH 33/65] [Edit] Make checkstyle happy --- platform/commonUI/edit/test/actions/SaveAsActionSpec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/commonUI/edit/test/actions/SaveAsActionSpec.js b/platform/commonUI/edit/test/actions/SaveAsActionSpec.js index c1b0eee0039..95f02098003 100644 --- a/platform/commonUI/edit/test/actions/SaveAsActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveAsActionSpec.js @@ -111,7 +111,7 @@ define( "perform" ] ); - + actionContext = { domainObject: mockDomainObject }; From abfabc85b56f7b335484b4f30249362179d93371 Mon Sep 17 00:00:00 2001 From: Alex M Date: Mon, 19 Sep 2016 20:41:50 +0300 Subject: [PATCH 34/65] [Edit] Fix edit-action-buttons indent --- platform/commonUI/edit/res/templates/edit-action-buttons.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/commonUI/edit/res/templates/edit-action-buttons.html b/platform/commonUI/edit/res/templates/edit-action-buttons.html index 0cc21b02ca6..4bc020612f0 100644 --- a/platform/commonUI/edit/res/templates/edit-action-buttons.html +++ b/platform/commonUI/edit/res/templates/edit-action-buttons.html @@ -41,7 +41,7 @@ - + Date: Mon, 19 Sep 2016 23:52:30 +0300 Subject: [PATCH 35/65] [Edit] Remove CreationService dep from SaveAs --- platform/commonUI/edit/bundle.js | 1 - platform/commonUI/edit/src/actions/SaveAsAction.js | 2 -- platform/commonUI/edit/test/actions/SaveAsActionSpec.js | 2 +- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/platform/commonUI/edit/bundle.js b/platform/commonUI/edit/bundle.js index 48f38d7ee9b..60da9001769 100644 --- a/platform/commonUI/edit/bundle.js +++ b/platform/commonUI/edit/bundle.js @@ -237,7 +237,6 @@ define([ "$injector", "policyService", "dialogService", - "creationService", "copyService" ], "priority": "mandatory" diff --git a/platform/commonUI/edit/src/actions/SaveAsAction.js b/platform/commonUI/edit/src/actions/SaveAsAction.js index 402fccb86cf..2befea07fd6 100644 --- a/platform/commonUI/edit/src/actions/SaveAsAction.js +++ b/platform/commonUI/edit/src/actions/SaveAsAction.js @@ -42,7 +42,6 @@ define([ $injector, policyService, dialogService, - creationService, copyService, context ) { @@ -52,7 +51,6 @@ define([ }; this.policyService = policyService; this.dialogService = dialogService; - this.creationService = creationService; this.copyService = copyService; } diff --git a/platform/commonUI/edit/test/actions/SaveAsActionSpec.js b/platform/commonUI/edit/test/actions/SaveAsActionSpec.js index 95f02098003..f87cf4766f1 100644 --- a/platform/commonUI/edit/test/actions/SaveAsActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveAsActionSpec.js @@ -116,7 +116,7 @@ define( domainObject: mockDomainObject }; - action = new SaveAsAction(undefined, undefined, mockDialogService, undefined, mockCopyService, actionContext); + action = new SaveAsAction(undefined, undefined, mockDialogService, mockCopyService, actionContext); spyOn(action, "getObjectService"); action.getObjectService.andReturn(mockObjectService); From 943e2ebe14fc076904ca2eb2832c08f8197efc1e Mon Sep 17 00:00:00 2001 From: David Hudson Date: Tue, 20 Sep 2016 17:40:08 +0900 Subject: [PATCH 36/65] [Timeline] Convert SOC to use percentages Also includes updated validation params which allow for floats to a maximum of 100 as well as a percentage sign which is later removed. --- platform/features/timeline/bundle.js | 4 ++-- .../features/timeline/src/capabilities/GraphCapability.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/platform/features/timeline/bundle.js b/platform/features/timeline/bundle.js index 145a496f08a..42b3c948f9b 100644 --- a/platform/features/timeline/bundle.js +++ b/platform/features/timeline/bundle.js @@ -184,14 +184,14 @@ define([ "pattern": "^-?\\d+(\\.\\d*)?$" }, { - "name": "Battery Starting SOC", + "name": "Battery starting SOC (%)", "control": "textfield", "required": false, "conversion": "number", "property": [ "startingSOC" ], - "pattern": "^-?\\d+(\\.\\d*)?$" + "pattern": "^([0-9](\\.\\d*)?|[1-9][0-9](\\.\\d*)?|100)%?$" } ], "model": { diff --git a/platform/features/timeline/src/capabilities/GraphCapability.js b/platform/features/timeline/src/capabilities/GraphCapability.js index c4e5166f0e5..86095b13ab7 100644 --- a/platform/features/timeline/src/capabilities/GraphCapability.js +++ b/platform/features/timeline/src/capabilities/GraphCapability.js @@ -55,12 +55,14 @@ define( if (domainObject.getModel().type === 'timeline' && result.power && domainObject.getModel().capacity > 0) { + domainObject.getModel().startingSOC = + parseFloat(domainObject.getModel().startingSOC) || 100; result.battery = new CumulativeGraph( result.power, 0, domainObject.getModel().capacity, // Watts - domainObject.getModel().startingSOC, + (domainObject.getModel().startingSOC/100)*domainObject.getModel().capacity, 1 / 3600000 // millis-to-hour (since units are watt-hours) ); } From f1852541141857aafbb97b6bc02d168ede8067ee Mon Sep 17 00:00:00 2001 From: David Hudson Date: Tue, 20 Sep 2016 17:41:45 +0900 Subject: [PATCH 37/65] [Formatting] Fix missing spaces --- platform/features/timeline/src/capabilities/GraphCapability.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/features/timeline/src/capabilities/GraphCapability.js b/platform/features/timeline/src/capabilities/GraphCapability.js index 86095b13ab7..4e9cce0c8c7 100644 --- a/platform/features/timeline/src/capabilities/GraphCapability.js +++ b/platform/features/timeline/src/capabilities/GraphCapability.js @@ -62,7 +62,7 @@ define( result.power, 0, domainObject.getModel().capacity, // Watts - (domainObject.getModel().startingSOC/100)*domainObject.getModel().capacity, + (domainObject.getModel().startingSOC / 100) * domainObject.getModel().capacity, 1 / 3600000 // millis-to-hour (since units are watt-hours) ); } From 3d17435438c0d1c5e8c7647a0218b7e0718adc79 Mon Sep 17 00:00:00 2001 From: David Hudson Date: Tue, 20 Sep 2016 17:42:34 +0900 Subject: [PATCH 38/65] [Test] Update spec to use SOC percentage --- .../features/timeline/test/capabilities/GraphCapabilitySpec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/features/timeline/test/capabilities/GraphCapabilitySpec.js b/platform/features/timeline/test/capabilities/GraphCapabilitySpec.js index e36724dbcbe..e2ccd376e21 100644 --- a/platform/features/timeline/test/capabilities/GraphCapabilitySpec.js +++ b/platform/features/timeline/test/capabilities/GraphCapabilitySpec.js @@ -101,7 +101,7 @@ define( it("provides a battery graph for timelines with capacity", function () { var mockCallback = jasmine.createSpy('callback'); testModel.capacity = 1000; - testModel.startingSOC = 1000; + testModel.startingSOC = 100; testModel.type = "timeline"; mockDomainObject.useCapability.andReturn(asPromise([ { key: "power", start: 0, end: 15 } From 3548cde9c44076c687038f20ebeec77939fd91e7 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 21 Sep 2016 16:12:09 -0700 Subject: [PATCH 39/65] [Edit Mode] Fixed issue with save dialog not being displayed for new objects after mutation. Fixes 1080 --- .../browse/src/navigation/NavigateAction.js | 26 +++++++--- .../test/navigation/NavigateActionSpec.js | 49 +++++++++++++++++-- .../commonUI/edit/src/actions/EditAction.js | 8 +-- .../edit/src/services/TransactionService.js | 2 +- .../edit/test/actions/EditActionSpec.js | 7 --- 5 files changed, 69 insertions(+), 23 deletions(-) diff --git a/platform/commonUI/browse/src/navigation/NavigateAction.js b/platform/commonUI/browse/src/navigation/NavigateAction.js index b3d935812a3..efdfb270f4a 100644 --- a/platform/commonUI/browse/src/navigation/NavigateAction.js +++ b/platform/commonUI/browse/src/navigation/NavigateAction.js @@ -48,20 +48,34 @@ define( */ NavigateAction.prototype.perform = function () { var self = this, - navigationAllowed = true; + navigateTo = this.domainObject, + currentObject = self.navigationService.getNavigation(), + editing = currentObject.hasCapability('editor') && + currentObject.getCapability('editor').isEditContextRoot(); function allow() { - self.policyService.allow("navigation", self.navigationService.getNavigation(), self.domainObject, function (message) { + var navigationAllowed = true; + self.policyService.allow("navigation", currentObject, navigateTo, function (message) { navigationAllowed = self.$window.confirm(message + "\r\n\r\n" + " Are you sure you want to continue?"); }); return navigationAllowed; } - // Set navigation, and wrap like a promise - return this.$q.when( - allow() && this.navigationService.setNavigation(this.domainObject) - ); + function cancelIfEditing() { + return self.$q.when(editing && currentObject.getCapability("editor").cancel()); + } + + function navigate() { + return self.navigationService.setNavigation(navigateTo); + } + + if (allow()) { + return cancelIfEditing().then(navigate); + } else { + return this.$q.when(false); + } + }; /** diff --git a/platform/commonUI/browse/test/navigation/NavigateActionSpec.js b/platform/commonUI/browse/test/navigation/NavigateActionSpec.js index 003012372bf..b769d7dce16 100644 --- a/platform/commonUI/browse/test/navigation/NavigateActionSpec.js +++ b/platform/commonUI/browse/test/navigation/NavigateActionSpec.js @@ -32,7 +32,9 @@ define( mockQ, mockDomainObject, mockPolicyService, + mockNavigatedObject, mockWindow, + capabilities, action; function mockPromise(value) { @@ -44,6 +46,29 @@ define( } beforeEach(function () { + capabilities = {}; + + mockQ = { when: mockPromise }; + mockNavigatedObject = jasmine.createSpyObj( + "domainObject", + [ + "getId", + "getModel", + "hasCapability", + "getCapability" + ] + ); + + capabilities.editor = jasmine.createSpyObj("editorCapability", [ + "isEditContextRoot", + "cancel" + ]); + + mockNavigatedObject.getCapability.andCallFake(function (capability) { + return capabilities[capability]; + }); + mockNavigatedObject.hasCapability.andReturn(false); + mockNavigationService = jasmine.createSpyObj( "navigationService", [ @@ -51,11 +76,14 @@ define( "getNavigation" ] ); - mockNavigationService.getNavigation.andReturn({}); - mockQ = { when: mockPromise }; + mockNavigationService.getNavigation.andReturn(mockNavigatedObject); + mockDomainObject = jasmine.createSpyObj( "domainObject", - ["getId", "getModel", "getCapability"] + [ + "getId", + "getModel" + ] ); mockPolicyService = jasmine.createSpyObj("policyService", @@ -112,6 +140,21 @@ define( }); }); + describe("in edit more", function () { + beforeEach(function () { + mockNavigatedObject.hasCapability.andCallFake(function (capability) { + return capability === "editor"; + }); + capabilities.editor.isEditContextRoot.andReturn(true); + }); + + it("cancels editing if in edit mode", function () { + action.perform(); + expect(capabilities.editor.cancel) + .toHaveBeenCalled(); + }); + }); + it("is only applicable when a domain object is in context", function () { expect(NavigateAction.appliesTo({})).toBeFalsy(); expect(NavigateAction.appliesTo({ diff --git a/platform/commonUI/edit/src/actions/EditAction.js b/platform/commonUI/edit/src/actions/EditAction.js index bd30968289f..9c1afd3e280 100644 --- a/platform/commonUI/edit/src/actions/EditAction.js +++ b/platform/commonUI/edit/src/actions/EditAction.js @@ -69,18 +69,14 @@ define( * Enter edit mode. */ EditAction.prototype.perform = function () { - var self = this; - function cancelEditing() { - self.domainObject.getCapability('editor').cancel(); - self.navigationService.removeListener(cancelEditing); - } + //If this is not the currently navigated object, then navigate // to it. if (this.navigationService.getNavigation() !== this.domainObject) { this.navigationService.setNavigation(this.domainObject); } - this.navigationService.addListener(cancelEditing); + //this.navigationService.addListener(cancelEditing); this.domainObject.useCapability("editor"); }; diff --git a/platform/commonUI/edit/src/services/TransactionService.js b/platform/commonUI/edit/src/services/TransactionService.js index 119e314b173..df0a051f0d2 100644 --- a/platform/commonUI/edit/src/services/TransactionService.js +++ b/platform/commonUI/edit/src/services/TransactionService.js @@ -138,7 +138,7 @@ define( try { results.push(onCancel()); } catch (error) { - this.$log.error("Error committing transaction."); + this.$log.error("Error cancelling transaction."); } } return this.$q.all(results).then(function () { diff --git a/platform/commonUI/edit/test/actions/EditActionSpec.js b/platform/commonUI/edit/test/actions/EditActionSpec.js index c896e83dd1f..0e70e571c3b 100644 --- a/platform/commonUI/edit/test/actions/EditActionSpec.js +++ b/platform/commonUI/edit/test/actions/EditActionSpec.js @@ -98,13 +98,6 @@ define( expect(EditAction.appliesTo(actionContext)).toBe(false); }); - it ("cancels editing when user navigates away", function () { - action.perform(); - expect(mockNavigationService.addListener).toHaveBeenCalled(); - mockNavigationService.addListener.mostRecentCall.args[0](); - expect(mockEditor.cancel).toHaveBeenCalled(); - }); - it ("invokes the Edit capability on the object", function () { action.perform(); expect(mockDomainObject.useCapability).toHaveBeenCalledWith("editor"); From 3c72eea9ef345310ff36043671347bd46e076762 Mon Sep 17 00:00:00 2001 From: Charles Hacskaylo Date: Thu, 22 Sep 2016 10:41:14 -0700 Subject: [PATCH 40/65] [Frontend] Removed export buttons from objects when in layout Fixes #1202 CSS modded --- platform/commonUI/general/res/sass/_views.scss | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/platform/commonUI/general/res/sass/_views.scss b/platform/commonUI/general/res/sass/_views.scss index 357f9f3c7c4..0a4cc651ddb 100644 --- a/platform/commonUI/general/res/sass/_views.scss +++ b/platform/commonUI/general/res/sass/_views.scss @@ -31,23 +31,10 @@ .has-control-bar { $btnExportH: $btnFrameH; .l-control-bar { - @include trans-prop-nice(opacity, $dur: 50ms); - opacity: 0; + display: none; } .l-view-section { - @include trans-prop-nice(top, $dur: 150ms, $delay: 50ms); top: 0; } - &:hover { - .l-control-bar { - @include trans-prop-nice(opacity, 150ms, 100ms); - opacity: 1; - } - .l-view-section { - @include trans-prop-nice(top, $dur: 150ms); - top: $btnExportH + $interiorMargin; - } - } } - } \ No newline at end of file From 7a94efccbf2a35ef60f9fbf1f23acfc0287cfe46 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 22 Sep 2016 11:04:04 -0700 Subject: [PATCH 41/65] [Edit Mode] Fixed spelling mistake, moved variable declaration --- platform/commonUI/browse/src/navigation/NavigateAction.js | 7 ++++--- .../commonUI/browse/test/navigation/NavigateActionSpec.js | 2 +- platform/commonUI/edit/src/actions/EditAction.js | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/commonUI/browse/src/navigation/NavigateAction.js b/platform/commonUI/browse/src/navigation/NavigateAction.js index efdfb270f4a..431ad8dadc7 100644 --- a/platform/commonUI/browse/src/navigation/NavigateAction.js +++ b/platform/commonUI/browse/src/navigation/NavigateAction.js @@ -49,9 +49,7 @@ define( NavigateAction.prototype.perform = function () { var self = this, navigateTo = this.domainObject, - currentObject = self.navigationService.getNavigation(), - editing = currentObject.hasCapability('editor') && - currentObject.getCapability('editor').isEditContextRoot(); + currentObject = self.navigationService.getNavigation(); function allow() { var navigationAllowed = true; @@ -63,6 +61,9 @@ define( } function cancelIfEditing() { + var editing = currentObject.hasCapability('editor') && + currentObject.getCapability('editor').isEditContextRoot(); + return self.$q.when(editing && currentObject.getCapability("editor").cancel()); } diff --git a/platform/commonUI/browse/test/navigation/NavigateActionSpec.js b/platform/commonUI/browse/test/navigation/NavigateActionSpec.js index b769d7dce16..509e7aef3dc 100644 --- a/platform/commonUI/browse/test/navigation/NavigateActionSpec.js +++ b/platform/commonUI/browse/test/navigation/NavigateActionSpec.js @@ -140,7 +140,7 @@ define( }); }); - describe("in edit more", function () { + describe("in edit mode", function () { beforeEach(function () { mockNavigatedObject.hasCapability.andCallFake(function (capability) { return capability === "editor"; diff --git a/platform/commonUI/edit/src/actions/EditAction.js b/platform/commonUI/edit/src/actions/EditAction.js index 9c1afd3e280..e65f035edf9 100644 --- a/platform/commonUI/edit/src/actions/EditAction.js +++ b/platform/commonUI/edit/src/actions/EditAction.js @@ -76,7 +76,6 @@ define( this.navigationService.setNavigation(this.domainObject); } - //this.navigationService.addListener(cancelEditing); this.domainObject.useCapability("editor"); }; From 904d56a0893fe3cf25f017eacb3670f5087aef22 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 22 Sep 2016 13:32:43 -0700 Subject: [PATCH 42/65] [Time Conductor] #933 Clean up time conductor listeners on scope destruction --- .../compatibility/src/ConductorRepresenter.js | 1 + .../conductor/src/ui/MctConductorAxis.js | 16 ++++++++-- .../conductor/src/ui/MctConductorAxisSpec.js | 14 ++++++-- .../src/ui/TimeConductorController.js | 10 ++++-- .../src/ui/TimeConductorControllerSpec.js | 32 +++++++++---------- 5 files changed, 50 insertions(+), 23 deletions(-) diff --git a/platform/features/conductor-v2/compatibility/src/ConductorRepresenter.js b/platform/features/conductor-v2/compatibility/src/ConductorRepresenter.js index fe19bbc66a7..7013906ef96 100644 --- a/platform/features/conductor-v2/compatibility/src/ConductorRepresenter.js +++ b/platform/features/conductor-v2/compatibility/src/ConductorRepresenter.js @@ -85,6 +85,7 @@ define( ConductorRepresenter.prototype.destroy = function destroy() { this.conductor.off("bounds", this.boundsListener); this.conductor.off("timeSystem", this.timeSystemListener); + this.conductor.off("follow", this.followListener); }; return ConductorRepresenter; diff --git a/platform/features/conductor-v2/conductor/src/ui/MctConductorAxis.js b/platform/features/conductor-v2/conductor/src/ui/MctConductorAxis.js index 88bfc5f2a8c..58cb60befcf 100644 --- a/platform/features/conductor-v2/conductor/src/ui/MctConductorAxis.js +++ b/platform/features/conductor-v2/conductor/src/ui/MctConductorAxis.js @@ -43,8 +43,6 @@ define( this.xScale = undefined; this.xAxis = undefined; this.axisElement = undefined; - this.setScale = this.setScale.bind(this); - this.changeTimeSystem = this.changeTimeSystem.bind(this); // Angular Directive interface this.link = this.link.bind(this); @@ -52,6 +50,13 @@ define( this.template = "
"; this.priority = 1000; + + //Bind all class functions to 'this' + Object.keys(MCTConductorAxis.prototype).filter(function (key) { + return typeof MCTConductorAxis.prototype[key] === 'function'; + }).forEach(function (key) { + this[key] = this[key].bind(this); + }.bind(this)); } MCTConductorAxis.prototype.setScale = function () { @@ -99,6 +104,11 @@ define( } }; + MCTConductorAxis.prototype.destroy = function () { + this.conductor.off('timeSystem', this.changeTimeSystem); + this.conductor.off('bounds', this.setScale); + }; + MCTConductorAxis.prototype.link = function (scope, element) { var conductor = this.conductor; this.target = element[0].firstChild; @@ -121,6 +131,8 @@ define( //On conductor bounds changes, redraw ticks conductor.on('bounds', this.setScale); + scope.$on("$destroy", this.destroy); + if (conductor.timeSystem() !== undefined) { this.changeTimeSystem(conductor.timeSystem()); this.setScale(); diff --git a/platform/features/conductor-v2/conductor/src/ui/MctConductorAxisSpec.js b/platform/features/conductor-v2/conductor/src/ui/MctConductorAxisSpec.js index 5c45521ea40..0fe3c4cf3fc 100644 --- a/platform/features/conductor-v2/conductor/src/ui/MctConductorAxisSpec.js +++ b/platform/features/conductor-v2/conductor/src/ui/MctConductorAxisSpec.js @@ -32,7 +32,9 @@ define(['./MctConductorAxis'], function (MctConductorAxis) { d3; beforeEach(function () { - mockScope = {}; + mockScope = jasmine.createSpyObj("scope", [ + "$on" + ]); //Add some HTML elements mockTarget = { @@ -49,7 +51,8 @@ define(['./MctConductorAxis'], function (MctConductorAxis) { mockConductor = jasmine.createSpyObj("conductor", [ "timeSystem", "bounds", - "on" + "on", + "off" ]); mockConductor.bounds.andReturn(mockBounds); @@ -85,6 +88,13 @@ define(['./MctConductorAxis'], function (MctConductorAxis) { expect(mockConductor.on).toHaveBeenCalledWith("bounds", directive.setScale); }); + it("on scope destruction, deregisters listeners", function () { + expect(mockScope.$on).toHaveBeenCalledWith("$destroy", directive.destroy); + directive.destroy(); + expect(mockConductor.off).toHaveBeenCalledWith("timeSystem", directive.changeTimeSystem); + expect(mockConductor.off).toHaveBeenCalledWith("bounds", directive.setScale); + }); + describe("when the time system changes", function () { var mockTimeSystem; var mockFormat; diff --git a/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js b/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js index c0964061aa3..83bc0558c61 100644 --- a/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js +++ b/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js @@ -53,9 +53,6 @@ define( this.initializeScope(); this.conductor.on('bounds', this.setFormFromBounds); - this.conductor.on('follow', function (follow) { - $scope.followMode = follow; - }); this.conductor.on('timeSystem', this.changeTimeSystem); // If no mode selected, select fixed as the default @@ -100,6 +97,13 @@ define( // Watch scope for selection of mode or time system by user this.$scope.$watch('modeModel.selectedKey', this.setMode); + + this.$scope.$on('$destroy', this.destroy); + }; + + TimeConductorController.prototype.destroy = function () { + this.conductor.off('bounds', this.setFormFromBounds); + this.conductor.off('timeSystem', this.changeTimeSystem); }; /** diff --git a/platform/features/conductor-v2/conductor/src/ui/TimeConductorControllerSpec.js b/platform/features/conductor-v2/conductor/src/ui/TimeConductorControllerSpec.js index 7d1457eafe3..39759c60f55 100644 --- a/platform/features/conductor-v2/conductor/src/ui/TimeConductorControllerSpec.js +++ b/platform/features/conductor-v2/conductor/src/ui/TimeConductorControllerSpec.js @@ -30,14 +30,18 @@ define(['./TimeConductorController'], function (TimeConductorController) { var controller; beforeEach(function () { - mockScope = jasmine.createSpyObj("$scope", ["$watch"]); + mockScope = jasmine.createSpyObj("$scope", [ + "$watch", + "$on" + ]); mockWindow = jasmine.createSpyObj("$window", ["requestAnimationFrame"]); mockTimeConductor = jasmine.createSpyObj( "TimeConductor", [ "bounds", "timeSystem", - "on" + "on", + "off" ] ); mockTimeConductor.bounds.andReturn({start: undefined, end: undefined}); @@ -124,9 +128,16 @@ define(['./TimeConductorController'], function (TimeConductorController) { }); it("listens for changes to conductor state", function () { - expect(mockTimeConductor.on).toHaveBeenCalledWith("timeSystem", jasmine.any(Function)); - expect(mockTimeConductor.on).toHaveBeenCalledWith("bounds", jasmine.any(Function)); - expect(mockTimeConductor.on).toHaveBeenCalledWith("follow", jasmine.any(Function)); + expect(mockTimeConductor.on).toHaveBeenCalledWith("timeSystem", controller.changeTimeSystem); + expect(mockTimeConductor.on).toHaveBeenCalledWith("bounds", controller.setFormFromBounds); + }); + + it("deregisters conductor listens when scope is destroyed", function () { + expect(mockScope.$on).toHaveBeenCalledWith("$destroy", controller.destroy); + + controller.destroy(); + expect(mockTimeConductor.off).toHaveBeenCalledWith("timeSystem", controller.changeTimeSystem); + expect(mockTimeConductor.off).toHaveBeenCalledWith("bounds", controller.setFormFromBounds); }); it("when time system changes, sets time system on scope", function () { @@ -164,17 +175,6 @@ define(['./TimeConductorController'], function (TimeConductorController) { expect(mockScope.boundsModel.start).toEqual(bounds.start); expect(mockScope.boundsModel.end).toEqual(bounds.end); }); - - it("responds to a change in 'follow' state of the time conductor", function () { - var followListener = getListener("follow"); - expect(followListener).toBeDefined(); - - followListener(true); - expect(mockScope.followMode).toEqual(true); - - followListener(false); - expect(mockScope.followMode).toEqual(false); - }); }); describe("when user makes changes from UI", function () { From 8eb7585653f188528a98ee868a556aa6cc5728f2 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 29 Aug 2016 10:58:02 -0700 Subject: [PATCH 43/65] [README] Warn about root installation issues Mitigates #1151. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c19be6ee1db..b9486dad3c8 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Differences between the two APIs include a move away from a declarative system o ## Building and Running Open MCT Locally Building and running Open MCT in your local dev environment is very easy. Be sure you have [Git](https://git-scm.com/downloads) and [Node.js](https://nodejs.org/) installed, then follow the directions below. Need additional information? Check out the [Getting Started](https://nasa.github.io/openmct/getting-started/) page on our website. +(These instructions assume you are installing as a non-root user; developers have [reported issues](https://github.com/nasa/openmct/issues/1151) running these steps with root privileges.) 1. Clone the source code From 2e81550c8676e6ade2df215110f61ce56ebabae7 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 14 Sep 2016 10:16:33 -0700 Subject: [PATCH 44/65] Revert "[Build] Check dependencies for vulnerabilities" --- gulpfile.js | 7 +------ package.json | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index bf522248635..ff994c6a2c0 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -103,11 +103,6 @@ gulp.task('stylesheets', function () { .pipe(gulp.dest(__dirname)); }); -gulp.task('nsp', function (done) { - var nsp = require('gulp-nsp'); - nsp({package: __dirname + '/package.json'}, done); -}); - gulp.task('lint', function () { var nonspecs = paths.specs.map(function (glob) { return "!" + glob; @@ -157,6 +152,6 @@ gulp.task('develop', ['serve', 'stylesheets', 'watch']); gulp.task('install', [ 'static', 'scripts' ]); -gulp.task('verify', [ 'lint', 'test', 'checkstyle', 'nsp' ]); +gulp.task('verify', [ 'lint', 'test', 'checkstyle' ]); gulp.task('build', [ 'verify', 'install' ]); diff --git a/package.json b/package.json index 5563f65c82a..555375007ea 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "gulp-jscs": "^3.0.2", "gulp-jshint": "^2.0.0", "gulp-jshint-html-reporter": "^0.1.3", - "gulp-nsp": "^2.4.2", "gulp-rename": "^1.2.2", "gulp-replace-task": "^0.11.0", "gulp-requirejs-optimize": "^0.3.1", From d77922d66c2a450b00043bd2efc0144cfd9eae92 Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Thu, 15 Sep 2016 09:37:11 -0700 Subject: [PATCH 45/65] Revert "[proxyUrl] pass URL parameters to proxied URL" --- app.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app.js b/app.js index 20429a3a5f4..6b7b1bb6350 100644 --- a/app.js +++ b/app.js @@ -67,14 +67,10 @@ }); app.use('/proxyUrl', function proxyRequest(req, res, next) { - var targetUrl = req.query.url; - var queryParameters = req.query; - console.log('Proxying request to: ', targetUrl); - delete queryParameters['url']; + console.log('Proxying request to: ', req.query.url); req.pipe(request({ - url: targetUrl, - strictSSL: false, - qs: queryParameters + url: req.query.url, + strictSSL: false }).on('error', next)).pipe(res); }); From 7fcafb6b58f8e24a0cc30f51392e2e65aea26d27 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 12 Sep 2016 16:53:48 -0700 Subject: [PATCH 46/65] [Time Conductor] Added pan to Time Conductor --- .../features/conductor-v2/conductor/bundle.js | 12 +- .../res/sass/_time-conductor-base.scss | 4 + .../res/templates/time-conductor.html | 126 +++++++------ .../src/ui/ConductorAxisController.js | 169 ++++++++++++++++++ .../conductor/src/ui/MctConductorAxis.js | 146 +++------------ .../src/ui/TimeConductorController.js | 8 + 6 files changed, 289 insertions(+), 176 deletions(-) create mode 100644 platform/features/conductor-v2/conductor/src/ui/ConductorAxisController.js diff --git a/platform/features/conductor-v2/conductor/bundle.js b/platform/features/conductor-v2/conductor/bundle.js index 438cb33715d..1fbeebdea79 100644 --- a/platform/features/conductor-v2/conductor/bundle.js +++ b/platform/features/conductor-v2/conductor/bundle.js @@ -24,16 +24,18 @@ define([ "./src/ui/TimeConductorViewService", "./src/ui/TimeConductorController", "./src/TimeConductor", + "./src/ui/ConductorAxisController", "./src/ui/MctConductorAxis", "./src/ui/NumberFormat", "text!./res/templates/time-conductor.html", "text!./res/templates/mode-selector/mode-selector.html", "text!./res/templates/mode-selector/mode-menu.html", - 'legacyRegistry' + "legacyRegistry" ], function ( TimeConductorViewService, TimeConductorController, TimeConductor, + ConductorAxisController, MCTConductorAxis, NumberFormat, timeConductorTemplate, @@ -69,6 +71,14 @@ define([ "timeConductorViewService", "timeSystems[]" ] + }, + { + "key": "ConductorAxisController", + "implementation": ConductorAxisController, + "depends": [ + "timeConductor", + "formatService" + ] } ], "directives": [ diff --git a/platform/features/conductor-v2/conductor/res/sass/_time-conductor-base.scss b/platform/features/conductor-v2/conductor/res/sass/_time-conductor-base.scss index e20c0ef4cd4..5beaf916d3e 100644 --- a/platform/features/conductor-v2/conductor/res/sass/_time-conductor-base.scss +++ b/platform/features/conductor-v2/conductor/res/sass/_time-conductor-base.scss @@ -136,6 +136,7 @@ bottom: 0; left: 0; z-index: 1; + pointer-events: none; .l-time-range-w { // Wraps a datetime text input field height: 100%; @@ -159,6 +160,9 @@ content: 'End'; } } + .l-time-conductor-inputs { + pointer-events: auto; + } input[type="text"] { @include trans-prop-nice(padding, 250ms); } diff --git a/platform/features/conductor-v2/conductor/res/templates/time-conductor.html b/platform/features/conductor-v2/conductor/res/templates/time-conductor.html index 19c86b2b746..86dcd14ec23 100644 --- a/platform/features/conductor-v2/conductor/res/templates/time-conductor.html +++ b/platform/features/conductor-v2/conductor/res/templates/time-conductor.html @@ -1,6 +1,18 @@ +
+ class="holder grows flex-elem l-flex-row l-time-conductor {{modeModel.selectedKey}}-mode {{timeSystemModel.selected.metadata.key}}-time-system" + ng-class="{'status-panning': panning}">
@@ -13,63 +25,67 @@
- - - - - - - - - - + + + + + + + + - + + + - - - - - - - + - - + + + + + + + + + + + + diff --git a/platform/features/conductor-v2/conductor/src/ui/ConductorAxisController.js b/platform/features/conductor-v2/conductor/src/ui/ConductorAxisController.js new file mode 100644 index 00000000000..b88177181d2 --- /dev/null +++ b/platform/features/conductor-v2/conductor/src/ui/ConductorAxisController.js @@ -0,0 +1,169 @@ +/***************************************************************************** + * 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. + *****************************************************************************/ + +define( + [ + "d3" + ], + function (d3) { + var PADDING = 1; + + /** + * The mct-conductor-axis renders a horizontal axis with regular + * labelled 'ticks'. It requires 'start' and 'end' integer values to + * be specified as attributes. + */ + function ConductorAxisController(conductor, formatService) { + // Dependencies + this.d3 = d3; + this.formatService = formatService; + this.conductor = conductor; + + // Runtime properties (set by 'link' function) + this.target = undefined; + this.xScale = undefined; + this.xAxis = undefined; + this.axisElement = undefined; + this.initialized = false; + this.msPerPixel = undefined; + + this.setScale = this.setScale.bind(this); + this.changeBounds = this.changeBounds.bind(this); + this.changeTimeSystem = this.changeTimeSystem.bind(this); + + this.bounds = conductor.bounds(); + this.timeSystem = conductor.timeSystem(); + } + + ConductorAxisController.prototype.changeBounds = function (bounds) { + this.bounds = bounds; + if (this.initialized) { + this.setScale(); + } + }; + + ConductorAxisController.prototype.setScale = function () { + var width = this.target.offsetWidth; + var timeSystem = this.conductor.timeSystem(); + var bounds = this.bounds; + + if (timeSystem.isUTCBased()) { + this.xScale = this.xScale || this.d3.scaleUtc(); + this.xScale.domain([new Date(bounds.start), new Date(bounds.end)]); + } else { + this.xScale = this.xScale || this.d3.scaleLinear(); + this.xScale.domain([bounds.start, bounds.end]); + } + + this.xScale.range([PADDING, width - PADDING * 2]); + this.axisElement.call(this.xAxis); + + this.msPerPixel = (bounds.end - bounds.start) / width; + }; + + ConductorAxisController.prototype.changeTimeSystem = function (timeSystem) { + this.timeSystem = timeSystem; + + var key = timeSystem.formats()[0]; + if (this.initialized && key !== undefined) { + var format = this.formatService.getFormat(key); + var bounds = this.conductor.bounds(); + + if (timeSystem.isUTCBased()) { + this.xScale = this.d3.scaleUtc(); + } else { + this.xScale = this.d3.scaleLinear(); + } + + this.xAxis.scale(this.xScale); + //Define a custom format function + this.xAxis.tickFormat(function (tickValue) { + // Normalize date representations to numbers + if (tickValue instanceof Date) { + tickValue = tickValue.getTime(); + } + return format.format(tickValue, { + min: bounds.start, + max: bounds.end + }); + }); + this.axisElement.call(this.xAxis); + } + }; + + ConductorAxisController.prototype.link = function (scope, element) { + this.target = element[0].firstChild; + this.scope = scope; + var height = this.target.offsetHeight; + var vis = this.d3.select(this.target) + .append("svg:svg") + .attr("width", "100%") + .attr("height", height); + + this.xAxis = this.d3.axisTop(); + + // draw x axis with labels and move to the bottom of the chart area + this.axisElement = vis.append("g") + .attr("transform", "translate(0," + (height - PADDING) + ")"); + + this.initialized = true; + + if (this.timeSystem !== undefined) { + this.changeTimeSystem(this.timeSystem); + this.setScale(this.bounds); + } + + //Respond to changes in conductor + this.conductor.on("timeSystem", this.changeTimeSystem); + this.conductor.on("bounds", this.changeBounds); + }; + + ConductorAxisController.prototype.panEnd = function () { + //resync view bounds with time conductor bounds + this.conductor.bounds(this.bounds); + this.scope.$emit("pan-stop"); + }; + + ConductorAxisController.prototype.pan = function (delta) { + if (!this.conductor.follow()) { + var deltaInMs = delta[0] * this.msPerPixel; + var bounds = this.conductor.bounds(); + var start = Math.floor((bounds.start - deltaInMs) / 1000) * 1000; + var end = Math.floor((bounds.end - deltaInMs) / 1000) * 1000; + this.bounds = { + start: start, + end: end + }; + this.setScale(); + this.scope.$emit("pan", this.bounds); + } + }; + + ConductorAxisController.prototype.resize = function () { + if (this.initialized) { + this.setScale(); + } + }; + + return ConductorAxisController; + } +); diff --git a/platform/features/conductor-v2/conductor/src/ui/MctConductorAxis.js b/platform/features/conductor-v2/conductor/src/ui/MctConductorAxis.js index 58cb60befcf..8b874badf28 100644 --- a/platform/features/conductor-v2/conductor/src/ui/MctConductorAxis.js +++ b/platform/features/conductor-v2/conductor/src/ui/MctConductorAxis.js @@ -20,127 +20,33 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -define( - [ - "d3" - ], - function (d3) { - var PADDING = 1; - - /** - * The mct-conductor-axis renders a horizontal axis with regular - * labelled 'ticks'. It requires 'start' and 'end' integer values to - * be specified as attributes. - */ - function MCTConductorAxis(conductor, formatService) { - // Dependencies - this.d3 = d3; - this.conductor = conductor; - this.formatService = formatService; - - // Runtime properties (set by 'link' function) - this.target = undefined; - this.xScale = undefined; - this.xAxis = undefined; - this.axisElement = undefined; - - // Angular Directive interface - this.link = this.link.bind(this); - this.restrict = "E"; - this.template = - "
"; - this.priority = 1000; - - //Bind all class functions to 'this' - Object.keys(MCTConductorAxis.prototype).filter(function (key) { - return typeof MCTConductorAxis.prototype[key] === 'function'; - }).forEach(function (key) { - this[key] = this[key].bind(this); - }.bind(this)); - } - - MCTConductorAxis.prototype.setScale = function () { - var width = this.target.offsetWidth; - var timeSystem = this.conductor.timeSystem(); - var bounds = this.conductor.bounds(); - - if (timeSystem.isUTCBased()) { - this.xScale = this.xScale || this.d3.scaleUtc(); - this.xScale.domain([new Date(bounds.start), new Date(bounds.end)]); - } else { - this.xScale = this.xScale || this.d3.scaleLinear(); - this.xScale.domain([bounds.start, bounds.end]); - } - - this.xScale.range([PADDING, width - PADDING * 2]); - this.axisElement.call(this.xAxis); - }; - - MCTConductorAxis.prototype.changeTimeSystem = function (timeSystem) { - var key = timeSystem.formats()[0]; - if (key !== undefined) { - var format = this.formatService.getFormat(key); - var bounds = this.conductor.bounds(); - - if (timeSystem.isUTCBased()) { - this.xScale = this.d3.scaleUtc(); - } else { - this.xScale = this.d3.scaleLinear(); - } - - this.xAxis.scale(this.xScale); - //Define a custom format function - this.xAxis.tickFormat(function (tickValue) { - // Normalize date representations to numbers - if (tickValue instanceof Date) { - tickValue = tickValue.getTime(); - } - return format.format(tickValue, { - min: bounds.start, - max: bounds.end - }); - }); - this.axisElement.call(this.xAxis); +define([], function () { + + function MctConductorAxis() { + /** + * The mct-conductor-axis renders a horizontal axis with regular + * labelled 'ticks'. It requires 'start' and 'end' integer values to + * be specified as attributes. + */ + + return { + controller: 'ConductorAxisController', + controllerAs: 'axis', + link: function(scope, element, attrs, controller){ + controller.link(scope, element); + }, + + restrict: 'E', + priority: 1000, + + template: '
' } - }; - - MCTConductorAxis.prototype.destroy = function () { - this.conductor.off('timeSystem', this.changeTimeSystem); - this.conductor.off('bounds', this.setScale); - }; - - MCTConductorAxis.prototype.link = function (scope, element) { - var conductor = this.conductor; - this.target = element[0].firstChild; - var height = this.target.offsetHeight; - var vis = this.d3.select(this.target) - .append('svg:svg') - .attr('width', '100%') - .attr('height', height); - - this.xAxis = this.d3.axisTop(); - - // draw x axis with labels and move to the bottom of the chart area - this.axisElement = vis.append("g") - .attr("transform", "translate(0," + (height - PADDING) + ")"); - - scope.resize = this.setScale; - - conductor.on('timeSystem', this.changeTimeSystem); - - //On conductor bounds changes, redraw ticks - conductor.on('bounds', this.setScale); - - scope.$on("$destroy", this.destroy); - - if (conductor.timeSystem() !== undefined) { - this.changeTimeSystem(conductor.timeSystem()); - this.setScale(); - } - }; + } - return function (conductor, formatService) { - return new MCTConductorAxis(conductor, formatService); - }; + return MctConductorAxis; } ); diff --git a/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js b/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js index 83bc0558c61..21040eea171 100644 --- a/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js +++ b/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js @@ -97,6 +97,14 @@ define( // Watch scope for selection of mode or time system by user this.$scope.$watch('modeModel.selectedKey', this.setMode); + this.$scope.$on('pan', function (e, bounds) { + this.$scope.panning = true; + this.setFormFromBounds(bounds); + }.bind(this)); + + this.$scope.$on('pan-stop', function () { + this.$scope.panning = false; + }.bind(this)); this.$scope.$on('$destroy', this.destroy); }; From 98122cc730471a0087729abbd5b03f31b50b2659 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 20 Sep 2016 11:40:58 -0700 Subject: [PATCH 47/65] [Time Conductor] Added Zoom --- .../res/sass/_time-conductor-base.scss | 4 +- .../res/templates/time-conductor.html | 8 +++- .../conductor/src/timeSystems/TimeSystem.js | 14 ++++++- .../src/ui/ConductorAxisController.js | 4 ++ .../src/ui/TimeConductorController.js | 40 +++++++++++++++++-- .../utcTimeSystem/src/UTCTimeSystem.js | 8 +++- 6 files changed, 69 insertions(+), 9 deletions(-) diff --git a/platform/features/conductor-v2/conductor/res/sass/_time-conductor-base.scss b/platform/features/conductor-v2/conductor/res/sass/_time-conductor-base.scss index 5beaf916d3e..68d79a37c6a 100644 --- a/platform/features/conductor-v2/conductor/res/sass/_time-conductor-base.scss +++ b/platform/features/conductor-v2/conductor/res/sass/_time-conductor-base.scss @@ -223,13 +223,13 @@ .l-time-conductor-zoom-w { @include justify-content(flex-end); .time-conductor-zoom { - display: none; // TEMP per request from Andrew 8/1/16 + //display: none; // TEMP per request from Andrew 8/1/16 height: $r3H; min-width: 100px; width: 20%; } .time-conductor-zoom-current-range { - display: none; // TEMP per request from Andrew 8/1/16 + //display: none; // TEMP per request from Andrew 8/1/16 color: $colorTick; } } diff --git a/platform/features/conductor-v2/conductor/res/templates/time-conductor.html b/platform/features/conductor-v2/conductor/res/templates/time-conductor.html index 86dcd14ec23..37ad80b8ffa 100644 --- a/platform/features/conductor-v2/conductor/res/templates/time-conductor.html +++ b/platform/features/conductor-v2/conductor/res/templates/time-conductor.html @@ -116,7 +116,13 @@
- +
diff --git a/platform/features/conductor-v2/conductor/src/timeSystems/TimeSystem.js b/platform/features/conductor-v2/conductor/src/timeSystems/TimeSystem.js index 652ea9ed0f0..51987b39c8a 100644 --- a/platform/features/conductor-v2/conductor/src/timeSystems/TimeSystem.js +++ b/platform/features/conductor-v2/conductor/src/timeSystems/TimeSystem.js @@ -73,8 +73,20 @@ define([], function () { throw new Error('Not implemented'); }; - /** + /*** + * + * @typedef {object} TimeConductorZoom + * @property {number} min The largest time span that the time + * conductor can display in this time system + * @property {number} max The smallest time span that the time + * conductor can display in this time system * + * @typedef {object} TimeSystemDefault + * @property {TimeConductorDeltas} deltas The deltas to apply by default + * when this time system is active. Applies to real-time modes only + * @property {TimeConductorBounds} bounds The bounds to apply by default + * when this time system is active + * @property {TimeConductorZoom} zoom Default min and max zoom levels * @returns {TimeSystemDefault[]} At least one set of default values for * this time system. */ diff --git a/platform/features/conductor-v2/conductor/src/ui/ConductorAxisController.js b/platform/features/conductor-v2/conductor/src/ui/ConductorAxisController.js index b88177181d2..135a3eec432 100644 --- a/platform/features/conductor-v2/conductor/src/ui/ConductorAxisController.js +++ b/platform/features/conductor-v2/conductor/src/ui/ConductorAxisController.js @@ -135,6 +135,10 @@ define( //Respond to changes in conductor this.conductor.on("timeSystem", this.changeTimeSystem); this.conductor.on("bounds", this.changeBounds); + + scope.$on("zoom", function (evt, bounds){ + this.changeBounds(bounds); + }.bind(this)); }; ConductorAxisController.prototype.panEnd = function () { diff --git a/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js b/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js index 21040eea171..f6aff18469e 100644 --- a/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js +++ b/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js @@ -123,6 +123,8 @@ define( TimeConductorController.prototype.setFormFromBounds = function (bounds) { this.$scope.boundsModel.start = bounds.start; this.$scope.boundsModel.end = bounds.end; + //this.$scope.currentZoom = bounds.end - bounds.start; + this.$scope.currentZoom = this.toSliderValue(bounds.end - bounds.start); if (!this.pendingUpdate) { this.pendingUpdate = true; this.$window.requestAnimationFrame(function () { @@ -157,9 +159,12 @@ define( * @private */ TimeConductorController.prototype.setFormFromTimeSystem = function (timeSystem) { - this.$scope.timeSystemModel.selected = timeSystem; - this.$scope.timeSystemModel.format = timeSystem.formats()[0]; - this.$scope.timeSystemModel.deltaFormat = timeSystem.deltaFormat(); + var timeSystemModel = this.$scope.timeSystemModel; + timeSystemModel.selected = timeSystem; + timeSystemModel.format = timeSystem.formats()[0]; + timeSystemModel.deltaFormat = timeSystem.deltaFormat(); + timeSystemModel.minZoom = timeSystem.defaults().zoom.min; + timeSystemModel.maxZoom = timeSystem.defaults().zoom.max; }; @@ -246,6 +251,35 @@ define( } }; + TimeConductorController.prototype.toSliderValue = function (timeSpan) { + var timeSystem = this.conductor.timeSystem(); + if (timeSystem) { + var zoomDefaults = this.conductor.timeSystem().defaults().zoom; + var perc = timeSpan / (zoomDefaults.min - zoomDefaults.max); + return 1 - Math.pow(perc, 1 / 4); + } + }; + + TimeConductorController.prototype.toTimeSpan = function (sliderValue) { + var center = this.$scope.boundsModel.start + + ((this.$scope.boundsModel.end - this.$scope.boundsModel.start) / 2); + var zoomDefaults = this.conductor.timeSystem().defaults().zoom; + var timeSpan = Math.pow((1 - sliderValue), 4) * (zoomDefaults.min - zoomDefaults.max); + return {start: center - timeSpan / 2, end: center + timeSpan / 2}; + }; + + TimeConductorController.prototype.zoom = function(sliderValue) { + var bounds = this.toTimeSpan(sliderValue); + this.setFormFromBounds(bounds); + + this.$scope.$broadcast("zoom", bounds); + }; + + TimeConductorController.prototype.zoomStop = function (sliderValue) { + var bounds = this.toTimeSpan(sliderValue); + this.conductor.bounds(bounds); + }; + return TimeConductorController; } ); diff --git a/platform/features/conductor-v2/utcTimeSystem/src/UTCTimeSystem.js b/platform/features/conductor-v2/utcTimeSystem/src/UTCTimeSystem.js index b6e969c3ebd..780bfa8db1b 100644 --- a/platform/features/conductor-v2/utcTimeSystem/src/UTCTimeSystem.js +++ b/platform/features/conductor-v2/utcTimeSystem/src/UTCTimeSystem.js @@ -64,13 +64,17 @@ define([ return this.sources; }; - UTCTimeSystem.prototype.defaults = function (key) { + UTCTimeSystem.prototype.defaults = function () { var now = Math.ceil(Date.now() / 1000) * 1000; + var ONE_MINUTE = 60 * 1 * 1000; + var FIFTY_YEARS = 50 * 365 * 24 * 60 * 60 * 1000; + return { key: 'utc-default', name: 'UTC time system defaults', deltas: {start: FIFTEEN_MINUTES, end: 0}, - bounds: {start: now - FIFTEEN_MINUTES, end: now} + bounds: {start: now - FIFTEEN_MINUTES, end: now}, + zoom: {min: FIFTY_YEARS, max: ONE_MINUTE} }; }; From 49ee5cb74b50551822194da52278fafd6701e175 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 22 Sep 2016 15:18:48 -0700 Subject: [PATCH 48/65] [Time Conductor] Destroy listeners in ConductorAxisController --- .../src/ui/ConductorAxisController.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/platform/features/conductor-v2/conductor/src/ui/ConductorAxisController.js b/platform/features/conductor-v2/conductor/src/ui/ConductorAxisController.js index 135a3eec432..83aff959da7 100644 --- a/platform/features/conductor-v2/conductor/src/ui/ConductorAxisController.js +++ b/platform/features/conductor-v2/conductor/src/ui/ConductorAxisController.js @@ -46,14 +46,22 @@ define( this.initialized = false; this.msPerPixel = undefined; - this.setScale = this.setScale.bind(this); - this.changeBounds = this.changeBounds.bind(this); - this.changeTimeSystem = this.changeTimeSystem.bind(this); - this.bounds = conductor.bounds(); this.timeSystem = conductor.timeSystem(); + + //Bind all class functions to 'this' + Object.keys(ConductorAxisController.prototype).filter(function (key) { + return typeof ConductorAxisController.prototype[key] === 'function'; + }).forEach(function (key) { + self[key] = self[key].bind(self); + }); } + ConductorAxisController.prototype.destroy = function () { + this.conductor.off('timeSystem', this.changeTimeSystem); + this.conductor.off('bounds', this.setScale); + }; + ConductorAxisController.prototype.changeBounds = function (bounds) { this.bounds = bounds; if (this.initialized) { @@ -136,6 +144,8 @@ define( this.conductor.on("timeSystem", this.changeTimeSystem); this.conductor.on("bounds", this.changeBounds); + this.scope.$on("$destroy", this.destroy); + scope.$on("zoom", function (evt, bounds){ this.changeBounds(bounds); }.bind(this)); From bad24d621361717e03de03d19670a480a3c83f9e Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Thu, 22 Sep 2016 15:48:48 -0700 Subject: [PATCH 49/65] [Build] Remove SNAPSHOT status ...to close sprint Pratchett, https://github.com/nasa/openmct/milestone/17 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 555375007ea..668b4de22bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openmct", - "version": "0.11.3-SNAPSHOT", + "version": "0.11.3", "description": "The Open MCT core platform", "dependencies": { "express": "^4.13.1", From 3f5388c2e893adc590d080dfaf11c0b6950b52e6 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Thu, 22 Sep 2016 16:20:18 -0700 Subject: [PATCH 50/65] [Build] Restore SNAPSHOT status ...and bump version number to open sprint Rajaniemi, https://github.com/nasa/openmct/milestone/18 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 668b4de22bc..e47a64e50e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openmct", - "version": "0.11.3", + "version": "0.12.0-SNAPSHOT", "description": "The Open MCT core platform", "dependencies": { "express": "^4.13.1", From 3c95c095f195c51fb9df8ad46936f27ba4db0915 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 22 Sep 2016 17:22:25 -0700 Subject: [PATCH 51/65] [Time Conductor] Refactored out use of angular event bus in favor of making TimeConductorViewService an event emitter. --- .../features/conductor-v2/conductor/bundle.js | 3 ++- .../src/ui/ConductorAxisController.js | 23 +++++++++++-------- .../conductor/src/ui/MctConductorAxis.js | 2 +- .../src/ui/TimeConductorController.js | 22 ++++++++++-------- .../src/ui/TimeConductorViewService.js | 8 ++++++- 5 files changed, 36 insertions(+), 22 deletions(-) diff --git a/platform/features/conductor-v2/conductor/bundle.js b/platform/features/conductor-v2/conductor/bundle.js index 1fbeebdea79..7c49ccd7c43 100644 --- a/platform/features/conductor-v2/conductor/bundle.js +++ b/platform/features/conductor-v2/conductor/bundle.js @@ -77,7 +77,8 @@ define([ "implementation": ConductorAxisController, "depends": [ "timeConductor", - "formatService" + "formatService", + "timeConductorViewService" ] } ], diff --git a/platform/features/conductor-v2/conductor/src/ui/ConductorAxisController.js b/platform/features/conductor-v2/conductor/src/ui/ConductorAxisController.js index 83aff959da7..2fbe958e455 100644 --- a/platform/features/conductor-v2/conductor/src/ui/ConductorAxisController.js +++ b/platform/features/conductor-v2/conductor/src/ui/ConductorAxisController.js @@ -32,11 +32,12 @@ define( * labelled 'ticks'. It requires 'start' and 'end' integer values to * be specified as attributes. */ - function ConductorAxisController(conductor, formatService) { + function ConductorAxisController(conductor, formatService, conductorViewService) { // Dependencies this.d3 = d3; this.formatService = formatService; this.conductor = conductor; + this.conductorViewService = conductorViewService; // Runtime properties (set by 'link' function) this.target = undefined; @@ -53,8 +54,8 @@ define( Object.keys(ConductorAxisController.prototype).filter(function (key) { return typeof ConductorAxisController.prototype[key] === 'function'; }).forEach(function (key) { - self[key] = self[key].bind(self); - }); + this[key] = ConductorAxisController.prototype[key].bind(this); + }.bind(this)); } ConductorAxisController.prototype.destroy = function () { @@ -137,7 +138,7 @@ define( if (this.timeSystem !== undefined) { this.changeTimeSystem(this.timeSystem); - this.setScale(this.bounds); + this.setScale(); } //Respond to changes in conductor @@ -146,15 +147,17 @@ define( this.scope.$on("$destroy", this.destroy); - scope.$on("zoom", function (evt, bounds){ - this.changeBounds(bounds); - }.bind(this)); + this.conductorViewService.on("zoom", this.zoom); }; - ConductorAxisController.prototype.panEnd = function () { + ConductorAxisController.prototype.panStop = function () { //resync view bounds with time conductor bounds this.conductor.bounds(this.bounds); - this.scope.$emit("pan-stop"); + this.conductorViewService.emit("pan-stop"); + }; + + ConductorAxisController.prototype.zoom = function (bounds) { + this.changeBounds(bounds); }; ConductorAxisController.prototype.pan = function (delta) { @@ -168,7 +171,7 @@ define( end: end }; this.setScale(); - this.scope.$emit("pan", this.bounds); + this.conductorViewService.emit("pan", this.bounds); } }; diff --git a/platform/features/conductor-v2/conductor/src/ui/MctConductorAxis.js b/platform/features/conductor-v2/conductor/src/ui/MctConductorAxis.js index 8b874badf28..d664057af69 100644 --- a/platform/features/conductor-v2/conductor/src/ui/MctConductorAxis.js +++ b/platform/features/conductor-v2/conductor/src/ui/MctConductorAxis.js @@ -41,7 +41,7 @@ define([], function () { template: '
' } diff --git a/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js b/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js index f6aff18469e..5c8dabb1126 100644 --- a/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js +++ b/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js @@ -97,14 +97,9 @@ define( // Watch scope for selection of mode or time system by user this.$scope.$watch('modeModel.selectedKey', this.setMode); - this.$scope.$on('pan', function (e, bounds) { - this.$scope.panning = true; - this.setFormFromBounds(bounds); - }.bind(this)); + this.conductorViewService.on('pan', this.pan); - this.$scope.$on('pan-stop', function () { - this.$scope.panning = false; - }.bind(this)); + this.conductorViewService.on('pan-stop', this.panStop); this.$scope.$on('$destroy', this.destroy); }; @@ -114,6 +109,15 @@ define( this.conductor.off('timeSystem', this.changeTimeSystem); }; + TimeConductorController.prototype.pan = function (bounds) { + this.$scope.panning = true; + this.setFormFromBounds(bounds); + }; + + TimeConductorController.prototype.panStop = function () { + this.$scope.panning = false; + }; + /** * Called when the bounds change in the time conductor. Synchronizes * the bounds values in the time conductor with those in the form @@ -123,7 +127,7 @@ define( TimeConductorController.prototype.setFormFromBounds = function (bounds) { this.$scope.boundsModel.start = bounds.start; this.$scope.boundsModel.end = bounds.end; - //this.$scope.currentZoom = bounds.end - bounds.start; + this.$scope.currentZoom = this.toSliderValue(bounds.end - bounds.start); if (!this.pendingUpdate) { this.pendingUpdate = true; @@ -272,7 +276,7 @@ define( var bounds = this.toTimeSpan(sliderValue); this.setFormFromBounds(bounds); - this.$scope.$broadcast("zoom", bounds); + this.conductorViewService.emit("zoom", bounds); }; TimeConductorController.prototype.zoomStop = function (sliderValue) { diff --git a/platform/features/conductor-v2/conductor/src/ui/TimeConductorViewService.js b/platform/features/conductor-v2/conductor/src/ui/TimeConductorViewService.js index 8cbc3495204..9796e2bc3b9 100644 --- a/platform/features/conductor-v2/conductor/src/ui/TimeConductorViewService.js +++ b/platform/features/conductor-v2/conductor/src/ui/TimeConductorViewService.js @@ -22,9 +22,10 @@ define( [ + 'EventEmitter', './TimeConductorMode' ], - function (TimeConductorMode) { + function (EventEmitter, TimeConductorMode) { /** * A class representing the state of the time conductor view. This @@ -36,6 +37,9 @@ define( * @constructor */ function TimeConductorViewService(conductor, timeSystems) { + + EventEmitter.call(this); + this.systems = timeSystems.map(function (timeSystemConstructor) { return timeSystemConstructor(); }); @@ -97,6 +101,8 @@ define( } } + TimeConductorViewService.prototype = Object.create(EventEmitter.prototype); + /** * Getter/Setter for the Time Conductor Mode. Modes determine the * behavior of the time conductor, especially with regards to the From 98f387b605108d589a7b68ebac2632f1791302f9 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 22 Sep 2016 17:34:53 -0700 Subject: [PATCH 52/65] [Edit Mode] Renamed function from EditAction.cancel() to EditAction.finish() --- platform/commonUI/browse/src/navigation/NavigateAction.js | 2 +- .../commonUI/browse/test/navigation/NavigateActionSpec.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/commonUI/browse/src/navigation/NavigateAction.js b/platform/commonUI/browse/src/navigation/NavigateAction.js index 431ad8dadc7..6121213a51e 100644 --- a/platform/commonUI/browse/src/navigation/NavigateAction.js +++ b/platform/commonUI/browse/src/navigation/NavigateAction.js @@ -64,7 +64,7 @@ define( var editing = currentObject.hasCapability('editor') && currentObject.getCapability('editor').isEditContextRoot(); - return self.$q.when(editing && currentObject.getCapability("editor").cancel()); + return self.$q.when(editing && currentObject.getCapability("editor").finish()); } function navigate() { diff --git a/platform/commonUI/browse/test/navigation/NavigateActionSpec.js b/platform/commonUI/browse/test/navigation/NavigateActionSpec.js index 509e7aef3dc..f9b756eeaa3 100644 --- a/platform/commonUI/browse/test/navigation/NavigateActionSpec.js +++ b/platform/commonUI/browse/test/navigation/NavigateActionSpec.js @@ -61,7 +61,7 @@ define( capabilities.editor = jasmine.createSpyObj("editorCapability", [ "isEditContextRoot", - "cancel" + "finish" ]); mockNavigatedObject.getCapability.andCallFake(function (capability) { @@ -148,9 +148,9 @@ define( capabilities.editor.isEditContextRoot.andReturn(true); }); - it("cancels editing if in edit mode", function () { + it("finishes editing if in edit mode", function () { action.perform(); - expect(capabilities.editor.cancel) + expect(capabilities.editor.finish) .toHaveBeenCalled(); }); }); From 2db4aa6235bb019e3457f35e14cf0784fb5e2606 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 23 Sep 2016 13:06:22 -0700 Subject: [PATCH 53/65] [Time Conductor] Added zoom level label --- .../commonUI/formats/src/UTCTimeFormat.js | 32 +++++++++++++++++++ .../features/conductor-v2/conductor/bundle.js | 3 +- .../res/templates/time-conductor.html | 3 +- .../src/ui/TimeConductorController.js | 13 ++++++-- 4 files changed, 47 insertions(+), 4 deletions(-) diff --git a/platform/commonUI/formats/src/UTCTimeFormat.js b/platform/commonUI/formats/src/UTCTimeFormat.js index 3faab7a620e..5d1fba01171 100644 --- a/platform/commonUI/formats/src/UTCTimeFormat.js +++ b/platform/commonUI/formats/src/UTCTimeFormat.js @@ -95,6 +95,38 @@ define([ })[0][0]; } + UTCTimeFormat.prototype.timeUnits = function (timeRange) { + var momentified = moment.duration(timeRange); + return [ + ["Decades", function (r) { + return r.years() > 15; + }], + ["Years", function (r) { + return r.years() > 0; + }], + ["Months", function (r) { + return r.months() > 0; + }], + ["Days", function (r) { + return r.days() > 0; + }], + ["Hours", function (r) { + return r.hours() > 0; + }], + ["Minutes", function (r) { + return r.minutes() > 0; + }], + ["Seconds", function (r) { + return r.seconds() > 0; + }], + ["Milliseconds", function (r) { + return true; + }] + ].filter(function (row){ + return row[1](momentified); + })[0][0]; + }; + /** * * @param value diff --git a/platform/features/conductor-v2/conductor/bundle.js b/platform/features/conductor-v2/conductor/bundle.js index 7c49ccd7c43..122e2a69ac5 100644 --- a/platform/features/conductor-v2/conductor/bundle.js +++ b/platform/features/conductor-v2/conductor/bundle.js @@ -69,7 +69,8 @@ define([ "$window", "timeConductor", "timeConductorViewService", - "timeSystems[]" + "timeSystems[]", + "formatService" ] }, { diff --git a/platform/features/conductor-v2/conductor/res/templates/time-conductor.html b/platform/features/conductor-v2/conductor/res/templates/time-conductor.html index 37ad80b8ffa..2826bc86a0f 100644 --- a/platform/features/conductor-v2/conductor/res/templates/time-conductor.html +++ b/platform/features/conductor-v2/conductor/res/templates/time-conductor.html @@ -115,7 +115,8 @@
- + {{timeUnits}} Date: Sat, 24 Sep 2016 20:43:35 +0300 Subject: [PATCH 54/65] [Edit] Switch other edit actions to mct-control --- platform/commonUI/edit/bundle.js | 4 +++- .../edit/res/templates/edit-action-buttons.html | 13 +++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/platform/commonUI/edit/bundle.js b/platform/commonUI/edit/bundle.js index 60da9001769..1094abb864e 100644 --- a/platform/commonUI/edit/bundle.js +++ b/platform/commonUI/edit/bundle.js @@ -245,7 +245,9 @@ define([ "key": "cancel", "category": "conclude-editing", "implementation": CancelAction, - "name": "Cancel", + // Because we use the name as label for edit buttons and mct-control buttons need + // the label to be set to undefined in order to not apply the labeled CSS rule. + "name": undefined, "cssclass": "icon-x no-label", "description": "Discard changes made to these objects.", "depends": [] diff --git a/platform/commonUI/edit/res/templates/edit-action-buttons.html b/platform/commonUI/edit/res/templates/edit-action-buttons.html index 4bc020612f0..7c1017992aa 100644 --- a/platform/commonUI/edit/res/templates/edit-action-buttons.html +++ b/platform/commonUI/edit/res/templates/edit-action-buttons.html @@ -42,11 +42,12 @@ - - {{currentAction.getMetadata().name}} - + + \ No newline at end of file From a34e89d56a8c33cde53bd37c59e25922e272e337 Mon Sep 17 00:00:00 2001 From: Alex M Date: Tue, 27 Sep 2016 21:19:25 +0300 Subject: [PATCH 55/65] [Edit] Bind action to .perform() inside mct-button --- .../commonUI/edit/res/templates/edit-action-buttons.html | 4 ++-- .../commonUI/edit/src/controllers/EditActionController.js | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/platform/commonUI/edit/res/templates/edit-action-buttons.html b/platform/commonUI/edit/res/templates/edit-action-buttons.html index 7c1017992aa..2af47b68784 100644 --- a/platform/commonUI/edit/res/templates/edit-action-buttons.html +++ b/platform/commonUI/edit/res/templates/edit-action-buttons.html @@ -25,7 +25,7 @@ @@ -45,7 +45,7 @@ diff --git a/platform/commonUI/edit/src/controllers/EditActionController.js b/platform/commonUI/edit/src/controllers/EditActionController.js index 7c33799ebbd..ba91b63e9d7 100644 --- a/platform/commonUI/edit/src/controllers/EditActionController.js +++ b/platform/commonUI/edit/src/controllers/EditActionController.js @@ -61,6 +61,12 @@ define( $scope.otherEditActions = $scope.action ? $scope.action.getActions(OTHERS_ACTION_CONTEXT) : []; + + // Required because Angular does not allow 'bind' + // in expressions. + $scope.actionPerformer = function (action) { + return action.perform.bind(action); + }; } // Update set of actions whenever the action capability From 754d7b3cd76e2ddd2163efc94a4090a47d4c6649 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 27 Sep 2016 16:47:35 -0700 Subject: [PATCH 56/65] [Build] Restore SNAPSHOT status ... for a patch build related to #1208 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 668b4de22bc..fd45d233571 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openmct", - "version": "0.11.3", + "version": "0.11.4-SNAPSHOT", "description": "The Open MCT core platform", "dependencies": { "express": "^4.13.1", From 91b63f78eb9dd9882541b040092a62fa2b43fabc Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 27 Sep 2016 16:40:29 -0700 Subject: [PATCH 57/65] [Build] Depend on non-minified jsPDF Fixes #1208 (for some reason) --- main.js | 2 +- test-main.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 3fc2c4da36c..34d1afeeebe 100644 --- a/main.js +++ b/main.js @@ -29,7 +29,7 @@ requirejs.config({ "csv": "bower_components/comma-separated-values/csv.min", "es6-promise": "bower_components/es6-promise/es6-promise.min", "html2canvas": "bower_components/html2canvas/build/html2canvas.min", - "jsPDF": "bower_components/jspdf/dist/jspdf.min", + "jsPDF": "bower_components/jspdf/dist/jspdf.debug", "moment": "bower_components/moment/moment", "moment-duration-format": "bower_components/moment-duration-format/lib/moment-duration-format", "saveAs": "bower_components/FileSaver.js/FileSaver.min", diff --git a/test-main.js b/test-main.js index 43142766b9b..ff8a50ca6b9 100644 --- a/test-main.js +++ b/test-main.js @@ -55,7 +55,7 @@ requirejs.config({ "csv": "bower_components/comma-separated-values/csv.min", "es6-promise": "bower_components/es6-promise/es6-promise.min", "html2canvas": "bower_components/html2canvas/build/html2canvas.min", - "jsPDF": "bower_components/jspdf/dist/jspdf.min", + "jsPDF": "bower_components/jspdf/dist/jspdf.debug", "moment": "bower_components/moment/moment", "moment-duration-format": "bower_components/moment-duration-format/lib/moment-duration-format", "saveAs": "bower_components/FileSaver.js/FileSaver.min", From d248dfe34674dc0a5e01631c5478aea36769711e Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 27 Sep 2016 16:48:38 -0700 Subject: [PATCH 58/65] [Build] Remove SNAPSHOT status ...to tag a build which addresses release blocker #1208 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fd45d233571..333b4258eb8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openmct", - "version": "0.11.4-SNAPSHOT", + "version": "0.11.4", "description": "The Open MCT core platform", "dependencies": { "express": "^4.13.1", From e1276e464debed1ba0fdfbfc3bfba3b1c2078315 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 27 Sep 2016 16:49:09 -0700 Subject: [PATCH 59/65] [Build] Restore version identifier --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 333b4258eb8..e47a64e50e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openmct", - "version": "0.11.4", + "version": "0.12.0-SNAPSHOT", "description": "The Open MCT core platform", "dependencies": { "express": "^4.13.1", From 5babf7274d4c7e7a59980218c107b83762b4ad82 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 29 Sep 2016 11:21:11 -0700 Subject: [PATCH 60/65] [Time Conductor] Tweaked the break points for zoom level indicator --- platform/commonUI/formats/src/UTCTimeFormat.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/commonUI/formats/src/UTCTimeFormat.js b/platform/commonUI/formats/src/UTCTimeFormat.js index 5d1fba01171..26919e31603 100644 --- a/platform/commonUI/formats/src/UTCTimeFormat.js +++ b/platform/commonUI/formats/src/UTCTimeFormat.js @@ -102,22 +102,22 @@ define([ return r.years() > 15; }], ["Years", function (r) { - return r.years() > 0; + return r.years() > 1; }], ["Months", function (r) { - return r.months() > 0; + return r.years() === 1 || r.months() > 1; }], ["Days", function (r) { - return r.days() > 0; + return r.months() === 1 || r.days() > 1; }], ["Hours", function (r) { - return r.hours() > 0; + return r.days() === 1 || r.hours() > 1; }], ["Minutes", function (r) { - return r.minutes() > 0; + return r.hours() === 1 || r.minutes() > 1; }], ["Seconds", function (r) { - return r.seconds() > 0; + return r.minutes() === 1 || r.seconds() > 1; }], ["Milliseconds", function (r) { return true; From e077f9ee1845e1a551084e0239a65209ad395cae Mon Sep 17 00:00:00 2001 From: David Hudson Date: Fri, 30 Sep 2016 21:34:03 +0200 Subject: [PATCH 61/65] [Timeline] Fix logic error Issue #1185. Also removed direct modification of domain object. --- .../timeline/src/capabilities/GraphCapability.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/platform/features/timeline/src/capabilities/GraphCapability.js b/platform/features/timeline/src/capabilities/GraphCapability.js index 4e9cce0c8c7..181c909f799 100644 --- a/platform/features/timeline/src/capabilities/GraphCapability.js +++ b/platform/features/timeline/src/capabilities/GraphCapability.js @@ -37,7 +37,8 @@ define( // Build graphs for this group of utilizations function buildGraphs(utilizations) { var utilizationMap = {}, - result = {}; + result = {}, + startingSOC; // Bucket utilizations by type utilizations.forEach(function (u) { @@ -55,14 +56,14 @@ define( if (domainObject.getModel().type === 'timeline' && result.power && domainObject.getModel().capacity > 0) { - domainObject.getModel().startingSOC = - parseFloat(domainObject.getModel().startingSOC) || 100; + startingSOC = isNaN(parseFloat(domainObject.getModel().startingSOC)) ? + 100 : parseFloat(domainObject.getModel().startingSOC); result.battery = new CumulativeGraph( result.power, 0, domainObject.getModel().capacity, // Watts - (domainObject.getModel().startingSOC / 100) * domainObject.getModel().capacity, + (startingSOC / 100) * domainObject.getModel().capacity, 1 / 3600000 // millis-to-hour (since units are watt-hours) ); } From ed102492e5529c0d840f00f33121e0161fa7e4b9 Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Fri, 30 Sep 2016 12:49:02 -0700 Subject: [PATCH 62/65] [Bower] specify jspdf minor version Specify jsPDF minor version to avoid updating to v1.3.0, which appears to have problems with requirejs bundling. Fixes https://github.com/nasa/openmct/issues/1214 --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 922eb905f34..7dbb8f98604 100644 --- a/bower.json +++ b/bower.json @@ -20,6 +20,6 @@ "FileSaver.js": "^0.0.2", "zepto": "^1.1.6", "html2canvas": "^0.4.1", - "jspdf": "^1.2.61" + "jspdf": "1.2.x" } } From ae6f6565fa61418406aafcad31d32e90c49fbb2f Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Fri, 30 Sep 2016 16:54:42 -0700 Subject: [PATCH 63/65] [export] remove pdf export Remove pdf export with extreme prejudice due to issues with build process. Fixes https://github.com/nasa/openmct/issues/1217 --- bower.json | 3 +-- main.js | 4 ---- platform/features/plot/bundle.js | 10 -------- .../features/plot/res/templates/plot.html | 5 ---- platform/features/plot/src/PlotController.js | 11 --------- .../plot/src/services/ExportImageService.js | 24 ++----------------- .../features/plot/test/PlotControllerSpec.js | 2 +- .../test/services/ExportImageServiceSpec.js | 21 ---------------- test-main.js | 1 - 9 files changed, 4 insertions(+), 77 deletions(-) diff --git a/bower.json b/bower.json index 7dbb8f98604..419871fe575 100644 --- a/bower.json +++ b/bower.json @@ -19,7 +19,6 @@ "comma-separated-values": "^3.6.4", "FileSaver.js": "^0.0.2", "zepto": "^1.1.6", - "html2canvas": "^0.4.1", - "jspdf": "1.2.x" + "html2canvas": "^0.4.1" } } diff --git a/main.js b/main.js index 34d1afeeebe..6968d8ff26f 100644 --- a/main.js +++ b/main.js @@ -29,7 +29,6 @@ requirejs.config({ "csv": "bower_components/comma-separated-values/csv.min", "es6-promise": "bower_components/es6-promise/es6-promise.min", "html2canvas": "bower_components/html2canvas/build/html2canvas.min", - "jsPDF": "bower_components/jspdf/dist/jspdf.debug", "moment": "bower_components/moment/moment", "moment-duration-format": "bower_components/moment-duration-format/lib/moment-duration-format", "saveAs": "bower_components/FileSaver.js/FileSaver.min", @@ -48,9 +47,6 @@ requirejs.config({ "html2canvas": { "exports": "html2canvas" }, - "jsPDF": { - "exports": "jsPDF" - }, "moment-duration-format": { "deps": ["moment"] }, diff --git a/platform/features/plot/bundle.js b/platform/features/plot/bundle.js index 691e3107918..ec4e6f375af 100644 --- a/platform/features/plot/bundle.js +++ b/platform/features/plot/bundle.js @@ -146,16 +146,6 @@ define([ "copyright": "Copyright © 2012 Niklas von Hertzen.", "license": "license-mit", "link": "https://github.com/niklasvh/html2canvas/blob/master/LICENSE" - }, - { - "name": "jsPDF", - "version": "1.2.61", - "author": "James Hall", - "description": "JavaScript HTML renderer", - "website": "https://github.com/MrRio/jsPDF", - "copyright": "Copyright © 2010-2016 James Hall", - "license": "license-mit", - "link": "https://github.com/MrRio/jsPDF/blob/master/MIT-LICENSE.txt" } ] } diff --git a/platform/features/plot/res/templates/plot.html b/platform/features/plot/res/templates/plot.html index e25b582044d..461389e2c17 100644 --- a/platform/features/plot/res/templates/plot.html +++ b/platform/features/plot/res/templates/plot.html @@ -23,11 +23,6 @@ class="abs holder holder-plot has-control-bar">
- - PDF - diff --git a/platform/features/plot/src/PlotController.js b/platform/features/plot/src/PlotController.js index 3b23bce34ae..b5af4407319 100644 --- a/platform/features/plot/src/PlotController.js +++ b/platform/features/plot/src/PlotController.js @@ -368,17 +368,6 @@ define( return this.pending; }; - /** - * Export the plot to PDF - */ - PlotController.prototype.exportPDF = function () { - var self = this; - self.hideExportButtons = true; - self.exportImageService.exportPDF(self.$element[0], "plot.pdf").finally(function () { - self.hideExportButtons = false; - }); - }; - /** * Export the plot to PNG */ diff --git a/platform/features/plot/src/services/ExportImageService.js b/platform/features/plot/src/services/ExportImageService.js index d49adc15eca..8fa02c8bf51 100644 --- a/platform/features/plot/src/services/ExportImageService.js +++ b/platform/features/plot/src/services/ExportImageService.js @@ -26,32 +26,29 @@ define( [ "html2canvas", - "jsPDF", "saveAs" ], function ( html2canvas, - jsPDF, saveAs ) { var self = this; /** * The export image service will export any HTML node to - * PDF, JPG, or PNG. + * JPG, or PNG. * @param {object} $q * @param {object} $timeout * @param {object} $log * @param {constant} EXPORT_IMAGE_TIMEOUT time in milliseconds before a timeout error is returned * @constructor */ - function ExportImageService($q, $timeout, $log, EXPORT_IMAGE_TIMEOUT, injHtml2Canvas, injJsPDF, injSaveAs, injFileReader) { + function ExportImageService($q, $timeout, $log, EXPORT_IMAGE_TIMEOUT, injHtml2Canvas, injSaveAs, injFileReader) { self.$q = $q; self.$timeout = $timeout; self.$log = $log; self.EXPORT_IMAGE_TIMEOUT = EXPORT_IMAGE_TIMEOUT; self.html2canvas = injHtml2Canvas || html2canvas; - self.jsPDF = injJsPDF || jsPDF; self.saveAs = injSaveAs || saveAs; self.reader = injFileReader || new FileReader(); } @@ -128,23 +125,6 @@ define( } } - /** - * Takes a screenshot of a DOM node and exports to PDF. - * @param {node} element to be exported - * @param {string} filename the exported image - * @returns {promise} - */ - ExportImageService.prototype.exportPDF = function (element, filename) { - return renderElement(element, "jpeg").then(function (img) { - self.reader.readAsDataURL(img); - self.reader.onloadend = function () { - var pdf = new self.jsPDF("l", "px", [element.offsetHeight, element.offsetWidth]); - pdf.addImage(self.reader.result, "JPEG", 0, 0, element.offsetWidth, element.offsetHeight); - pdf.save(filename); - }; - }); - }; - /** * Takes a screenshot of a DOM node and exports to JPG. * @param {node} element to be exported diff --git a/platform/features/plot/test/PlotControllerSpec.js b/platform/features/plot/test/PlotControllerSpec.js index 73a01d716a7..482af047cb4 100644 --- a/platform/features/plot/test/PlotControllerSpec.js +++ b/platform/features/plot/test/PlotControllerSpec.js @@ -72,7 +72,7 @@ define( mockElement = angular.element('
'); mockExportImageService = jasmine.createSpyObj( "ExportImageService", - ["exportJPG", "exportPNG", "exportPDF"] + ["exportJPG", "exportPNG"] ); mockFormatter = jasmine.createSpyObj( "formatter", diff --git a/platform/features/plot/test/services/ExportImageServiceSpec.js b/platform/features/plot/test/services/ExportImageServiceSpec.js index 111a8d3432e..675429f4e2f 100644 --- a/platform/features/plot/test/services/ExportImageServiceSpec.js +++ b/platform/features/plot/test/services/ExportImageServiceSpec.js @@ -33,8 +33,6 @@ define( mockLog, mockHtml2Canvas, mockCanvas, - mockJsPDF, - mockJsPDFSave, mockSaveAs, mockFileReader, mockExportTimeoutConstant, @@ -79,13 +77,6 @@ define( "canvas", ["toBlob"] ); - mockJsPDFSave = jasmine.createSpy("jsPDFSave"); - mockJsPDF = function () { - return { - "addImage": function () {}, - "save": mockJsPDFSave - }; - }; mockSaveAs = jasmine.createSpy("saveAs"); mockFileReader = jasmine.createSpyObj( "FileReader", @@ -100,23 +91,11 @@ define( mockLog, mockExportTimeoutConstant, mockHtml2Canvas, - mockJsPDF, mockSaveAs, mockFileReader ); }); - it("runs html2canvas and tries to save a pdf", function () { - exportImageService.exportPDF(testElement, "plot.pdf"); - mockFileReader.onloadend(); - - expect(mockHtml2Canvas).toHaveBeenCalledWith(testElement, { onrendered: jasmine.any(Function) }); - expect(mockCanvas.toBlob).toHaveBeenCalledWith(mockDeferred.resolve, "image/jpeg"); - expect(mockDeferred.reject).not.toHaveBeenCalled(); - expect(mockJsPDFSave).toHaveBeenCalled(); - expect(mockPromise.finally).toHaveBeenCalled(); - }); - it("runs html2canvas and tries to save a png", function () { exportImageService.exportPNG(testElement, "plot.png"); diff --git a/test-main.js b/test-main.js index ff8a50ca6b9..e006094a248 100644 --- a/test-main.js +++ b/test-main.js @@ -55,7 +55,6 @@ requirejs.config({ "csv": "bower_components/comma-separated-values/csv.min", "es6-promise": "bower_components/es6-promise/es6-promise.min", "html2canvas": "bower_components/html2canvas/build/html2canvas.min", - "jsPDF": "bower_components/jspdf/dist/jspdf.debug", "moment": "bower_components/moment/moment", "moment-duration-format": "bower_components/moment-duration-format/lib/moment-duration-format", "saveAs": "bower_components/FileSaver.js/FileSaver.min", From bff4e120a7dfb6d5e1a76258360a31d5764ff818 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 4 Oct 2016 18:23:13 -0700 Subject: [PATCH 64/65] [Tables] Modified selection of scrollable element. Fixes #1216 --- .../src/controllers/MCTTableController.js | 16 ++++++------- .../controllers/MCTTableControllerSpec.js | 23 ++++++++----------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/platform/features/table/src/controllers/MCTTableController.js b/platform/features/table/src/controllers/MCTTableController.js index bf5ea9218c2..d78140f67e3 100644 --- a/platform/features/table/src/controllers/MCTTableController.js +++ b/platform/features/table/src/controllers/MCTTableController.js @@ -1,7 +1,7 @@ define( - [], - function () { + ['zepto'], + function ($) { /** * A controller for the MCTTable directive. Populates scope with @@ -16,13 +16,13 @@ define( var self = this; this.$scope = $scope; - this.element = element; + this.element = $(element[0]); this.$timeout = $timeout; this.maxDisplayRows = 50; - this.scrollable = element.find('div'); - this.thead = element.find('thead'); - this.tbody = element.find('tbody'); + this.scrollable = this.element.find('.l-view-section.scrolling').first(); + this.resultsHeader = this.element.find('.mct-table>thead').first(); + this.sizingTableBody = this.element.find('.sizing-table>tbody').first(); this.$scope.sizingRow = {}; this.scrollable.on('scroll', this.onScroll.bind(this)); @@ -261,8 +261,8 @@ define( * for individual rows. */ MCTTableController.prototype.setElementSizes = function () { - var thead = this.thead, - tbody = this.tbody, + var thead = this.resultsHeader, + tbody = this.sizingTableBody, firstRow = tbody.find('tr'), column = firstRow.find('td'), headerHeight = thead.prop('offsetHeight'), diff --git a/platform/features/table/test/controllers/MCTTableControllerSpec.js b/platform/features/table/test/controllers/MCTTableControllerSpec.js index 94ce7c71c2d..285403423fb 100644 --- a/platform/features/table/test/controllers/MCTTableControllerSpec.js +++ b/platform/features/table/test/controllers/MCTTableControllerSpec.js @@ -22,9 +22,16 @@ define( [ + "zepto", "../../src/controllers/MCTTableController" ], - function (MCTTableController) { + function ($, MCTTableController) { + + var MOCK_ELEMENT_TEMPLATE = + '
' + + '
' + + '
' + + '
'; describe('The MCTTable Controller', function () { @@ -55,19 +62,7 @@ define( watches[event] = callback; }); - mockElement = jasmine.createSpyObj('element', [ - 'find', - 'prop', - 'on' - ]); - mockElement.find.andReturn(mockElement); - mockElement.prop.andReturn(0); - mockElement[0] = { - scrollTop: 0, - scrollHeight: 500, - offsetHeight: 1000 - }; - + mockElement = $(MOCK_ELEMENT_TEMPLATE); mockExportService = jasmine.createSpyObj('exportService', [ 'exportCSV' ]); From f1d2072bb939a486d731b282fa41e4899bd2d5ed Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 5 Oct 2016 11:17:22 -0700 Subject: [PATCH 65/65] Added license information --- platform/features/conductor-v2/conductor/bundle.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/platform/features/conductor-v2/conductor/bundle.js b/platform/features/conductor-v2/conductor/bundle.js index 438cb33715d..e50ecd37939 100644 --- a/platform/features/conductor-v2/conductor/bundle.js +++ b/platform/features/conductor-v2/conductor/bundle.js @@ -111,6 +111,18 @@ define([ "template": timeConductorTemplate } ], + "licenses": [ + { + "name": "D3: Data-Driven Documents", + "version": "4.1.0", + "author": "Mike Bostock", + "description": "D3 (or D3.js) is a JavaScript library for visualizing data using web standards. D3 helps you bring data to life using SVG, Canvas and HTML. D3 combines powerful visualization and interaction techniques with a data-driven approach to DOM manipulation, giving you the full capabilities of modern browsers and the freedom to design the right visual interface for your data.", + "website": "https://d3js.org/", + "copyright": "Copyright 2010-2016 Mike Bostock", + "license": "BSD-3-Clause", + "link": "https://github.com/d3/d3/blob/master/LICENSE" + } + ], "formats": [ { "key": "number",