From 4a609943f9d95c7138ce3ee48772f20e05797ef8 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 10:11:17 -0800 Subject: [PATCH 01/85] [Build] Configure JSHint #671 --- .jshintrc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.jshintrc b/.jshintrc index a8e18932fd..e33c0e0c45 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,4 +1,18 @@ { - "validthis": true, - "laxbreak": true + "bitwise": true, + "curly": true, + "eqeqeq": true, + "esversion": 5, + "freeze": true, + "funcscope": true, + "futurehostile": true, + "latedef": true, + "noarg": true, + "nocomma": true, + "nonbsp": true, + "nonew": true, + "predef": [ "define" ], + "strict": "implied", + "undef": true, + "unused": true } From 91fb82d2121f5ef456cec082316787180f0c552f Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 10:14:37 -0800 Subject: [PATCH 02/85] [Build] Remove esversion: 5 from lint cfg ...as this is apparently presumed. --- .jshintrc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.jshintrc b/.jshintrc index e33c0e0c45..3448f91e42 100644 --- a/.jshintrc +++ b/.jshintrc @@ -2,7 +2,6 @@ "bitwise": true, "curly": true, "eqeqeq": true, - "esversion": 5, "freeze": true, "funcscope": true, "futurehostile": true, @@ -11,8 +10,8 @@ "nocomma": true, "nonbsp": true, "nonew": true, - "predef": [ "define" ], + "predef": ["define"], "strict": "implied", "undef": true, "unused": true -} +} \ No newline at end of file From 28ae62b4acd9c00765d4973659f7d1e7ef47f1d0 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 10:21:12 -0800 Subject: [PATCH 03/85] [Build] Add script for JSHint migration To remove boilerplate which JSHint neither expects nor like. --- scripts/migrate-for-jshint.js | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 scripts/migrate-for-jshint.js diff --git a/scripts/migrate-for-jshint.js b/scripts/migrate-for-jshint.js new file mode 100644 index 0000000000..d86abc12aa --- /dev/null +++ b/scripts/migrate-for-jshint.js @@ -0,0 +1,49 @@ +/***************************************************************************** + * 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. + *****************************************************************************/ + +// Converts all templateUrl references in bundle.js files to +// plain template references, loading said templates with the +// RequireJS text plugin. + +var glob = require('glob'), + fs = require('fs'); + +function migrate(file) { + var sourceCode = fs.readFileSync(file, 'utf8'), + lines = sourceCode.split('\n') + .filter(function (line) { + return line.trim().replace("'", '"') !== '"use strict";'; + }) + .filter(function (line) { + return line.indexOf("/*global") !== 0; + }); + fs.writeFileSync(file, lines.join('\n')); +} + +glob('platform/**/*.js', {}, function (err, files) { + if (err) { + console.log(err); + return; + } + + files.forEach(migrate); +}); From f092bfe653c5b5a573a8e743aa7c992b91f866a7 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 10:27:34 -0800 Subject: [PATCH 04/85] [Build] Don't lint specs --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index fa832d1aa6..1724192224 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -98,7 +98,7 @@ gulp.task('stylesheets', function () { }); gulp.task('lint', function () { - return gulp.src(paths.scripts) + return gulp.src(paths.scripts.concat(['!**/test/*', '!**/*Spec.js'])) .pipe(jshint()) .pipe(jshint.reporter('default')) .pipe(jshint.reporter('fail')); From 02b806ebe0191fafc9b8f4bd5cadcfafd37d8fe3 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 10:27:59 -0800 Subject: [PATCH 05/85] [Build] Remove main.js boilerplate ...to satisfy JSHint --- main.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main.js b/main.js index 452fe3e823..739cf056cd 100644 --- a/main.js +++ b/main.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 define, window, requirejs*/ +/*global requirejs*/ requirejs.config({ "paths": { @@ -93,8 +93,6 @@ define([ './example/eventGenerator/bundle', './example/generator/bundle' ], function (Main, legacyRegistry) { - 'use strict'; - return { legacyRegistry: legacyRegistry, run: function () { From bc8aafbb1ff1609ee78b9b95f2c617f6a455f51c Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 10:36:10 -0800 Subject: [PATCH 06/85] [Build] Define more common globals --- .jshintrc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.jshintrc b/.jshintrc index 3448f91e42..b3d3868d70 100644 --- a/.jshintrc +++ b/.jshintrc @@ -10,7 +10,11 @@ "nocomma": true, "nonbsp": true, "nonew": true, - "predef": ["define"], + "predef": [ + "define", + "Blob", + "Promise" + ], "strict": "implied", "undef": true, "unused": true From 377786caf96f92fa4cab8e221a5269e86c6b9f94 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 10:36:28 -0800 Subject: [PATCH 07/85] [Build] Fix lint exclusions --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 1724192224..6a8c790c8b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -98,7 +98,7 @@ gulp.task('stylesheets', function () { }); gulp.task('lint', function () { - return gulp.src(paths.scripts.concat(['!**/test/*', '!**/*Spec.js'])) + return gulp.src(paths.scripts.concat(['!**/test/**/*.js', '!**/*Spec.js'])) .pipe(jshint()) .pipe(jshint.reporter('default')) .pipe(jshint.reporter('fail')); From 9f840aa0fdaf94bb76fe2c3b5d25d897abc2fb21 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 10:36:49 -0800 Subject: [PATCH 08/85] [Build] Tweak migration script --- scripts/migrate-for-jshint.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/migrate-for-jshint.js b/scripts/migrate-for-jshint.js index d86abc12aa..77a7c14569 100644 --- a/scripts/migrate-for-jshint.js +++ b/scripts/migrate-for-jshint.js @@ -31,7 +31,7 @@ function migrate(file) { var sourceCode = fs.readFileSync(file, 'utf8'), lines = sourceCode.split('\n') .filter(function (line) { - return line.trim().replace("'", '"') !== '"use strict";'; + return !(/^\W*['"]use strict['"];\W*$/.test(line)); }) .filter(function (line) { return line.indexOf("/*global") !== 0; @@ -39,7 +39,7 @@ function migrate(file) { fs.writeFileSync(file, lines.join('\n')); } -glob('platform/**/*.js', {}, function (err, files) { +glob('@(src|platform)/**/*.js', {}, function (err, files) { if (err) { console.log(err); return; From ac5ac8d34eedc76d8fbd78ae5898343f363f97f6 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 10:46:38 -0800 Subject: [PATCH 09/85] [Build] Remove boilerplate from scripts No longer necessary after JSHint configuration. --- platform/commonUI/about/bundle.js | 2 -- platform/commonUI/about/src/AboutController.js | 2 -- platform/commonUI/about/src/LicenseController.js | 2 -- platform/commonUI/about/src/LogoController.js | 2 -- platform/commonUI/about/test/AboutControllerSpec.js | 2 -- platform/commonUI/about/test/LicenseControllerSpec.js | 2 -- platform/commonUI/about/test/LogoControllerSpec.js | 2 -- platform/commonUI/browse/bundle.js | 2 -- platform/commonUI/browse/src/BrowseController.js | 2 -- platform/commonUI/browse/src/BrowseObjectController.js | 2 -- platform/commonUI/browse/src/InspectorRegion.js | 2 -- platform/commonUI/browse/src/MenuArrowController.js | 2 -- platform/commonUI/browse/src/PaneController.js | 2 -- platform/commonUI/browse/src/creation/AddAction.js | 2 -- platform/commonUI/browse/src/creation/AddActionProvider.js | 2 -- platform/commonUI/browse/src/creation/CreateAction.js | 2 -- platform/commonUI/browse/src/creation/CreateActionProvider.js | 2 -- platform/commonUI/browse/src/creation/CreateMenuController.js | 2 -- platform/commonUI/browse/src/creation/CreateWizard.js | 2 -- platform/commonUI/browse/src/creation/CreationPolicy.js | 2 -- platform/commonUI/browse/src/creation/CreationService.js | 2 -- platform/commonUI/browse/src/creation/LocatorController.js | 2 -- platform/commonUI/browse/src/navigation/NavigateAction.js | 2 -- platform/commonUI/browse/src/navigation/NavigationService.js | 2 -- platform/commonUI/browse/src/windowing/FullscreenAction.js | 2 -- platform/commonUI/browse/src/windowing/NewTabAction.js | 2 -- platform/commonUI/browse/src/windowing/WindowTitler.js | 2 -- platform/commonUI/browse/test/BrowseControllerSpec.js | 2 -- platform/commonUI/browse/test/BrowseObjectControllerSpec.js | 2 -- platform/commonUI/browse/test/InspectorRegionSpec.js | 2 -- platform/commonUI/browse/test/MenuArrowControllerSpec.js | 2 -- platform/commonUI/browse/test/PaneControllerSpec.js | 2 -- platform/commonUI/browse/test/creation/AddActionProviderSpec.js | 2 -- .../commonUI/browse/test/creation/CreateActionProviderSpec.js | 2 -- platform/commonUI/browse/test/creation/CreateActionSpec.js | 2 -- .../commonUI/browse/test/creation/CreateMenuControllerSpec.js | 2 -- platform/commonUI/browse/test/creation/CreateWizardSpec.js | 2 -- platform/commonUI/browse/test/creation/CreationPolicySpec.js | 2 -- platform/commonUI/browse/test/creation/CreationServiceSpec.js | 2 -- platform/commonUI/browse/test/creation/LocatorControllerSpec.js | 2 -- platform/commonUI/browse/test/navigation/NavigateActionSpec.js | 2 -- .../commonUI/browse/test/navigation/NavigationServiceSpec.js | 2 -- platform/commonUI/browse/test/windowing/FullscreenActionSpec.js | 2 -- platform/commonUI/browse/test/windowing/NewTabActionSpec.js | 2 -- platform/commonUI/browse/test/windowing/WindowTitlerSpec.js | 2 -- platform/commonUI/dialog/bundle.js | 2 -- platform/commonUI/dialog/src/DialogService.js | 2 -- platform/commonUI/dialog/src/OverlayService.js | 2 -- platform/commonUI/dialog/test/DialogServiceSpec.js | 2 -- platform/commonUI/dialog/test/OverlayServiceSpec.js | 2 -- platform/commonUI/edit/bundle.js | 2 -- platform/commonUI/edit/src/actions/CancelAction.js | 2 -- platform/commonUI/edit/src/actions/EditAction.js | 2 -- platform/commonUI/edit/src/actions/LinkAction.js | 2 -- platform/commonUI/edit/src/actions/PropertiesAction.js | 2 -- platform/commonUI/edit/src/actions/PropertiesDialog.js | 2 -- platform/commonUI/edit/src/actions/RemoveAction.js | 2 -- platform/commonUI/edit/src/actions/SaveAction.js | 2 -- .../commonUI/edit/src/capabilities/EditableActionCapability.js | 2 -- .../edit/src/capabilities/EditableCompositionCapability.js | 2 -- .../commonUI/edit/src/capabilities/EditableContextCapability.js | 2 -- .../edit/src/capabilities/EditableInstantiationCapability.js | 2 -- .../commonUI/edit/src/capabilities/EditableLookupCapability.js | 2 -- .../edit/src/capabilities/EditablePersistenceCapability.js | 2 -- .../edit/src/capabilities/EditableRelationshipCapability.js | 2 -- platform/commonUI/edit/src/capabilities/EditorCapability.js | 2 -- platform/commonUI/edit/src/controllers/EditActionController.js | 2 -- platform/commonUI/edit/src/controllers/EditObjectController.js | 2 -- platform/commonUI/edit/src/controllers/EditPanesController.js | 2 -- platform/commonUI/edit/src/controllers/ElementsController.js | 2 -- platform/commonUI/edit/src/directives/MCTBeforeUnload.js | 2 -- platform/commonUI/edit/src/objects/EditableDomainObject.js | 2 -- platform/commonUI/edit/src/objects/EditableDomainObjectCache.js | 2 -- platform/commonUI/edit/src/objects/EditableModelCache.js | 2 -- platform/commonUI/edit/src/policies/EditActionPolicy.js | 2 -- platform/commonUI/edit/src/policies/EditNavigationPolicy.js | 2 -- platform/commonUI/edit/src/policies/EditableViewPolicy.js | 2 -- platform/commonUI/edit/src/representers/EditRepresenter.js | 2 -- platform/commonUI/edit/src/representers/EditToolbar.js | 2 -- .../commonUI/edit/src/representers/EditToolbarRepresenter.js | 2 -- platform/commonUI/edit/src/representers/EditToolbarSelection.js | 2 -- platform/commonUI/edit/test/actions/CancelActionSpec.js | 2 -- platform/commonUI/edit/test/actions/EditActionSpec.js | 2 -- platform/commonUI/edit/test/actions/LinkActionSpec.js | 2 -- platform/commonUI/edit/test/actions/PropertiesActionSpec.js | 2 -- platform/commonUI/edit/test/actions/PropertiesDialogSpec.js | 2 -- platform/commonUI/edit/test/actions/RemoveActionSpec.js | 2 -- platform/commonUI/edit/test/actions/SaveActionSpec.js | 2 -- .../edit/test/capabilities/EditableCompositionCapabilitySpec.js | 2 -- .../edit/test/capabilities/EditableContextCapabilitySpec.js | 2 -- .../edit/test/capabilities/EditableLookupCapabilitySpec.js | 2 -- .../edit/test/capabilities/EditablePersistenceCapabilitySpec.js | 2 -- .../test/capabilities/EditableRelationshipCapabilitySpec.js | 2 -- .../commonUI/edit/test/capabilities/EditorCapabilitySpec.js | 2 -- .../commonUI/edit/test/controllers/EditActionControllerSpec.js | 2 -- platform/commonUI/edit/test/controllers/EditControllerSpec.js | 2 -- .../commonUI/edit/test/controllers/EditPanesControllerSpec.js | 2 -- platform/commonUI/edit/test/directives/MCTBeforeUnloadSpec.js | 2 -- .../commonUI/edit/test/objects/EditableDomainObjectCacheSpec.js | 2 -- platform/commonUI/edit/test/objects/EditableDomainObjectSpec.js | 2 -- platform/commonUI/edit/test/objects/EditableModelCacheSpec.js | 2 -- platform/commonUI/edit/test/policies/EditActionPolicySpec.js | 2 -- platform/commonUI/edit/test/policies/EditableViewPolicySpec.js | 2 -- platform/commonUI/edit/test/representers/EditRepresenterSpec.js | 2 -- .../edit/test/representers/EditToolbarRepresenterSpec.js | 2 -- .../commonUI/edit/test/representers/EditToolbarSelectionSpec.js | 2 -- platform/commonUI/edit/test/representers/EditToolbarSpec.js | 2 -- platform/commonUI/formats/bundle.js | 2 -- platform/commonUI/formats/src/FormatProvider.js | 2 -- platform/commonUI/formats/src/UTCTimeFormat.js | 2 -- platform/commonUI/formats/test/FormatProviderSpec.js | 2 -- platform/commonUI/formats/test/UTCTimeFormatSpec.js | 2 -- platform/commonUI/general/bundle.js | 2 -- platform/commonUI/general/src/SplashScreenManager.js | 2 -- platform/commonUI/general/src/StyleSheetLoader.js | 2 -- platform/commonUI/general/src/UnsupportedBrowserWarning.js | 2 -- .../commonUI/general/src/controllers/ActionGroupController.js | 2 -- platform/commonUI/general/src/controllers/BannerController.js | 2 -- .../commonUI/general/src/controllers/BottomBarController.js | 2 -- .../commonUI/general/src/controllers/ClickAwayController.js | 2 -- .../commonUI/general/src/controllers/ContextMenuController.js | 2 -- .../commonUI/general/src/controllers/DateTimeFieldController.js | 2 -- .../general/src/controllers/DateTimePickerController.js | 2 -- .../commonUI/general/src/controllers/GetterSetterController.js | 2 -- .../general/src/controllers/ObjectInspectorController.js | 2 -- platform/commonUI/general/src/controllers/SelectorController.js | 2 -- .../commonUI/general/src/controllers/TimeRangeController.js | 2 -- platform/commonUI/general/src/controllers/ToggleController.js | 2 -- platform/commonUI/general/src/controllers/TreeNodeController.js | 2 -- .../commonUI/general/src/controllers/ViewSwitcherController.js | 2 -- platform/commonUI/general/src/directives/MCTClickElsewhere.js | 2 -- platform/commonUI/general/src/directives/MCTContainer.js | 2 -- platform/commonUI/general/src/directives/MCTDrag.js | 2 -- platform/commonUI/general/src/directives/MCTPopup.js | 2 -- platform/commonUI/general/src/directives/MCTResize.js | 2 -- platform/commonUI/general/src/directives/MCTScroll.js | 2 -- platform/commonUI/general/src/directives/MCTSplitPane.js | 2 -- platform/commonUI/general/src/directives/MCTSplitter.js | 2 -- platform/commonUI/general/src/filters/ReverseFilter.js | 2 -- platform/commonUI/general/src/services/Popup.js | 2 -- platform/commonUI/general/src/services/PopupService.js | 2 -- platform/commonUI/general/src/services/UrlService.js | 2 -- platform/commonUI/general/test/SplashScreenManagerSpec.js | 2 -- platform/commonUI/general/test/StyleSheetLoaderSpec.js | 2 -- platform/commonUI/general/test/UnsupportedBrowserWarningSpec.js | 2 -- .../general/test/controllers/ActionGroupControllerSpec.js | 2 -- .../general/test/controllers/BottomBarControllerSpec.js | 2 -- .../general/test/controllers/ClickAwayControllerSpec.js | 2 -- .../general/test/controllers/ContextMenuControllerSpec.js | 2 -- .../general/test/controllers/DateTimeFieldControllerSpec.js | 2 -- .../general/test/controllers/DateTimePickerControllerSpec.js | 2 -- .../general/test/controllers/GetterSetterControllerSpec.js | 2 -- .../general/test/controllers/ObjectInspectorControllerSpec.js | 2 -- .../commonUI/general/test/controllers/SelectorControllerSpec.js | 2 -- .../general/test/controllers/TimeRangeControllerSpec.js | 2 -- .../commonUI/general/test/controllers/ToggleControllerSpec.js | 2 -- .../commonUI/general/test/controllers/TreeNodeControllerSpec.js | 2 -- .../general/test/controllers/ViewSwitcherControllerSpec.js | 2 -- .../commonUI/general/test/directives/MCTClickElsewhereSpec.js | 2 -- platform/commonUI/general/test/directives/MCTContainerSpec.js | 2 -- platform/commonUI/general/test/directives/MCTDragSpec.js | 2 -- platform/commonUI/general/test/directives/MCTPopupSpec.js | 2 -- platform/commonUI/general/test/directives/MCTResizeSpec.js | 2 -- platform/commonUI/general/test/directives/MCTScrollSpec.js | 2 -- platform/commonUI/general/test/directives/MCTSplitPaneSpec.js | 2 -- platform/commonUI/general/test/directives/MCTSplitterSpec.js | 2 -- platform/commonUI/general/test/filters/ReverseFilterSpec.js | 2 -- platform/commonUI/general/test/services/PopupServiceSpec.js | 2 -- platform/commonUI/general/test/services/PopupSpec.js | 2 -- platform/commonUI/general/test/services/UrlServiceSpec.js | 2 -- platform/commonUI/inspect/bundle.js | 2 -- platform/commonUI/inspect/src/InfoConstants.js | 1 - platform/commonUI/inspect/src/gestures/InfoButtonGesture.js | 2 -- platform/commonUI/inspect/src/gestures/InfoGesture.js | 2 -- platform/commonUI/inspect/src/services/InfoService.js | 2 -- .../commonUI/inspect/test/gestures/InfoButtonGestureSpec.js | 2 -- platform/commonUI/inspect/test/gestures/InfoGestureSpec.js | 2 -- platform/commonUI/inspect/test/services/InfoServiceSpec.js | 2 -- platform/commonUI/mobile/bundle.js | 2 -- platform/commonUI/mobile/src/AgentService.js | 2 -- platform/commonUI/mobile/src/DeviceClassifier.js | 2 -- platform/commonUI/mobile/src/DeviceMatchers.js | 2 -- platform/commonUI/mobile/src/MCTDevice.js | 2 -- platform/commonUI/mobile/test/AgentServiceSpec.js | 2 -- platform/commonUI/mobile/test/DeviceClassifierSpec.js | 2 -- platform/commonUI/mobile/test/DeviceMatchersSpec.js | 2 -- platform/commonUI/mobile/test/MCTDeviceSpec.js | 2 -- platform/commonUI/notification/bundle.js | 2 -- platform/commonUI/notification/src/NotificationIndicator.js | 2 -- .../notification/src/NotificationIndicatorController.js | 2 -- platform/commonUI/notification/src/NotificationService.js | 2 -- .../notification/test/NotificationIndicatorControllerSpec.js | 2 -- platform/commonUI/notification/test/NotificationServiceSpec.js | 2 -- platform/commonUI/regions/bundle.js | 2 -- platform/commonUI/regions/src/EditableRegionPolicy.js | 2 -- platform/commonUI/regions/src/InspectorController.js | 2 -- platform/commonUI/regions/src/Region.js | 2 -- platform/commonUI/regions/test/EditableRegionPolicySpec.js | 2 -- platform/commonUI/regions/test/InspectorControllerSpec.js | 2 -- platform/commonUI/regions/test/RegionSpec.js | 2 -- platform/commonUI/themes/espresso/bundle.js | 2 -- platform/commonUI/themes/snow/bundle.js | 2 -- platform/containment/bundle.js | 2 -- platform/containment/src/CapabilityTable.js | 2 -- platform/containment/src/ComposeActionPolicy.js | 2 -- platform/containment/src/CompositionModelPolicy.js | 2 -- platform/containment/src/CompositionMutabilityPolicy.js | 2 -- platform/containment/src/CompositionPolicy.js | 2 -- platform/containment/src/ContainmentTable.js | 2 -- platform/containment/test/CapabilityTableSpec.js | 2 -- platform/containment/test/ComposeActionPolicySpec.js | 2 -- platform/containment/test/CompositionModelPolicySpec.js | 2 -- platform/containment/test/CompositionMutabilityPolicySpec.js | 2 -- platform/containment/test/CompositionPolicySpec.js | 2 -- platform/containment/test/ContainmentTableSpec.js | 2 -- platform/core/bundle.js | 2 -- platform/core/src/actions/ActionAggregator.js | 2 -- platform/core/src/actions/ActionCapability.js | 2 -- platform/core/src/actions/ActionProvider.js | 2 -- platform/core/src/actions/LoggingActionDecorator.js | 2 -- platform/core/src/capabilities/CompositionCapability.js | 2 -- platform/core/src/capabilities/ContextCapability.js | 2 -- platform/core/src/capabilities/ContextualDomainObject.js | 2 -- platform/core/src/capabilities/CoreCapabilityProvider.js | 2 -- platform/core/src/capabilities/DelegationCapability.js | 2 -- platform/core/src/capabilities/InstantiationCapability.js | 2 -- platform/core/src/capabilities/MetadataCapability.js | 2 -- platform/core/src/capabilities/MutationCapability.js | 2 -- platform/core/src/capabilities/PersistenceCapability.js | 2 -- platform/core/src/capabilities/RelationshipCapability.js | 2 -- platform/core/src/identifiers/Identifier.js | 2 -- platform/core/src/identifiers/IdentifierProvider.js | 2 -- platform/core/src/models/CachingModelDecorator.js | 2 -- platform/core/src/models/MissingModelDecorator.js | 2 -- platform/core/src/models/ModelAggregator.js | 2 -- platform/core/src/models/PersistedModelProvider.js | 2 -- platform/core/src/models/RootModelProvider.js | 2 -- platform/core/src/models/StaticModelProvider.js | 2 -- platform/core/src/objects/DomainObjectImpl.js | 2 -- platform/core/src/objects/DomainObjectProvider.js | 2 -- platform/core/src/services/Contextualize.js | 2 -- platform/core/src/services/Instantiate.js | 2 -- platform/core/src/services/Now.js | 2 -- platform/core/src/services/Throttle.js | 2 -- platform/core/src/services/Topic.js | 2 -- platform/core/src/types/MergeModels.js | 2 -- platform/core/src/types/TypeCapability.js | 2 -- platform/core/src/types/TypeImpl.js | 2 -- platform/core/src/types/TypeProperty.js | 2 -- platform/core/src/types/TypePropertyConversion.js | 2 -- platform/core/src/types/TypeProvider.js | 2 -- platform/core/src/views/ViewCapability.js | 2 -- platform/core/src/views/ViewProvider.js | 2 -- platform/core/test/actions/ActionAggregatorSpec.js | 2 -- platform/core/test/actions/ActionCapabilitySpec.js | 2 -- platform/core/test/actions/ActionProviderSpec.js | 2 -- platform/core/test/actions/LoggingActionDecoratorSpec.js | 2 -- platform/core/test/capabilities/CompositionCapabilitySpec.js | 2 -- platform/core/test/capabilities/ContextCapabilitySpec.js | 2 -- platform/core/test/capabilities/ContextualDomainObjectSpec.js | 2 -- platform/core/test/capabilities/CoreCapabilityProviderSpec.js | 2 -- platform/core/test/capabilities/DelegationCapabilitySpec.js | 2 -- platform/core/test/capabilities/InstantiationCapabilitySpec.js | 2 -- platform/core/test/capabilities/MetadataCapabilitySpec.js | 2 -- platform/core/test/capabilities/MutationCapabilitySpec.js | 2 -- platform/core/test/capabilities/PersistenceCapabilitySpec.js | 2 -- platform/core/test/capabilities/RelationshipCapabilitySpec.js | 2 -- platform/core/test/identifiers/IdentifierProviderSpec.js | 2 -- platform/core/test/identifiers/IdentifierSpec.js | 2 -- platform/core/test/models/CachingModelDecoratorSpec.js | 2 -- platform/core/test/models/MissingModelDecoratorSpec.js | 2 -- platform/core/test/models/ModelAggregatorSpec.js | 2 -- platform/core/test/models/PersistedModelProviderSpec.js | 2 -- platform/core/test/models/RootModelProviderSpec.js | 2 -- platform/core/test/models/StaticModelProviderSpec.js | 2 -- platform/core/test/objects/DomainObjectProviderSpec.js | 2 -- platform/core/test/objects/DomainObjectSpec.js | 2 -- platform/core/test/services/ContextualizeSpec.js | 2 -- platform/core/test/services/InstantiateSpec.js | 2 -- platform/core/test/services/NowSpec.js | 2 -- platform/core/test/services/ThrottleSpec.js | 2 -- platform/core/test/services/TopicSpec.js | 2 -- platform/core/test/types/MergeModelsSpec.js | 2 -- platform/core/test/types/TypeCapabilitySpec.js | 2 -- platform/core/test/types/TypeImplSpec.js | 2 -- platform/core/test/types/TypePropertyConversionSpec.js | 2 -- platform/core/test/types/TypePropertySpec.js | 2 -- platform/core/test/types/TypeProviderSpec.js | 2 -- platform/core/test/views/ViewCapabilitySpec.js | 2 -- platform/core/test/views/ViewProviderSpec.js | 2 -- platform/entanglement/bundle.js | 2 -- platform/entanglement/src/actions/AbstractComposeAction.js | 2 -- platform/entanglement/src/actions/CopyAction.js | 2 -- platform/entanglement/src/actions/GoToOriginalAction.js | 2 -- platform/entanglement/src/actions/LinkAction.js | 2 -- platform/entanglement/src/actions/MoveAction.js | 2 -- platform/entanglement/src/actions/SetPrimaryLocationAction.js | 2 -- platform/entanglement/src/capabilities/LocationCapability.js | 2 -- platform/entanglement/src/policies/CrossSpacePolicy.js | 2 -- platform/entanglement/src/services/CopyService.js | 2 -- platform/entanglement/src/services/CopyTask.js | 2 -- platform/entanglement/src/services/LinkService.js | 2 -- platform/entanglement/src/services/LocatingCreationDecorator.js | 2 -- platform/entanglement/src/services/LocatingObjectDecorator.js | 2 -- platform/entanglement/src/services/LocationService.js | 2 -- platform/entanglement/src/services/MoveService.js | 2 -- platform/entanglement/test/ControlledPromise.js | 1 - platform/entanglement/test/DomainObjectFactory.js | 2 -- platform/entanglement/test/actions/AbstractComposeActionSpec.js | 2 -- platform/entanglement/test/actions/CopyActionSpec.js | 2 -- platform/entanglement/test/actions/GoToOriginalActionSpec.js | 2 -- platform/entanglement/test/actions/LinkActionSpec.js | 2 -- platform/entanglement/test/actions/MoveActionSpec.js | 2 -- .../entanglement/test/actions/SetPrimaryLocationActionSpec.js | 2 -- .../entanglement/test/capabilities/LocationCapabilitySpec.js | 2 -- platform/entanglement/test/policies/CrossSpacePolicySpec.js | 2 -- platform/entanglement/test/services/CopyServiceSpec.js | 2 -- platform/entanglement/test/services/CopyTaskSpec.js | 2 -- platform/entanglement/test/services/LinkServiceSpec.js | 2 -- .../entanglement/test/services/LocatingCreationDecoratorSpec.js | 2 -- .../entanglement/test/services/LocatingObjectDecoratorSpec.js | 2 -- platform/entanglement/test/services/LocationServiceSpec.js | 2 -- platform/entanglement/test/services/MockCopyService.js | 2 -- platform/entanglement/test/services/MockLinkService.js | 2 -- platform/entanglement/test/services/MockMoveService.js | 2 -- platform/entanglement/test/services/MoveServiceSpec.js | 2 -- platform/execution/bundle.js | 2 -- platform/execution/src/WorkerService.js | 2 -- platform/execution/test/WorkerServiceSpec.js | 2 -- platform/exporters/ExportService.js | 1 - platform/exporters/ExportServiceSpec.js | 2 -- platform/exporters/bundle.js | 2 -- platform/features/clock/bundle.js | 2 -- platform/features/clock/src/actions/AbstractStartTimerAction.js | 2 -- platform/features/clock/src/actions/RestartTimerAction.js | 2 -- platform/features/clock/src/actions/StartTimerAction.js | 2 -- platform/features/clock/src/controllers/ClockController.js | 2 -- platform/features/clock/src/controllers/RefreshingController.js | 2 -- platform/features/clock/src/controllers/TimerController.js | 2 -- platform/features/clock/src/controllers/TimerFormatter.js | 2 -- platform/features/clock/src/indicators/ClockIndicator.js | 2 -- platform/features/clock/src/services/TickerService.js | 2 -- .../features/clock/test/actions/AbstractStartTimerActionSpec.js | 2 -- platform/features/clock/test/actions/RestartTimerActionSpec.js | 2 -- platform/features/clock/test/actions/StartTimerActionSpec.js | 2 -- platform/features/clock/test/controllers/ClockControllerSpec.js | 2 -- .../features/clock/test/controllers/RefreshingControllerSpec.js | 2 -- platform/features/clock/test/controllers/TimerControllerSpec.js | 2 -- platform/features/clock/test/controllers/TimerFormatterSpec.js | 2 -- platform/features/clock/test/indicators/ClockIndicatorSpec.js | 2 -- platform/features/clock/test/services/TickerServiceSpec.js | 2 -- platform/features/conductor/bundle.js | 2 -- platform/features/conductor/src/ConductorRepresenter.js | 2 -- platform/features/conductor/src/ConductorService.js | 2 -- platform/features/conductor/src/ConductorTelemetryDecorator.js | 2 -- platform/features/conductor/src/TimeConductor.js | 2 -- platform/features/conductor/test/ConductorRepresenterSpec.js | 2 -- platform/features/conductor/test/ConductorServiceSpec.js | 2 -- .../features/conductor/test/ConductorTelemetryDecoratorSpec.js | 2 -- platform/features/conductor/test/TestTimeConductor.js | 2 -- platform/features/conductor/test/TimeConductorSpec.js | 2 -- platform/features/events/bundle.js | 2 -- platform/features/events/src/DomainColumn.js | 2 -- platform/features/events/src/EventListController.js | 2 -- platform/features/events/src/EventListPopulator.js | 2 -- platform/features/events/src/RangeColumn.js | 2 -- platform/features/events/src/directives/MCTDataTable.js | 2 -- platform/features/events/src/policies/MessagesViewPolicy.js | 2 -- platform/features/events/test/DomainColumnSpec.js | 2 -- platform/features/events/test/EventListControllerSpec.js | 2 -- platform/features/events/test/EventListPopulatorSpec.js | 2 -- platform/features/events/test/RangeColumnSpec.js | 2 -- .../features/events/test/policies/MessagesViewPolicySpec.js | 2 -- platform/features/imagery/bundle.js | 2 -- platform/features/imagery/src/controllers/ImageryController.js | 2 -- platform/features/imagery/src/directives/MCTBackgroundImage.js | 2 -- platform/features/imagery/src/policies/ImageryViewPolicy.js | 2 -- .../features/imagery/test/controllers/ImageryControllerSpec.js | 2 -- .../features/imagery/test/directives/MCTBackgroundImageSpec.js | 2 -- .../features/imagery/test/policies/ImageryViewPolicySpec.js | 2 -- platform/features/layout/bundle.js | 2 -- platform/features/layout/src/FixedController.js | 2 -- platform/features/layout/src/FixedDragHandle.js | 2 -- platform/features/layout/src/FixedProxy.js | 2 -- platform/features/layout/src/LayoutCompositionPolicy.js | 2 -- platform/features/layout/src/LayoutController.js | 2 -- platform/features/layout/src/LayoutDrag.js | 2 -- platform/features/layout/src/elements/AccessorMutator.js | 2 -- platform/features/layout/src/elements/BoxProxy.js | 2 -- platform/features/layout/src/elements/ElementFactory.js | 2 -- platform/features/layout/src/elements/ElementProxies.js | 2 -- platform/features/layout/src/elements/ElementProxy.js | 2 -- platform/features/layout/src/elements/ImageProxy.js | 2 -- platform/features/layout/src/elements/LineHandle.js | 2 -- platform/features/layout/src/elements/LineProxy.js | 2 -- platform/features/layout/src/elements/ResizeHandle.js | 2 -- platform/features/layout/src/elements/TelemetryProxy.js | 2 -- platform/features/layout/src/elements/TextProxy.js | 2 -- platform/features/layout/test/FixedControllerSpec.js | 2 -- platform/features/layout/test/FixedDragHandleSpec.js | 2 -- platform/features/layout/test/FixedProxySpec.js | 2 -- platform/features/layout/test/LayoutCompositionPolicySpec.js | 2 -- platform/features/layout/test/LayoutControllerSpec.js | 2 -- platform/features/layout/test/LayoutDragSpec.js | 2 -- platform/features/layout/test/elements/AccessorMutatorSpec.js | 2 -- platform/features/layout/test/elements/BoxProxySpec.js | 2 -- platform/features/layout/test/elements/ElementFactorySpec.js | 2 -- platform/features/layout/test/elements/ElementProxiesSpec.js | 2 -- platform/features/layout/test/elements/ElementProxySpec.js | 2 -- platform/features/layout/test/elements/ImageProxySpec.js | 2 -- platform/features/layout/test/elements/LineHandleSpec.js | 2 -- platform/features/layout/test/elements/LineProxySpec.js | 2 -- platform/features/layout/test/elements/ResizeHandleSpec.js | 2 -- platform/features/layout/test/elements/TelemetryProxySpec.js | 2 -- platform/features/layout/test/elements/TextProxySpec.js | 2 -- platform/features/pages/bundle.js | 2 -- platform/features/pages/src/EmbeddedPageController.js | 2 -- platform/features/pages/test/EmbeddedPageControllerSpec.js | 2 -- platform/features/plot/bundle.js | 2 -- platform/features/plot/src/Canvas2DChart.js | 2 -- platform/features/plot/src/GLChart.js | 2 -- platform/features/plot/src/MCTChart.js | 2 -- platform/features/plot/src/PlotController.js | 2 -- platform/features/plot/src/PlotOptionsController.js | 2 -- platform/features/plot/src/PlotOptionsForm.js | 2 -- platform/features/plot/src/SubPlot.js | 2 -- platform/features/plot/src/SubPlotFactory.js | 2 -- platform/features/plot/src/elements/PlotAxis.js | 2 -- platform/features/plot/src/elements/PlotLimitTracker.js | 2 -- platform/features/plot/src/elements/PlotLine.js | 2 -- platform/features/plot/src/elements/PlotLineBuffer.js | 2 -- platform/features/plot/src/elements/PlotPalette.js | 2 -- platform/features/plot/src/elements/PlotPanZoomStack.js | 2 -- platform/features/plot/src/elements/PlotPanZoomStackGroup.js | 2 -- platform/features/plot/src/elements/PlotPosition.js | 2 -- platform/features/plot/src/elements/PlotPreparer.js | 2 -- platform/features/plot/src/elements/PlotSeriesWindow.js | 2 -- platform/features/plot/src/elements/PlotTelemetryFormatter.js | 2 -- platform/features/plot/src/elements/PlotTickGenerator.js | 2 -- platform/features/plot/src/elements/PlotUpdater.js | 2 -- platform/features/plot/src/modes/PlotModeOptions.js | 2 -- platform/features/plot/src/modes/PlotOverlayMode.js | 2 -- platform/features/plot/src/modes/PlotStackMode.js | 2 -- platform/features/plot/src/policies/PlotViewPolicy.js | 2 -- platform/features/plot/test/Canvas2DChartSpec.js | 2 -- platform/features/plot/test/GLChartSpec.js | 2 -- platform/features/plot/test/MCTChartSpec.js | 2 -- platform/features/plot/test/PlotControllerSpec.js | 2 -- platform/features/plot/test/PlotOptionsControllerSpec.js | 2 -- platform/features/plot/test/PlotOptionsFormSpec.js | 2 -- platform/features/plot/test/SubPlotFactorySpec.js | 2 -- platform/features/plot/test/SubPlotSpec.js | 2 -- platform/features/plot/test/elements/PlotAxisSpec.js | 2 -- platform/features/plot/test/elements/PlotLimitTrackerSpec.js | 2 -- platform/features/plot/test/elements/PlotLineBufferSpec.js | 2 -- platform/features/plot/test/elements/PlotLineSpec.js | 2 -- platform/features/plot/test/elements/PlotPaletteSpec.js | 2 -- .../features/plot/test/elements/PlotPanZoomStackGroupSpec.js | 2 -- platform/features/plot/test/elements/PlotPanZoomStackSpec.js | 2 -- platform/features/plot/test/elements/PlotPositionSpec.js | 2 -- platform/features/plot/test/elements/PlotPreparerSpec.js | 2 -- platform/features/plot/test/elements/PlotSeriesWindowSpec.js | 2 -- .../features/plot/test/elements/PlotTelemetryFormatterSpec.js | 2 -- platform/features/plot/test/elements/PlotTickGeneratorSpec.js | 2 -- platform/features/plot/test/elements/PlotUpdaterSpec.js | 2 -- platform/features/plot/test/modes/PlotModeOptionsSpec.js | 2 -- platform/features/plot/test/modes/PlotOverlayModeSpec.js | 2 -- platform/features/plot/test/modes/PlotStackModeSpec.js | 2 -- platform/features/plot/test/policies/PlotViewPolicySpec.js | 2 -- platform/features/rtevents/bundle.js | 2 -- platform/features/rtevents/src/DomainColumn.js | 2 -- platform/features/rtevents/src/RTEventListController.js | 2 -- platform/features/rtevents/src/RangeColumn.js | 2 -- platform/features/rtevents/src/directives/MCTRTDataTable.js | 2 -- platform/features/rtevents/src/policies/RTMessagesViewPolicy.js | 2 -- platform/features/rtevents/test/DomainColumnSpec.js | 2 -- platform/features/rtevents/test/RTEventListControllerSpec.js | 2 -- platform/features/rtevents/test/RangeColumnSpec.js | 2 -- .../features/rtevents/test/policies/RTMessagesViewPolicySpec.js | 2 -- platform/features/rtscrolling/bundle.js | 2 -- platform/features/rtscrolling/src/DomainColumn.js | 2 -- platform/features/rtscrolling/src/NameColumn.js | 2 -- platform/features/rtscrolling/src/RTScrollingListController.js | 2 -- platform/features/rtscrolling/src/RangeColumn.js | 2 -- platform/features/scrolling/bundle.js | 2 -- platform/features/scrolling/src/DomainColumn.js | 2 -- platform/features/scrolling/src/NameColumn.js | 2 -- platform/features/scrolling/src/RangeColumn.js | 2 -- platform/features/scrolling/src/ScrollingListController.js | 2 -- platform/features/scrolling/src/ScrollingListPopulator.js | 2 -- platform/features/scrolling/test/DomainColumnSpec.js | 2 -- platform/features/scrolling/test/NameColumnSpec.js | 2 -- platform/features/scrolling/test/RangeColumnSpec.js | 2 -- platform/features/scrolling/test/ScrollingListControllerSpec.js | 2 -- platform/features/scrolling/test/ScrollingListPopulatorSpec.js | 2 -- platform/features/static-markup/bundle.js | 2 -- platform/features/table/bundle.js | 2 -- platform/features/table/src/DomainColumn.js | 2 -- platform/features/table/src/NameColumn.js | 2 -- platform/features/table/src/RangeColumn.js | 2 -- platform/features/table/src/TableConfiguration.js | 2 -- platform/features/table/src/controllers/MCTTableController.js | 2 -- .../features/table/src/controllers/TableOptionsController.js | 2 -- .../features/table/src/controllers/TelemetryTableController.js | 2 -- platform/features/table/src/directives/MCTTable.js | 2 -- platform/features/table/test/DomainColumnSpec.js | 2 -- platform/features/table/test/NameColumnSpec.js | 2 -- platform/features/table/test/RangeColumnSpec.js | 2 -- platform/features/table/test/TableConfigurationSpec.js | 2 -- .../features/table/test/controllers/MCTTableControllerSpec.js | 2 -- .../table/test/controllers/TableOptionsControllerSpec.js | 2 -- .../table/test/controllers/TelemetryTableControllerSpec.js | 2 -- platform/features/timeline/bundle.js | 2 -- platform/features/timeline/src/TimelineConstants.js | 1 - platform/features/timeline/src/TimelineFormatter.js | 2 -- platform/features/timeline/src/capabilities/ActivityTimespan.js | 2 -- .../timeline/src/capabilities/ActivityTimespanCapability.js | 2 -- .../features/timeline/src/capabilities/ActivityUtilization.js | 2 -- platform/features/timeline/src/capabilities/CostCapability.js | 2 -- platform/features/timeline/src/capabilities/CumulativeGraph.js | 2 -- platform/features/timeline/src/capabilities/GraphCapability.js | 2 -- platform/features/timeline/src/capabilities/ResourceGraph.js | 2 -- platform/features/timeline/src/capabilities/TimelineTimespan.js | 2 -- .../timeline/src/capabilities/TimelineTimespanCapability.js | 2 -- .../features/timeline/src/capabilities/TimelineUtilization.js | 2 -- .../features/timeline/src/capabilities/UtilizationCapability.js | 2 -- .../timeline/src/controllers/ActivityModeValuesController.js | 2 -- .../features/timeline/src/controllers/TimelineController.js | 2 -- .../timeline/src/controllers/TimelineDateTimeController.js | 2 -- .../timeline/src/controllers/TimelineGanttController.js | 2 -- .../timeline/src/controllers/TimelineGraphController.js | 2 -- .../timeline/src/controllers/TimelineTableController.js | 2 -- .../features/timeline/src/controllers/TimelineTickController.js | 2 -- .../features/timeline/src/controllers/TimelineZoomController.js | 2 -- .../timeline/src/controllers/drag/TimelineDragHandleFactory.js | 2 -- .../timeline/src/controllers/drag/TimelineDragHandler.js | 2 -- .../timeline/src/controllers/drag/TimelineDragPopulator.js | 2 -- .../features/timeline/src/controllers/drag/TimelineEndHandle.js | 2 -- .../timeline/src/controllers/drag/TimelineMoveHandle.js | 2 -- .../timeline/src/controllers/drag/TimelineSnapHandler.js | 2 -- .../timeline/src/controllers/drag/TimelineStartHandle.js | 2 -- .../features/timeline/src/controllers/graph/TimelineGraph.js | 2 -- .../timeline/src/controllers/graph/TimelineGraphPopulator.js | 2 -- .../timeline/src/controllers/graph/TimelineGraphRenderer.js | 2 -- .../timeline/src/controllers/swimlane/TimelineColorAssigner.js | 2 -- .../features/timeline/src/controllers/swimlane/TimelineProxy.js | 2 -- .../timeline/src/controllers/swimlane/TimelineSwimlane.js | 2 -- .../src/controllers/swimlane/TimelineSwimlaneDecorator.js | 2 -- .../src/controllers/swimlane/TimelineSwimlaneDropHandler.js | 2 -- .../src/controllers/swimlane/TimelineSwimlanePopulator.js | 2 -- platform/features/timeline/src/directives/MCTSwimlaneDrag.js | 2 -- platform/features/timeline/src/directives/MCTSwimlaneDrop.js | 2 -- .../features/timeline/src/directives/SwimlaneDragConstants.js | 1 - platform/features/timeline/src/services/ObjectLoader.js | 2 -- platform/features/timeline/test/TimelineConstantsSpec.js | 2 -- platform/features/timeline/test/TimelineFormatterSpec.js | 2 -- .../test/capabilities/ActivityTimespanCapabilitySpec.js | 2 -- .../features/timeline/test/capabilities/ActivityTimespanSpec.js | 2 -- .../timeline/test/capabilities/ActivityUtilizationSpec.js | 2 -- .../features/timeline/test/capabilities/CostCapabilitySpec.js | 2 -- .../features/timeline/test/capabilities/CumulativeGraphSpec.js | 2 -- .../features/timeline/test/capabilities/GraphCapabilitySpec.js | 2 -- .../features/timeline/test/capabilities/ResourceGraphSpec.js | 2 -- .../test/capabilities/TimelineTimespanCapabilitySpec.js | 2 -- .../features/timeline/test/capabilities/TimelineTimespanSpec.js | 2 -- .../timeline/test/capabilities/TimelineUtilizationSpec.js | 2 -- .../timeline/test/capabilities/UtilizationCapabilitySpec.js | 2 -- .../test/controllers/ActivityModeValuesControllerSpec.js | 2 -- .../timeline/test/controllers/TimelineControllerSpec.js | 2 -- .../timeline/test/controllers/TimelineDateTimeControllerSpec.js | 2 -- .../timeline/test/controllers/TimelineGanttControllerSpec.js | 2 -- .../timeline/test/controllers/TimelineGraphControllerSpec.js | 2 -- .../timeline/test/controllers/TimelineTableControllerSpec.js | 2 -- .../timeline/test/controllers/TimelineTickControllerSpec.js | 2 -- .../timeline/test/controllers/TimelineZoomControllerSpec.js | 2 -- .../test/controllers/drag/TimelineDragHandleFactorySpec.js | 2 -- .../timeline/test/controllers/drag/TimelineDragHandlerSpec.js | 2 -- .../timeline/test/controllers/drag/TimelineDragPopulatorSpec.js | 2 -- .../timeline/test/controllers/drag/TimelineEndHandleSpec.js | 2 -- .../timeline/test/controllers/drag/TimelineMoveHandleSpec.js | 2 -- .../timeline/test/controllers/drag/TimelineSnapHandlerSpec.js | 2 -- .../timeline/test/controllers/drag/TimelineStartHandleSpec.js | 2 -- .../test/controllers/graph/TimelineGraphPopulatorSpec.js | 2 -- .../test/controllers/graph/TimelineGraphRendererSpec.js | 2 -- .../timeline/test/controllers/graph/TimelineGraphSpec.js | 2 -- .../test/controllers/swimlane/TimelineColorAssignerSpec.js | 2 -- .../timeline/test/controllers/swimlane/TimelineProxySpec.js | 2 -- .../test/controllers/swimlane/TimelineSwimlaneDecoratorSpec.js | 2 -- .../controllers/swimlane/TimelineSwimlaneDropHandlerSpec.js | 2 -- .../test/controllers/swimlane/TimelineSwimlanePopulatorSpec.js | 2 -- .../timeline/test/controllers/swimlane/TimelineSwimlaneSpec.js | 2 -- .../features/timeline/test/directives/MCTSwimlaneDragSpec.js | 2 -- .../features/timeline/test/directives/MCTSwimlaneDropSpec.js | 2 -- .../timeline/test/directives/SwimlaneDragConstantsSpec.js | 2 -- platform/features/timeline/test/services/ObjectLoaderSpec.js | 2 -- platform/forms/bundle.js | 2 -- platform/forms/src/MCTControl.js | 2 -- platform/forms/src/MCTForm.js | 2 -- platform/forms/src/MCTToolbar.js | 2 -- platform/forms/src/controllers/ColorController.js | 2 -- platform/forms/src/controllers/CompositeController.js | 2 -- platform/forms/src/controllers/DateTimeController.js | 2 -- platform/forms/src/controllers/DialogButtonController.js | 2 -- platform/forms/src/controllers/FormController.js | 2 -- platform/forms/test/MCTControlSpec.js | 2 -- platform/forms/test/MCTFormSpec.js | 2 -- platform/forms/test/MCTToolbarSpec.js | 2 -- platform/forms/test/controllers/ColorControllerSpec.js | 2 -- platform/forms/test/controllers/CompositeControllerSpec.js | 2 -- platform/forms/test/controllers/DateTimeControllerSpec.js | 2 -- platform/forms/test/controllers/DialogButtonControllerSpec.js | 2 -- platform/forms/test/controllers/FormControllerSpec.js | 2 -- platform/framework/bundle.js | 2 -- platform/framework/src/Constants.js | 1 - platform/framework/src/FrameworkInitializer.js | 2 -- platform/framework/src/FrameworkLayer.js | 2 -- platform/framework/src/LogLevel.js | 2 -- platform/framework/src/Main.js | 2 -- platform/framework/src/bootstrap/ApplicationBootstrapper.js | 2 -- platform/framework/src/load/Bundle.js | 2 -- platform/framework/src/load/BundleLoader.js | 2 -- platform/framework/src/load/Extension.js | 2 -- platform/framework/src/register/CustomRegistrars.js | 2 -- platform/framework/src/register/ExtensionRegistrar.js | 2 -- platform/framework/src/register/ExtensionSorter.js | 2 -- platform/framework/src/register/PartialConstructor.js | 2 -- platform/framework/src/register/ServiceCompositor.js | 2 -- platform/framework/src/resolve/BundleResolver.js | 2 -- platform/framework/src/resolve/ExtensionResolver.js | 2 -- platform/framework/src/resolve/ImplementationLoader.js | 2 -- platform/framework/src/resolve/RequireConfigurator.js | 2 -- platform/framework/test/FrameworkInitializerSpec.js | 2 -- platform/framework/test/LogLevelSpec.js | 2 -- .../framework/test/bootstrap/ApplicationBootstrapperSpec.js | 2 -- platform/framework/test/load/BundleLoaderSpec.js | 2 -- platform/framework/test/load/BundleSpec.js | 2 -- platform/framework/test/load/ExtensionSpec.js | 2 -- platform/framework/test/register/CustomRegistrarsSpec.js | 2 -- platform/framework/test/register/ExtensionRegistrarSpec.js | 2 -- platform/framework/test/register/ExtensionSorterSpec.js | 2 -- platform/framework/test/register/PartialConstructorSpec.js | 2 -- platform/framework/test/register/ServiceCompositorSpec.js | 2 -- platform/framework/test/resolve/BundleResolverSpec.js | 2 -- platform/framework/test/resolve/ExtensionResolverSpec.js | 2 -- platform/framework/test/resolve/ImplementationLoaderSpec.js | 2 -- platform/framework/test/resolve/RequireConfiguratorSpec.js | 2 -- platform/identity/bundle.js | 2 -- platform/identity/src/IdentityAggregator.js | 2 -- platform/identity/src/IdentityCreationDecorator.js | 2 -- platform/identity/src/IdentityIndicator.js | 2 -- platform/identity/src/IdentityProvider.js | 2 -- platform/identity/test/IdentityAggregatorSpec.js | 2 -- platform/identity/test/IdentityCreationDecoratorSpec.js | 2 -- platform/identity/test/IdentityIndicatorSpec.js | 2 -- platform/identity/test/IdentityProviderSpec.js | 2 -- platform/persistence/aggregator/bundle.js | 2 -- platform/persistence/aggregator/src/PersistenceAggregator.js | 2 -- .../persistence/aggregator/test/PersistenceAggregatorSpec.js | 2 -- platform/persistence/cache/bundle.js | 2 -- platform/persistence/cache/src/CachingPersistenceDecorator.js | 2 -- .../persistence/cache/test/CachingPersistenceDecoratorSpec.js | 2 -- platform/persistence/couch/bundle.js | 2 -- platform/persistence/couch/src/CouchDocument.js | 2 -- platform/persistence/couch/src/CouchIndicator.js | 2 -- platform/persistence/couch/src/CouchPersistenceProvider.js | 2 -- platform/persistence/couch/test/CouchDocumentSpec.js | 2 -- platform/persistence/couch/test/CouchIndicatorSpec.js | 2 -- platform/persistence/couch/test/CouchPersistenceProviderSpec.js | 2 -- platform/persistence/elastic/bundle.js | 2 -- platform/persistence/elastic/src/ElasticIndicator.js | 2 -- platform/persistence/elastic/src/ElasticPersistenceProvider.js | 2 -- platform/persistence/elastic/src/ElasticSearchProvider.js | 2 -- platform/persistence/elastic/test/ElasticIndicatorSpec.js | 2 -- .../persistence/elastic/test/ElasticPersistenceProviderSpec.js | 2 -- platform/persistence/elastic/test/ElasticSearchProviderSpec.js | 2 -- platform/persistence/local/bundle.js | 2 -- platform/persistence/local/src/LocalStorageIndicator.js | 2 -- .../persistence/local/src/LocalStoragePersistenceProvider.js | 2 -- platform/persistence/local/test/LocalStorageIndicatorSpec.js | 2 -- .../local/test/LocalStoragePersistenceProviderSpec.js | 2 -- platform/persistence/queue/bundle.js | 2 -- platform/persistence/queue/src/PersistenceFailureConstants.js | 1 - platform/persistence/queue/src/PersistenceFailureController.js | 2 -- platform/persistence/queue/src/PersistenceFailureDialog.js | 2 -- platform/persistence/queue/src/PersistenceFailureHandler.js | 2 -- platform/persistence/queue/src/PersistenceQueue.js | 2 -- platform/persistence/queue/src/PersistenceQueueHandler.js | 2 -- platform/persistence/queue/src/PersistenceQueueImpl.js | 2 -- platform/persistence/queue/src/QueuingPersistenceCapability.js | 2 -- .../queue/src/QueuingPersistenceCapabilityDecorator.js | 2 -- .../persistence/queue/test/PersistenceFailureConstantsSpec.js | 2 -- .../persistence/queue/test/PersistenceFailureControllerSpec.js | 2 -- platform/persistence/queue/test/PersistenceFailureDialogSpec.js | 2 -- .../persistence/queue/test/PersistenceFailureHandlerSpec.js | 2 -- platform/persistence/queue/test/PersistenceQueueHandlerSpec.js | 2 -- platform/persistence/queue/test/PersistenceQueueImplSpec.js | 2 -- platform/persistence/queue/test/PersistenceQueueSpec.js | 2 -- .../queue/test/QueuingPersistenceCapabilityDecoratorSpec.js | 2 -- .../persistence/queue/test/QueuingPersistenceCapabilitySpec.js | 2 -- platform/policy/bundle.js | 2 -- platform/policy/src/PolicyActionDecorator.js | 2 -- platform/policy/src/PolicyProvider.js | 2 -- platform/policy/src/PolicyViewDecorator.js | 2 -- platform/policy/test/PolicyActionDecoratorSpec.js | 2 -- platform/policy/test/PolicyProviderSpec.js | 2 -- platform/policy/test/PolicyViewDecoratorSpec.js | 2 -- platform/representation/bundle.js | 2 -- platform/representation/src/MCTInclude.js | 2 -- platform/representation/src/MCTRepresentation.js | 2 -- platform/representation/src/TemplateLinker.js | 2 -- platform/representation/src/TemplatePrefetcher.js | 2 -- platform/representation/src/actions/ContextMenuAction.js | 2 -- platform/representation/src/gestures/ContextMenuGesture.js | 2 -- platform/representation/src/gestures/DragGesture.js | 2 -- platform/representation/src/gestures/DropGesture.js | 2 -- platform/representation/src/gestures/GestureConstants.js | 1 - platform/representation/src/gestures/GestureProvider.js | 2 -- platform/representation/src/gestures/GestureRepresenter.js | 2 -- platform/representation/src/services/DndService.js | 2 -- platform/representation/test/MCTIncludeSpec.js | 2 -- platform/representation/test/MCTRepresentationSpec.js | 2 -- platform/representation/test/TemplateLinkerSpec.js | 2 -- platform/representation/test/TemplatePrefetcherSpec.js | 2 -- platform/representation/test/actions/ContextMenuActionSpec.js | 2 -- platform/representation/test/gestures/ContextMenuGestureSpec.js | 2 -- platform/representation/test/gestures/DragGestureSpec.js | 2 -- platform/representation/test/gestures/DropGestureSpec.js | 2 -- platform/representation/test/gestures/GestureProviderSpec.js | 2 -- platform/representation/test/gestures/GestureRepresenterSpec.js | 2 -- platform/representation/test/services/DndServiceSpec.js | 2 -- platform/search/bundle.js | 2 -- platform/search/src/controllers/ClickAwayController.js | 2 -- platform/search/src/controllers/SearchController.js | 2 -- platform/search/src/controllers/SearchMenuController.js | 2 -- platform/search/src/services/GenericSearchProvider.js | 2 -- platform/search/src/services/GenericSearchWorker.js | 2 -- platform/search/src/services/SearchAggregator.js | 2 -- platform/search/test/controllers/ClickAwayControllerSpec.js | 2 -- platform/search/test/controllers/SearchControllerSpec.js | 2 -- platform/search/test/controllers/SearchMenuControllerSpec.js | 2 -- platform/search/test/services/GenericSearchProviderSpec.js | 2 -- platform/search/test/services/GenericSearchWorkerSpec.js | 2 -- platform/search/test/services/SearchAggregatorSpec.js | 2 -- platform/status/bundle.js | 2 -- platform/status/src/StatusCapability.js | 2 -- platform/status/src/StatusConstants.js | 1 - platform/status/src/StatusRepresenter.js | 2 -- platform/status/src/StatusService.js | 2 -- platform/status/test/StatusCapabilitySpec.js | 2 -- platform/status/test/StatusRepresenterSpec.js | 2 -- platform/status/test/StatusServiceSpec.js | 2 -- platform/telemetry/bundle.js | 2 -- platform/telemetry/src/TelemetryAggregator.js | 2 -- platform/telemetry/src/TelemetryCapability.js | 2 -- platform/telemetry/src/TelemetryController.js | 2 -- platform/telemetry/src/TelemetryDelegator.js | 2 -- platform/telemetry/src/TelemetryFormatter.js | 2 -- platform/telemetry/src/TelemetryHandle.js | 2 -- platform/telemetry/src/TelemetryHandler.js | 2 -- platform/telemetry/src/TelemetryQueue.js | 2 -- platform/telemetry/src/TelemetrySubscriber.js | 2 -- platform/telemetry/src/TelemetrySubscription.js | 2 -- platform/telemetry/src/TelemetryTable.js | 2 -- platform/telemetry/test/TelemetryAggregatorSpec.js | 2 -- platform/telemetry/test/TelemetryCapabilitySpec.js | 2 -- platform/telemetry/test/TelemetryControllerSpec.js | 2 -- platform/telemetry/test/TelemetryDelegatorSpec.js | 2 -- platform/telemetry/test/TelemetryFormatterSpec.js | 2 -- platform/telemetry/test/TelemetryHandleSpec.js | 2 -- platform/telemetry/test/TelemetryHandlerSpec.js | 2 -- platform/telemetry/test/TelemetryQueueSpec.js | 2 -- platform/telemetry/test/TelemetrySubscriberSpec.js | 2 -- platform/telemetry/test/TelemetrySubscriptionSpec.js | 2 -- platform/telemetry/test/TelemetryTableSpec.js | 2 -- src/BundleRegistry.js | 2 -- src/BundleRegistrySpec.js | 2 -- src/legacyRegistry.js | 2 -- src/legacyRegistrySpec.js | 2 -- 778 files changed, 1547 deletions(-) diff --git a/platform/commonUI/about/bundle.js b/platform/commonUI/about/bundle.js index aff0825f5c..a5fdd726d5 100644 --- a/platform/commonUI/about/bundle.js +++ b/platform/commonUI/about/bundle.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define([ "text!./res/templates/about-dialog.html", @@ -48,7 +47,6 @@ define([ licensesExportMdTemplate, legacyRegistry ) { - "use strict"; legacyRegistry.register("platform/commonUI/about", { "name": "About Open MCT Web", diff --git a/platform/commonUI/about/src/AboutController.js b/platform/commonUI/about/src/AboutController.js index dffd9b9471..0807166bc9 100644 --- a/platform/commonUI/about/src/AboutController.js +++ b/platform/commonUI/about/src/AboutController.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ /** @@ -29,7 +28,6 @@ define( [], function () { - "use strict"; /** * The AboutController provides information to populate the diff --git a/platform/commonUI/about/src/LicenseController.js b/platform/commonUI/about/src/LicenseController.js index 740124641f..5d030588c9 100644 --- a/platform/commonUI/about/src/LicenseController.js +++ b/platform/commonUI/about/src/LicenseController.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; /** * Provides extension-introduced licenses information to the diff --git a/platform/commonUI/about/src/LogoController.js b/platform/commonUI/about/src/LogoController.js index 85909a0552..616981e8da 100644 --- a/platform/commonUI/about/src/LogoController.js +++ b/platform/commonUI/about/src/LogoController.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; /** * The LogoController provides functionality to the application diff --git a/platform/commonUI/about/test/AboutControllerSpec.js b/platform/commonUI/about/test/AboutControllerSpec.js index c4fb26c488..f902c7b6dc 100644 --- a/platform/commonUI/about/test/AboutControllerSpec.js +++ b/platform/commonUI/about/test/AboutControllerSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ define( ['../src/AboutController'], function (AboutController) { - "use strict"; describe("The About controller", function () { var testVersions, diff --git a/platform/commonUI/about/test/LicenseControllerSpec.js b/platform/commonUI/about/test/LicenseControllerSpec.js index 9e281c3cfd..ba99fc1f0d 100644 --- a/platform/commonUI/about/test/LicenseControllerSpec.js +++ b/platform/commonUI/about/test/LicenseControllerSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ define( ['../src/LicenseController'], function (LicenseController) { - "use strict"; describe("The License controller", function () { var testLicenses, diff --git a/platform/commonUI/about/test/LogoControllerSpec.js b/platform/commonUI/about/test/LogoControllerSpec.js index c7ad665319..da1c4b0a84 100644 --- a/platform/commonUI/about/test/LogoControllerSpec.js +++ b/platform/commonUI/about/test/LogoControllerSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ define( ['../src/LogoController'], function (LogoController) { - "use strict"; describe("The About controller", function () { var mockOverlayService, diff --git a/platform/commonUI/browse/bundle.js b/platform/commonUI/browse/bundle.js index 7fd785a7f5..73b3f44de7 100644 --- a/platform/commonUI/browse/bundle.js +++ b/platform/commonUI/browse/bundle.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define([ "./src/BrowseController", @@ -80,7 +79,6 @@ define([ inspectorRegionTemplate, legacyRegistry ) { - "use strict"; legacyRegistry.register("platform/commonUI/browse", { "extensions": { diff --git a/platform/commonUI/browse/src/BrowseController.js b/platform/commonUI/browse/src/BrowseController.js index db7d9182cb..2c07ee7b50 100644 --- a/platform/commonUI/browse/src/BrowseController.js +++ b/platform/commonUI/browse/src/BrowseController.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise, confirm*/ /** * This bundle implements Browse mode. @@ -30,7 +29,6 @@ define( '../../../representation/src/gestures/GestureConstants' ], function (GestureConstants) { - "use strict"; var ROOT_ID = "ROOT"; diff --git a/platform/commonUI/browse/src/BrowseObjectController.js b/platform/commonUI/browse/src/BrowseObjectController.js index 71345d6f1b..63547993f8 100644 --- a/platform/commonUI/browse/src/BrowseObjectController.js +++ b/platform/commonUI/browse/src/BrowseObjectController.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ define( [], function () { - "use strict"; /** * Controller for the `browse-object` representation of a domain diff --git a/platform/commonUI/browse/src/InspectorRegion.js b/platform/commonUI/browse/src/InspectorRegion.js index cc47ae2db8..e227d3d452 100644 --- a/platform/commonUI/browse/src/InspectorRegion.js +++ b/platform/commonUI/browse/src/InspectorRegion.js @@ -19,14 +19,12 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,window*/ define( [ '../../regions/src/Region' ], function (Region) { - "use strict"; /** * Defines the a default Inspector region. Captured in a class to diff --git a/platform/commonUI/browse/src/MenuArrowController.js b/platform/commonUI/browse/src/MenuArrowController.js index 5c4916e099..f222871ccc 100644 --- a/platform/commonUI/browse/src/MenuArrowController.js +++ b/platform/commonUI/browse/src/MenuArrowController.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ /** * Module defining MenuArrowController. Created by shale on 06/30/2015. @@ -27,7 +26,6 @@ define( [], function () { - "use strict"; /** * A left-click on the menu arrow should display a diff --git a/platform/commonUI/browse/src/PaneController.js b/platform/commonUI/browse/src/PaneController.js index 6a59baa0e0..3fb5630fdd 100644 --- a/platform/commonUI/browse/src/PaneController.js +++ b/platform/commonUI/browse/src/PaneController.js @@ -19,13 +19,11 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ define( [], function () { - "use strict"; /** * Controller to provide the ability to show/hide the tree in diff --git a/platform/commonUI/browse/src/creation/AddAction.js b/platform/commonUI/browse/src/creation/AddAction.js index 3832280130..9a9467ef5b 100644 --- a/platform/commonUI/browse/src/creation/AddAction.js +++ b/platform/commonUI/browse/src/creation/AddAction.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * Module defining AddAction. Created by ahenry on 01/21/16. @@ -29,7 +28,6 @@ define( './CreateWizard' ], function (CreateWizard) { - "use strict"; /** * The Add Action is performed to create new instances of diff --git a/platform/commonUI/browse/src/creation/AddActionProvider.js b/platform/commonUI/browse/src/creation/AddActionProvider.js index 0ac97c0013..9ae5364d95 100644 --- a/platform/commonUI/browse/src/creation/AddActionProvider.js +++ b/platform/commonUI/browse/src/creation/AddActionProvider.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * Module defining AddActionProvider.js. Created by ahenry on 01/21/16. @@ -27,7 +26,6 @@ define( ["./AddAction"], function (AddAction) { - "use strict"; /** * The AddActionProvider is an ActionProvider which introduces diff --git a/platform/commonUI/browse/src/creation/CreateAction.js b/platform/commonUI/browse/src/creation/CreateAction.js index 83d88ba709..00b7c09fa4 100644 --- a/platform/commonUI/browse/src/creation/CreateAction.js +++ b/platform/commonUI/browse/src/creation/CreateAction.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * Module defining CreateAction. Created by vwoeltje on 11/10/14. @@ -30,7 +29,6 @@ define( '../../../edit/src/objects/EditableDomainObject' ], function (CreateWizard, EditableDomainObject) { - "use strict"; /** * The Create Action is performed to create new instances of diff --git a/platform/commonUI/browse/src/creation/CreateActionProvider.js b/platform/commonUI/browse/src/creation/CreateActionProvider.js index 0a8d145b4e..82f57343da 100644 --- a/platform/commonUI/browse/src/creation/CreateActionProvider.js +++ b/platform/commonUI/browse/src/creation/CreateActionProvider.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * Module defining CreateActionProvider.js. Created by vwoeltje on 11/10/14. @@ -27,7 +26,6 @@ define( ["./CreateAction"], function (CreateAction) { - "use strict"; /** * The CreateActionProvider is an ActionProvider which introduces diff --git a/platform/commonUI/browse/src/creation/CreateMenuController.js b/platform/commonUI/browse/src/creation/CreateMenuController.js index 624764c2e4..77e09a69c4 100644 --- a/platform/commonUI/browse/src/creation/CreateMenuController.js +++ b/platform/commonUI/browse/src/creation/CreateMenuController.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * Module defining CreateMenuController. Created by vwoeltje on 11/10/14. @@ -27,7 +26,6 @@ define( [], function () { - "use strict"; /** * Controller for the Create menu; maintains an up-to-date diff --git a/platform/commonUI/browse/src/creation/CreateWizard.js b/platform/commonUI/browse/src/creation/CreateWizard.js index f4a29d42ac..660a577905 100644 --- a/platform/commonUI/browse/src/creation/CreateWizard.js +++ b/platform/commonUI/browse/src/creation/CreateWizard.js @@ -19,11 +19,9 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( function () { - 'use strict'; /** * A class for capturing user input data from an object creation diff --git a/platform/commonUI/browse/src/creation/CreationPolicy.js b/platform/commonUI/browse/src/creation/CreationPolicy.js index 28749e711f..480d0adec4 100644 --- a/platform/commonUI/browse/src/creation/CreationPolicy.js +++ b/platform/commonUI/browse/src/creation/CreationPolicy.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; /** * A policy for determining whether objects of a given type can be diff --git a/platform/commonUI/browse/src/creation/CreationService.js b/platform/commonUI/browse/src/creation/CreationService.js index 4b7c0119c9..ca5389e162 100644 --- a/platform/commonUI/browse/src/creation/CreationService.js +++ b/platform/commonUI/browse/src/creation/CreationService.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * Module defining CreateService. Created by vwoeltje on 11/10/14. @@ -27,7 +26,6 @@ define( [], function () { - "use strict"; var NON_PERSISTENT_WARNING = "Tried to create an object in non-persistent container.", diff --git a/platform/commonUI/browse/src/creation/LocatorController.js b/platform/commonUI/browse/src/creation/LocatorController.js index 3d8c6cfc7f..43a1a4ed10 100644 --- a/platform/commonUI/browse/src/creation/LocatorController.js +++ b/platform/commonUI/browse/src/creation/LocatorController.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; /** * Controller for the "locator" control, which provides the diff --git a/platform/commonUI/browse/src/navigation/NavigateAction.js b/platform/commonUI/browse/src/navigation/NavigateAction.js index 7b258afafe..e9cc700f93 100644 --- a/platform/commonUI/browse/src/navigation/NavigateAction.js +++ b/platform/commonUI/browse/src/navigation/NavigateAction.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * Module defining NavigateAction. Created by vwoeltje on 11/10/14. @@ -27,7 +26,6 @@ define( [], function () { - "use strict"; /** * The navigate action navigates to a specific domain object. diff --git a/platform/commonUI/browse/src/navigation/NavigationService.js b/platform/commonUI/browse/src/navigation/NavigationService.js index 3b4d266bd1..05d93aa996 100644 --- a/platform/commonUI/browse/src/navigation/NavigationService.js +++ b/platform/commonUI/browse/src/navigation/NavigationService.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * Module defining NavigationService. Created by vwoeltje on 11/10/14. @@ -27,7 +26,6 @@ define( [], function () { - "use strict"; /** * The navigation service maintains the application's current diff --git a/platform/commonUI/browse/src/windowing/FullscreenAction.js b/platform/commonUI/browse/src/windowing/FullscreenAction.js index 5de4336acd..f898dbbe6e 100644 --- a/platform/commonUI/browse/src/windowing/FullscreenAction.js +++ b/platform/commonUI/browse/src/windowing/FullscreenAction.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,screenfull,Promise*/ /** * Module defining FullscreenAction. Created by vwoeltje on 11/18/14. @@ -27,7 +26,6 @@ define( ["screenfull"], function () { - "use strict"; var ENTER_FULLSCREEN = "Enter full screen mode", EXIT_FULLSCREEN = "Exit full screen mode"; diff --git a/platform/commonUI/browse/src/windowing/NewTabAction.js b/platform/commonUI/browse/src/windowing/NewTabAction.js index 301c204bbd..83422d5096 100644 --- a/platform/commonUI/browse/src/windowing/NewTabAction.js +++ b/platform/commonUI/browse/src/windowing/NewTabAction.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * Module defining NewTabAction (Originally NewWindowAction). Created by vwoeltje on 11/18/14. @@ -27,7 +26,6 @@ define( [], function () { - "use strict"; var ROOT_ID = "ROOT", DEFAULT_PATH = "/mine"; /** diff --git a/platform/commonUI/browse/src/windowing/WindowTitler.js b/platform/commonUI/browse/src/windowing/WindowTitler.js index 4ce448cb1e..eb8c499e24 100644 --- a/platform/commonUI/browse/src/windowing/WindowTitler.js +++ b/platform/commonUI/browse/src/windowing/WindowTitler.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ define( [], function () { - "use strict"; /** * Updates the title of the current window to reflect the name diff --git a/platform/commonUI/browse/test/BrowseControllerSpec.js b/platform/commonUI/browse/test/BrowseControllerSpec.js index cc14b4d0e5..6bb41b4e6e 100644 --- a/platform/commonUI/browse/test/BrowseControllerSpec.js +++ b/platform/commonUI/browse/test/BrowseControllerSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine,xit,xdescribe*/ /** * MCTRepresentationSpec. Created by vwoeltje on 11/6/14. @@ -27,7 +26,6 @@ define( ["../src/BrowseController"], function (BrowseController) { - "use strict"; describe("The browse controller", function () { var mockScope, diff --git a/platform/commonUI/browse/test/BrowseObjectControllerSpec.js b/platform/commonUI/browse/test/BrowseObjectControllerSpec.js index 9fc7ba3119..dd873030f5 100644 --- a/platform/commonUI/browse/test/BrowseObjectControllerSpec.js +++ b/platform/commonUI/browse/test/BrowseObjectControllerSpec.js @@ -19,13 +19,11 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ define( ["../src/BrowseObjectController"], function (BrowseObjectController) { - "use strict"; describe("The browse object controller", function () { var mockScope, diff --git a/platform/commonUI/browse/test/InspectorRegionSpec.js b/platform/commonUI/browse/test/InspectorRegionSpec.js index e455a8df4d..b7ce021cdc 100644 --- a/platform/commonUI/browse/test/InspectorRegionSpec.js +++ b/platform/commonUI/browse/test/InspectorRegionSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ /** * MCTIncudeSpec. Created by vwoeltje on 11/6/14. @@ -27,7 +26,6 @@ define( ["../src/InspectorRegion"], function (InspectorRegion) { - "use strict"; describe("The inspector region", function () { var inspectorRegion; diff --git a/platform/commonUI/browse/test/MenuArrowControllerSpec.js b/platform/commonUI/browse/test/MenuArrowControllerSpec.js index b8aa345489..22f9882115 100644 --- a/platform/commonUI/browse/test/MenuArrowControllerSpec.js +++ b/platform/commonUI/browse/test/MenuArrowControllerSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ /** * MenuArrowControllerSpec. Created by shale on 07/02/2015. @@ -27,7 +26,6 @@ define( ["../src/MenuArrowController"], function (MenuArrowController) { - "use strict"; describe("The menu arrow controller ", function () { var mockScope, diff --git a/platform/commonUI/browse/test/PaneControllerSpec.js b/platform/commonUI/browse/test/PaneControllerSpec.js index f02da713a4..8654884f39 100644 --- a/platform/commonUI/browse/test/PaneControllerSpec.js +++ b/platform/commonUI/browse/test/PaneControllerSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ define( ["../src/PaneController"], function (PaneController) { - 'use strict'; describe("The PaneController", function () { var mockScope, diff --git a/platform/commonUI/browse/test/creation/AddActionProviderSpec.js b/platform/commonUI/browse/test/creation/AddActionProviderSpec.js index aaa83af8e9..3b391d0258 100644 --- a/platform/commonUI/browse/test/creation/AddActionProviderSpec.js +++ b/platform/commonUI/browse/test/creation/AddActionProviderSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine,xit,xdescribe*/ /** * MCTRepresentationSpec. Created by ahenry on 01/21/14. @@ -27,7 +26,6 @@ define( ["../../src/creation/AddActionProvider"], function (AddActionProvider) { - "use strict"; describe("The add action provider", function () { var mockTypeService, diff --git a/platform/commonUI/browse/test/creation/CreateActionProviderSpec.js b/platform/commonUI/browse/test/creation/CreateActionProviderSpec.js index 857b29fe4e..b5bb794b04 100644 --- a/platform/commonUI/browse/test/creation/CreateActionProviderSpec.js +++ b/platform/commonUI/browse/test/creation/CreateActionProviderSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine,xit,xdescribe*/ /** * MCTRepresentationSpec. Created by vwoeltje on 11/6/14. @@ -27,7 +26,6 @@ define( ["../../src/creation/CreateActionProvider"], function (CreateActionProvider) { - "use strict"; describe("The create action provider", function () { var mockTypeService, diff --git a/platform/commonUI/browse/test/creation/CreateActionSpec.js b/platform/commonUI/browse/test/creation/CreateActionSpec.js index d7e357fd9e..600bfadbdb 100644 --- a/platform/commonUI/browse/test/creation/CreateActionSpec.js +++ b/platform/commonUI/browse/test/creation/CreateActionSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine,xit,xdescribe*/ /** * MCTRepresentationSpec. Created by vwoeltje on 11/6/14. @@ -27,7 +26,6 @@ define( ["../../src/creation/CreateAction"], function (CreateAction) { - "use strict"; describe("The create action", function () { var mockType, diff --git a/platform/commonUI/browse/test/creation/CreateMenuControllerSpec.js b/platform/commonUI/browse/test/creation/CreateMenuControllerSpec.js index 5f10ee35e4..a2f5473199 100644 --- a/platform/commonUI/browse/test/creation/CreateMenuControllerSpec.js +++ b/platform/commonUI/browse/test/creation/CreateMenuControllerSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ /** * MCTRepresentationSpec. Created by vwoeltje on 11/6/14. @@ -27,7 +26,6 @@ define( ["../../src/creation/CreateMenuController"], function (CreateMenuController) { - "use strict"; describe("The create menu controller", function () { var mockScope, diff --git a/platform/commonUI/browse/test/creation/CreateWizardSpec.js b/platform/commonUI/browse/test/creation/CreateWizardSpec.js index fbb2a735e6..577fb9b9ff 100644 --- a/platform/commonUI/browse/test/creation/CreateWizardSpec.js +++ b/platform/commonUI/browse/test/creation/CreateWizardSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ /** * MCTRepresentationSpec. Created by vwoeltje on 11/6/14. @@ -27,7 +26,6 @@ define( ["../../src/creation/CreateWizard"], function (CreateWizard) { - "use strict"; describe("The create wizard", function () { var mockType, diff --git a/platform/commonUI/browse/test/creation/CreationPolicySpec.js b/platform/commonUI/browse/test/creation/CreationPolicySpec.js index 1f88c1b149..a12d2c752d 100644 --- a/platform/commonUI/browse/test/creation/CreationPolicySpec.js +++ b/platform/commonUI/browse/test/creation/CreationPolicySpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine*/ define( ["../../src/creation/CreationPolicy"], function (CreationPolicy) { - "use strict"; describe("The creation policy", function () { var mockType, diff --git a/platform/commonUI/browse/test/creation/CreationServiceSpec.js b/platform/commonUI/browse/test/creation/CreationServiceSpec.js index e0704ba702..deb2ba068b 100644 --- a/platform/commonUI/browse/test/creation/CreationServiceSpec.js +++ b/platform/commonUI/browse/test/creation/CreationServiceSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ /** * MCTRepresentationSpec. Created by vwoeltje on 11/6/14. @@ -27,7 +26,6 @@ define( ["../../src/creation/CreationService"], function (CreationService) { - "use strict"; describe("The creation service", function () { var mockQ, diff --git a/platform/commonUI/browse/test/creation/LocatorControllerSpec.js b/platform/commonUI/browse/test/creation/LocatorControllerSpec.js index 381aecf0ab..a601d5ea42 100644 --- a/platform/commonUI/browse/test/creation/LocatorControllerSpec.js +++ b/platform/commonUI/browse/test/creation/LocatorControllerSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ /** * MCTRepresentationSpec. Created by vwoeltje on 11/6/14. @@ -27,7 +26,6 @@ define( ["../../src/creation/LocatorController"], function (LocatorController) { - "use strict"; describe("The locator controller", function () { var mockScope, diff --git a/platform/commonUI/browse/test/navigation/NavigateActionSpec.js b/platform/commonUI/browse/test/navigation/NavigateActionSpec.js index 2441087a1a..fca6f3bea0 100644 --- a/platform/commonUI/browse/test/navigation/NavigateActionSpec.js +++ b/platform/commonUI/browse/test/navigation/NavigateActionSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ /** * MCTRepresentationSpec. Created by vwoeltje on 11/6/14. @@ -27,7 +26,6 @@ define( ["../../src/navigation/NavigateAction"], function (NavigateAction) { - "use strict"; describe("The navigate action", function () { var mockNavigationService, diff --git a/platform/commonUI/browse/test/navigation/NavigationServiceSpec.js b/platform/commonUI/browse/test/navigation/NavigationServiceSpec.js index 410a5f1562..12b849a314 100644 --- a/platform/commonUI/browse/test/navigation/NavigationServiceSpec.js +++ b/platform/commonUI/browse/test/navigation/NavigationServiceSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ /** * MCTRepresentationSpec. Created by vwoeltje on 11/6/14. @@ -27,7 +26,6 @@ define( ["../../src/navigation/NavigationService"], function (NavigationService) { - "use strict"; describe("The navigation service", function () { var navigationService; diff --git a/platform/commonUI/browse/test/windowing/FullscreenActionSpec.js b/platform/commonUI/browse/test/windowing/FullscreenActionSpec.js index 4ef3f50a7f..f0cf4eb382 100644 --- a/platform/commonUI/browse/test/windowing/FullscreenActionSpec.js +++ b/platform/commonUI/browse/test/windowing/FullscreenActionSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine,afterEach,window*/ /** * MCTRepresentationSpec. Created by vwoeltje on 11/6/14. @@ -27,7 +26,6 @@ define( ["../../src/windowing/FullscreenAction"], function (FullscreenAction) { - "use strict"; describe("The fullscreen action", function () { var action, diff --git a/platform/commonUI/browse/test/windowing/NewTabActionSpec.js b/platform/commonUI/browse/test/windowing/NewTabActionSpec.js index 1371f96eda..47f02f6c41 100644 --- a/platform/commonUI/browse/test/windowing/NewTabActionSpec.js +++ b/platform/commonUI/browse/test/windowing/NewTabActionSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine,afterEach,window*/ define( ["../../src/windowing/NewTabAction"], function (NewTabAction) { - "use strict"; describe("The new tab action", function () { var actionSelected, diff --git a/platform/commonUI/browse/test/windowing/WindowTitlerSpec.js b/platform/commonUI/browse/test/windowing/WindowTitlerSpec.js index d9c71a86dd..f4a0bfb4bc 100644 --- a/platform/commonUI/browse/test/windowing/WindowTitlerSpec.js +++ b/platform/commonUI/browse/test/windowing/WindowTitlerSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ /** * WindowTitlerSpec. Created by vwoeltje on 11/6/14. @@ -27,7 +26,6 @@ define( ["../../src/windowing/WindowTitler"], function (WindowTitler) { - "use strict"; describe("The window titler", function () { var mockNavigationService, diff --git a/platform/commonUI/dialog/bundle.js b/platform/commonUI/dialog/bundle.js index 3d99408478..ef1384c3d4 100644 --- a/platform/commonUI/dialog/bundle.js +++ b/platform/commonUI/dialog/bundle.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define([ "./src/DialogService", @@ -44,7 +43,6 @@ define([ overlayTemplate, legacyRegistry ) { - "use strict"; legacyRegistry.register("platform/commonUI/dialog", { "extensions": { diff --git a/platform/commonUI/dialog/src/DialogService.js b/platform/commonUI/dialog/src/DialogService.js index 0d480f3455..94b59e0156 100644 --- a/platform/commonUI/dialog/src/DialogService.js +++ b/platform/commonUI/dialog/src/DialogService.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ /** * This bundle implements the dialog service, which can be used to @@ -29,7 +28,6 @@ define( [], function () { - "use strict"; /** * The dialog service is responsible for handling window-modal * communication with the user, such as displaying forms for user diff --git a/platform/commonUI/dialog/src/OverlayService.js b/platform/commonUI/dialog/src/OverlayService.js index 5e9703cb42..084342603f 100644 --- a/platform/commonUI/dialog/src/OverlayService.js +++ b/platform/commonUI/dialog/src/OverlayService.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; // Template to inject into the DOM to show the dialog; really just points to // the a specific template that can be included via mct-include diff --git a/platform/commonUI/dialog/test/DialogServiceSpec.js b/platform/commonUI/dialog/test/DialogServiceSpec.js index 2dc109ac44..cfaf21fe76 100644 --- a/platform/commonUI/dialog/test/DialogServiceSpec.js +++ b/platform/commonUI/dialog/test/DialogServiceSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ /** * MCTIncudeSpec. Created by vwoeltje on 11/6/14. @@ -27,7 +26,6 @@ define( ["../src/DialogService"], function (DialogService) { - "use strict"; describe("The dialog service", function () { var mockOverlayService, diff --git a/platform/commonUI/dialog/test/OverlayServiceSpec.js b/platform/commonUI/dialog/test/OverlayServiceSpec.js index cdeffb9f24..42fec48efd 100644 --- a/platform/commonUI/dialog/test/OverlayServiceSpec.js +++ b/platform/commonUI/dialog/test/OverlayServiceSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ /** * MCTIncudeSpec. Created by vwoeltje on 11/6/14. @@ -27,7 +26,6 @@ define( ["../src/OverlayService"], function (OverlayService) { - "use strict"; describe("The overlay service", function () { var mockDocument, diff --git a/platform/commonUI/edit/bundle.js b/platform/commonUI/edit/bundle.js index 80a98a6927..3638f882c9 100644 --- a/platform/commonUI/edit/bundle.js +++ b/platform/commonUI/edit/bundle.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define([ "./src/controllers/EditActionController", @@ -66,7 +65,6 @@ define([ topbarEditTemplate, legacyRegistry ) { - "use strict"; legacyRegistry.register("platform/commonUI/edit", { "extensions": { diff --git a/platform/commonUI/edit/src/actions/CancelAction.js b/platform/commonUI/edit/src/actions/CancelAction.js index 6b9cbf9c08..da3fea8046 100644 --- a/platform/commonUI/edit/src/actions/CancelAction.js +++ b/platform/commonUI/edit/src/actions/CancelAction.js @@ -19,11 +19,9 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( function () { - 'use strict'; /** * The "Cancel" action; the action triggered by clicking Cancel from diff --git a/platform/commonUI/edit/src/actions/EditAction.js b/platform/commonUI/edit/src/actions/EditAction.js index d771f75dd4..17fd34156c 100644 --- a/platform/commonUI/edit/src/actions/EditAction.js +++ b/platform/commonUI/edit/src/actions/EditAction.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * Module defining EditAction. Created by vwoeltje on 11/14/14. @@ -27,7 +26,6 @@ define( ['../objects/EditableDomainObject'], function (EditableDomainObject) { - "use strict"; // A no-op action to return in the event that the action cannot // be completed. diff --git a/platform/commonUI/edit/src/actions/LinkAction.js b/platform/commonUI/edit/src/actions/LinkAction.js index 95ed9a8082..f12539b1fe 100644 --- a/platform/commonUI/edit/src/actions/LinkAction.js +++ b/platform/commonUI/edit/src/actions/LinkAction.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; /** diff --git a/platform/commonUI/edit/src/actions/PropertiesAction.js b/platform/commonUI/edit/src/actions/PropertiesAction.js index 1134c23190..7ec48122ca 100644 --- a/platform/commonUI/edit/src/actions/PropertiesAction.js +++ b/platform/commonUI/edit/src/actions/PropertiesAction.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ /** * Edit the properties of a domain object. Shows a dialog @@ -29,7 +28,6 @@ define( ['./PropertiesDialog'], function (PropertiesDialog) { - 'use strict'; /** * Implements the "Edit Properties" action, which prompts the user diff --git a/platform/commonUI/edit/src/actions/PropertiesDialog.js b/platform/commonUI/edit/src/actions/PropertiesDialog.js index f461c0b8e1..0508724ac1 100644 --- a/platform/commonUI/edit/src/actions/PropertiesDialog.js +++ b/platform/commonUI/edit/src/actions/PropertiesDialog.js @@ -19,11 +19,9 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( function () { - 'use strict'; /** * Construct a new Properties dialog. diff --git a/platform/commonUI/edit/src/actions/RemoveAction.js b/platform/commonUI/edit/src/actions/RemoveAction.js index dd95616289..3174330d03 100644 --- a/platform/commonUI/edit/src/actions/RemoveAction.js +++ b/platform/commonUI/edit/src/actions/RemoveAction.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ /** * Module defining RemoveAction. Created by vwoeltje on 11/17/14. @@ -27,7 +26,6 @@ define( [], function () { - "use strict"; /** * Construct an action which will remove the provided object manifestation. diff --git a/platform/commonUI/edit/src/actions/SaveAction.js b/platform/commonUI/edit/src/actions/SaveAction.js index 1415a6ed4b..55755e12cb 100644 --- a/platform/commonUI/edit/src/actions/SaveAction.js +++ b/platform/commonUI/edit/src/actions/SaveAction.js @@ -19,14 +19,12 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ /*jslint es5: true */ define( ['../../../browse/src/creation/CreateWizard'], function (CreateWizard) { - 'use strict'; /** * The "Save" action; the action triggered by clicking Save from diff --git a/platform/commonUI/edit/src/capabilities/EditableActionCapability.js b/platform/commonUI/edit/src/capabilities/EditableActionCapability.js index b5bad72dc0..2e83dee0a0 100644 --- a/platform/commonUI/edit/src/capabilities/EditableActionCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditableActionCapability.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( function () { - 'use strict'; var DISALLOWED_ACTIONS = ["move", "copy", "link", "window", "follow"]; /** * Editable Action Capability. Overrides the action capability diff --git a/platform/commonUI/edit/src/capabilities/EditableCompositionCapability.js b/platform/commonUI/edit/src/capabilities/EditableCompositionCapability.js index 17dff58c0d..343c6a03a2 100644 --- a/platform/commonUI/edit/src/capabilities/EditableCompositionCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditableCompositionCapability.js @@ -19,13 +19,11 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( ['./EditableLookupCapability'], function (EditableLookupCapability) { - 'use strict'; /** * Wrapper for the "composition" capability; diff --git a/platform/commonUI/edit/src/capabilities/EditableContextCapability.js b/platform/commonUI/edit/src/capabilities/EditableContextCapability.js index d0df90afc4..d20971fb04 100644 --- a/platform/commonUI/edit/src/capabilities/EditableContextCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditableContextCapability.js @@ -19,13 +19,11 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( ['./EditableLookupCapability'], function (EditableLookupCapability) { - 'use strict'; /** * Wrapper for the "context" capability; diff --git a/platform/commonUI/edit/src/capabilities/EditableInstantiationCapability.js b/platform/commonUI/edit/src/capabilities/EditableInstantiationCapability.js index 6a0392476b..4376a9310e 100644 --- a/platform/commonUI/edit/src/capabilities/EditableInstantiationCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditableInstantiationCapability.js @@ -19,13 +19,11 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( ['./EditableLookupCapability'], function (EditableLookupCapability) { - 'use strict'; /** * Wrapper for the "instantiation" capability; diff --git a/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js b/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js index dae2df3d83..a0c8add0c3 100644 --- a/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js @@ -19,13 +19,11 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - 'use strict'; /** * Wrapper for both "context" and "composition" capabilities; diff --git a/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js b/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js index 92d29f66ad..e6c32e2bf4 100644 --- a/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( function () { - 'use strict'; /** * Editable Persistence Capability. Overrides the persistence capability diff --git a/platform/commonUI/edit/src/capabilities/EditableRelationshipCapability.js b/platform/commonUI/edit/src/capabilities/EditableRelationshipCapability.js index 3034301502..af8c142338 100644 --- a/platform/commonUI/edit/src/capabilities/EditableRelationshipCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditableRelationshipCapability.js @@ -19,13 +19,11 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( ['./EditableLookupCapability'], function (EditableLookupCapability) { - 'use strict'; /** * Wrapper for the "relationship" capability; diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index b48c1988e6..ff9dfc19ed 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - 'use strict'; /** diff --git a/platform/commonUI/edit/src/controllers/EditActionController.js b/platform/commonUI/edit/src/controllers/EditActionController.js index 4ea38f9bb5..85a0550182 100644 --- a/platform/commonUI/edit/src/controllers/EditActionController.js +++ b/platform/commonUI/edit/src/controllers/EditActionController.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * Module defining EditActionController. Created by vwoeltje on 11/17/14. @@ -27,7 +26,6 @@ define( [], function () { - "use strict"; var ACTION_CONTEXT = { category: 'conclude-editing' }; diff --git a/platform/commonUI/edit/src/controllers/EditObjectController.js b/platform/commonUI/edit/src/controllers/EditObjectController.js index d6121106ec..2b41f344b5 100644 --- a/platform/commonUI/edit/src/controllers/EditObjectController.js +++ b/platform/commonUI/edit/src/controllers/EditObjectController.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * This bundle implements Edit mode. @@ -28,7 +27,6 @@ define( [], function () { - "use strict"; /** * Controller which is responsible for populating the scope for diff --git a/platform/commonUI/edit/src/controllers/EditPanesController.js b/platform/commonUI/edit/src/controllers/EditPanesController.js index 7dedc251ec..83562c6ffc 100644 --- a/platform/commonUI/edit/src/controllers/EditPanesController.js +++ b/platform/commonUI/edit/src/controllers/EditPanesController.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; /** * Supports the Library and Elements panes in Edit mode. diff --git a/platform/commonUI/edit/src/controllers/ElementsController.js b/platform/commonUI/edit/src/controllers/ElementsController.js index c62e999fa2..531828544a 100644 --- a/platform/commonUI/edit/src/controllers/ElementsController.js +++ b/platform/commonUI/edit/src/controllers/ElementsController.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ define( [], function () { - "use strict"; /** * The ElementsController prepares the elements view for display diff --git a/platform/commonUI/edit/src/directives/MCTBeforeUnload.js b/platform/commonUI/edit/src/directives/MCTBeforeUnload.js index 3e7501c788..a5dfc852ed 100644 --- a/platform/commonUI/edit/src/directives/MCTBeforeUnload.js +++ b/platform/commonUI/edit/src/directives/MCTBeforeUnload.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; /** * Defines the `mct-before-unload` directive. The expression bound diff --git a/platform/commonUI/edit/src/objects/EditableDomainObject.js b/platform/commonUI/edit/src/objects/EditableDomainObject.js index 253947181d..1eedcd563b 100644 --- a/platform/commonUI/edit/src/objects/EditableDomainObject.js +++ b/platform/commonUI/edit/src/objects/EditableDomainObject.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ /** * Defines EditableDomainObject, which wraps domain objects @@ -51,7 +50,6 @@ define( EditableActionCapability, EditableDomainObjectCache ) { - "use strict"; var capabilityFactories = { persistence: EditablePersistenceCapability, diff --git a/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js b/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js index 32a11604de..bd557f882c 100644 --- a/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js +++ b/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ /* @@ -36,7 +35,6 @@ define( ["./EditableModelCache"], function (EditableModelCache) { - 'use strict'; /** * Construct a new cache for editable domain objects. This can be used diff --git a/platform/commonUI/edit/src/objects/EditableModelCache.js b/platform/commonUI/edit/src/objects/EditableModelCache.js index 30ca3d774a..702cfbe6c7 100644 --- a/platform/commonUI/edit/src/objects/EditableModelCache.js +++ b/platform/commonUI/edit/src/objects/EditableModelCache.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; /** * An editable model cache stores domain object models that have been diff --git a/platform/commonUI/edit/src/policies/EditActionPolicy.js b/platform/commonUI/edit/src/policies/EditActionPolicy.js index 7f623ce07b..a3a43fa81e 100644 --- a/platform/commonUI/edit/src/policies/EditActionPolicy.js +++ b/platform/commonUI/edit/src/policies/EditActionPolicy.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; /** * Policy controlling when the `edit` and/or `properties` actions diff --git a/platform/commonUI/edit/src/policies/EditNavigationPolicy.js b/platform/commonUI/edit/src/policies/EditNavigationPolicy.js index 882e64935e..6797ac4eb1 100644 --- a/platform/commonUI/edit/src/policies/EditNavigationPolicy.js +++ b/platform/commonUI/edit/src/policies/EditNavigationPolicy.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; /** * Policy controlling whether navigation events should proceed diff --git a/platform/commonUI/edit/src/policies/EditableViewPolicy.js b/platform/commonUI/edit/src/policies/EditableViewPolicy.js index 17194064b0..7c9742e2d3 100644 --- a/platform/commonUI/edit/src/policies/EditableViewPolicy.js +++ b/platform/commonUI/edit/src/policies/EditableViewPolicy.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; /** * Policy controlling which views should be visible in Edit mode. diff --git a/platform/commonUI/edit/src/representers/EditRepresenter.js b/platform/commonUI/edit/src/representers/EditRepresenter.js index 533c8031e0..386285b38f 100644 --- a/platform/commonUI/edit/src/representers/EditRepresenter.js +++ b/platform/commonUI/edit/src/representers/EditRepresenter.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; /** * The EditRepresenter is responsible for implementing diff --git a/platform/commonUI/edit/src/representers/EditToolbar.js b/platform/commonUI/edit/src/representers/EditToolbar.js index 367eaf1705..aabea1cf4a 100644 --- a/platform/commonUI/edit/src/representers/EditToolbar.js +++ b/platform/commonUI/edit/src/representers/EditToolbar.js @@ -19,11 +19,9 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; // Utility functions for reducing truth arrays function and(a, b) { return a && b; } diff --git a/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js b/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js index daf3645b69..0e30920575 100644 --- a/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js +++ b/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( ['./EditToolbar', './EditToolbarSelection'], function (EditToolbar, EditToolbarSelection) { - "use strict"; // No operation var NOOP_REPRESENTER = { diff --git a/platform/commonUI/edit/src/representers/EditToolbarSelection.js b/platform/commonUI/edit/src/representers/EditToolbarSelection.js index 318ae935b5..f6cdedeadd 100644 --- a/platform/commonUI/edit/src/representers/EditToolbarSelection.js +++ b/platform/commonUI/edit/src/representers/EditToolbarSelection.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; /** * Tracks selection state for editable views. Selection is diff --git a/platform/commonUI/edit/test/actions/CancelActionSpec.js b/platform/commonUI/edit/test/actions/CancelActionSpec.js index 4a06ad9649..2131bbf999 100644 --- a/platform/commonUI/edit/test/actions/CancelActionSpec.js +++ b/platform/commonUI/edit/test/actions/CancelActionSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine,xit,xdescribe*/ define( ["../../src/actions/CancelAction"], function (CancelAction) { - "use strict"; //TODO: Disabled for NEM Beta xdescribe("The Cancel action", function () { diff --git a/platform/commonUI/edit/test/actions/EditActionSpec.js b/platform/commonUI/edit/test/actions/EditActionSpec.js index 4858d9cf0a..7ed8b672bd 100644 --- a/platform/commonUI/edit/test/actions/EditActionSpec.js +++ b/platform/commonUI/edit/test/actions/EditActionSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine,xit,xdescribe*/ define( ["../../src/actions/EditAction"], function (EditAction) { - "use strict"; describe("The Edit action", function () { var mockLocation, diff --git a/platform/commonUI/edit/test/actions/LinkActionSpec.js b/platform/commonUI/edit/test/actions/LinkActionSpec.js index 96ea30e2b3..144dd4e395 100644 --- a/platform/commonUI/edit/test/actions/LinkActionSpec.js +++ b/platform/commonUI/edit/test/actions/LinkActionSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine,spyOn*/ define( ["../../src/actions/LinkAction"], function (LinkAction) { - "use strict"; describe("The Link action", function () { var mockQ, diff --git a/platform/commonUI/edit/test/actions/PropertiesActionSpec.js b/platform/commonUI/edit/test/actions/PropertiesActionSpec.js index 1621a34ab6..cad091cff5 100644 --- a/platform/commonUI/edit/test/actions/PropertiesActionSpec.js +++ b/platform/commonUI/edit/test/actions/PropertiesActionSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,xit,expect,beforeEach,jasmine*/ define( ['../../src/actions/PropertiesAction'], function (PropertiesAction) { - "use strict"; describe("Properties action", function () { var capabilities, model, object, context, input, dialogService, action; diff --git a/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js b/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js index a9077e8ec6..764d8483c9 100644 --- a/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js +++ b/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,xit,expect,beforeEach*/ define( ["../../src/actions/PropertiesDialog"], function (PropertiesDialog) { - "use strict"; describe("Properties dialog", function () { diff --git a/platform/commonUI/edit/test/actions/RemoveActionSpec.js b/platform/commonUI/edit/test/actions/RemoveActionSpec.js index 116627c87d..f9f36e36a8 100644 --- a/platform/commonUI/edit/test/actions/RemoveActionSpec.js +++ b/platform/commonUI/edit/test/actions/RemoveActionSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine,spyOn*/ define( ["../../src/actions/RemoveAction"], function (RemoveAction) { - "use strict"; describe("The Remove action", function () { var mockQ, diff --git a/platform/commonUI/edit/test/actions/SaveActionSpec.js b/platform/commonUI/edit/test/actions/SaveActionSpec.js index 656d6e1ebc..77b27fa429 100644 --- a/platform/commonUI/edit/test/actions/SaveActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveActionSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine,xit,xdescribe*/ define( ["../../src/actions/SaveAction"], function (SaveAction) { - "use strict"; describe("The Save action", function () { var mockLocation, diff --git a/platform/commonUI/edit/test/capabilities/EditableCompositionCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/EditableCompositionCapabilitySpec.js index eed6222202..3e4083d2e8 100644 --- a/platform/commonUI/edit/test/capabilities/EditableCompositionCapabilitySpec.js +++ b/platform/commonUI/edit/test/capabilities/EditableCompositionCapabilitySpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine*/ define( ["../../src/capabilities/EditableCompositionCapability"], function (EditableCompositionCapability) { - "use strict"; describe("An editable composition capability", function () { var mockContext, diff --git a/platform/commonUI/edit/test/capabilities/EditableContextCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/EditableContextCapabilitySpec.js index 9967ffa076..b18a02e881 100644 --- a/platform/commonUI/edit/test/capabilities/EditableContextCapabilitySpec.js +++ b/platform/commonUI/edit/test/capabilities/EditableContextCapabilitySpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine*/ define( ["../../src/capabilities/EditableContextCapability"], function (EditableContextCapability) { - "use strict"; describe("An editable context capability", function () { var mockContext, diff --git a/platform/commonUI/edit/test/capabilities/EditableLookupCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/EditableLookupCapabilitySpec.js index 16bcee88b1..dc178da449 100644 --- a/platform/commonUI/edit/test/capabilities/EditableLookupCapabilitySpec.js +++ b/platform/commonUI/edit/test/capabilities/EditableLookupCapabilitySpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine*/ define( ["../../src/capabilities/EditableLookupCapability"], function (EditableLookupCapability) { - "use strict"; describe("An editable lookup capability", function () { var mockContext, diff --git a/platform/commonUI/edit/test/capabilities/EditablePersistenceCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/EditablePersistenceCapabilitySpec.js index 7fa0ac0dd7..4ce4a2f75d 100644 --- a/platform/commonUI/edit/test/capabilities/EditablePersistenceCapabilitySpec.js +++ b/platform/commonUI/edit/test/capabilities/EditablePersistenceCapabilitySpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine*/ define( ["../../src/capabilities/EditablePersistenceCapability"], function (EditablePersistenceCapability) { - "use strict"; describe("An editable persistence capability", function () { var mockPersistence, diff --git a/platform/commonUI/edit/test/capabilities/EditableRelationshipCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/EditableRelationshipCapabilitySpec.js index 366818e861..9a6c17d944 100644 --- a/platform/commonUI/edit/test/capabilities/EditableRelationshipCapabilitySpec.js +++ b/platform/commonUI/edit/test/capabilities/EditableRelationshipCapabilitySpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine*/ define( ["../../src/capabilities/EditableRelationshipCapability"], function (EditableRelationshipCapability) { - "use strict"; describe("An editable relationship capability", function () { var mockContext, diff --git a/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js index 4e16a01170..d18cdcd931 100644 --- a/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js +++ b/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,waitsFor,runs,jasmine,xit,xdescribe*/ define( ["../../src/capabilities/EditorCapability"], function (EditorCapability) { - "use strict"; describe("The editor capability", function () { var mockPersistence, diff --git a/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js b/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js index 0ac30d6ef5..6478837ce6 100644 --- a/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js +++ b/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine*/ define( ["../../src/controllers/EditActionController"], function (EditActionController) { - "use strict"; describe("The Edit Action controller", function () { var mockScope, diff --git a/platform/commonUI/edit/test/controllers/EditControllerSpec.js b/platform/commonUI/edit/test/controllers/EditControllerSpec.js index 0ed0ddecc7..a359d6945b 100644 --- a/platform/commonUI/edit/test/controllers/EditControllerSpec.js +++ b/platform/commonUI/edit/test/controllers/EditControllerSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine*/ define( ["../../src/controllers/EditObjectController"], function (EditObjectController) { - "use strict"; describe("The Edit mode controller", function () { var mockScope, diff --git a/platform/commonUI/edit/test/controllers/EditPanesControllerSpec.js b/platform/commonUI/edit/test/controllers/EditPanesControllerSpec.js index fd1d56e67c..d0d6aea413 100644 --- a/platform/commonUI/edit/test/controllers/EditPanesControllerSpec.js +++ b/platform/commonUI/edit/test/controllers/EditPanesControllerSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine*/ define( ["../../src/controllers/EditPanesController"], function (EditPanesController) { - "use strict"; describe("The Edit Panes controller", function () { var mockScope, diff --git a/platform/commonUI/edit/test/directives/MCTBeforeUnloadSpec.js b/platform/commonUI/edit/test/directives/MCTBeforeUnloadSpec.js index 41070d76f5..f025cef20d 100644 --- a/platform/commonUI/edit/test/directives/MCTBeforeUnloadSpec.js +++ b/platform/commonUI/edit/test/directives/MCTBeforeUnloadSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine*/ define( ["../../src/directives/MCTBeforeUnload"], function (MCTBeforeUnload) { - "use strict"; describe("The mct-before-unload directive", function () { var mockWindow, diff --git a/platform/commonUI/edit/test/objects/EditableDomainObjectCacheSpec.js b/platform/commonUI/edit/test/objects/EditableDomainObjectCacheSpec.js index 4eea727e26..127bf6e3e4 100644 --- a/platform/commonUI/edit/test/objects/EditableDomainObjectCacheSpec.js +++ b/platform/commonUI/edit/test/objects/EditableDomainObjectCacheSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine*/ define( ["../../src/objects/EditableDomainObjectCache"], function (EditableDomainObjectCache) { - 'use strict'; describe("Editable domain object cache", function () { diff --git a/platform/commonUI/edit/test/objects/EditableDomainObjectSpec.js b/platform/commonUI/edit/test/objects/EditableDomainObjectSpec.js index f0f241be96..3878575237 100644 --- a/platform/commonUI/edit/test/objects/EditableDomainObjectSpec.js +++ b/platform/commonUI/edit/test/objects/EditableDomainObjectSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine*/ define( ["../../src/objects/EditableDomainObject"], function (EditableDomainObject) { - "use strict"; describe("Editable domain object", function () { diff --git a/platform/commonUI/edit/test/objects/EditableModelCacheSpec.js b/platform/commonUI/edit/test/objects/EditableModelCacheSpec.js index a12432164d..1fe8db0262 100644 --- a/platform/commonUI/edit/test/objects/EditableModelCacheSpec.js +++ b/platform/commonUI/edit/test/objects/EditableModelCacheSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine*/ define( ["../../src/objects/EditableModelCache"], function (EditableModelCache) { - "use strict"; describe("The editable model cache", function () { var mockObject, diff --git a/platform/commonUI/edit/test/policies/EditActionPolicySpec.js b/platform/commonUI/edit/test/policies/EditActionPolicySpec.js index 823c3d2737..b82d5458d0 100644 --- a/platform/commonUI/edit/test/policies/EditActionPolicySpec.js +++ b/platform/commonUI/edit/test/policies/EditActionPolicySpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine,xit,xdescribe*/ define( ["../../src/policies/EditActionPolicy"], function (EditActionPolicy) { - "use strict"; describe("The Edit action policy", function () { var editableView, diff --git a/platform/commonUI/edit/test/policies/EditableViewPolicySpec.js b/platform/commonUI/edit/test/policies/EditableViewPolicySpec.js index a4a4c41a6f..6f432fafeb 100644 --- a/platform/commonUI/edit/test/policies/EditableViewPolicySpec.js +++ b/platform/commonUI/edit/test/policies/EditableViewPolicySpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine*/ define( ["../../src/policies/EditableViewPolicy"], function (EditableViewPolicy) { - "use strict"; describe("The editable view policy", function () { var testView, diff --git a/platform/commonUI/edit/test/representers/EditRepresenterSpec.js b/platform/commonUI/edit/test/representers/EditRepresenterSpec.js index 3dcaa34627..b4c2f4ce7f 100644 --- a/platform/commonUI/edit/test/representers/EditRepresenterSpec.js +++ b/platform/commonUI/edit/test/representers/EditRepresenterSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine*/ define( ["../../src/representers/EditRepresenter"], function (EditRepresenter) { - "use strict"; describe("The Edit mode representer", function () { var mockQ, diff --git a/platform/commonUI/edit/test/representers/EditToolbarRepresenterSpec.js b/platform/commonUI/edit/test/representers/EditToolbarRepresenterSpec.js index c8b5bb2c91..cc566c71f3 100644 --- a/platform/commonUI/edit/test/representers/EditToolbarRepresenterSpec.js +++ b/platform/commonUI/edit/test/representers/EditToolbarRepresenterSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine*/ define( ["../../src/representers/EditToolbarRepresenter"], function (EditToolbarRepresenter) { - "use strict"; describe("The Edit mode toolbar representer", function () { var mockScope, diff --git a/platform/commonUI/edit/test/representers/EditToolbarSelectionSpec.js b/platform/commonUI/edit/test/representers/EditToolbarSelectionSpec.js index 45cbe92136..fa762631f7 100644 --- a/platform/commonUI/edit/test/representers/EditToolbarSelectionSpec.js +++ b/platform/commonUI/edit/test/representers/EditToolbarSelectionSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine,xit*/ define( ['../../src/representers/EditToolbarSelection'], function (EditToolbarSelection) { - "use strict"; describe("The Edit mode selection manager", function () { var testProxy, diff --git a/platform/commonUI/edit/test/representers/EditToolbarSpec.js b/platform/commonUI/edit/test/representers/EditToolbarSpec.js index fb58015654..9a5488d356 100644 --- a/platform/commonUI/edit/test/representers/EditToolbarSpec.js +++ b/platform/commonUI/edit/test/representers/EditToolbarSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine*/ define( ['../../src/representers/EditToolbar'], function (EditToolbar) { - "use strict"; describe("An Edit mode toolbar", function () { var mockCommit, diff --git a/platform/commonUI/formats/bundle.js b/platform/commonUI/formats/bundle.js index d323d3d47a..99c384f47f 100644 --- a/platform/commonUI/formats/bundle.js +++ b/platform/commonUI/formats/bundle.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define([ "./src/FormatProvider", @@ -30,7 +29,6 @@ define([ UTCTimeFormat, legacyRegistry ) { - "use strict"; legacyRegistry.register("platform/commonUI/formats", { "name": "Time services bundle", diff --git a/platform/commonUI/formats/src/FormatProvider.js b/platform/commonUI/formats/src/FormatProvider.js index e6d38fbcee..4df4a82d3d 100644 --- a/platform/commonUI/formats/src/FormatProvider.js +++ b/platform/commonUI/formats/src/FormatProvider.js @@ -19,14 +19,12 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define([ ], function ( ) { - "use strict"; /** * An object used to convert between numeric values and text values, diff --git a/platform/commonUI/formats/src/UTCTimeFormat.js b/platform/commonUI/formats/src/UTCTimeFormat.js index b035fed99f..913ffe3200 100644 --- a/platform/commonUI/formats/src/UTCTimeFormat.js +++ b/platform/commonUI/formats/src/UTCTimeFormat.js @@ -19,14 +19,12 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define([ 'moment' ], function ( moment ) { - "use strict"; var DATE_FORMAT = "YYYY-MM-DD HH:mm:ss", DATE_FORMATS = [ diff --git a/platform/commonUI/formats/test/FormatProviderSpec.js b/platform/commonUI/formats/test/FormatProviderSpec.js index 4f68c106f7..d66f9f8a5d 100644 --- a/platform/commonUI/formats/test/FormatProviderSpec.js +++ b/platform/commonUI/formats/test/FormatProviderSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ define( ['../src/FormatProvider'], function (FormatProvider) { - 'use strict'; var KEYS = [ 'a', 'b', 'c' ]; diff --git a/platform/commonUI/formats/test/UTCTimeFormatSpec.js b/platform/commonUI/formats/test/UTCTimeFormatSpec.js index d55a8a9507..cd6917b06c 100644 --- a/platform/commonUI/formats/test/UTCTimeFormatSpec.js +++ b/platform/commonUI/formats/test/UTCTimeFormatSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ define( ['../src/UTCTimeFormat', 'moment'], function (UTCTimeFormat, moment) { - 'use strict'; describe("The UTCTimeFormat", function () { var format; diff --git a/platform/commonUI/general/bundle.js b/platform/commonUI/general/bundle.js index f3d6d98f61..c03fe4cf09 100644 --- a/platform/commonUI/general/bundle.js +++ b/platform/commonUI/general/bundle.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define([ "./src/services/UrlService", @@ -118,7 +117,6 @@ define([ datetimeFieldTemplate, legacyRegistry ) { - "use strict"; legacyRegistry.register("platform/commonUI/general", { "name": "General UI elements", diff --git a/platform/commonUI/general/src/SplashScreenManager.js b/platform/commonUI/general/src/SplashScreenManager.js index 97b866ec45..b0e1d30672 100644 --- a/platform/commonUI/general/src/SplashScreenManager.js +++ b/platform/commonUI/general/src/SplashScreenManager.js @@ -20,14 +20,12 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define([ ], function ( ) { - 'use strict'; function SplashScreenManager($document) { var splash; diff --git a/platform/commonUI/general/src/StyleSheetLoader.js b/platform/commonUI/general/src/StyleSheetLoader.js index 9b64303df1..76f2a4a803 100644 --- a/platform/commonUI/general/src/StyleSheetLoader.js +++ b/platform/commonUI/general/src/StyleSheetLoader.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ /** * This bundle provides various general-purpose UI elements, including @@ -29,7 +28,6 @@ define( [], function () { - "use strict"; /** * The StyleSheetLoader adds links to style sheets exposed from diff --git a/platform/commonUI/general/src/UnsupportedBrowserWarning.js b/platform/commonUI/general/src/UnsupportedBrowserWarning.js index f2fa0c3f20..5e37568cfd 100644 --- a/platform/commonUI/general/src/UnsupportedBrowserWarning.js +++ b/platform/commonUI/general/src/UnsupportedBrowserWarning.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ /** * This bundle provides various general-purpose UI elements, including @@ -29,7 +28,6 @@ define( [], function () { - "use strict"; var WARNING_TITLE = "Unsupported browser", WARNING_DESCRIPTION = [ diff --git a/platform/commonUI/general/src/controllers/ActionGroupController.js b/platform/commonUI/general/src/controllers/ActionGroupController.js index 0992b5e967..f9704f9c81 100644 --- a/platform/commonUI/general/src/controllers/ActionGroupController.js +++ b/platform/commonUI/general/src/controllers/ActionGroupController.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * Module defining ActionGroupController. Created by vwoeltje on 11/14/14. @@ -27,7 +26,6 @@ define( [], function () { - "use strict"; /** * Controller which keeps an up-to-date list of actions of diff --git a/platform/commonUI/general/src/controllers/BannerController.js b/platform/commonUI/general/src/controllers/BannerController.js index cea7af4fbd..b3f7e23131 100644 --- a/platform/commonUI/general/src/controllers/BannerController.js +++ b/platform/commonUI/general/src/controllers/BannerController.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; /** * A controller for banner notifications. Banner notifications are a diff --git a/platform/commonUI/general/src/controllers/BottomBarController.js b/platform/commonUI/general/src/controllers/BottomBarController.js index d53d76fce6..a536da1881 100644 --- a/platform/commonUI/general/src/controllers/BottomBarController.js +++ b/platform/commonUI/general/src/controllers/BottomBarController.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; /** * Controller for the bottombar template. Exposes diff --git a/platform/commonUI/general/src/controllers/ClickAwayController.js b/platform/commonUI/general/src/controllers/ClickAwayController.js index 9c7c6f8091..d8843d5631 100644 --- a/platform/commonUI/general/src/controllers/ClickAwayController.js +++ b/platform/commonUI/general/src/controllers/ClickAwayController.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ define( [], function () { - "use strict"; /** * A ClickAwayController is used to toggle things (such as context diff --git a/platform/commonUI/general/src/controllers/ContextMenuController.js b/platform/commonUI/general/src/controllers/ContextMenuController.js index dece522682..0f81d785bc 100644 --- a/platform/commonUI/general/src/controllers/ContextMenuController.js +++ b/platform/commonUI/general/src/controllers/ContextMenuController.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * Module defining ContextMenuController. Created by vwoeltje on 11/17/14. @@ -27,7 +26,6 @@ define( [], function () { - "use strict"; /** * Controller for the context menu. Maintains an up-to-date diff --git a/platform/commonUI/general/src/controllers/DateTimeFieldController.js b/platform/commonUI/general/src/controllers/DateTimeFieldController.js index ef0827e515..555cb62209 100644 --- a/platform/commonUI/general/src/controllers/DateTimeFieldController.js +++ b/platform/commonUI/general/src/controllers/DateTimeFieldController.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ define( [], function () { - 'use strict'; /** * Controller to support the date-time entry field. diff --git a/platform/commonUI/general/src/controllers/DateTimePickerController.js b/platform/commonUI/general/src/controllers/DateTimePickerController.js index ac07d77553..81708d353e 100644 --- a/platform/commonUI/general/src/controllers/DateTimePickerController.js +++ b/platform/commonUI/general/src/controllers/DateTimePickerController.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ define( [ 'moment' ], function (moment) { - 'use strict'; var TIME_NAMES = { 'hours': "Hour", diff --git a/platform/commonUI/general/src/controllers/GetterSetterController.js b/platform/commonUI/general/src/controllers/GetterSetterController.js index 3d61c00116..90a5474cd3 100644 --- a/platform/commonUI/general/src/controllers/GetterSetterController.js +++ b/platform/commonUI/general/src/controllers/GetterSetterController.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; /** * This controller acts as an adapter to permit getter-setter diff --git a/platform/commonUI/general/src/controllers/ObjectInspectorController.js b/platform/commonUI/general/src/controllers/ObjectInspectorController.js index 5b04304af0..abdc27c154 100644 --- a/platform/commonUI/general/src/controllers/ObjectInspectorController.js +++ b/platform/commonUI/general/src/controllers/ObjectInspectorController.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * Module defining ObjectInspectorController. Created by shale on 08/21/2015. @@ -27,7 +26,6 @@ define( [], function () { - "use strict"; /** * The ObjectInspectorController gets and formats the data for diff --git a/platform/commonUI/general/src/controllers/SelectorController.js b/platform/commonUI/general/src/controllers/SelectorController.js index 26fe5f4d62..55a79af308 100644 --- a/platform/commonUI/general/src/controllers/SelectorController.js +++ b/platform/commonUI/general/src/controllers/SelectorController.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; var ROOT_ID = "ROOT"; diff --git a/platform/commonUI/general/src/controllers/TimeRangeController.js b/platform/commonUI/general/src/controllers/TimeRangeController.js index f0e3da46d9..3f1b625d29 100644 --- a/platform/commonUI/general/src/controllers/TimeRangeController.js +++ b/platform/commonUI/general/src/controllers/TimeRangeController.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ define( ['moment'], function (moment) { - "use strict"; var TICK_SPACING_PX = 150; diff --git a/platform/commonUI/general/src/controllers/ToggleController.js b/platform/commonUI/general/src/controllers/ToggleController.js index 9d7d493f15..8d5840f05a 100644 --- a/platform/commonUI/general/src/controllers/ToggleController.js +++ b/platform/commonUI/general/src/controllers/ToggleController.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ define( [], function () { - "use strict"; /** * A ToggleController is used to activate/deactivate things. diff --git a/platform/commonUI/general/src/controllers/TreeNodeController.js b/platform/commonUI/general/src/controllers/TreeNodeController.js index 3efcf82d28..228069a8e9 100644 --- a/platform/commonUI/general/src/controllers/TreeNodeController.js +++ b/platform/commonUI/general/src/controllers/TreeNodeController.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * Module defining TreeNodeController. Created by vwoeltje on 11/10/14. @@ -27,7 +26,6 @@ define( [], function () { - "use strict"; /** * The TreeNodeController supports the tree node representation; diff --git a/platform/commonUI/general/src/controllers/ViewSwitcherController.js b/platform/commonUI/general/src/controllers/ViewSwitcherController.js index a3ab2e7bc4..2dee615011 100644 --- a/platform/commonUI/general/src/controllers/ViewSwitcherController.js +++ b/platform/commonUI/general/src/controllers/ViewSwitcherController.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * Module defining ViewSwitcherController. Created by vwoeltje on 11/7/14. @@ -27,7 +26,6 @@ define( [], function () { - "use strict"; /** * Controller for the view switcher; populates and maintains a list diff --git a/platform/commonUI/general/src/directives/MCTClickElsewhere.js b/platform/commonUI/general/src/directives/MCTClickElsewhere.js index 1bcdbbe6b5..0ffff19713 100644 --- a/platform/commonUI/general/src/directives/MCTClickElsewhere.js +++ b/platform/commonUI/general/src/directives/MCTClickElsewhere.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; /** * The `mct-click-elsewhere` directive will evaluate its diff --git a/platform/commonUI/general/src/directives/MCTContainer.js b/platform/commonUI/general/src/directives/MCTContainer.js index e35c52f9f6..0c58f6a914 100644 --- a/platform/commonUI/general/src/directives/MCTContainer.js +++ b/platform/commonUI/general/src/directives/MCTContainer.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * Module defining MCTContainer. Created by vwoeltje on 11/17/14. @@ -27,7 +26,6 @@ define( [], function () { - "use strict"; /** * The mct-container is similar to the mct-include directive diff --git a/platform/commonUI/general/src/directives/MCTDrag.js b/platform/commonUI/general/src/directives/MCTDrag.js index 7bccccdf28..ac96357da8 100644 --- a/platform/commonUI/general/src/directives/MCTDrag.js +++ b/platform/commonUI/general/src/directives/MCTDrag.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; /** * The mct-drag directive allows drag functionality diff --git a/platform/commonUI/general/src/directives/MCTPopup.js b/platform/commonUI/general/src/directives/MCTPopup.js index 254a41d1eb..e96c1c0327 100644 --- a/platform/commonUI/general/src/directives/MCTPopup.js +++ b/platform/commonUI/general/src/directives/MCTPopup.js @@ -19,11 +19,9 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( function () { - 'use strict'; var TEMPLATE = "
"; diff --git a/platform/commonUI/general/src/directives/MCTResize.js b/platform/commonUI/general/src/directives/MCTResize.js index f0fd8e0a69..5cf6971c39 100644 --- a/platform/commonUI/general/src/directives/MCTResize.js +++ b/platform/commonUI/general/src/directives/MCTResize.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - "use strict"; // Default resize interval var DEFAULT_INTERVAL = 100; diff --git a/platform/commonUI/general/src/directives/MCTScroll.js b/platform/commonUI/general/src/directives/MCTScroll.js index 6b9d480c66..fd546e426c 100644 --- a/platform/commonUI/general/src/directives/MCTScroll.js +++ b/platform/commonUI/general/src/directives/MCTScroll.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - 'use strict'; /** * Implements `mct-scroll-x` and `mct-scroll-y` directives. Listens diff --git a/platform/commonUI/general/src/directives/MCTSplitPane.js b/platform/commonUI/general/src/directives/MCTSplitPane.js index b094ba785f..5f028fdf6b 100644 --- a/platform/commonUI/general/src/directives/MCTSplitPane.js +++ b/platform/commonUI/general/src/directives/MCTSplitPane.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - 'use strict'; // Pixel width to allocate for the splitter itself var DEFAULT_ANCHOR = 'left', diff --git a/platform/commonUI/general/src/directives/MCTSplitter.js b/platform/commonUI/general/src/directives/MCTSplitter.js index ad8f809c65..b0c5b3357d 100644 --- a/platform/commonUI/general/src/directives/MCTSplitter.js +++ b/platform/commonUI/general/src/directives/MCTSplitter.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [], function () { - 'use strict'; // Pixel width to allocate for the splitter itself var SPLITTER_TEMPLATE = "
Date: Fri, 4 Mar 2016 10:46:51 -0800 Subject: [PATCH 10/85] [Build] Add Float32Array to predefs --- .jshintrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.jshintrc b/.jshintrc index b3d3868d70..a0109fbce7 100644 --- a/.jshintrc +++ b/.jshintrc @@ -13,6 +13,7 @@ "predef": [ "define", "Blob", + "Float32Array", "Promise" ], "strict": "implied", From dda06286212b9ef95c3236924409256f508927e2 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 10:49:22 -0800 Subject: [PATCH 11/85] [Build] Clarify expressions ...to satisfy JSHint. --- .../src/controllers/drag/TimelineMoveHandle.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/platform/features/timeline/src/controllers/drag/TimelineMoveHandle.js b/platform/features/timeline/src/controllers/drag/TimelineMoveHandle.js index 6d642bf166..a05ce117e5 100644 --- a/platform/features/timeline/src/controllers/drag/TimelineMoveHandle.js +++ b/platform/features/timeline/src/controllers/drag/TimelineMoveHandle.js @@ -117,13 +117,10 @@ define( style: function (zoom) { return { - left: zoom.toPixels(dragHandler.start(id)) + - Constants.HANDLE_WIDTH + - 'px', - width: zoom.toPixels(dragHandler.duration(id)) - - Constants.HANDLE_WIDTH * 2 - + 'px' - //cursor: initialStart === undefined ? 'grab' : 'grabbing' + left: (zoom.toPixels(dragHandler.start(id)) + + Constants.HANDLE_WIDTH) + 'px', + width: (zoom.toPixels(dragHandler.duration(id)) - + Constants.HANDLE_WIDTH * 2) + 'px' }; } }; From 2dabe0d3c426dcf683d23b0582e27bc2188f3b79 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 10:51:08 -0800 Subject: [PATCH 12/85] [Build] Add curly braces around if block ...to satisfy JSHint --- .../features/table/src/controllers/TelemetryTableController.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/features/table/src/controllers/TelemetryTableController.js b/platform/features/table/src/controllers/TelemetryTableController.js index 747f6cc137..12339cf9e6 100644 --- a/platform/features/table/src/controllers/TelemetryTableController.js +++ b/platform/features/table/src/controllers/TelemetryTableController.js @@ -59,8 +59,9 @@ define( // Subscribe to telemetry when a domain object becomes available this.$scope.$watch('domainObject', function(domainObject){ - if (!domainObject) + if (!domainObject) { return; + } self.subscribe(); self.registerChangeListeners(); From a8f7bc01c32dd1d9f191649c338a96f5b9be5389 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 10:53:12 -0800 Subject: [PATCH 13/85] [Build] Redeclare globals --- platform/framework/src/FrameworkLayer.js | 2 ++ platform/framework/src/Main.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/platform/framework/src/FrameworkLayer.js b/platform/framework/src/FrameworkLayer.js index ba362be67b..1f8910fe15 100644 --- a/platform/framework/src/FrameworkLayer.js +++ b/platform/framework/src/FrameworkLayer.js @@ -20,6 +20,8 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ +/*global window,requirejs*/ + define([ 'require', './Constants', diff --git a/platform/framework/src/Main.js b/platform/framework/src/Main.js index 87b67dd8ca..c468e4dbea 100644 --- a/platform/framework/src/Main.js +++ b/platform/framework/src/Main.js @@ -20,6 +20,8 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ +/*global window,requirejs*/ + /** * Implements the framework layer, which handles the loading of bundles * and the wiring-together of the extensions they expose. From 72ef1347507c7258e77ea4cda6c3d82e86489662 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 10:55:30 -0800 Subject: [PATCH 14/85] [Build] Move operators to satisfy JSHint --- platform/features/clock/src/actions/RestartTimerAction.js | 4 ++-- platform/features/clock/src/actions/StartTimerAction.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/features/clock/src/actions/RestartTimerAction.js b/platform/features/clock/src/actions/RestartTimerAction.js index 7f359ca721..30b785b332 100644 --- a/platform/features/clock/src/actions/RestartTimerAction.js +++ b/platform/features/clock/src/actions/RestartTimerAction.js @@ -47,8 +47,8 @@ define( RestartTimerAction.appliesTo = function (context) { var model = - (context.domainObject && context.domainObject.getModel()) - || {}; + (context.domainObject && context.domainObject.getModel()) || + {}; // We show this variant for timers which already have // a target time. diff --git a/platform/features/clock/src/actions/StartTimerAction.js b/platform/features/clock/src/actions/StartTimerAction.js index 04a548de2b..25aff8ac2a 100644 --- a/platform/features/clock/src/actions/StartTimerAction.js +++ b/platform/features/clock/src/actions/StartTimerAction.js @@ -47,8 +47,8 @@ define( StartTimerAction.appliesTo = function (context) { var model = - (context.domainObject && context.domainObject.getModel()) - || {}; + (context.domainObject && context.domainObject.getModel()) || + {}; // We show this variant for timers which do not yet have // a target time. From f6898d16c9efabf25319cae2981bd1d8c082fff1 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 10:56:51 -0800 Subject: [PATCH 15/85] [Build] Remove obsolete argument ...which incidentally triggers JSHint errors --- platform/commonUI/inspect/src/services/InfoService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/commonUI/inspect/src/services/InfoService.js b/platform/commonUI/inspect/src/services/InfoService.js index 314ed32dd0..605bf8dfc5 100644 --- a/platform/commonUI/inspect/src/services/InfoService.js +++ b/platform/commonUI/inspect/src/services/InfoService.js @@ -67,7 +67,7 @@ define( // On a phone, bubble takes up more screen real estate, // so position it differently (toward the bottom) - if (this.agentService.isPhone(navigator.userAgent)) { + if (this.agentService.isPhone()) { position = MOBILE_POSITION; options = {}; } From 56a91dfbaf3012bcfd2bc27967a86be6fbd54a3f Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 10:58:23 -0800 Subject: [PATCH 16/85] [Build] Use not-threequals operator ...to satisfy JSHint --- platform/commonUI/edit/src/representers/EditRepresenter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/commonUI/edit/src/representers/EditRepresenter.js b/platform/commonUI/edit/src/representers/EditRepresenter.js index 386285b38f..d61d5825ec 100644 --- a/platform/commonUI/edit/src/representers/EditRepresenter.js +++ b/platform/commonUI/edit/src/representers/EditRepresenter.js @@ -131,7 +131,7 @@ define( * object representation accordingly */ this.listenHandle = this.domainObject.getCapability('status').listen(function(statuses){ - if (statuses.indexOf('editing')!=-1){ + if (statuses.indexOf('editing') !== -1){ setEditing(); } else { delete scope.viewObjectTemplate; From c00d77dcb11338c67fe01ee610c7a77ed331fda3 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 11:02:57 -0800 Subject: [PATCH 17/85] [Build] Relocate operators ...in multi-line expressions, to satisfy JSHint. --- platform/commonUI/edit/src/policies/EditActionPolicy.js | 6 +++--- .../commonUI/edit/src/policies/EditNavigationPolicy.js | 4 ++-- platform/commonUI/notification/src/NotificationService.js | 8 ++++---- platform/entanglement/src/actions/GoToOriginalAction.js | 4 ++-- .../entanglement/src/actions/SetPrimaryLocationAction.js | 4 ++-- platform/features/plot/src/SubPlot.js | 4 ++-- platform/persistence/queue/src/PersistenceQueueImpl.js | 4 ++-- .../representation/src/gestures/ContextMenuGesture.js | 8 ++++---- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/platform/commonUI/edit/src/policies/EditActionPolicy.js b/platform/commonUI/edit/src/policies/EditActionPolicy.js index a3a43fa81e..8c4ffc2641 100644 --- a/platform/commonUI/edit/src/policies/EditActionPolicy.js +++ b/platform/commonUI/edit/src/policies/EditActionPolicy.js @@ -79,9 +79,9 @@ define( */ function isEditing(context) { var domainObject = (context || {}).domainObject; - return domainObject - && domainObject.hasCapability('status') - && domainObject.getCapability('status').get('editing'); + return domainObject && + domainObject.hasCapability('status') && + domainObject.getCapability('status').get('editing'); } EditActionPolicy.prototype.allow = function (action, context) { diff --git a/platform/commonUI/edit/src/policies/EditNavigationPolicy.js b/platform/commonUI/edit/src/policies/EditNavigationPolicy.js index 6797ac4eb1..62c489b35d 100644 --- a/platform/commonUI/edit/src/policies/EditNavigationPolicy.js +++ b/platform/commonUI/edit/src/policies/EditNavigationPolicy.js @@ -45,8 +45,8 @@ define( statusCapability = navigatedObject && navigatedObject.getCapability("status"); - return statusCapability && statusCapability.get('editing') - && editorCapability && editorCapability.dirty(); + return statusCapability && statusCapability.get('editing') && + editorCapability && editorCapability.dirty(); }; /** diff --git a/platform/commonUI/notification/src/NotificationService.js b/platform/commonUI/notification/src/NotificationService.js index 6ee888d57c..7d3ab2c61d 100644 --- a/platform/commonUI/notification/src/NotificationService.js +++ b/platform/commonUI/notification/src/NotificationService.js @@ -388,8 +388,8 @@ define( notifications queued for display, setup a timeout to dismiss the dialog. */ - if (notification && (notification.model.autoDismiss - || this.selectNextNotification())) { + if (notification && (notification.model.autoDismiss || + this.selectNextNotification())) { timeout = notification.model.autoDismiss || this.DEFAULT_AUTO_DISMISS; this.active.timeout = this.$timeout(function () { @@ -416,8 +416,8 @@ define( for (; i< this.notifications.length; i++) { notification = this.notifications[i]; - if (!notification.model.minimized - && notification!== this.active.notification) { + if (!notification.model.minimized && + notification!== this.active.notification) { return notification; } diff --git a/platform/entanglement/src/actions/GoToOriginalAction.js b/platform/entanglement/src/actions/GoToOriginalAction.js index 6a1dbc6343..f68225d3b3 100644 --- a/platform/entanglement/src/actions/GoToOriginalAction.js +++ b/platform/entanglement/src/actions/GoToOriginalAction.js @@ -50,8 +50,8 @@ define( GoToOriginalAction.appliesTo = function (context) { var domainObject = context.domainObject; - return domainObject && domainObject.hasCapability("location") - && domainObject.getCapability("location").isLink(); + return domainObject && domainObject.hasCapability("location") && + domainObject.getCapability("location").isLink(); }; return GoToOriginalAction; diff --git a/platform/entanglement/src/actions/SetPrimaryLocationAction.js b/platform/entanglement/src/actions/SetPrimaryLocationAction.js index d47ef4a28d..6fbdf89cbc 100644 --- a/platform/entanglement/src/actions/SetPrimaryLocationAction.js +++ b/platform/entanglement/src/actions/SetPrimaryLocationAction.js @@ -48,8 +48,8 @@ define( SetPrimaryLocationAction.appliesTo = function (context) { var domainObject = context.domainObject; - return domainObject && domainObject.hasCapability("location") - && (domainObject.getModel().location === undefined); + return domainObject && domainObject.hasCapability("location") && + (domainObject.getModel().location === undefined); }; return SetPrimaryLocationAction; diff --git a/platform/features/plot/src/SubPlot.js b/platform/features/plot/src/SubPlot.js index b2a31cc8ca..d016d4730d 100644 --- a/platform/features/plot/src/SubPlot.js +++ b/platform/features/plot/src/SubPlot.js @@ -68,8 +68,8 @@ define( * @returns {boolean} true if domain data exists for the current pan/zoom level */ SubPlot.prototype.hasDomainData = function() { - return this.panZoomStack - && this.panZoomStack.getDimensions()[0] > 0; + return this.panZoomStack && + this.panZoomStack.getDimensions()[0] > 0; }; // Utility function for filtering out empty strings. diff --git a/platform/persistence/queue/src/PersistenceQueueImpl.js b/platform/persistence/queue/src/PersistenceQueueImpl.js index d344efe2b5..f177800afe 100644 --- a/platform/persistence/queue/src/PersistenceQueueImpl.js +++ b/platform/persistence/queue/src/PersistenceQueueImpl.js @@ -66,8 +66,8 @@ define( // Check if the queue's size has stopped increasing) function quiescent() { - return Object.keys(self.persistences).length - === self.lastObservedSize; + return Object.keys(self.persistences).length === + self.lastObservedSize; } // Persist all queued objects diff --git a/platform/representation/src/gestures/ContextMenuGesture.js b/platform/representation/src/gestures/ContextMenuGesture.js index 36d5aea65e..78abed5347 100644 --- a/platform/representation/src/gestures/ContextMenuGesture.js +++ b/platform/representation/src/gestures/ContextMenuGesture.js @@ -45,10 +45,10 @@ define( parameters = element && element.attr('parameters') && $parse(element.attr('parameters'))(); function suppressMenu() { - return parameters - && parameters.suppressMenuOnEdit - && navigationService.getNavigation() - && navigationService.getNavigation().hasCapability('editor'); + return parameters && + parameters.suppressMenuOnEdit && + navigationService.getNavigation() && + navigationService.getNavigation().hasCapability('editor'); } function showMenu(event) { From 6289fe333bb62f2a01a181a860b592f560f64368 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 11:05:08 -0800 Subject: [PATCH 18/85] [Build] Declare screenfull ...and shim such that it can be acquired in the normal AMD way. Avoids use of global variable to satisfy JSHint. --- main.js | 3 +++ platform/commonUI/browse/src/windowing/FullscreenAction.js | 2 +- test-main.js | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 739cf056cd..8f0dfd2f3e 100644 --- a/main.js +++ b/main.js @@ -44,6 +44,9 @@ requirejs.config({ }, "moment-duration-format": { "deps": [ "moment" ] + }, + "screenfull": { + "exports": "screenfull" } } }); diff --git a/platform/commonUI/browse/src/windowing/FullscreenAction.js b/platform/commonUI/browse/src/windowing/FullscreenAction.js index f898dbbe6e..e9fcf9df76 100644 --- a/platform/commonUI/browse/src/windowing/FullscreenAction.js +++ b/platform/commonUI/browse/src/windowing/FullscreenAction.js @@ -25,7 +25,7 @@ */ define( ["screenfull"], - function () { + function (screenfull) { var ENTER_FULLSCREEN = "Enter full screen mode", EXIT_FULLSCREEN = "Exit full screen mode"; diff --git a/test-main.js b/test-main.js index 13f1bf367d..caa306c1b6 100644 --- a/test-main.js +++ b/test-main.js @@ -65,6 +65,9 @@ requirejs.config({ }, "moment-duration-format": { "deps": [ "moment" ] + }, + "screenfull": { + "exports": "screenfull" } }, From f380e43219e38a53f59b579e4d76cc05186413f3 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 11:08:20 -0800 Subject: [PATCH 19/85] [Build] Inject window to satisfy JSHint --- platform/persistence/local/bundle.js | 1 + .../persistence/local/src/LocalStoragePersistenceProvider.js | 5 ++--- .../local/test/LocalStoragePersistenceProviderSpec.js | 5 +---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/platform/persistence/local/bundle.js b/platform/persistence/local/bundle.js index 11a546941a..e09e19e4b7 100644 --- a/platform/persistence/local/bundle.js +++ b/platform/persistence/local/bundle.js @@ -38,6 +38,7 @@ define([ "type": "provider", "implementation": LocalStoragePersistenceProvider, "depends": [ + "$window", "$q", "PERSISTENCE_SPACE" ] diff --git a/platform/persistence/local/src/LocalStoragePersistenceProvider.js b/platform/persistence/local/src/LocalStoragePersistenceProvider.js index 2321297a44..a930304074 100644 --- a/platform/persistence/local/src/LocalStoragePersistenceProvider.js +++ b/platform/persistence/local/src/LocalStoragePersistenceProvider.js @@ -20,7 +20,6 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ - define( [], function () { @@ -36,11 +35,11 @@ define( * @param $interval Angular's $interval service * @param {string} space the name of the persistence space being served */ - function LocalStoragePersistenceProvider($q, space) { + function LocalStoragePersistenceProvider($window, $q, space) { this.$q = $q; this.space = space; this.spaces = space ? [space] : []; - this.localStorage = window.localStorage; + this.localStorage = $window.localStorage; } /** diff --git a/platform/persistence/local/test/LocalStoragePersistenceProviderSpec.js b/platform/persistence/local/test/LocalStoragePersistenceProviderSpec.js index f01ece2e49..b6530584d6 100644 --- a/platform/persistence/local/test/LocalStoragePersistenceProviderSpec.js +++ b/platform/persistence/local/test/LocalStoragePersistenceProviderSpec.js @@ -49,14 +49,11 @@ define( mockQ.when.andCallFake(mockPromise); provider = new LocalStoragePersistenceProvider( + { localStorage: testLocalStorage }, mockQ, testSpace, testLocalStorage ); - - // White-boxy: Can't effectively mock window.localStorage, - // so override the provider's local reference to it. - provider.localStorage = testLocalStorage; }); it("reports available spaces", function () { From 6aeb156a5864d81cbafb81a83e9d5aa5b69704de Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 11:09:41 -0800 Subject: [PATCH 20/85] [Build] Declare global self in worker --- platform/search/src/services/GenericSearchWorker.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/search/src/services/GenericSearchWorker.js b/platform/search/src/services/GenericSearchWorker.js index bd8ab68ec2..a3cd34c2e2 100644 --- a/platform/search/src/services/GenericSearchWorker.js +++ b/platform/search/src/services/GenericSearchWorker.js @@ -20,6 +20,8 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ +/*global self*/ + /** * Module defining GenericSearchWorker. Created by shale on 07/21/2015. */ From 9526207af876358987d7f0570f2e700418554b83 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 11:13:31 -0800 Subject: [PATCH 21/85] [Build] Replace setTimeout with To avoid need to declare global usage to satisfy JSHint --- platform/search/bundle.js | 1 + platform/search/src/services/GenericSearchProvider.js | 10 ++++++---- .../search/test/services/GenericSearchProviderSpec.js | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/platform/search/bundle.js b/platform/search/bundle.js index fb5714fab6..74040b84f4 100644 --- a/platform/search/bundle.js +++ b/platform/search/bundle.js @@ -103,6 +103,7 @@ define([ "type": "provider", "implementation": GenericSearchProvider, "depends": [ + "$timeout", "$q", "$log", "modelService", diff --git a/platform/search/src/services/GenericSearchProvider.js b/platform/search/src/services/GenericSearchProvider.js index 7eff7c3b08..caa5dec428 100644 --- a/platform/search/src/services/GenericSearchProvider.js +++ b/platform/search/src/services/GenericSearchProvider.js @@ -41,8 +41,9 @@ define([ * @param {TopicService} topic the topic service. * @param {Array} ROOTS An array of object Ids to begin indexing. */ - function GenericSearchProvider($q, $log, modelService, workerService, topic, ROOTS) { + function GenericSearchProvider($timeout, $q, $log, modelService, workerService, topic, ROOTS) { var provider = this; + this.$timeout = $timeout; this.$q = $q; this.$log = $log; this.modelService = modelService; @@ -188,7 +189,8 @@ define([ */ GenericSearchProvider.prototype.beginIndexRequest = function () { var idToIndex = this.idsToIndex.shift(), - provider = this; + provider = this, + $timeout = this.$timeout; this.pendingRequests += 1; this.modelService @@ -204,10 +206,10 @@ define([ .warn('Failed to index domain object ' + idToIndex); }) .then(function () { - setTimeout(function () { + $timeout(function () { provider.pendingRequests -= 1; provider.keepIndexing(); - }, 0); + }, 0, false); }); }; diff --git a/platform/search/test/services/GenericSearchProviderSpec.js b/platform/search/test/services/GenericSearchProviderSpec.js index da3f43897f..b7c8321add 100644 --- a/platform/search/test/services/GenericSearchProviderSpec.js +++ b/platform/search/test/services/GenericSearchProviderSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ - runs*/ /** * SearchSpec. Created by shale on 07/31/2015. @@ -43,6 +42,7 @@ define([ provider; beforeEach(function () { + $timeout = jasmine.createSpy('$timeout'); $q = jasmine.createSpyObj( '$q', ['defer'] @@ -82,6 +82,7 @@ define([ spyOn(GenericSearchProvider.prototype, 'scheduleForIndexing'); provider = new GenericSearchProvider( + $timeout, $q, $log, modelService, From 19c9fcd3691ea86db583905bfc653c5a75130d44 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 11:18:25 -0800 Subject: [PATCH 22/85] [Build] Remove apparent strict violations ...from persistence providers. --- .../couch/src/CouchPersistenceProvider.js | 16 ++++++++-------- .../elastic/src/ElasticPersistenceProvider.js | 11 ++++++----- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/platform/persistence/couch/src/CouchPersistenceProvider.js b/platform/persistence/couch/src/CouchPersistenceProvider.js index 6e7a1c6aaf..21579eb5f9 100644 --- a/platform/persistence/couch/src/CouchPersistenceProvider.js +++ b/platform/persistence/couch/src/CouchPersistenceProvider.js @@ -69,24 +69,24 @@ define( // Check the response to a create/update/delete request; // track the rev if it's valid, otherwise return false to // indicate that the request failed. - function checkResponse(response) { + CouchPersistenceProvider.prototype.checkResponse = function (response) { if (response && response.ok) { this.revs[response.id] = response.rev; return response.ok; } else { return false; } - } + }; // Get a domain object model out of CouchDB's response - function getModel(response) { + CouchPersistenceProvider.prototype.getModel = function (response) { if (response && response.model) { this.revs[response[ID]] = response[REV]; return response.model; } else { return undefined; } - } + }; // Issue a request using $http; get back the plain JS object // from the expected JSON response @@ -122,24 +122,24 @@ define( CouchPersistenceProvider.prototype.createObject = function (space, key, value) { return this.put(key, new CouchDocument(key, value)) - .then(bind(checkResponse, this)); + .then(bind(this.checkResponse, this)); }; CouchPersistenceProvider.prototype.readObject = function (space, key) { - return this.get(key).then(bind(getModel, this)); + return this.get(key).then(bind(this.getModel, this)); }; CouchPersistenceProvider.prototype.updateObject = function (space, key, value) { var rev = this.revs[key]; return this.put(key, new CouchDocument(key, value, rev)) - .then(bind(checkResponse, this)); + .then(bind(this.checkResponse, this)); }; CouchPersistenceProvider.prototype.deleteObject = function (space, key, value) { var rev = this.revs[key]; return this.put(key, new CouchDocument(key, value, rev, true)) - .then(bind(checkResponse, this)); + .then(bind(this.checkResponse, this)); }; return CouchPersistenceProvider; diff --git a/platform/persistence/elastic/src/ElasticPersistenceProvider.js b/platform/persistence/elastic/src/ElasticPersistenceProvider.js index 75208c9aac..8ffb5d0232 100644 --- a/platform/persistence/elastic/src/ElasticPersistenceProvider.js +++ b/platform/persistence/elastic/src/ElasticPersistenceProvider.js @@ -108,14 +108,14 @@ define( }; // Get a domain object model out of ElasticSearch's response - function getModel(response) { + ElasticPersistenceProvider.prototype.getModel = function (response) { if (response && response[SRC]) { this.revs[response[ID]] = response[REV]; return response[SRC]; } else { return undefined; } - } + }; // Check the response to a create/update/delete request; // track the rev if it's valid, otherwise return false to @@ -145,15 +145,16 @@ define( }; ElasticPersistenceProvider.prototype.readObject = function (space, key) { - return this.get(key).then(bind(getModel, this)); + return this.get(key).then(bind(this.getModel, this)); }; ElasticPersistenceProvider.prototype.updateObject = function (space, key, value) { + var self = this; function checkUpdate(response) { - return this.checkResponse(response, key); + return self.checkResponse(response, key); } return this.put(key, value, { version: this.revs[key] }) - .then(bind(checkUpdate, this)); + .then(checkUpdate); }; ElasticPersistenceProvider.prototype.deleteObject = function (space, key, value) { From bf232d05933e9a24d3be42b72351a8c3ec2d0bf6 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 11:24:14 -0800 Subject: [PATCH 23/85] [Build] Ignore apparent strict violation ...in CustomRegistrars. --- platform/framework/src/register/CustomRegistrars.js | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/framework/src/register/CustomRegistrars.js b/platform/framework/src/register/CustomRegistrars.js index d0ce3cccc3..95ce291ad1 100644 --- a/platform/framework/src/register/CustomRegistrars.js +++ b/platform/framework/src/register/CustomRegistrars.js @@ -26,6 +26,7 @@ define( ['../Constants', './ServiceCompositor'], function (Constants, ServiceCompositor) { + /*jshint validthis:true */ /** * Handles registration of a few specific extension types that are From a1a7b2b8ce9b6c512842cbc17ceca6d2273c8849 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 11:41:48 -0800 Subject: [PATCH 24/85] [Build] Remove unused variables ...to satisfy JSHint --- platform/commonUI/browse/src/BrowseController.js | 6 ++---- platform/commonUI/browse/src/creation/CreationService.js | 4 +--- platform/commonUI/browse/src/windowing/NewTabAction.js | 2 -- platform/commonUI/edit/src/actions/SaveAction.js | 3 +-- .../edit/src/capabilities/EditableActionCapability.js | 5 +---- .../edit/src/objects/EditableDomainObjectCache.js | 3 +-- .../commonUI/edit/src/representers/EditRepresenter.js | 4 ++-- .../general/src/controllers/TimeRangeController.js | 8 ++++---- .../general/src/controllers/TreeNodeController.js | 4 +--- platform/commonUI/general/src/directives/MCTSplitPane.js | 9 +-------- platform/commonUI/general/src/directives/MCTSplitter.js | 9 +-------- platform/commonUI/general/src/services/PopupService.js | 3 +-- .../commonUI/notification/src/NotificationService.js | 3 +-- platform/containment/src/CompositionModelPolicy.js | 2 +- .../core/src/capabilities/InstantiationCapability.js | 4 ++-- platform/core/src/objects/DomainObjectProvider.js | 4 ++-- platform/entanglement/src/policies/CrossSpacePolicy.js | 3 +-- .../features/clock/src/controllers/TimerController.js | 3 +-- platform/features/clock/src/services/TickerService.js | 4 ++-- platform/features/conductor/src/ConductorRepresenter.js | 2 +- .../conductor/src/ConductorTelemetryDecorator.js | 3 --- .../imagery/src/directives/MCTBackgroundImage.js | 4 ++-- platform/features/layout/src/FixedController.js | 4 ++-- platform/features/layout/src/elements/TelemetryProxy.js | 4 ++-- platform/features/rtevents/src/RTEventListController.js | 6 +----- .../table/src/controllers/TelemetryTableController.js | 2 +- platform/features/table/src/directives/MCTTable.js | 4 ++-- .../timeline/src/capabilities/ActivityUtilization.js | 4 ++-- .../timeline/src/capabilities/CumulativeGraph.js | 1 - .../timeline/src/capabilities/TimelineTimespan.js | 4 ++-- .../timeline/src/controllers/TimelineZoomController.js | 8 ++------ .../timeline/src/controllers/graph/TimelineGraph.js | 2 -- .../features/timeline/src/directives/MCTSwimlaneDrop.js | 1 - platform/forms/src/controllers/ColorController.js | 2 +- platform/persistence/couch/src/CouchIndicator.js | 2 +- .../persistence/couch/src/CouchPersistenceProvider.js | 2 +- .../elastic/src/ElasticPersistenceProvider.js | 2 +- .../persistence/elastic/src/ElasticSearchProvider.js | 2 +- .../local/src/LocalStoragePersistenceProvider.js | 2 +- platform/representation/src/MCTRepresentation.js | 5 ++--- platform/representation/src/TemplatePrefetcher.js | 2 +- .../representation/src/gestures/ContextMenuGesture.js | 2 +- platform/representation/src/gestures/DropGesture.js | 9 +-------- platform/telemetry/src/TelemetryFormatter.js | 2 +- 44 files changed, 55 insertions(+), 109 deletions(-) diff --git a/platform/commonUI/browse/src/BrowseController.js b/platform/commonUI/browse/src/BrowseController.js index 2c07ee7b50..e5d0fcf2b9 100644 --- a/platform/commonUI/browse/src/BrowseController.js +++ b/platform/commonUI/browse/src/BrowseController.js @@ -25,10 +25,8 @@ * @namespace platform/commonUI/browse */ define( - [ - '../../../representation/src/gestures/GestureConstants' - ], - function (GestureConstants) { + [], + function () { var ROOT_ID = "ROOT"; diff --git a/platform/commonUI/browse/src/creation/CreationService.js b/platform/commonUI/browse/src/creation/CreationService.js index ca5389e162..6048d15378 100644 --- a/platform/commonUI/browse/src/creation/CreationService.js +++ b/platform/commonUI/browse/src/creation/CreationService.js @@ -28,9 +28,7 @@ define( function () { var NON_PERSISTENT_WARNING = - "Tried to create an object in non-persistent container.", - NO_COMPOSITION_WARNING = - "Could not add to composition; no composition in "; + "Tried to create an object in non-persistent container."; /** * The creation service is responsible for instantiating and diff --git a/platform/commonUI/browse/src/windowing/NewTabAction.js b/platform/commonUI/browse/src/windowing/NewTabAction.js index 83422d5096..86c1dfdd94 100644 --- a/platform/commonUI/browse/src/windowing/NewTabAction.js +++ b/platform/commonUI/browse/src/windowing/NewTabAction.js @@ -26,8 +26,6 @@ define( [], function () { - var ROOT_ID = "ROOT", - DEFAULT_PATH = "/mine"; /** * The new tab action allows a domain object to be opened * into a new browser tab. diff --git a/platform/commonUI/edit/src/actions/SaveAction.js b/platform/commonUI/edit/src/actions/SaveAction.js index 55755e12cb..bdc3225258 100644 --- a/platform/commonUI/edit/src/actions/SaveAction.js +++ b/platform/commonUI/edit/src/actions/SaveAction.js @@ -79,8 +79,7 @@ define( } function doWizardSave(parent) { - var context = domainObject.getCapability("context"), - wizard = new CreateWizard( + var wizard = new CreateWizard( domainObject, parent, self.policyService diff --git a/platform/commonUI/edit/src/capabilities/EditableActionCapability.js b/platform/commonUI/edit/src/capabilities/EditableActionCapability.js index 2e83dee0a0..bdfa4d3f59 100644 --- a/platform/commonUI/edit/src/capabilities/EditableActionCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditableActionCapability.js @@ -37,10 +37,7 @@ define( * @implements {PersistenceCapability} */ function EditableActionCapability( - actionCapability, - editableObject, - domainObject, - cache + actionCapability ) { var action = Object.create(actionCapability); diff --git a/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js b/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js index bd557f882c..774e562e61 100644 --- a/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js +++ b/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js @@ -68,8 +68,7 @@ define( EditableDomainObjectCache.prototype.getEditableObject = function (domainObject) { var type = domainObject.getCapability('type'), EditableDomainObject = this.EditableDomainObject, - editableObject, - statusListener; + editableObject; // Track the top-level domain object; this will have // some special behavior for its context capability. diff --git a/platform/commonUI/edit/src/representers/EditRepresenter.js b/platform/commonUI/edit/src/representers/EditRepresenter.js index d61d5825ec..b48bb2f50a 100644 --- a/platform/commonUI/edit/src/representers/EditRepresenter.js +++ b/platform/commonUI/edit/src/representers/EditRepresenter.js @@ -109,8 +109,8 @@ define( // Handle a specific representation of a specific domain object EditRepresenter.prototype.represent = function represent(representation, representedObject) { - var scope = this.scope, - self = this; + var scope = this.scope; + // Track the key, to know which view configuration to save to. this.key = (representation || {}).key; // Track the represented object diff --git a/platform/commonUI/general/src/controllers/TimeRangeController.js b/platform/commonUI/general/src/controllers/TimeRangeController.js index 3f1b625d29..7f6732b98a 100644 --- a/platform/commonUI/general/src/controllers/TimeRangeController.js +++ b/platform/commonUI/general/src/controllers/TimeRangeController.js @@ -21,8 +21,8 @@ *****************************************************************************/ define( - ['moment'], - function (moment) { + [], + function () { var TICK_SPACING_PX = 150; @@ -180,7 +180,7 @@ define( }; } - function updateOuterStart(t) { + function updateOuterStart() { var ngModel = $scope.ngModel; ngModel.inner.start = @@ -195,7 +195,7 @@ define( updateTicks(); } - function updateOuterEnd(t) { + function updateOuterEnd() { var ngModel = $scope.ngModel; ngModel.inner.end = diff --git a/platform/commonUI/general/src/controllers/TreeNodeController.js b/platform/commonUI/general/src/controllers/TreeNodeController.js index 228069a8e9..52b0e2e5a9 100644 --- a/platform/commonUI/general/src/controllers/TreeNodeController.js +++ b/platform/commonUI/general/src/controllers/TreeNodeController.js @@ -60,9 +60,7 @@ define( */ function TreeNodeController($scope, $timeout) { var self = this, - selectedObject = ($scope.ngModel || {}).selectedObject, - isSelected = false, - hasBeenExpanded = false; + selectedObject = ($scope.ngModel || {}).selectedObject; // Look up the id for a domain object. A convenience // for mapping; additionally does some undefined-checking. diff --git a/platform/commonUI/general/src/directives/MCTSplitPane.js b/platform/commonUI/general/src/directives/MCTSplitPane.js index 5f028fdf6b..243481f0db 100644 --- a/platform/commonUI/general/src/directives/MCTSplitPane.js +++ b/platform/commonUI/general/src/directives/MCTSplitPane.js @@ -94,13 +94,6 @@ define( * @constructor */ function MCTSplitPane($parse, $log, $interval) { - var anchors = { - left: true, - right: true, - top: true, - bottom: true - }; - function controller($scope, $element, $attrs) { var anchorKey = $attrs.anchor || DEFAULT_ANCHOR, anchor, @@ -162,7 +155,7 @@ define( // Getter-setter for the pixel offset of the splitter, // relative to the current edge. function getSetPosition(value) { - var min, max, prior = position; + var prior = position; if (typeof value === 'number') { position = value; enforceExtrema(); diff --git a/platform/commonUI/general/src/directives/MCTSplitter.js b/platform/commonUI/general/src/directives/MCTSplitter.js index b0c5b3357d..0f8c77da96 100644 --- a/platform/commonUI/general/src/directives/MCTSplitter.js +++ b/platform/commonUI/general/src/directives/MCTSplitter.js @@ -28,13 +28,7 @@ define( var SPLITTER_TEMPLATE = "
", - OFFSETS_BY_EDGE = { - left: "offsetLeft", - right: "offsetRight", - top: "offsetTop", - bottom: "offsetBottom" - }; + "mct-drag-up=\"splitter.endMove()\">
"; /** * Implements `mct-splitter` directive. @@ -50,7 +44,6 @@ define( scope.splitter = { // Begin moving this splitter startMove: function () { - var splitter = element[0]; initialPosition = mctSplitPane.position(); mctSplitPane.toggleClass('resizing'); }, diff --git a/platform/commonUI/general/src/services/PopupService.js b/platform/commonUI/general/src/services/PopupService.js index 62d7a340e7..b869be6d76 100644 --- a/platform/commonUI/general/src/services/PopupService.js +++ b/platform/commonUI/general/src/services/PopupService.js @@ -81,8 +81,7 @@ define( winDim = [ $window.innerWidth, $window.innerHeight ], styles = { position: 'absolute' }, margin, - offset, - bubble; + offset; function adjustNegatives(value, index) { return value < 0 ? (value + winDim[index]) : value; diff --git a/platform/commonUI/notification/src/NotificationService.js b/platform/commonUI/notification/src/NotificationService.js index 7d3ab2c61d..868ccf6f08 100644 --- a/platform/commonUI/notification/src/NotificationService.js +++ b/platform/commonUI/notification/src/NotificationService.js @@ -379,9 +379,8 @@ define( */ NotificationService.prototype.setActiveNotification = function (notification) { + var timeout; - var self = this, - timeout; this.active.notification = notification; /* If autoDismiss has been specified, OR there are other diff --git a/platform/containment/src/CompositionModelPolicy.js b/platform/containment/src/CompositionModelPolicy.js index 3c8144a08e..be51e0c040 100644 --- a/platform/containment/src/CompositionModelPolicy.js +++ b/platform/containment/src/CompositionModelPolicy.js @@ -13,7 +13,7 @@ define( function CompositionModelPolicy() { } - CompositionModelPolicy.prototype.allow = function (candidate, context) { + CompositionModelPolicy.prototype.allow = function (candidate) { return Array.isArray( (candidate.getInitialModel() || {}).composition ); diff --git a/platform/core/src/capabilities/InstantiationCapability.js b/platform/core/src/capabilities/InstantiationCapability.js index 0b92c2bc68..e1de97f624 100644 --- a/platform/core/src/capabilities/InstantiationCapability.js +++ b/platform/core/src/capabilities/InstantiationCapability.js @@ -21,8 +21,8 @@ *****************************************************************************/ define( - ['../objects/DomainObjectImpl'], - function (DomainObjectImpl) { + [], + function () { /** * Implements the `instantiation` capability. This allows new domain diff --git a/platform/core/src/objects/DomainObjectProvider.js b/platform/core/src/objects/DomainObjectProvider.js index b2bbd8f84c..496d29d117 100644 --- a/platform/core/src/objects/DomainObjectProvider.js +++ b/platform/core/src/objects/DomainObjectProvider.js @@ -61,7 +61,7 @@ define( * @memberof platform/core * @constructor */ - function DomainObjectProvider(modelService, instantiate, $q) { + function DomainObjectProvider(modelService, instantiate) { this.modelService = modelService; this.instantiate = instantiate; } @@ -75,7 +75,7 @@ define( // from this service. function assembleResult(models) { var result = {}; - ids.forEach(function (id, index) { + ids.forEach(function (id) { if (models[id]) { // Create the domain object result[id] = instantiate(models[id], id); diff --git a/platform/entanglement/src/policies/CrossSpacePolicy.js b/platform/entanglement/src/policies/CrossSpacePolicy.js index 42f4c80f7f..29aab5a484 100644 --- a/platform/entanglement/src/policies/CrossSpacePolicy.js +++ b/platform/entanglement/src/policies/CrossSpacePolicy.js @@ -48,8 +48,7 @@ define( function isCrossSpace(context) { var domainObject = context.domainObject, - selectedObject = context.selectedObject, - spaces = [ domainObject, selectedObject ].map(lookupSpace); + selectedObject = context.selectedObject; return selectedObject !== undefined && domainObject !== undefined && lookupSpace(domainObject) !== lookupSpace(selectedObject); diff --git a/platform/features/clock/src/controllers/TimerController.js b/platform/features/clock/src/controllers/TimerController.js index ab42b065c1..d1d31bfb80 100644 --- a/platform/features/clock/src/controllers/TimerController.js +++ b/platform/features/clock/src/controllers/TimerController.js @@ -38,8 +38,7 @@ define( * time (typically wrapping `Date.now`) */ function TimerController($scope, $window, now) { - var timerObject, - formatter, + var formatter, active = true, relativeTimestamp, lastTimestamp, diff --git a/platform/features/clock/src/services/TickerService.js b/platform/features/clock/src/services/TickerService.js index 4f8661fca4..07e0a5886b 100644 --- a/platform/features/clock/src/services/TickerService.js +++ b/platform/features/clock/src/services/TickerService.js @@ -21,8 +21,8 @@ *****************************************************************************/ define( - ['moment'], - function (moment) { + [], + function () { /** * Calls functions every second, as close to the actual second diff --git a/platform/features/conductor/src/ConductorRepresenter.js b/platform/features/conductor/src/ConductorRepresenter.js index 720372b316..08a5968800 100644 --- a/platform/features/conductor/src/ConductorRepresenter.js +++ b/platform/features/conductor/src/ConductorRepresenter.js @@ -144,7 +144,7 @@ define( }; // Handle a specific representation of a specific domain object - ConductorRepresenter.prototype.represent = function represent(representation, representedObject) { + ConductorRepresenter.prototype.represent = function represent(representation) { this.destroy(); if (this.views.indexOf(representation) !== -1 && !GLOBAL_SHOWING) { diff --git a/platform/features/conductor/src/ConductorTelemetryDecorator.js b/platform/features/conductor/src/ConductorTelemetryDecorator.js index 953056c25a..67ec29a17b 100644 --- a/platform/features/conductor/src/ConductorTelemetryDecorator.js +++ b/platform/features/conductor/src/ConductorTelemetryDecorator.js @@ -57,14 +57,11 @@ define( }; ConductorTelemetryDecorator.prototype.requestTelemetry = function (requests) { - var self = this; return this.telemetryService .requestTelemetry(this.amendRequests(requests)); }; ConductorTelemetryDecorator.prototype.subscribe = function (callback, requests) { - var self = this; - return this.telemetryService .subscribe(callback, this.amendRequests(requests)); }; diff --git a/platform/features/imagery/src/directives/MCTBackgroundImage.js b/platform/features/imagery/src/directives/MCTBackgroundImage.js index f550b5f93b..ab2eb7b169 100644 --- a/platform/features/imagery/src/directives/MCTBackgroundImage.js +++ b/platform/features/imagery/src/directives/MCTBackgroundImage.js @@ -36,7 +36,7 @@ define( * @memberof platform/features/imagery */ function MCTBackgroundImage($document) { - function link(scope, element, attrs) { + function link(scope, element) { // General strategy here: // - Keep count of how many images have been requested; this // counter will be used as an internal identifier or sorts @@ -49,7 +49,7 @@ define( // in which images are actually loaded may be different, so // some strategy like this is necessary to ensure that images // do not display out-of-order. - var div, requested = 0, loaded = 0; + var requested = 0, loaded = 0; function nextImage(url) { var myCounter = requested, diff --git a/platform/features/layout/src/FixedController.js b/platform/features/layout/src/FixedController.js index b2d5e3c934..8a3bfd9d7e 100644 --- a/platform/features/layout/src/FixedController.js +++ b/platform/features/layout/src/FixedController.js @@ -36,7 +36,7 @@ define( * @constructor * @param {Scope} $scope the controller's Angular scope */ - function FixedController($scope, $q, dialogService, telemetryHandler, telemetryFormatter, throttle) { + function FixedController($scope, $q, dialogService, telemetryHandler, telemetryFormatter) { var self = this, handle, names = {}, // Cache names by ID @@ -230,7 +230,7 @@ define( } // Handle changes in the object's composition - function updateComposition(ids) { + function updateComposition() { // Populate panel positions // TODO: Ensure defaults here // Resubscribe - objects in view have changed diff --git a/platform/features/layout/src/elements/TelemetryProxy.js b/platform/features/layout/src/elements/TelemetryProxy.js index f03bb6cbb6..5537d3b525 100644 --- a/platform/features/layout/src/elements/TelemetryProxy.js +++ b/platform/features/layout/src/elements/TelemetryProxy.js @@ -21,8 +21,8 @@ *****************************************************************************/ define( - ['./TextProxy', './AccessorMutator'], - function (TextProxy, AccessorMutator) { + ['./TextProxy'], + function (TextProxy) { // Method names to expose from this proxy var HIDE = 'hideTitle', SHOW = 'showTitle'; diff --git a/platform/features/rtevents/src/RTEventListController.js b/platform/features/rtevents/src/RTEventListController.js index 9beaffdec9..1d32a346b6 100644 --- a/platform/features/rtevents/src/RTEventListController.js +++ b/platform/features/rtevents/src/RTEventListController.js @@ -58,11 +58,7 @@ define( lastIds.some(mismatch); } - function setupColumns(telemetryObjects) { - var id = $scope.domainObject && $scope.domainObject.getId(), - firstId = - telemetryObjects[0] && telemetryObjects[0].getId(); - + function setupColumns() { columns = []; columns.push(new DomainColumn(telemetryFormatter)); diff --git a/platform/features/table/src/controllers/TelemetryTableController.js b/platform/features/table/src/controllers/TelemetryTableController.js index 12339cf9e6..f7fcdec74a 100644 --- a/platform/features/table/src/controllers/TelemetryTableController.js +++ b/platform/features/table/src/controllers/TelemetryTableController.js @@ -143,7 +143,7 @@ define( self = this; if (handle) { - handle.promiseTelemetryObjects().then(function (objects) { + handle.promiseTelemetryObjects().then(function () { table.buildColumns(handle.getMetadata()); self.filterColumns(); diff --git a/platform/features/table/src/directives/MCTTable.js b/platform/features/table/src/directives/MCTTable.js index 8a8b9588c0..c7feb6bc35 100644 --- a/platform/features/table/src/directives/MCTTable.js +++ b/platform/features/table/src/directives/MCTTable.js @@ -3,7 +3,7 @@ define( ["../controllers/MCTTableController"], function (MCTTableController) { - function MCTTable($timeout) { + function MCTTable() { return { restrict: "E", templateUrl: "platform/features/table/res/templates/mct-data-table.html", @@ -13,7 +13,7 @@ define( rows: "=", enableFilter: "=?", enableSort: "=?" - }, + } }; } diff --git a/platform/features/timeline/src/capabilities/ActivityUtilization.js b/platform/features/timeline/src/capabilities/ActivityUtilization.js index b64d102e7c..9034d09939 100644 --- a/platform/features/timeline/src/capabilities/ActivityUtilization.js +++ b/platform/features/timeline/src/capabilities/ActivityUtilization.js @@ -35,10 +35,10 @@ define( getPointCount: function () { return 0; }, - getDomainValue: function (index) { + getDomainValue: function () { return 0; }, - getRangeValue: function (index) { + getRangeValue: function () { return 0; } }; diff --git a/platform/features/timeline/src/capabilities/CumulativeGraph.js b/platform/features/timeline/src/capabilities/CumulativeGraph.js index 2908e0c77c..a9cf5c7cad 100644 --- a/platform/features/timeline/src/capabilities/CumulativeGraph.js +++ b/platform/features/timeline/src/capabilities/CumulativeGraph.js @@ -55,7 +55,6 @@ define( function initializeValues() { var values = [], slope = 0, - previous = 0, i; // Add a point (or points, if needed) reaching to the provided diff --git a/platform/features/timeline/src/capabilities/TimelineTimespan.js b/platform/features/timeline/src/capabilities/TimelineTimespan.js index 246c60e075..ac07ef7071 100644 --- a/platform/features/timeline/src/capabilities/TimelineTimespan.js +++ b/platform/features/timeline/src/capabilities/TimelineTimespan.js @@ -63,12 +63,12 @@ define( } // Set the duration associated with this object - function setDuration(value) { + function setDuration() { // No-op; duration is implicit } // Set the end time associated with this object - function setEnd(value) { + function setEnd() { // No-op; end time is implicit } diff --git a/platform/features/timeline/src/controllers/TimelineZoomController.js b/platform/features/timeline/src/controllers/TimelineZoomController.js index 4581195d6f..1488d44aeb 100644 --- a/platform/features/timeline/src/controllers/TimelineZoomController.js +++ b/platform/features/timeline/src/controllers/TimelineZoomController.js @@ -20,11 +20,8 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ define( - ['../TimelineFormatter'], - function (TimelineFormatter) { - - - var FORMATTER = new TimelineFormatter(); + [], + function () { /** * Controls the pan-zoom state of a timeline view. @@ -113,7 +110,6 @@ define( * @returns {number} duration, in milliseconds */ duration: function (value) { - var prior = duration; if (arguments.length > 0) { duration = roundDuration(value); } diff --git a/platform/features/timeline/src/controllers/graph/TimelineGraph.js b/platform/features/timeline/src/controllers/graph/TimelineGraph.js index 99696ac40c..c5e84ddaa0 100644 --- a/platform/features/timeline/src/controllers/graph/TimelineGraph.js +++ b/platform/features/timeline/src/controllers/graph/TimelineGraph.js @@ -45,8 +45,6 @@ define( min = 0, // current maximum max = 0, - // current displayed time span - duration = 1000, // line colors to display colors = Object.keys(domainObjects); diff --git a/platform/features/timeline/src/directives/MCTSwimlaneDrop.js b/platform/features/timeline/src/directives/MCTSwimlaneDrop.js index 1ffc0744d2..5a827c75f6 100644 --- a/platform/features/timeline/src/directives/MCTSwimlaneDrop.js +++ b/platform/features/timeline/src/directives/MCTSwimlaneDrop.js @@ -40,7 +40,6 @@ define( height = element[0].offsetHeight, rect = element[0].getBoundingClientRect(), offset = event.pageY - rect.top, - dataTransfer = event.dataTransfer, id = dndService.getData( SwimlaneDragConstants.MCT_DRAG_TYPE ), diff --git a/platform/forms/src/controllers/ColorController.js b/platform/forms/src/controllers/ColorController.js index 6224b25944..2bf38e0c63 100644 --- a/platform/forms/src/controllers/ColorController.js +++ b/platform/forms/src/controllers/ColorController.js @@ -55,7 +55,7 @@ define( } function initializeGroups() { - var i, group; + var group; // Ten grayscale colors group = []; diff --git a/platform/persistence/couch/src/CouchIndicator.js b/platform/persistence/couch/src/CouchIndicator.js index dfd8de04ee..223a12b7c4 100644 --- a/platform/persistence/couch/src/CouchIndicator.js +++ b/platform/persistence/couch/src/CouchIndicator.js @@ -74,7 +74,7 @@ define( // Callback if the HTTP request to Couch fails - function handleError(err) { + function handleError() { self.state = DISCONNECTED; } diff --git a/platform/persistence/couch/src/CouchPersistenceProvider.js b/platform/persistence/couch/src/CouchPersistenceProvider.js index 21579eb5f9..2e0cec8807 100644 --- a/platform/persistence/couch/src/CouchPersistenceProvider.js +++ b/platform/persistence/couch/src/CouchPersistenceProvider.js @@ -116,7 +116,7 @@ define( return this.$q.when(this.spaces); }; - CouchPersistenceProvider.prototype.listObjects = function (space) { + CouchPersistenceProvider.prototype.listObjects = function () { return this.get("_all_docs").then(bind(getIdsFromAllDocs, this)); }; diff --git a/platform/persistence/elastic/src/ElasticPersistenceProvider.js b/platform/persistence/elastic/src/ElasticPersistenceProvider.js index 8ffb5d0232..564029b4c7 100644 --- a/platform/persistence/elastic/src/ElasticPersistenceProvider.js +++ b/platform/persistence/elastic/src/ElasticPersistenceProvider.js @@ -157,7 +157,7 @@ define( .then(checkUpdate); }; - ElasticPersistenceProvider.prototype.deleteObject = function (space, key, value) { + ElasticPersistenceProvider.prototype.deleteObject = function (space, key) { return this.del(key).then(bind(this.checkResponse, this)); }; diff --git a/platform/persistence/elastic/src/ElasticSearchProvider.js b/platform/persistence/elastic/src/ElasticSearchProvider.js index a3dbe58f9c..30ef2cd62a 100644 --- a/platform/persistence/elastic/src/ElasticSearchProvider.js +++ b/platform/persistence/elastic/src/ElasticSearchProvider.js @@ -73,7 +73,7 @@ define([ }) .then(function success(succesResponse) { return provider.parseResponse(succesResponse); - }, function error(errorResponse) { + }, function error() { // Gracefully fail. return { hits: [], diff --git a/platform/persistence/local/src/LocalStoragePersistenceProvider.js b/platform/persistence/local/src/LocalStoragePersistenceProvider.js index a930304074..9f6b594a71 100644 --- a/platform/persistence/local/src/LocalStoragePersistenceProvider.js +++ b/platform/persistence/local/src/LocalStoragePersistenceProvider.js @@ -79,7 +79,7 @@ define( return this.$q.when(spaceObj[key]); }; - LocalStoragePersistenceProvider.prototype.deleteObject = function (space, key, value) { + LocalStoragePersistenceProvider.prototype.deleteObject = function (space, key) { var spaceObj = this.getValue(space); delete spaceObj[key]; this.setValue(space, spaceObj); diff --git a/platform/representation/src/MCTRepresentation.js b/platform/representation/src/MCTRepresentation.js index a9b784ae56..783f61e1f2 100644 --- a/platform/representation/src/MCTRepresentation.js +++ b/platform/representation/src/MCTRepresentation.js @@ -53,8 +53,7 @@ define( * @param {ViewDefinition[]} views an array of view extensions */ function MCTRepresentation(representations, views, representers, $q, templateLinker, $log) { - var representationMap = {}, - gestureMap = {}; + var representationMap = {}; // Assemble all representations and views // The distinction between views and representations is @@ -82,7 +81,7 @@ define( } } - function link($scope, element, attrs, ctrl, transclude) { + function link($scope, element, attrs) { var activeRepresenters = representers.map(function (Representer) { return new Representer($scope, element, attrs); }), diff --git a/platform/representation/src/TemplatePrefetcher.js b/platform/representation/src/TemplatePrefetcher.js index aea1389825..25fd223610 100644 --- a/platform/representation/src/TemplatePrefetcher.js +++ b/platform/representation/src/TemplatePrefetcher.js @@ -31,7 +31,7 @@ define( * @param {...Array.<{templateUrl: string}>} extensions arrays * of template or template-like extensions */ - function TemplatePrefetcher(templateLinker, extensions) { + function TemplatePrefetcher(templateLinker) { Array.prototype.slice.apply(arguments, [1]) .reduce(function (a, b) { return a.concat(b); diff --git a/platform/representation/src/gestures/ContextMenuGesture.js b/platform/representation/src/gestures/ContextMenuGesture.js index 78abed5347..f659005694 100644 --- a/platform/representation/src/gestures/ContextMenuGesture.js +++ b/platform/representation/src/gestures/ContextMenuGesture.js @@ -91,7 +91,7 @@ define( }); // Whenever the touch event ends, 'isPressing' is false. - element.on('touchend', function (event) { + element.on('touchend', function () { isPressing = false; }); } diff --git a/platform/representation/src/gestures/DropGesture.js b/platform/representation/src/gestures/DropGesture.js index 992c17ba98..6af580d9c3 100644 --- a/platform/representation/src/gestures/DropGesture.js +++ b/platform/representation/src/gestures/DropGesture.js @@ -71,13 +71,6 @@ define( } } - function canCompose(domainObject, selectedObject){ - return domainObject.getCapability("action").getActions({ - key: 'compose', - selectedObject: selectedObject - }).length > 0; - } - function dragOver(e) { //Refresh domain object on each dragOver to catch external // updates to the model @@ -121,7 +114,7 @@ define( // destination domain object's composition, and persist // the change. if (id) { - $q.when(action && action.perform()).then(function (result) { + $q.when(action && action.perform()).then(function () { //Don't go into edit mode for folders if (domainObjectType!=='folder') { editableDomainObject.getCapability('action').perform('edit'); diff --git a/platform/telemetry/src/TelemetryFormatter.js b/platform/telemetry/src/TelemetryFormatter.js index 71c6e60bb9..92807f5cb8 100644 --- a/platform/telemetry/src/TelemetryFormatter.js +++ b/platform/telemetry/src/TelemetryFormatter.js @@ -70,7 +70,7 @@ define( * @returns {string} a textual representation of the * value, suitable for display. */ - TelemetryFormatter.prototype.formatRangeValue = function (v, key) { + TelemetryFormatter.prototype.formatRangeValue = function (v) { return isNaN(v) ? String(v) : v.toFixed(VALUE_FORMAT_DIGITS); }; From 65095d18f274e7de5a91de2edba648f61dd07dcb Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 11:43:55 -0800 Subject: [PATCH 25/85] [Build] Remove partial global declarations --- platform/core/test/actions/ActionCapabilitySpec.js | 1 - platform/features/conductor/test/ConductorRepresenterSpec.js | 1 - platform/search/test/services/GenericSearchWorkerSpec.js | 1 - 3 files changed, 3 deletions(-) diff --git a/platform/core/test/actions/ActionCapabilitySpec.js b/platform/core/test/actions/ActionCapabilitySpec.js index f0a7da2672..de80d2186d 100644 --- a/platform/core/test/actions/ActionCapabilitySpec.js +++ b/platform/core/test/actions/ActionCapabilitySpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ - jasmine*/ /** * ActionCapabilitySpec. Created by vwoeltje on 11/6/14. diff --git a/platform/features/conductor/test/ConductorRepresenterSpec.js b/platform/features/conductor/test/ConductorRepresenterSpec.js index a9493b8864..20647e91e8 100644 --- a/platform/features/conductor/test/ConductorRepresenterSpec.js +++ b/platform/features/conductor/test/ConductorRepresenterSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ - waitsFor,afterEach,jasmine*/ define( ["../src/ConductorRepresenter", "./TestTimeConductor"], diff --git a/platform/search/test/services/GenericSearchWorkerSpec.js b/platform/search/test/services/GenericSearchWorkerSpec.js index 3a35edfc9a..44c7c778ba 100644 --- a/platform/search/test/services/GenericSearchWorkerSpec.js +++ b/platform/search/test/services/GenericSearchWorkerSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ - require,afterEach*/ /** * SearchSpec. Created by shale on 07/31/2015. From 4f85616632bd03937547cce9cfcedde5399319d1 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 11:46:15 -0800 Subject: [PATCH 26/85] [Build] Fix FullscreenAction spec ...to reflect acquisition of screenfull dependency via AMD --- .../browse/test/windowing/FullscreenActionSpec.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/platform/commonUI/browse/test/windowing/FullscreenActionSpec.js b/platform/commonUI/browse/test/windowing/FullscreenActionSpec.js index f0cf4eb382..7b3dfdab80 100644 --- a/platform/commonUI/browse/test/windowing/FullscreenActionSpec.js +++ b/platform/commonUI/browse/test/windowing/FullscreenActionSpec.js @@ -24,26 +24,25 @@ * MCTRepresentationSpec. Created by vwoeltje on 11/6/14. */ define( - ["../../src/windowing/FullscreenAction"], - function (FullscreenAction) { + ["../../src/windowing/FullscreenAction", "screenfull"], + function (FullscreenAction, screenfull) { describe("The fullscreen action", function () { var action, - oldScreenfull; + oldToggle; beforeEach(function () { // Screenfull is not shimmed or injected, so // we need to spy on it in the global scope. - oldScreenfull = window.screenfull; + oldToggle = screenfull.toggle; - window.screenfull = {}; - window.screenfull.toggle = jasmine.createSpy("toggle"); + screenfull.toggle = jasmine.createSpy("toggle"); action = new FullscreenAction({}); }); afterEach(function () { - window.screenfull = oldScreenfull; + screenfull.toggle = oldToggle; }); it("toggles fullscreen mode when performed", function () { From 2be6b3f0515fa25de349826a3d2faeca9721d702 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 11:48:20 -0800 Subject: [PATCH 27/85] [Build] Fix GenericSearchProvider spec ...by delegating to window.setTimeout, such that spec as-written behaves correctly. --- platform/search/test/services/GenericSearchProviderSpec.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/search/test/services/GenericSearchProviderSpec.js b/platform/search/test/services/GenericSearchProviderSpec.js index b7c8321add..a6c0e981c8 100644 --- a/platform/search/test/services/GenericSearchProviderSpec.js +++ b/platform/search/test/services/GenericSearchProviderSpec.js @@ -81,6 +81,10 @@ define([ spyOn(GenericSearchProvider.prototype, 'scheduleForIndexing'); + $timeout.andCallFake(function (callback, millis) { + window.setTimeout(callback, millis); + }); + provider = new GenericSearchProvider( $timeout, $q, From 1cdbc11894289ad3e200820884db14696cba5864 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 11:52:46 -0800 Subject: [PATCH 28/85] [Build] Clarify spec paths --- gulpfile.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 6a8c790c8b..d96d0ad825 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -42,6 +42,7 @@ var gulp = require('gulp'), assets: 'dist/assets', scss: ['./platform/**/*.scss', './example/**/*.scss'], scripts: [ 'main.js', 'platform/**/*.js', 'src/**/*.js' ], + specs: [ 'platform/**/*Spec.js', 'src/**/*Spec.js' ], static: [ 'index.html', 'platform/**/*', @@ -98,7 +99,10 @@ gulp.task('stylesheets', function () { }); gulp.task('lint', function () { - return gulp.src(paths.scripts.concat(['!**/test/**/*.js', '!**/*Spec.js'])) + var nonspecs = paths.specs.map(function (glob) { + return "!" + glob; + }); + return gulp.src(paths.scripts.concat(nonspecs)) .pipe(jshint()) .pipe(jshint.reporter('default')) .pipe(jshint.reporter('fail')); From f34ef8c4c8d1588f921e59870ae78687478c962f Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 11:53:08 -0800 Subject: [PATCH 29/85] [Build] Add global declarations to mocks --- .../entanglement/test/ControlledPromise.js | 23 ++++++++++++++++++- .../entanglement/test/DomainObjectFactory.js | 2 +- .../test/services/MockCopyService.js | 2 +- .../test/services/MockLinkService.js | 4 ++-- .../test/services/MockMoveService.js | 2 +- .../conductor/test/TestTimeConductor.js | 1 + 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/platform/entanglement/test/ControlledPromise.js b/platform/entanglement/test/ControlledPromise.js index b555a5333d..0b3fcd6cf6 100644 --- a/platform/entanglement/test/ControlledPromise.js +++ b/platform/entanglement/test/ControlledPromise.js @@ -1,4 +1,25 @@ - +/***************************************************************************** + * Open MCT Web, Copyright (c) 2014-2015, United States Government + * as represented by the Administrator of the National Aeronautics and Space + * Administration. All rights reserved. + * + * Open MCT Web is licensed under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * Open MCT Web includes source code licensed under additional open source + * licenses. See the Open Source Licenses file (LICENSES.md) included with + * this source code distribution or the Licensing information page available + * at runtime from the About dialog for additional information. + *****************************************************************************/ +/*global spyOn*/ define( function () { diff --git a/platform/entanglement/test/DomainObjectFactory.js b/platform/entanglement/test/DomainObjectFactory.js index 5ee26c0a2f..4a11667084 100644 --- a/platform/entanglement/test/DomainObjectFactory.js +++ b/platform/entanglement/test/DomainObjectFactory.js @@ -20,7 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ - +/*global jasmine*/ define( function () { diff --git a/platform/entanglement/test/services/MockCopyService.js b/platform/entanglement/test/services/MockCopyService.js index 0415a01b4b..cf986bec7e 100644 --- a/platform/entanglement/test/services/MockCopyService.js +++ b/platform/entanglement/test/services/MockCopyService.js @@ -20,7 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ - +/*global jasmine*/ define( function () { diff --git a/platform/entanglement/test/services/MockLinkService.js b/platform/entanglement/test/services/MockLinkService.js index 2a5122d871..5345efc86e 100644 --- a/platform/entanglement/test/services/MockLinkService.js +++ b/platform/entanglement/test/services/MockLinkService.js @@ -20,7 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ - +/*global jasmine*/ define( [ '../ControlledPromise' @@ -63,7 +63,7 @@ define( ] ); - mockLinkService.perform.andCallFake(function (object, newParent) { + mockLinkService.perform.andCallFake(function (object) { var performPromise = new ControlledPromise(); this.perform.mostRecentCall.promise = performPromise; diff --git a/platform/entanglement/test/services/MockMoveService.js b/platform/entanglement/test/services/MockMoveService.js index 6136d623c6..d5a290c03f 100644 --- a/platform/entanglement/test/services/MockMoveService.js +++ b/platform/entanglement/test/services/MockMoveService.js @@ -20,7 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ - +/*global jasmine*/ define( function () { diff --git a/platform/features/conductor/test/TestTimeConductor.js b/platform/features/conductor/test/TestTimeConductor.js index 2a0fe7a7a8..52ffb773d4 100644 --- a/platform/features/conductor/test/TestTimeConductor.js +++ b/platform/features/conductor/test/TestTimeConductor.js @@ -20,6 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ +/*global spyOn*/ define( ["../src/TimeConductor"], function (TimeConductor) { From 43176cfbb858f6b3050e5716d6d0f89b70ece0c3 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 11:56:31 -0800 Subject: [PATCH 30/85] [Build] Move lint config to gulpfile --- .jshintrc | 22 ---------------------- gulpfile.js | 24 +++++++++++++++++++++++- 2 files changed, 23 insertions(+), 23 deletions(-) delete mode 100644 .jshintrc diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index a0109fbce7..0000000000 --- a/.jshintrc +++ /dev/null @@ -1,22 +0,0 @@ -{ - "bitwise": true, - "curly": true, - "eqeqeq": true, - "freeze": true, - "funcscope": true, - "futurehostile": true, - "latedef": true, - "noarg": true, - "nocomma": true, - "nonbsp": true, - "nonew": true, - "predef": [ - "define", - "Blob", - "Float32Array", - "Promise" - ], - "strict": "implied", - "undef": true, - "unused": true -} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index d96d0ad825..1fab6d5b18 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -56,6 +56,28 @@ var gulp = require('gulp'), mainConfigFile: paths.main, wrapShim: true }, + jshint: { + "bitwise": true, + "curly": true, + "eqeqeq": true, + "freeze": true, + "funcscope": true, + "futurehostile": true, + "latedef": true, + "noarg": true, + "nocomma": true, + "nonbsp": true, + "nonew": true, + "predef": [ + "define", + "Blob", + "Float32Array", + "Promise" + ], + "strict": "implied", + "undef": true, + "unused": true + }, karma: { configFile: path.resolve(__dirname, 'karma.conf.js'), singleRun: true @@ -103,7 +125,7 @@ gulp.task('lint', function () { return "!" + glob; }); return gulp.src(paths.scripts.concat(nonspecs)) - .pipe(jshint()) + .pipe(jshint(options.jshint)) .pipe(jshint.reporter('default')) .pipe(jshint.reporter('fail')); }); From c7f199a59ecfe40f1ddb5cff53898edd96d14a67 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 12:01:11 -0800 Subject: [PATCH 31/85] [Build] Also lint specs ...with additional tolerance declared for Jasmine variables. --- gulpfile.js | 14 ++++++++++---- package.json | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 1fab6d5b18..2caf983d46 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -35,7 +35,9 @@ var gulp = require('gulp'), fs = require('fs'), git = require('git-rev-sync'), moment = require('moment'), + merge = require('merge-stream'), project = require('./package.json'), + _ = require('lodash'), paths = { main: 'main.js', dist: 'dist', @@ -122,10 +124,14 @@ gulp.task('stylesheets', function () { gulp.task('lint', function () { var nonspecs = paths.specs.map(function (glob) { - return "!" + glob; - }); - return gulp.src(paths.scripts.concat(nonspecs)) - .pipe(jshint(options.jshint)) + return "!" + glob; + }), + scriptLint = gulp.src(paths.scripts.concat(nonspecs)) + .pipe(jshint(options.jshint)), + specLint = gulp.src(paths.specs) + .pipe(jshint(_.extend({ jasmine: true }, options.jshint))); + + return merge(scriptLint, specLint) .pipe(jshint.reporter('default')) .pipe(jshint.reporter('fail')); }); diff --git a/package.json b/package.json index c0afb1c9ce..19f45ac089 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "lodash": "^3.10.1", "markdown-toc": "^0.11.7", "marked": "^0.3.5", + "merge-stream": "^1.0.0", "mkdirp": "^0.5.1", "moment": "^2.11.1", "node-bourbon": "^4.2.3", From 7eb7027b671ebaf33a31e4db9504926eb6942cda Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 12:05:00 -0800 Subject: [PATCH 32/85] [Build] Specify browser environment ...such that various browser globals do not need to be individually declared. --- gulpfile.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 2caf983d46..d319738002 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -60,6 +60,7 @@ var gulp = require('gulp'), }, jshint: { "bitwise": true, + "browser": true, "curly": true, "eqeqeq": true, "freeze": true, @@ -72,8 +73,6 @@ var gulp = require('gulp'), "nonew": true, "predef": [ "define", - "Blob", - "Float32Array", "Promise" ], "strict": "implied", From 5920533637e58d5af9ad65e369bad8185192178a Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 12:23:53 -0800 Subject: [PATCH 33/85] [Build] Don't appear to use new for side effects --- platform/commonUI/general/test/SplashScreenManagerSpec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/commonUI/general/test/SplashScreenManagerSpec.js b/platform/commonUI/general/test/SplashScreenManagerSpec.js index 09546971a5..1e82190326 100644 --- a/platform/commonUI/general/test/SplashScreenManagerSpec.js +++ b/platform/commonUI/general/test/SplashScreenManagerSpec.js @@ -52,7 +52,7 @@ define([ describe('when element exists', function () { beforeEach(function () { $document.querySelectorAll.andReturn([splashElement]); - new SplashScreenManager([$document]); + return new SplashScreenManager([$document]); }); it('adds fade out class', function () { @@ -79,7 +79,7 @@ define([ $document.querySelectorAll.andReturn([]); function run() { - new SplashScreenManager([$document]); + return new SplashScreenManager([$document]); } expect(run).not.toThrow(); From e4704517183996685930a7c009c2aaa21b44233a Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 12:30:23 -0800 Subject: [PATCH 34/85] [Build] Declare undefined variables ...to satisfy JSLint for specs. --- platform/search/test/services/GenericSearchProviderSpec.js | 3 ++- platform/search/test/services/GenericSearchWorkerSpec.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/search/test/services/GenericSearchProviderSpec.js b/platform/search/test/services/GenericSearchProviderSpec.js index a6c0e981c8..ecc76f044e 100644 --- a/platform/search/test/services/GenericSearchProviderSpec.js +++ b/platform/search/test/services/GenericSearchProviderSpec.js @@ -30,7 +30,8 @@ define([ ) { describe('GenericSearchProvider', function () { - var $q, + var $timeout, + $q, $log, modelService, models, diff --git a/platform/search/test/services/GenericSearchWorkerSpec.js b/platform/search/test/services/GenericSearchWorkerSpec.js index 44c7c778ba..952d2a4d58 100644 --- a/platform/search/test/services/GenericSearchWorkerSpec.js +++ b/platform/search/test/services/GenericSearchWorkerSpec.js @@ -20,6 +20,8 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ +/*global require*/ + /** * SearchSpec. Created by shale on 07/31/2015. */ From d6ec7e9ab883d125f995c176e48f753fd98de145 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 12:56:14 -0800 Subject: [PATCH 35/85] [Build] Remove unused variables from specs ...to satisfy JSHint. --- .../browse/test/creation/CreationServiceSpec.js | 6 ++---- .../browse/test/navigation/NavigateActionSpec.js | 1 - .../browse/test/windowing/NewTabActionSpec.js | 1 - .../edit/test/actions/PropertiesDialogSpec.js | 2 +- .../edit/test/controllers/EditControllerSpec.js | 3 +-- .../test/objects/EditableDomainObjectCacheSpec.js | 3 +-- .../edit/test/objects/EditableDomainObjectSpec.js | 4 ++++ .../edit/test/policies/EditableViewPolicySpec.js | 3 +-- .../edit/test/representers/EditToolbarSpec.js | 2 +- .../commonUI/formats/test/FormatProviderSpec.js | 1 - .../general/test/directives/MCTPopupSpec.js | 8 -------- .../inspect/test/services/InfoServiceSpec.js | 4 ++-- .../test/NotificationIndicatorControllerSpec.js | 13 ++++++------- platform/containment/test/CapabilityTableSpec.js | 2 +- .../test/capabilities/MutationCapabilitySpec.js | 2 +- .../test/capabilities/RelationshipCapabilitySpec.js | 6 ++---- platform/core/test/identifiers/IdentifierSpec.js | 2 +- .../core/test/objects/DomainObjectProviderSpec.js | 6 ------ platform/core/test/services/InstantiateSpec.js | 2 -- platform/core/test/types/TypeProviderSpec.js | 8 +------- platform/core/test/views/ViewProviderSpec.js | 3 +-- .../test/actions/SetPrimaryLocationActionSpec.js | 3 +-- .../entanglement/test/services/CopyServiceSpec.js | 7 ++----- platform/entanglement/test/services/CopyTaskSpec.js | 7 ++----- .../clock/test/controllers/ClockControllerSpec.js | 1 - .../clock/test/controllers/TimerFormatterSpec.js | 4 ---- .../test/ConductorTelemetryDecoratorSpec.js | 10 ---------- .../events/test/policies/MessagesViewPolicySpec.js | 3 +-- .../features/layout/test/LayoutControllerSpec.js | 2 +- .../features/plot/test/PlotOptionsControllerSpec.js | 1 - platform/features/plot/test/PlotOptionsFormSpec.js | 3 +-- .../plot/test/elements/PlotLimitTrackerSpec.js | 1 - .../features/plot/test/elements/PlotPreparerSpec.js | 2 ++ .../features/plot/test/modes/PlotOverlayModeSpec.js | 13 ++----------- .../features/plot/test/modes/PlotStackModeSpec.js | 11 +---------- .../test/controllers/MCTTableControllerSpec.js | 8 -------- .../test/controllers/TableOptionsControllerSpec.js | 8 -------- .../controllers/TelemetryTableControllerSpec.js | 2 -- .../timeline/test/directives/MCTSwimlaneDropSpec.js | 1 - platform/forms/test/MCTFormSpec.js | 3 +-- platform/identity/test/IdentityAggregatorSpec.js | 1 - .../queue/test/PersistenceFailureHandlerSpec.js | 2 +- platform/policy/test/PolicyActionDecoratorSpec.js | 2 +- platform/policy/test/PolicyViewDecoratorSpec.js | 2 +- .../test/actions/ContextMenuActionSpec.js | 7 +++---- .../test/gestures/GestureRepresenterSpec.js | 1 - .../test/controllers/SearchMenuControllerSpec.js | 1 - platform/telemetry/test/TelemetryDelegatorSpec.js | 4 ++++ 48 files changed, 50 insertions(+), 142 deletions(-) diff --git a/platform/commonUI/browse/test/creation/CreationServiceSpec.js b/platform/commonUI/browse/test/creation/CreationServiceSpec.js index deb2ba068b..270f5f8c90 100644 --- a/platform/commonUI/browse/test/creation/CreationServiceSpec.js +++ b/platform/commonUI/browse/test/creation/CreationServiceSpec.js @@ -147,8 +147,7 @@ define( }); it("adds new objects to the parent's composition", function () { - var model = { someKey: "some value" }, - parentModel = { composition: ["notAnyUUID"] }; + var model = { someKey: "some value" }; creationService.createObject(model, mockParentObject); // Verify that a new ID was added @@ -199,8 +198,7 @@ define( it("logs an error when mutaton fails", function () { // If mutation of the parent fails, we've lost the // created object - this is an error. - var model = { someKey: "some value" }, - parentModel = { composition: ["notAnyUUID"] }; + var model = { someKey: "some value" }; mockCompositionCapability.add.andReturn(mockPromise(false)); diff --git a/platform/commonUI/browse/test/navigation/NavigateActionSpec.js b/platform/commonUI/browse/test/navigation/NavigateActionSpec.js index fca6f3bea0..0295651a1f 100644 --- a/platform/commonUI/browse/test/navigation/NavigateActionSpec.js +++ b/platform/commonUI/browse/test/navigation/NavigateActionSpec.js @@ -30,7 +30,6 @@ define( describe("The navigate action", function () { var mockNavigationService, mockQ, - actionContext, mockDomainObject, action; diff --git a/platform/commonUI/browse/test/windowing/NewTabActionSpec.js b/platform/commonUI/browse/test/windowing/NewTabActionSpec.js index 47f02f6c41..335c4fe42b 100644 --- a/platform/commonUI/browse/test/windowing/NewTabActionSpec.js +++ b/platform/commonUI/browse/test/windowing/NewTabActionSpec.js @@ -28,7 +28,6 @@ define( var actionSelected, actionCurrent, mockWindow, - mockDomainObject, mockContextCurrent, mockContextSelected, mockUrlService; diff --git a/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js b/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js index 764d8483c9..2de6c12885 100644 --- a/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js +++ b/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js @@ -26,7 +26,7 @@ define( describe("Properties dialog", function () { - var type, properties, domainObject, model, dialog; + var type, properties, model, dialog; beforeEach(function () { type = { diff --git a/platform/commonUI/edit/test/controllers/EditControllerSpec.js b/platform/commonUI/edit/test/controllers/EditControllerSpec.js index a359d6945b..8c6a1ee31f 100644 --- a/platform/commonUI/edit/test/controllers/EditControllerSpec.js +++ b/platform/commonUI/edit/test/controllers/EditControllerSpec.js @@ -93,8 +93,7 @@ define( }); it("exposes a warning message for unload", function () { - var obj = mockObject, - errorMessage = "Unsaved changes"; + var errorMessage = "Unsaved changes"; // Normally, should be undefined expect(controller.getUnloadWarning()).toBeUndefined(); diff --git a/platform/commonUI/edit/test/objects/EditableDomainObjectCacheSpec.js b/platform/commonUI/edit/test/objects/EditableDomainObjectCacheSpec.js index 127bf6e3e4..edbfd3edc4 100644 --- a/platform/commonUI/edit/test/objects/EditableDomainObjectCacheSpec.js +++ b/platform/commonUI/edit/test/objects/EditableDomainObjectCacheSpec.js @@ -28,7 +28,6 @@ define( var captured, completionCapability, - object, mockQ, mockType, cache; @@ -45,7 +44,7 @@ define( type: mockType }[key]; }, - hasCapability: function (key) { + hasCapability: function () { return false; } }; diff --git a/platform/commonUI/edit/test/objects/EditableDomainObjectSpec.js b/platform/commonUI/edit/test/objects/EditableDomainObjectSpec.js index 3878575237..9b1095f68d 100644 --- a/platform/commonUI/edit/test/objects/EditableDomainObjectSpec.js +++ b/platform/commonUI/edit/test/objects/EditableDomainObjectSpec.js @@ -25,7 +25,11 @@ define( function (EditableDomainObject) { describe("Editable domain object", function () { + var object; + beforeEach(function () { + object = new EditableDomainObject(); + }); }); } ); \ No newline at end of file diff --git a/platform/commonUI/edit/test/policies/EditableViewPolicySpec.js b/platform/commonUI/edit/test/policies/EditableViewPolicySpec.js index 6f432fafeb..2194a8c45a 100644 --- a/platform/commonUI/edit/test/policies/EditableViewPolicySpec.js +++ b/platform/commonUI/edit/test/policies/EditableViewPolicySpec.js @@ -25,8 +25,7 @@ define( function (EditableViewPolicy) { describe("The editable view policy", function () { - var testView, - mockDomainObject, + var mockDomainObject, testMode, policy; diff --git a/platform/commonUI/edit/test/representers/EditToolbarSpec.js b/platform/commonUI/edit/test/representers/EditToolbarSpec.js index 9a5488d356..a252b32612 100644 --- a/platform/commonUI/edit/test/representers/EditToolbarSpec.js +++ b/platform/commonUI/edit/test/representers/EditToolbarSpec.js @@ -147,7 +147,7 @@ define( }); it("invokes setters on update", function () { - var structure, state; + var structure; testABC.a = jasmine.createSpy('a'); diff --git a/platform/commonUI/formats/test/FormatProviderSpec.js b/platform/commonUI/formats/test/FormatProviderSpec.js index d66f9f8a5d..527a0182af 100644 --- a/platform/commonUI/formats/test/FormatProviderSpec.js +++ b/platform/commonUI/formats/test/FormatProviderSpec.js @@ -28,7 +28,6 @@ define( describe("The FormatProvider", function () { var mockFormats, - mockLog, mockFormatInstances, provider; diff --git a/platform/commonUI/general/test/directives/MCTPopupSpec.js b/platform/commonUI/general/test/directives/MCTPopupSpec.js index 065b916c32..bfe6b469cb 100644 --- a/platform/commonUI/general/test/directives/MCTPopupSpec.js +++ b/platform/commonUI/general/test/directives/MCTPopupSpec.js @@ -40,14 +40,6 @@ define( testRect, mctPopup; - function testEvent(x, y) { - return { - pageX: x, - pageY: y, - preventDefault: jasmine.createSpy("preventDefault") - }; - } - beforeEach(function () { mockCompile = jasmine.createSpy("$compile"); diff --git a/platform/commonUI/inspect/test/services/InfoServiceSpec.js b/platform/commonUI/inspect/test/services/InfoServiceSpec.js index 167b940360..1f5c315041 100644 --- a/platform/commonUI/inspect/test/services/InfoServiceSpec.js +++ b/platform/commonUI/inspect/test/services/InfoServiceSpec.js @@ -21,8 +21,8 @@ *****************************************************************************/ define( - ['../../src/services/InfoService', '../../src/InfoConstants'], - function (InfoService, InfoConstants) { + ['../../src/services/InfoService'], + function (InfoService) { describe("The info service", function () { var mockCompile, diff --git a/platform/commonUI/notification/test/NotificationIndicatorControllerSpec.js b/platform/commonUI/notification/test/NotificationIndicatorControllerSpec.js index 0af266ad19..a6acd28417 100644 --- a/platform/commonUI/notification/test/NotificationIndicatorControllerSpec.js +++ b/platform/commonUI/notification/test/NotificationIndicatorControllerSpec.js @@ -27,7 +27,8 @@ define( describe("The notification indicator controller ", function () { var mockNotificationService, mockScope, - mockDialogService; + mockDialogService, + controller; beforeEach(function(){ mockNotificationService = jasmine.createSpy("notificationService"); @@ -36,19 +37,18 @@ define( "dialogService", ["getDialogResponse","dismiss"] ); - }); - - it("exposes the highest notification severity to the template", function() { mockNotificationService.highest = { severity: "error" }; - var controller = new NotificationIndicatorController(mockScope, mockNotificationService, mockDialogService); + controller = new NotificationIndicatorController(mockScope, mockNotificationService, mockDialogService); + }); + + it("exposes the highest notification severity to the template", function() { expect(mockScope.highest).toBeTruthy(); expect(mockScope.highest.severity).toBe("error"); }); it("invokes the dialog service to show list of messages", function() { - var controller = new NotificationIndicatorController(mockScope, mockNotificationService, mockDialogService); expect(mockScope.showNotificationsList).toBeDefined(); mockScope.showNotificationsList(); expect(mockDialogService.getDialogResponse).toHaveBeenCalled(); @@ -61,7 +61,6 @@ define( }); it("provides a means of dismissing the message list", function() { - var controller = new NotificationIndicatorController(mockScope, mockNotificationService, mockDialogService); expect(mockScope.showNotificationsList).toBeDefined(); mockScope.showNotificationsList(); expect(mockDialogService.getDialogResponse).toHaveBeenCalled(); diff --git a/platform/containment/test/CapabilityTableSpec.js b/platform/containment/test/CapabilityTableSpec.js index 79a86d45d5..76fbd6ffcd 100644 --- a/platform/containment/test/CapabilityTableSpec.js +++ b/platform/containment/test/CapabilityTableSpec.js @@ -39,7 +39,7 @@ define( [ 'getCapabilities' ] ); // Both types can only contain b, let's say - mockTypes = ['a', 'b'].map(function (type, index) { + mockTypes = ['a', 'b'].map(function (type) { var mockType = jasmine.createSpyObj( 'type-' + type, ['getKey', 'getDefinition', 'getInitialModel'] diff --git a/platform/core/test/capabilities/MutationCapabilitySpec.js b/platform/core/test/capabilities/MutationCapabilitySpec.js index 28aa983144..bb6070b154 100644 --- a/platform/core/test/capabilities/MutationCapabilitySpec.js +++ b/platform/core/test/capabilities/MutationCapabilitySpec.js @@ -60,7 +60,7 @@ define( }); it("allows setting a model", function () { - mutation.invoke(function (m) { + mutation.invoke(function () { return { someKey: "some value" }; }); expect(testModel.number).toBeUndefined(); diff --git a/platform/core/test/capabilities/RelationshipCapabilitySpec.js b/platform/core/test/capabilities/RelationshipCapabilitySpec.js index f3130326c6..6b69a9b615 100644 --- a/platform/core/test/capabilities/RelationshipCapabilitySpec.js +++ b/platform/core/test/capabilities/RelationshipCapabilitySpec.js @@ -104,10 +104,8 @@ define( }); it("avoids redundant requests", function () { - // Lookups can be expensive, so this capability + // Lookups can be expensive, so this capability // should have some self-caching - var response; - mockDomainObject.getModel .andReturn({ relationships: { xyz: ['a'] } }); @@ -123,7 +121,7 @@ define( it("makes new requests on modification", function () { // Lookups can be expensive, so this capability // should have some self-caching - var response, testModel; + var testModel; testModel = { relationships: { xyz: ['a'] } }; diff --git a/platform/core/test/identifiers/IdentifierSpec.js b/platform/core/test/identifiers/IdentifierSpec.js index 37fee4b82a..e54a853712 100644 --- a/platform/core/test/identifiers/IdentifierSpec.js +++ b/platform/core/test/identifiers/IdentifierSpec.js @@ -34,7 +34,7 @@ define( }); describe("when space is encoded", function () { - var idSpace, idKey, spacedId; + var idSpace, idKey; beforeEach(function () { idSpace = "a-specific-space"; diff --git a/platform/core/test/objects/DomainObjectProviderSpec.js b/platform/core/test/objects/DomainObjectProviderSpec.js index 19aa95bc24..6da0d122b5 100644 --- a/platform/core/test/objects/DomainObjectProviderSpec.js +++ b/platform/core/test/objects/DomainObjectProviderSpec.js @@ -46,12 +46,6 @@ define( }; } - function mockAll(mockPromises) { - return mockPromise(mockPromises.map(function (p) { - return mockPromise(p).testValue; - })); - } - beforeEach(function () { mockModelService = jasmine.createSpyObj( "modelService", diff --git a/platform/core/test/services/InstantiateSpec.js b/platform/core/test/services/InstantiateSpec.js index bd609de8ef..0d32f9fa0e 100644 --- a/platform/core/test/services/InstantiateSpec.js +++ b/platform/core/test/services/InstantiateSpec.js @@ -30,8 +30,6 @@ define( mockIdentifierService, mockCapabilityConstructor, mockCapabilityInstance, - mockCapabilities, - mockIdentifier, idCounter, testModel, instantiate, diff --git a/platform/core/test/types/TypeProviderSpec.js b/platform/core/test/types/TypeProviderSpec.js index d178564e2e..3f687764d3 100644 --- a/platform/core/test/types/TypeProviderSpec.js +++ b/platform/core/test/types/TypeProviderSpec.js @@ -26,13 +26,7 @@ define( describe("Type provider", function () { - var captured = {}, - capture = function (name) { - return function (value) { - captured[name] = value; - }; - }, - testTypeDefinitions = [ + var testTypeDefinitions = [ { key: 'basic', glyph: "X", diff --git a/platform/core/test/views/ViewProviderSpec.js b/platform/core/test/views/ViewProviderSpec.js index 936bb903b4..0029527bbb 100644 --- a/platform/core/test/views/ViewProviderSpec.js +++ b/platform/core/test/views/ViewProviderSpec.js @@ -133,8 +133,7 @@ define( }); it("enforces view restrictions from types", function () { - var testType = "testType", - testView = { key: "x" }, + var testView = { key: "x" }, provider = new ViewProvider([testView], mockLog); // Include a "type" capability diff --git a/platform/entanglement/test/actions/SetPrimaryLocationActionSpec.js b/platform/entanglement/test/actions/SetPrimaryLocationActionSpec.js index db6e805a3e..ca4c1671ec 100644 --- a/platform/entanglement/test/actions/SetPrimaryLocationActionSpec.js +++ b/platform/entanglement/test/actions/SetPrimaryLocationActionSpec.js @@ -32,8 +32,7 @@ define( var testContext, testModel, testId, - mockLocationCapability, - mockContextCapability; + mockLocationCapability; beforeEach(function () { testId = "some-id"; diff --git a/platform/entanglement/test/services/CopyServiceSpec.js b/platform/entanglement/test/services/CopyServiceSpec.js index e020a828b3..c036de1ec6 100644 --- a/platform/entanglement/test/services/CopyServiceSpec.js +++ b/platform/entanglement/test/services/CopyServiceSpec.js @@ -124,10 +124,8 @@ define( var mockQ, mockDeferred, - creationService, createObjectPromise, copyService, - mockNow, object, newParent, copyResult, @@ -172,7 +170,7 @@ define( 'mockDeferred', ['notify', 'resolve', 'reject'] ); - mockDeferred.notify.andCallFake(function(notification){}); + mockDeferred.notify.andCallFake(function(){}); mockDeferred.resolve.andCallFake(function(value){resolvedValue = value;}); mockDeferred.promise = { then: function(callback){ @@ -271,8 +269,7 @@ define( }); describe("on domainObject with composition", function () { - var newObject, - childObject, + var childObject, objectClone, childObjectClone, compositionPromise; diff --git a/platform/entanglement/test/services/CopyTaskSpec.js b/platform/entanglement/test/services/CopyTaskSpec.js index 6f97db7fe0..32302edb04 100644 --- a/platform/entanglement/test/services/CopyTaskSpec.js +++ b/platform/entanglement/test/services/CopyTaskSpec.js @@ -187,8 +187,7 @@ define( describe("copies object trees with multiple references to the" + " same object", function () { - var model, - mockDomainObjectB, + var mockDomainObjectB, mockComposingObject, composingObjectModel, domainObjectClone, @@ -252,9 +251,7 @@ define( it(" and correctly updates child identifiers in object" + " arrays within models ", function () { var childA_ID = task.clones[0].getId(), - childB_ID = task.clones[1].getId(), - childC_ID = task.clones[3].getId(), - childD_ID = task.clones[4].getId(); + childB_ID = task.clones[1].getId(); expect(domainObjectClone.model.objArr[0].id).not.toBe(ID_A); expect(domainObjectClone.model.objArr[0].id).toBe(childA_ID); diff --git a/platform/features/clock/test/controllers/ClockControllerSpec.js b/platform/features/clock/test/controllers/ClockControllerSpec.js index c453ca356d..3ee76596fb 100644 --- a/platform/features/clock/test/controllers/ClockControllerSpec.js +++ b/platform/features/clock/test/controllers/ClockControllerSpec.js @@ -31,7 +31,6 @@ define( var mockScope, mockTicker, mockUnticker, - mockDomainObject, controller; beforeEach(function () { diff --git a/platform/features/clock/test/controllers/TimerFormatterSpec.js b/platform/features/clock/test/controllers/TimerFormatterSpec.js index 9a54685f21..58f91edad7 100644 --- a/platform/features/clock/test/controllers/TimerFormatterSpec.js +++ b/platform/features/clock/test/controllers/TimerFormatterSpec.js @@ -45,10 +45,6 @@ define( ].reduce(sum, 0); } - function twoDigits(n) { - return n < 10 ? ('0' + n) : n; - } - it("formats short-form values (no days)", function () { expect(formatter.short(toDuration(0, 123, 2, 3) + 123)) .toEqual("123:02:03"); diff --git a/platform/features/conductor/test/ConductorTelemetryDecoratorSpec.js b/platform/features/conductor/test/ConductorTelemetryDecoratorSpec.js index 914fbf0e3b..aa7757423b 100644 --- a/platform/features/conductor/test/ConductorTelemetryDecoratorSpec.js +++ b/platform/features/conductor/test/ConductorTelemetryDecoratorSpec.js @@ -33,16 +33,6 @@ define( mockSeries, decorator; - function seriesIsInWindow(series) { - var i, v, inWindow = true; - for (i = 0; i < series.getPointCount(); i += 1) { - v = series.getDomainValue(i); - inWindow = inWindow && (v >= mockConductor.displayStart()); - inWindow = inWindow && (v <= mockConductor.displayEnd()); - } - return inWindow; - } - beforeEach(function () { mockTelemetryService = jasmine.createSpyObj( 'telemetryService', diff --git a/platform/features/events/test/policies/MessagesViewPolicySpec.js b/platform/features/events/test/policies/MessagesViewPolicySpec.js index 95542fa2c3..f890dda91a 100644 --- a/platform/features/events/test/policies/MessagesViewPolicySpec.js +++ b/platform/features/events/test/policies/MessagesViewPolicySpec.js @@ -30,7 +30,6 @@ define( describe("The messages view policy", function () { var mockDomainObject, mockTelemetry, - telemetryType, testType, testView, testMetadata, @@ -50,7 +49,7 @@ define( ['getMetadata'] ); - mockDomainObject.getModel.andCallFake(function (c) { + mockDomainObject.getModel.andCallFake(function () { return {type: testType}; }); mockDomainObject.getCapability.andCallFake(function (c) { diff --git a/platform/features/layout/test/LayoutControllerSpec.js b/platform/features/layout/test/LayoutControllerSpec.js index 85efaec5bd..ebd778cb7e 100644 --- a/platform/features/layout/test/LayoutControllerSpec.js +++ b/platform/features/layout/test/LayoutControllerSpec.js @@ -235,7 +235,7 @@ define( }); it("ensures a minimum frame size", function () { - var styleB, styleC; + var styleB; // Start with a very small frame size testModel.layoutGrid = [ 1, 1 ]; diff --git a/platform/features/plot/test/PlotOptionsControllerSpec.js b/platform/features/plot/test/PlotOptionsControllerSpec.js index 6584ccfe78..caaf66182a 100644 --- a/platform/features/plot/test/PlotOptionsControllerSpec.js +++ b/platform/features/plot/test/PlotOptionsControllerSpec.js @@ -32,7 +32,6 @@ define( mockCompositionCapability, mockComposition, mockUnlisten, - mockFormUnlisten, mockChildOne, mockChildTwo, model, diff --git a/platform/features/plot/test/PlotOptionsFormSpec.js b/platform/features/plot/test/PlotOptionsFormSpec.js index 6ee5a25ac6..bb35d532f4 100644 --- a/platform/features/plot/test/PlotOptionsFormSpec.js +++ b/platform/features/plot/test/PlotOptionsFormSpec.js @@ -25,8 +25,7 @@ define( function (PlotOptionsForm) { describe("The Plot Options form", function () { - var plotOptionsForm, - listener; + var plotOptionsForm; beforeEach(function () { diff --git a/platform/features/plot/test/elements/PlotLimitTrackerSpec.js b/platform/features/plot/test/elements/PlotLimitTrackerSpec.js index 3e080b9e87..d37507c628 100644 --- a/platform/features/plot/test/elements/PlotLimitTrackerSpec.js +++ b/platform/features/plot/test/elements/PlotLimitTrackerSpec.js @@ -29,7 +29,6 @@ define( testRange, mockTelemetryObjects, testData, - mockLimitCapabilities, tracker; beforeEach(function () { diff --git a/platform/features/plot/test/elements/PlotPreparerSpec.js b/platform/features/plot/test/elements/PlotPreparerSpec.js index fd0535bd91..414c3b56e1 100644 --- a/platform/features/plot/test/elements/PlotPreparerSpec.js +++ b/platform/features/plot/test/elements/PlotPreparerSpec.js @@ -61,6 +61,8 @@ define( var datas = [makeMockData(1)], preparer = new PlotPreparer(datas, "testDomain", "testRange"); + expect(preparer).toBeDefined(); + expect(datas[0].getDomainValue).toHaveBeenCalledWith( jasmine.any(Number), "testDomain" diff --git a/platform/features/plot/test/modes/PlotOverlayModeSpec.js b/platform/features/plot/test/modes/PlotOverlayModeSpec.js index 2f86c0e11e..0560d428f7 100644 --- a/platform/features/plot/test/modes/PlotOverlayModeSpec.js +++ b/platform/features/plot/test/modes/PlotOverlayModeSpec.js @@ -30,20 +30,11 @@ define( describe("Overlaid plot mode", function () { var mockDomainObject, mockSubPlotFactory, - mockSubPlot, mockPrepared, testBuffers, testDrawingObjects, mode; - function mockElement(x, y, w, h) { - return { - getBoundingClientRect: function () { - return { left: x, top: y, width: w, height: h }; - } - }; - } - function createMockSubPlot() { var mockSubPlot = jasmine.createSpyObj( "subPlot", @@ -127,7 +118,7 @@ define( mode.plotTelemetry(mockPrepared); // Should have one sub-plot with three lines - testDrawingObjects.forEach(function (testDrawingObject, i) { + testDrawingObjects.forEach(function (testDrawingObject) { // Either empty list or undefined is fine; // just want to make sure there are no lines. expect(testDrawingObject.lines.length) @@ -178,7 +169,7 @@ define( }); // Step back the same number of zoom changes - mockSubPlotFactory.createSubPlot.calls.forEach(function (c) { + mockSubPlotFactory.createSubPlot.calls.forEach(function () { // Should still be zoomed at start of each iteration expect(mode.isZoomed()).toBeTruthy(); // Step back one of the zoom changes. diff --git a/platform/features/plot/test/modes/PlotStackModeSpec.js b/platform/features/plot/test/modes/PlotStackModeSpec.js index db052dbe5c..cf4407e7e0 100644 --- a/platform/features/plot/test/modes/PlotStackModeSpec.js +++ b/platform/features/plot/test/modes/PlotStackModeSpec.js @@ -30,20 +30,11 @@ define( describe("Stacked plot mode", function () { var mockDomainObject, mockSubPlotFactory, - mockSubPlot, mockPrepared, testBuffers, testDrawingObjects, mode; - function mockElement(x, y, w, h) { - return { - getBoundingClientRect: function () { - return { left: x, top: y, width: w, height: h }; - } - }; - } - function createMockSubPlot() { var mockSubPlot = jasmine.createSpyObj( "subPlot", @@ -172,7 +163,7 @@ define( }); // Step back the same number of zoom changes - mockSubPlotFactory.createSubPlot.calls.forEach(function (c) { + mockSubPlotFactory.createSubPlot.calls.forEach(function () { // Should still be zoomed at start of each iteration expect(mode.isZoomed()).toBeTruthy(); // Step back diff --git a/platform/features/table/test/controllers/MCTTableControllerSpec.js b/platform/features/table/test/controllers/MCTTableControllerSpec.js index f9c7ff50c7..4fe4be7df3 100644 --- a/platform/features/table/test/controllers/MCTTableControllerSpec.js +++ b/platform/features/table/test/controllers/MCTTableControllerSpec.js @@ -34,14 +34,6 @@ define( mockTimeout, mockElement; - function promise(value) { - return { - then: function (callback){ - return promise(callback(value)); - } - }; - } - beforeEach(function() { watches = {}; diff --git a/platform/features/table/test/controllers/TableOptionsControllerSpec.js b/platform/features/table/test/controllers/TableOptionsControllerSpec.js index 7976aecafd..4838f2e6ac 100644 --- a/platform/features/table/test/controllers/TableOptionsControllerSpec.js +++ b/platform/features/table/test/controllers/TableOptionsControllerSpec.js @@ -32,14 +32,6 @@ define( controller, mockScope; - function promise(value) { - return { - then: function (callback){ - return promise(callback(value)); - } - }; - } - beforeEach(function() { mockCapability = jasmine.createSpyObj('mutationCapability', [ 'listen' diff --git a/platform/features/table/test/controllers/TelemetryTableControllerSpec.js b/platform/features/table/test/controllers/TelemetryTableControllerSpec.js index 548e0ea733..91e6a05315 100644 --- a/platform/features/table/test/controllers/TelemetryTableControllerSpec.js +++ b/platform/features/table/test/controllers/TelemetryTableControllerSpec.js @@ -130,8 +130,6 @@ define( it('to create column configuration, which is written to the' + ' object model', function() { - var mockModel = {}; - controller.setup(); expect(mockTable.getColumnConfiguration).toHaveBeenCalled(); expect(mockTable.saveColumnConfiguration).toHaveBeenCalled(); diff --git a/platform/features/timeline/test/directives/MCTSwimlaneDropSpec.js b/platform/features/timeline/test/directives/MCTSwimlaneDropSpec.js index 0ae16394a0..60891567cc 100644 --- a/platform/features/timeline/test/directives/MCTSwimlaneDropSpec.js +++ b/platform/features/timeline/test/directives/MCTSwimlaneDropSpec.js @@ -33,7 +33,6 @@ define( mockElement, testAttrs, mockSwimlane, - mockRealElement, testEvent, handlers, directive; diff --git a/platform/forms/test/MCTFormSpec.js b/platform/forms/test/MCTFormSpec.js index 7b5563f6ae..0be985212e 100644 --- a/platform/forms/test/MCTFormSpec.js +++ b/platform/forms/test/MCTFormSpec.js @@ -29,8 +29,7 @@ define( mctForm; function installController() { - var controllerProperty = mctForm.controller, - Controller = mctForm.controller[1]; + var Controller = mctForm.controller[1]; return new Controller(mockScope); } diff --git a/platform/identity/test/IdentityAggregatorSpec.js b/platform/identity/test/IdentityAggregatorSpec.js index 242ff95eca..c61e8b805b 100644 --- a/platform/identity/test/IdentityAggregatorSpec.js +++ b/platform/identity/test/IdentityAggregatorSpec.js @@ -28,7 +28,6 @@ define( var mockProviders, mockQ, resolves, - mockPromise, mockCallback, testUsers, aggregator; diff --git a/platform/persistence/queue/test/PersistenceFailureHandlerSpec.js b/platform/persistence/queue/test/PersistenceFailureHandlerSpec.js index e6a5f9cc27..7bb0fe8a04 100644 --- a/platform/persistence/queue/test/PersistenceFailureHandlerSpec.js +++ b/platform/persistence/queue/test/PersistenceFailureHandlerSpec.js @@ -104,7 +104,7 @@ define( // User chooses overwrite mockPromise.then.mostRecentCall.args[0](false); // Should refresh, but not remutate, and requeue all objects - mockFailures.forEach(function (mockFailure, i) { + mockFailures.forEach(function (mockFailure) { expect(mockFailure.persistence.refresh).toHaveBeenCalled(); expect(mockFailure.requeue).not.toHaveBeenCalled(); expect(mockFailure.domainObject.useCapability).not.toHaveBeenCalled(); diff --git a/platform/policy/test/PolicyActionDecoratorSpec.js b/platform/policy/test/PolicyActionDecoratorSpec.js index a098d508e4..fb9c7b6724 100644 --- a/platform/policy/test/PolicyActionDecoratorSpec.js +++ b/platform/policy/test/PolicyActionDecoratorSpec.js @@ -86,7 +86,7 @@ define( it("filters out policy-disallowed actions", function () { // Disallow the second action - mockPolicyService.allow.andCallFake(function (cat, candidate, ctxt) { + mockPolicyService.allow.andCallFake(function (cat, candidate) { return candidate.someKey !== 'b'; }); expect(decorator.getActions(testContext)) diff --git a/platform/policy/test/PolicyViewDecoratorSpec.js b/platform/policy/test/PolicyViewDecoratorSpec.js index 30829f46ce..91e86e9bd1 100644 --- a/platform/policy/test/PolicyViewDecoratorSpec.js +++ b/platform/policy/test/PolicyViewDecoratorSpec.js @@ -90,7 +90,7 @@ define( it("filters out policy-disallowed views", function () { // Disallow the second action - mockPolicyService.allow.andCallFake(function (cat, candidate, ctxt) { + mockPolicyService.allow.andCallFake(function (cat, candidate) { return candidate.someKey !== 'b'; }); expect(decorator.getViews(mockDomainObject)) diff --git a/platform/representation/test/actions/ContextMenuActionSpec.js b/platform/representation/test/actions/ContextMenuActionSpec.js index 3af48fb3c5..bab5a311f5 100644 --- a/platform/representation/test/actions/ContextMenuActionSpec.js +++ b/platform/representation/test/actions/ContextMenuActionSpec.js @@ -25,12 +25,11 @@ * Module defining ContextMenuActionSpec. Created by shale on 07/02/2015. */ define( - ["../../src/actions/ContextMenuAction", "../../src/gestures/GestureConstants"], - function (ContextMenuAction, GestureConstants) { + ["../../src/actions/ContextMenuAction"], + function (ContextMenuAction) { var JQLITE_FUNCTIONS = [ "on", "off", "find", "append", "remove" ], - DOMAIN_OBJECT_METHODS = [ "getId", "getModel", "getCapability", "hasCapability", "useCapability" ], - MENU_DIMENSIONS = GestureConstants.MCT_MENU_DIMENSIONS; + DOMAIN_OBJECT_METHODS = [ "getId", "getModel", "getCapability", "hasCapability", "useCapability" ]; describe("The 'context menu' action", function () { diff --git a/platform/representation/test/gestures/GestureRepresenterSpec.js b/platform/representation/test/gestures/GestureRepresenterSpec.js index ceffa2e734..f66696ed99 100644 --- a/platform/representation/test/gestures/GestureRepresenterSpec.js +++ b/platform/representation/test/gestures/GestureRepresenterSpec.js @@ -27,7 +27,6 @@ define( describe("A gesture representer", function () { var mockGestureService, mockGestureHandle, - mockScope, mockElement, representer; diff --git a/platform/search/test/controllers/SearchMenuControllerSpec.js b/platform/search/test/controllers/SearchMenuControllerSpec.js index 1c0949a67c..bff6dab569 100644 --- a/platform/search/test/controllers/SearchMenuControllerSpec.js +++ b/platform/search/test/controllers/SearchMenuControllerSpec.js @@ -29,7 +29,6 @@ define( describe("The search menu controller", function () { var mockScope, - mockPromise, mockTypes, controller; diff --git a/platform/telemetry/test/TelemetryDelegatorSpec.js b/platform/telemetry/test/TelemetryDelegatorSpec.js index 5c5897cf30..0841020449 100644 --- a/platform/telemetry/test/TelemetryDelegatorSpec.js +++ b/platform/telemetry/test/TelemetryDelegatorSpec.js @@ -25,7 +25,11 @@ define( function (TelemetryDelegator) { describe("The telemetry delegator", function () { + var delegator; + beforeEach(function () { + delegator = new TelemetryDelegator(); + }); }); } ); From 8b5a425da6eebb47fd0596c3b2f7601880c77daa Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 13:03:41 -0800 Subject: [PATCH 36/85] [Build] Restore erroneously-removed variable --- platform/core/test/types/TypeProviderSpec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/core/test/types/TypeProviderSpec.js b/platform/core/test/types/TypeProviderSpec.js index 3f687764d3..d876c9fa08 100644 --- a/platform/core/test/types/TypeProviderSpec.js +++ b/platform/core/test/types/TypeProviderSpec.js @@ -26,7 +26,8 @@ define( describe("Type provider", function () { - var testTypeDefinitions = [ + var captured = {}, + testTypeDefinitions = [ { key: 'basic', glyph: "X", From fb56b3ad56f4cdc628e46d80a42d288f9a3a0ef2 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 13:04:06 -0800 Subject: [PATCH 37/85] [Build] Enable forin check for JSHint --- gulpfile.js | 1 + 1 file changed, 1 insertion(+) diff --git a/gulpfile.js b/gulpfile.js index d319738002..80a668b87c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -63,6 +63,7 @@ var gulp = require('gulp'), "browser": true, "curly": true, "eqeqeq": true, + "forin": true, "freeze": true, "funcscope": true, "futurehostile": true, From 134452582c5c1c8e9c0d4dc150609b8b3fa2c8ca Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 13:10:23 -0800 Subject: [PATCH 38/85] [Build] Remove/qualify for-in usages --- .../capabilities/EditableLookupCapability.js | 2 +- .../src/controllers/SearchMenuController.js | 6 ++---- .../controllers/SearchMenuControllerSpec.js | 20 +++++++------------ 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js b/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js index a0c8add0c3..0abde97c5a 100644 --- a/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js @@ -24,7 +24,7 @@ define( [], function () { - + /*jshint forin:false */ /** * Wrapper for both "context" and "composition" capabilities; * ensures that any domain objects reachable in Edit mode diff --git a/platform/search/src/controllers/SearchMenuController.js b/platform/search/src/controllers/SearchMenuController.js index 154f746a53..2f369929ab 100644 --- a/platform/search/src/controllers/SearchMenuController.js +++ b/platform/search/src/controllers/SearchMenuController.js @@ -90,12 +90,10 @@ define(function () { // For documentation, see checkAll below function checkAll() { - var type; - // Reset all the other options to original/default position - for (type in $scope.ngModel.checked) { + Object.keys($scope.ngModel.checked).forEach(function (type) { $scope.ngModel.checked[type] = false; - } + }); // Change the filters string depending on checkAll status if ($scope.ngModel.checkAll) { diff --git a/platform/search/test/controllers/SearchMenuControllerSpec.js b/platform/search/test/controllers/SearchMenuControllerSpec.js index bff6dab569..68f8930431 100644 --- a/platform/search/test/controllers/SearchMenuControllerSpec.js +++ b/platform/search/test/controllers/SearchMenuControllerSpec.js @@ -87,24 +87,20 @@ define( }); it("checking checkAll option resets other options", function () { - var type; - mockScope.ngModel.checked['mock.type.1'] = true; mockScope.ngModel.checked['mock.type.2'] = true; controller.checkAll(); - - for (type in mockScope.ngModel.checked) { + + Object.keys(mockScope.ngModel.checked).forEach(function (type) { expect(mockScope.ngModel.checked[type]).toBeFalsy(); - } + }); }); it("tells the user when no options are checked", function () { - var type; - - for (type in mockScope.ngModel.checked) { + Object.keys(mockScope.ngModel.checked).forEach(function (type) { mockScope.ngModel.checked[type] = false; - } + }); mockScope.ngModel.checkAll = false; controller.updateOptions(); @@ -113,12 +109,10 @@ define( }); it("tells the user when options are checked", function () { - var type; - mockScope.ngModel.checkAll = false; - for (type in mockScope.ngModel.checked) { + Object.keys(mockScope.ngModel.checked).forEach(function (type) { mockScope.ngModel.checked[type] = true; - } + }); controller.updateOptions(); From 22be6bc86027180ad0a8ed996a25f45604840554 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Mar 2016 16:16:35 -0800 Subject: [PATCH 39/85] [Build] Run lint task from CircleCI https://github.com/nasa/openmctweb/pull/724#issuecomment-192487995 --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index d163b3ee0c..e2f670e899 100644 --- a/circle.yml +++ b/circle.yml @@ -15,4 +15,4 @@ deployment: appname: openmctweb-staging-deux test: post: - - npm run jshint --silent + - gulp lint From 50884537125d743259b30d95f7ffa69d713f2b6c Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 8 Apr 2016 16:11:12 -0700 Subject: [PATCH 40/85] [Build] Remove use strict, global Remove usages of use strict and global declarations that are no longer necessary with JSHint configuration, from files added/changed since #724 --- platform/commonUI/edit/src/policies/EditableLinkPolicy.js | 2 -- platform/commonUI/general/src/ui/TreeLabelView.js | 2 -- platform/commonUI/general/src/ui/TreeNodeView.js | 2 -- platform/commonUI/general/src/ui/TreeView.js | 2 -- platform/commonUI/general/test/directives/MCTTreeSpec.js | 1 - platform/commonUI/general/test/ui/TreeViewSpec.js | 2 -- platform/core/src/models/ModelCacheService.js | 2 -- platform/core/test/models/ModelCacheServiceSpec.js | 2 -- platform/entanglement/src/policies/CopyPolicy.js | 2 -- platform/entanglement/src/policies/MovePolicy.js | 2 -- platform/entanglement/test/ControlledPromise.js | 1 - platform/entanglement/test/DomainObjectFactory.js | 1 - platform/entanglement/test/policies/CopyPolicySpec.js | 2 -- platform/entanglement/test/policies/MovePolicySpec.js | 2 -- platform/entanglement/test/services/MockCopyService.js | 1 - platform/entanglement/test/services/MockLinkService.js | 1 - platform/entanglement/test/services/MockMoveService.js | 1 - platform/features/conductor/test/TestTimeConductor.js | 1 - .../table/src/controllers/RTTelemetryTableController.js | 2 -- .../table/test/controllers/RTTelemetryTableControllerSpec.js | 2 -- platform/features/timeline/src/actions/CompositionColumn.js | 2 -- .../features/timeline/src/actions/ExportTimelineAsCSVAction.js | 2 -- .../features/timeline/src/actions/ExportTimelineAsCSVTask.js | 2 -- platform/features/timeline/src/actions/IdColumn.js | 2 -- platform/features/timeline/src/actions/MetadataColumn.js | 2 -- platform/features/timeline/src/actions/ModeColumn.js | 2 -- platform/features/timeline/src/actions/TimelineColumnizer.js | 2 -- platform/features/timeline/src/actions/TimelineTraverser.js | 2 -- platform/features/timeline/src/actions/TimespanColumn.js | 2 -- .../features/timeline/test/actions/CompositionColumnSpec.js | 1 - .../timeline/test/actions/ExportTimelineAsCSVActionSpec.js | 1 - .../timeline/test/actions/ExportTimelineAsCSVTaskSpec.js | 2 -- platform/features/timeline/test/actions/IdColumnSpec.js | 1 - platform/features/timeline/test/actions/MetadataColumnSpec.js | 1 - platform/features/timeline/test/actions/ModeColumnSpec.js | 1 - .../features/timeline/test/actions/TimelineColumnizerSpec.js | 1 - .../features/timeline/test/actions/TimelineTraverserSpec.js | 2 -- platform/features/timeline/test/actions/TimespanColumnSpec.js | 1 - platform/framework/src/FrameworkLayer.js | 1 - platform/framework/src/Main.js | 1 - platform/search/src/services/GenericSearchWorker.js | 1 - platform/search/test/services/GenericSearchWorkerSpec.js | 1 - 42 files changed, 66 deletions(-) diff --git a/platform/commonUI/edit/src/policies/EditableLinkPolicy.js b/platform/commonUI/edit/src/policies/EditableLinkPolicy.js index ad3043df2d..c311266cf8 100644 --- a/platform/commonUI/edit/src/policies/EditableLinkPolicy.js +++ b/platform/commonUI/edit/src/policies/EditableLinkPolicy.js @@ -19,10 +19,8 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define([], function () { - "use strict"; /** * Policy suppressing links when the linked-to domain object is in diff --git a/platform/commonUI/general/src/ui/TreeLabelView.js b/platform/commonUI/general/src/ui/TreeLabelView.js index 75e8efcc29..d5dffb0068 100644 --- a/platform/commonUI/general/src/ui/TreeLabelView.js +++ b/platform/commonUI/general/src/ui/TreeLabelView.js @@ -19,13 +19,11 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define([ 'zepto', 'text!../../res/templates/tree/tree-label.html' ], function ($, labelTemplate) { - 'use strict'; function TreeLabelView(gestureService) { this.el = $(labelTemplate); diff --git a/platform/commonUI/general/src/ui/TreeNodeView.js b/platform/commonUI/general/src/ui/TreeNodeView.js index 14ff0f3233..2cff198e76 100644 --- a/platform/commonUI/general/src/ui/TreeNodeView.js +++ b/platform/commonUI/general/src/ui/TreeNodeView.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define([ 'zepto', @@ -27,7 +26,6 @@ define([ './ToggleView', './TreeLabelView' ], function ($, nodeTemplate, ToggleView, TreeLabelView) { - 'use strict'; function TreeNodeView(gestureService, subtreeFactory, selectFn) { this.li = $('
  • '); diff --git a/platform/commonUI/general/src/ui/TreeView.js b/platform/commonUI/general/src/ui/TreeView.js index b1b394ae4c..da0bed7091 100644 --- a/platform/commonUI/general/src/ui/TreeView.js +++ b/platform/commonUI/general/src/ui/TreeView.js @@ -19,14 +19,12 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define([ 'zepto', './TreeNodeView', 'text!../../res/templates/tree/wait-node.html' ], function ($, TreeNodeView, spinnerTemplate) { - 'use strict'; function TreeView(gestureService, selectFn) { this.ul = $('
      '); diff --git a/platform/commonUI/general/test/directives/MCTTreeSpec.js b/platform/commonUI/general/test/directives/MCTTreeSpec.js index 597c4c55b7..80854685e6 100644 --- a/platform/commonUI/general/test/directives/MCTTreeSpec.js +++ b/platform/commonUI/general/test/directives/MCTTreeSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,beforeEach,jasmine,it,expect*/ define([ '../../src/directives/MCTTree' diff --git a/platform/commonUI/general/test/ui/TreeViewSpec.js b/platform/commonUI/general/test/ui/TreeViewSpec.js index eae4d3eafd..7d28ae32a6 100644 --- a/platform/commonUI/general/test/ui/TreeViewSpec.js +++ b/platform/commonUI/general/test/ui/TreeViewSpec.js @@ -19,13 +19,11 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,beforeEach,jasmine,it,expect*/ define([ '../../src/ui/TreeView', 'zepto' ], function (TreeView, $) { - 'use strict'; describe("TreeView", function () { var mockGestureService, diff --git a/platform/core/src/models/ModelCacheService.js b/platform/core/src/models/ModelCacheService.js index 4bcee0b93d..0e6a196dbc 100644 --- a/platform/core/src/models/ModelCacheService.js +++ b/platform/core/src/models/ModelCacheService.js @@ -19,10 +19,8 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define([], function () { - 'use strict'; /** * Provides a cache for domain object models which exist in memory, diff --git a/platform/core/test/models/ModelCacheServiceSpec.js b/platform/core/test/models/ModelCacheServiceSpec.js index f8254779ab..23d1a0ce0d 100644 --- a/platform/core/test/models/ModelCacheServiceSpec.js +++ b/platform/core/test/models/ModelCacheServiceSpec.js @@ -19,10 +19,8 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ define(['../../src/models/ModelCacheService'], function (ModelCacheService) { - 'use strict'; describe("ModelCacheService", function () { var testIds, testModels, diff --git a/platform/entanglement/src/policies/CopyPolicy.js b/platform/entanglement/src/policies/CopyPolicy.js index 09fe424540..dae3066111 100644 --- a/platform/entanglement/src/policies/CopyPolicy.js +++ b/platform/entanglement/src/policies/CopyPolicy.js @@ -20,9 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define */ define([], function () { - 'use strict'; /** * Disallow duplication when the object to be duplicated is not diff --git a/platform/entanglement/src/policies/MovePolicy.js b/platform/entanglement/src/policies/MovePolicy.js index 064b6b7192..0c395f9302 100644 --- a/platform/entanglement/src/policies/MovePolicy.js +++ b/platform/entanglement/src/policies/MovePolicy.js @@ -20,9 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define */ define([], function () { - 'use strict'; /** * Disallow moves when either the parent or the child are not diff --git a/platform/entanglement/test/ControlledPromise.js b/platform/entanglement/test/ControlledPromise.js index 0b3fcd6cf6..2f1c99ed84 100644 --- a/platform/entanglement/test/ControlledPromise.js +++ b/platform/entanglement/test/ControlledPromise.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global spyOn*/ define( function () { diff --git a/platform/entanglement/test/DomainObjectFactory.js b/platform/entanglement/test/DomainObjectFactory.js index 4a11667084..e9ef03c021 100644 --- a/platform/entanglement/test/DomainObjectFactory.js +++ b/platform/entanglement/test/DomainObjectFactory.js @@ -20,7 +20,6 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global jasmine*/ define( function () { diff --git a/platform/entanglement/test/policies/CopyPolicySpec.js b/platform/entanglement/test/policies/CopyPolicySpec.js index b53f4d22ed..88eeaec8d8 100644 --- a/platform/entanglement/test/policies/CopyPolicySpec.js +++ b/platform/entanglement/test/policies/CopyPolicySpec.js @@ -20,12 +20,10 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,beforeEach,it,jasmine,expect,spyOn */ define([ '../../src/policies/CopyPolicy', '../DomainObjectFactory' ], function (CopyPolicy, domainObjectFactory) { - 'use strict'; describe("CopyPolicy", function () { var testMetadata, diff --git a/platform/entanglement/test/policies/MovePolicySpec.js b/platform/entanglement/test/policies/MovePolicySpec.js index d55ad3c697..ab19731a60 100644 --- a/platform/entanglement/test/policies/MovePolicySpec.js +++ b/platform/entanglement/test/policies/MovePolicySpec.js @@ -20,12 +20,10 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,beforeEach,it,jasmine,expect,spyOn */ define([ '../../src/policies/MovePolicy', '../DomainObjectFactory' ], function (MovePolicy, domainObjectFactory) { - 'use strict'; describe("MovePolicy", function () { var testMetadata, diff --git a/platform/entanglement/test/services/MockCopyService.js b/platform/entanglement/test/services/MockCopyService.js index cf986bec7e..2ba49b53b9 100644 --- a/platform/entanglement/test/services/MockCopyService.js +++ b/platform/entanglement/test/services/MockCopyService.js @@ -20,7 +20,6 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global jasmine*/ define( function () { diff --git a/platform/entanglement/test/services/MockLinkService.js b/platform/entanglement/test/services/MockLinkService.js index 5345efc86e..5c583783c8 100644 --- a/platform/entanglement/test/services/MockLinkService.js +++ b/platform/entanglement/test/services/MockLinkService.js @@ -20,7 +20,6 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global jasmine*/ define( [ '../ControlledPromise' diff --git a/platform/entanglement/test/services/MockMoveService.js b/platform/entanglement/test/services/MockMoveService.js index d5a290c03f..1eccad53c0 100644 --- a/platform/entanglement/test/services/MockMoveService.js +++ b/platform/entanglement/test/services/MockMoveService.js @@ -20,7 +20,6 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global jasmine*/ define( function () { diff --git a/platform/features/conductor/test/TestTimeConductor.js b/platform/features/conductor/test/TestTimeConductor.js index 52ffb773d4..2a0fe7a7a8 100644 --- a/platform/features/conductor/test/TestTimeConductor.js +++ b/platform/features/conductor/test/TestTimeConductor.js @@ -20,7 +20,6 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global spyOn*/ define( ["../src/TimeConductor"], function (TimeConductor) { diff --git a/platform/features/table/src/controllers/RTTelemetryTableController.js b/platform/features/table/src/controllers/RTTelemetryTableController.js index 8a61d61b5e..6ae7f3b578 100644 --- a/platform/features/table/src/controllers/RTTelemetryTableController.js +++ b/platform/features/table/src/controllers/RTTelemetryTableController.js @@ -19,14 +19,12 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define( [ './TelemetryTableController' ], function (TableController) { - "use strict"; /** * Extends TelemetryTableController and adds real-time streaming diff --git a/platform/features/table/test/controllers/RTTelemetryTableControllerSpec.js b/platform/features/table/test/controllers/RTTelemetryTableControllerSpec.js index 59911d1771..cf6421c9a5 100644 --- a/platform/features/table/test/controllers/RTTelemetryTableControllerSpec.js +++ b/platform/features/table/test/controllers/RTTelemetryTableControllerSpec.js @@ -19,14 +19,12 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,xit*/ define( [ "../../src/controllers/RTTelemetryTableController" ], function (TableController) { - "use strict"; describe('The real-time table controller', function () { var mockScope, diff --git a/platform/features/timeline/src/actions/CompositionColumn.js b/platform/features/timeline/src/actions/CompositionColumn.js index b7208c3e92..f9bede9983 100644 --- a/platform/features/timeline/src/actions/CompositionColumn.js +++ b/platform/features/timeline/src/actions/CompositionColumn.js @@ -19,10 +19,8 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define([], function () { - "use strict"; /** * A column containing references to other objects contained diff --git a/platform/features/timeline/src/actions/ExportTimelineAsCSVAction.js b/platform/features/timeline/src/actions/ExportTimelineAsCSVAction.js index 387c0839a0..7b7754e720 100644 --- a/platform/features/timeline/src/actions/ExportTimelineAsCSVAction.js +++ b/platform/features/timeline/src/actions/ExportTimelineAsCSVAction.js @@ -19,10 +19,8 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define(["./ExportTimelineAsCSVTask"], function (ExportTimelineAsCSVTask) { - 'use strict'; /** * Implements the "Export Timeline as CSV" action. diff --git a/platform/features/timeline/src/actions/ExportTimelineAsCSVTask.js b/platform/features/timeline/src/actions/ExportTimelineAsCSVTask.js index 253db5c8b9..b8d796b3c4 100644 --- a/platform/features/timeline/src/actions/ExportTimelineAsCSVTask.js +++ b/platform/features/timeline/src/actions/ExportTimelineAsCSVTask.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ /** * Module defining ExportTimelineAsCSVTask. Created by vwoeltje on 2/8/16. @@ -28,7 +27,6 @@ define([ "./TimelineTraverser", "./TimelineColumnizer" ], function (TimelineTraverser, TimelineColumnizer) { - "use strict"; /** * Runs (and coordinates) the preparation and export of CSV data diff --git a/platform/features/timeline/src/actions/IdColumn.js b/platform/features/timeline/src/actions/IdColumn.js index 56ddfe385f..38c8b9264e 100644 --- a/platform/features/timeline/src/actions/IdColumn.js +++ b/platform/features/timeline/src/actions/IdColumn.js @@ -19,10 +19,8 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define([], function () { - "use strict"; /** * A column showing domain object identifiers. diff --git a/platform/features/timeline/src/actions/MetadataColumn.js b/platform/features/timeline/src/actions/MetadataColumn.js index c94237a917..7676552879 100644 --- a/platform/features/timeline/src/actions/MetadataColumn.js +++ b/platform/features/timeline/src/actions/MetadataColumn.js @@ -19,10 +19,8 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define([], function () { - "use strict"; /** * A column reflecting properties from domain object metadata. diff --git a/platform/features/timeline/src/actions/ModeColumn.js b/platform/features/timeline/src/actions/ModeColumn.js index 4ae61b30d3..fe2063566d 100644 --- a/platform/features/timeline/src/actions/ModeColumn.js +++ b/platform/features/timeline/src/actions/ModeColumn.js @@ -19,10 +19,8 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define([], function () { - "use strict"; /** * A column showing relationships to activity modes. diff --git a/platform/features/timeline/src/actions/TimelineColumnizer.js b/platform/features/timeline/src/actions/TimelineColumnizer.js index 3069bd8b96..f24fa20eee 100644 --- a/platform/features/timeline/src/actions/TimelineColumnizer.js +++ b/platform/features/timeline/src/actions/TimelineColumnizer.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ define([ "./IdColumn", @@ -34,7 +33,6 @@ define([ MetadataColumn, TimespanColumn ) { - 'use strict'; /** * A description of how to populate a given column within a diff --git a/platform/features/timeline/src/actions/TimelineTraverser.js b/platform/features/timeline/src/actions/TimelineTraverser.js index f6857658fb..f38d0e3489 100644 --- a/platform/features/timeline/src/actions/TimelineTraverser.js +++ b/platform/features/timeline/src/actions/TimelineTraverser.js @@ -19,10 +19,8 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ define([], function () { - "use strict"; /** * Builds a list of domain objects which should be included diff --git a/platform/features/timeline/src/actions/TimespanColumn.js b/platform/features/timeline/src/actions/TimespanColumn.js index 6d0c4e05a9..a701724ee1 100644 --- a/platform/features/timeline/src/actions/TimespanColumn.js +++ b/platform/features/timeline/src/actions/TimespanColumn.js @@ -19,10 +19,8 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define*/ define(['../TimelineFormatter'], function (TimelineFormatter) { - "use strict"; var FORMATTER = new TimelineFormatter(); diff --git a/platform/features/timeline/test/actions/CompositionColumnSpec.js b/platform/features/timeline/test/actions/CompositionColumnSpec.js index 99e23d5597..87377a856f 100644 --- a/platform/features/timeline/test/actions/CompositionColumnSpec.js +++ b/platform/features/timeline/test/actions/CompositionColumnSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/ define( ['../../src/actions/CompositionColumn'], diff --git a/platform/features/timeline/test/actions/ExportTimelineAsCSVActionSpec.js b/platform/features/timeline/test/actions/ExportTimelineAsCSVActionSpec.js index 3d5cd8b01c..7250fd2621 100644 --- a/platform/features/timeline/test/actions/ExportTimelineAsCSVActionSpec.js +++ b/platform/features/timeline/test/actions/ExportTimelineAsCSVActionSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/ define( ['../../src/actions/ExportTimelineAsCSVAction'], diff --git a/platform/features/timeline/test/actions/ExportTimelineAsCSVTaskSpec.js b/platform/features/timeline/test/actions/ExportTimelineAsCSVTaskSpec.js index 7979104ee5..d9c6ca3c6e 100644 --- a/platform/features/timeline/test/actions/ExportTimelineAsCSVTaskSpec.js +++ b/platform/features/timeline/test/actions/ExportTimelineAsCSVTaskSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/ define( ['../../src/actions/ExportTimelineAsCSVTask'], function (ExportTimelineAsCSVTask) { - 'use strict'; // Note that most responsibility is delegated to helper // classes, so testing here is minimal. diff --git a/platform/features/timeline/test/actions/IdColumnSpec.js b/platform/features/timeline/test/actions/IdColumnSpec.js index a12b6145a9..5aab82d11f 100644 --- a/platform/features/timeline/test/actions/IdColumnSpec.js +++ b/platform/features/timeline/test/actions/IdColumnSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/ define( ['../../src/actions/IdColumn'], diff --git a/platform/features/timeline/test/actions/MetadataColumnSpec.js b/platform/features/timeline/test/actions/MetadataColumnSpec.js index ba38fc83c0..f9ff3f3d35 100644 --- a/platform/features/timeline/test/actions/MetadataColumnSpec.js +++ b/platform/features/timeline/test/actions/MetadataColumnSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/ define( ['../../src/actions/MetadataColumn'], diff --git a/platform/features/timeline/test/actions/ModeColumnSpec.js b/platform/features/timeline/test/actions/ModeColumnSpec.js index ab15d696c2..1189b30ca6 100644 --- a/platform/features/timeline/test/actions/ModeColumnSpec.js +++ b/platform/features/timeline/test/actions/ModeColumnSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/ define( ['../../src/actions/ModeColumn'], diff --git a/platform/features/timeline/test/actions/TimelineColumnizerSpec.js b/platform/features/timeline/test/actions/TimelineColumnizerSpec.js index 9eacf4f3b3..d47d493ca9 100644 --- a/platform/features/timeline/test/actions/TimelineColumnizerSpec.js +++ b/platform/features/timeline/test/actions/TimelineColumnizerSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/ define( ['../../src/actions/TimelineColumnizer'], diff --git a/platform/features/timeline/test/actions/TimelineTraverserSpec.js b/platform/features/timeline/test/actions/TimelineTraverserSpec.js index 6962373ff9..3cec488b0d 100644 --- a/platform/features/timeline/test/actions/TimelineTraverserSpec.js +++ b/platform/features/timeline/test/actions/TimelineTraverserSpec.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/ define([ "../../src/actions/TimelineTraverser" ], function (TimelineTraverser) { - 'use strict'; describe("TimelineTraverser", function () { var testModels, diff --git a/platform/features/timeline/test/actions/TimespanColumnSpec.js b/platform/features/timeline/test/actions/TimespanColumnSpec.js index f4970b778e..5eea2a9281 100644 --- a/platform/features/timeline/test/actions/TimespanColumnSpec.js +++ b/platform/features/timeline/test/actions/TimespanColumnSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/ define( ['../../src/actions/TimespanColumn', '../../src/TimelineFormatter'], diff --git a/platform/framework/src/FrameworkLayer.js b/platform/framework/src/FrameworkLayer.js index 1f8910fe15..765013adf8 100644 --- a/platform/framework/src/FrameworkLayer.js +++ b/platform/framework/src/FrameworkLayer.js @@ -20,7 +20,6 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global window,requirejs*/ define([ 'require', diff --git a/platform/framework/src/Main.js b/platform/framework/src/Main.js index c468e4dbea..e1feb8b861 100644 --- a/platform/framework/src/Main.js +++ b/platform/framework/src/Main.js @@ -20,7 +20,6 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global window,requirejs*/ /** * Implements the framework layer, which handles the loading of bundles diff --git a/platform/search/src/services/GenericSearchWorker.js b/platform/search/src/services/GenericSearchWorker.js index a3cd34c2e2..4575ed1b55 100644 --- a/platform/search/src/services/GenericSearchWorker.js +++ b/platform/search/src/services/GenericSearchWorker.js @@ -20,7 +20,6 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global self*/ /** * Module defining GenericSearchWorker. Created by shale on 07/21/2015. diff --git a/platform/search/test/services/GenericSearchWorkerSpec.js b/platform/search/test/services/GenericSearchWorkerSpec.js index 952d2a4d58..22f0d35ac9 100644 --- a/platform/search/test/services/GenericSearchWorkerSpec.js +++ b/platform/search/test/services/GenericSearchWorkerSpec.js @@ -20,7 +20,6 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global require*/ /** * SearchSpec. Created by shale on 07/31/2015. From 0b11ddbcfd6dd8c9e8ca9e859f2c010e1447d353 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 8 Apr 2016 16:22:28 -0700 Subject: [PATCH 41/85] [Build] Satisfy JSHint Restore globals lost during removal due to merge, remove unused variables and use threequals in new scripts. --- platform/commonUI/general/test/ui/TreeViewSpec.js | 3 ++- platform/core/src/capabilities/PersistenceCapability.js | 1 - platform/entanglement/test/ControlledPromise.js | 1 + platform/entanglement/test/DomainObjectFactory.js | 1 + platform/entanglement/test/services/MockCopyService.js | 1 + platform/entanglement/test/services/MockLinkService.js | 1 + platform/entanglement/test/services/MockMoveService.js | 1 + platform/features/conductor/test/TestTimeConductor.js | 1 + .../features/table/src/controllers/MCTTableController.js | 7 +++---- .../table/src/controllers/TelemetryTableController.js | 2 -- platform/framework/src/FrameworkLayer.js | 1 + platform/framework/src/Main.js | 1 + platform/search/src/services/GenericSearchWorker.js | 1 + platform/search/test/services/GenericSearchWorkerSpec.js | 1 + 14 files changed, 15 insertions(+), 8 deletions(-) diff --git a/platform/commonUI/general/test/ui/TreeViewSpec.js b/platform/commonUI/general/test/ui/TreeViewSpec.js index 7d28ae32a6..e8d114b27a 100644 --- a/platform/commonUI/general/test/ui/TreeViewSpec.js +++ b/platform/commonUI/general/test/ui/TreeViewSpec.js @@ -19,6 +19,7 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ +/*global define,describe,beforeEach,jasmine,it,expect*/ define([ '../../src/ui/TreeView', @@ -122,7 +123,7 @@ define([ function waitForCompositionCallback() { var calledBack = false; - testCapabilities.composition.invoke().then(function (c) { + testCapabilities.composition.invoke().then(function () { calledBack = true; }); waitsFor(function () { diff --git a/platform/core/src/capabilities/PersistenceCapability.js b/platform/core/src/capabilities/PersistenceCapability.js index a56e0bb1c9..bf8fbd9961 100644 --- a/platform/core/src/capabilities/PersistenceCapability.js +++ b/platform/core/src/capabilities/PersistenceCapability.js @@ -130,7 +130,6 @@ define( domainObject = this.domainObject, model = domainObject.getModel(), modified = model.modified, - cacheService = this.cacheService, persistenceService = this.persistenceService, persistenceFn = model.persisted !== undefined ? this.persistenceService.updateObject : diff --git a/platform/entanglement/test/ControlledPromise.js b/platform/entanglement/test/ControlledPromise.js index 2f1c99ed84..0b3fcd6cf6 100644 --- a/platform/entanglement/test/ControlledPromise.js +++ b/platform/entanglement/test/ControlledPromise.js @@ -19,6 +19,7 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ +/*global spyOn*/ define( function () { diff --git a/platform/entanglement/test/DomainObjectFactory.js b/platform/entanglement/test/DomainObjectFactory.js index e9ef03c021..4a11667084 100644 --- a/platform/entanglement/test/DomainObjectFactory.js +++ b/platform/entanglement/test/DomainObjectFactory.js @@ -20,6 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ +/*global jasmine*/ define( function () { diff --git a/platform/entanglement/test/services/MockCopyService.js b/platform/entanglement/test/services/MockCopyService.js index 2ba49b53b9..cf986bec7e 100644 --- a/platform/entanglement/test/services/MockCopyService.js +++ b/platform/entanglement/test/services/MockCopyService.js @@ -20,6 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ +/*global jasmine*/ define( function () { diff --git a/platform/entanglement/test/services/MockLinkService.js b/platform/entanglement/test/services/MockLinkService.js index 5c583783c8..5345efc86e 100644 --- a/platform/entanglement/test/services/MockLinkService.js +++ b/platform/entanglement/test/services/MockLinkService.js @@ -20,6 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ +/*global jasmine*/ define( [ '../ControlledPromise' diff --git a/platform/entanglement/test/services/MockMoveService.js b/platform/entanglement/test/services/MockMoveService.js index 1eccad53c0..d5a290c03f 100644 --- a/platform/entanglement/test/services/MockMoveService.js +++ b/platform/entanglement/test/services/MockMoveService.js @@ -20,6 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ +/*global jasmine*/ define( function () { diff --git a/platform/features/conductor/test/TestTimeConductor.js b/platform/features/conductor/test/TestTimeConductor.js index 2a0fe7a7a8..52ffb773d4 100644 --- a/platform/features/conductor/test/TestTimeConductor.js +++ b/platform/features/conductor/test/TestTimeConductor.js @@ -20,6 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ +/*global spyOn*/ define( ["../src/TimeConductor"], function (TimeConductor) { diff --git a/platform/features/table/src/controllers/MCTTableController.js b/platform/features/table/src/controllers/MCTTableController.js index ace37bdfe6..34987fc15d 100644 --- a/platform/features/table/src/controllers/MCTTableController.js +++ b/platform/features/table/src/controllers/MCTTableController.js @@ -118,7 +118,7 @@ define( // Do a sequential search here. Only way of finding row is by // object equality, so array is in effect unsorted. indexInDisplayRows = this.$scope.displayRows.indexOf(row); - if (indexInDisplayRows != -1) { + if (indexInDisplayRows !== -1) { this.$scope.displayRows.splice(indexInDisplayRows, 1); this.setVisibleRows(); } @@ -160,7 +160,7 @@ define( if (this.$scope.displayRows.length < this.maxDisplayRows) { //Check whether need to resynchronize visible with display // rows (if data added) - if (this.$scope.visibleRows.length != + if (this.$scope.visibleRows.length !== this.$scope.displayRows.length){ start = 0; end = this.$scope.displayRows.length; @@ -247,8 +247,7 @@ define( * for individual rows. */ MCTTableController.prototype.setElementSizes = function () { - var self = this, - thead = this.element.find('thead'), + var thead = this.element.find('thead'), tbody = this.element.find('tbody'), firstRow = tbody.find('tr'), column = firstRow.find('td'), diff --git a/platform/features/table/src/controllers/TelemetryTableController.js b/platform/features/table/src/controllers/TelemetryTableController.js index 1954488a69..488f8dc171 100644 --- a/platform/features/table/src/controllers/TelemetryTableController.js +++ b/platform/features/table/src/controllers/TelemetryTableController.js @@ -108,8 +108,6 @@ define( only). */ TelemetryTableController.prototype.subscribe = function () { - var self = this; - if (this.handle) { this.handle.unsubscribe(); } diff --git a/platform/framework/src/FrameworkLayer.js b/platform/framework/src/FrameworkLayer.js index 765013adf8..1f8910fe15 100644 --- a/platform/framework/src/FrameworkLayer.js +++ b/platform/framework/src/FrameworkLayer.js @@ -20,6 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ +/*global window,requirejs*/ define([ 'require', diff --git a/platform/framework/src/Main.js b/platform/framework/src/Main.js index e1feb8b861..c468e4dbea 100644 --- a/platform/framework/src/Main.js +++ b/platform/framework/src/Main.js @@ -20,6 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ +/*global window,requirejs*/ /** * Implements the framework layer, which handles the loading of bundles diff --git a/platform/search/src/services/GenericSearchWorker.js b/platform/search/src/services/GenericSearchWorker.js index 4575ed1b55..a3cd34c2e2 100644 --- a/platform/search/src/services/GenericSearchWorker.js +++ b/platform/search/src/services/GenericSearchWorker.js @@ -20,6 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ +/*global self*/ /** * Module defining GenericSearchWorker. Created by shale on 07/21/2015. diff --git a/platform/search/test/services/GenericSearchWorkerSpec.js b/platform/search/test/services/GenericSearchWorkerSpec.js index 22f0d35ac9..952d2a4d58 100644 --- a/platform/search/test/services/GenericSearchWorkerSpec.js +++ b/platform/search/test/services/GenericSearchWorkerSpec.js @@ -20,6 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ +/*global require*/ /** * SearchSpec. Created by shale on 07/31/2015. From f6a9c90cef7ea0822731550886fbd63b6b8a508f Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 8 Apr 2016 16:25:32 -0700 Subject: [PATCH 42/85] [Build] Use native bind ...in CouchPersistenceProvider and ElasticPersistenceProvider, per https://github.com/nasa/openmct/pull/724#issuecomment-193542314 --- .../couch/src/CouchPersistenceProvider.js | 16 +++++----------- .../elastic/src/ElasticPersistenceProvider.js | 12 +++--------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/platform/persistence/couch/src/CouchPersistenceProvider.js b/platform/persistence/couch/src/CouchPersistenceProvider.js index 2e0cec8807..ac0aaca304 100644 --- a/platform/persistence/couch/src/CouchPersistenceProvider.js +++ b/platform/persistence/couch/src/CouchPersistenceProvider.js @@ -54,12 +54,6 @@ define( this.path = path; } - function bind(fn, thisArg) { - return function () { - return fn.apply(thisArg, arguments); - }; - } - // Pull out a list of document IDs from CouchDB's // _all_docs response function getIdsFromAllDocs(allDocs) { @@ -117,29 +111,29 @@ define( }; CouchPersistenceProvider.prototype.listObjects = function () { - return this.get("_all_docs").then(bind(getIdsFromAllDocs, this)); + return this.get("_all_docs").then(getIdsFromAllDocs.bind(this)); }; CouchPersistenceProvider.prototype.createObject = function (space, key, value) { return this.put(key, new CouchDocument(key, value)) - .then(bind(this.checkResponse, this)); + .then(this.checkResponse.bind(this)); }; CouchPersistenceProvider.prototype.readObject = function (space, key) { - return this.get(key).then(bind(this.getModel, this)); + return this.get(key).then(this.getModel.bind(this)); }; CouchPersistenceProvider.prototype.updateObject = function (space, key, value) { var rev = this.revs[key]; return this.put(key, new CouchDocument(key, value, rev)) - .then(bind(this.checkResponse, this)); + .then(this.checkResponse.bind(this)); }; CouchPersistenceProvider.prototype.deleteObject = function (space, key, value) { var rev = this.revs[key]; return this.put(key, new CouchDocument(key, value, rev, true)) - .then(bind(this.checkResponse, this)); + .then(this.checkResponse.bind(this)); }; return CouchPersistenceProvider; diff --git a/platform/persistence/elastic/src/ElasticPersistenceProvider.js b/platform/persistence/elastic/src/ElasticPersistenceProvider.js index 564029b4c7..970f5cca26 100644 --- a/platform/persistence/elastic/src/ElasticPersistenceProvider.js +++ b/platform/persistence/elastic/src/ElasticPersistenceProvider.js @@ -58,12 +58,6 @@ define( this.path = path; } - function bind(fn, thisArg) { - return function () { - return fn.apply(thisArg, arguments); - }; - } - // Issue a request using $http; get back the plain JS object // from the expected JSON response ElasticPersistenceProvider.prototype.request = function (subpath, method, value, params) { @@ -141,11 +135,11 @@ define( ElasticPersistenceProvider.prototype.createObject = function (space, key, value) { - return this.put(key, value).then(bind(this.checkResponse, this)); + return this.put(key, value).then(this.checkResponse.bind(this)); }; ElasticPersistenceProvider.prototype.readObject = function (space, key) { - return this.get(key).then(bind(this.getModel, this)); + return this.get(key).then(this.getModel.bind(this)); }; ElasticPersistenceProvider.prototype.updateObject = function (space, key, value) { @@ -158,7 +152,7 @@ define( }; ElasticPersistenceProvider.prototype.deleteObject = function (space, key) { - return this.del(key).then(bind(this.checkResponse, this)); + return this.del(key).then(this.checkResponse.bind(this)); }; return ElasticPersistenceProvider; From aa45e5344082ff24f34164f1d2cb61dd3847b945 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 8 Apr 2016 16:28:35 -0700 Subject: [PATCH 43/85] [Build] Revert setTimeout changes Restore usage of setTimeout (instead of the Angular-wrapped version) per https://github.com/nasa/openmct/pull/724#issuecomment-193542314 --- platform/search/bundle.js | 1 - platform/search/src/services/GenericSearchProvider.js | 11 +++++------ .../search/test/services/GenericSearchProviderSpec.js | 9 +-------- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/platform/search/bundle.js b/platform/search/bundle.js index 74040b84f4..fb5714fab6 100644 --- a/platform/search/bundle.js +++ b/platform/search/bundle.js @@ -103,7 +103,6 @@ define([ "type": "provider", "implementation": GenericSearchProvider, "depends": [ - "$timeout", "$q", "$log", "modelService", diff --git a/platform/search/src/services/GenericSearchProvider.js b/platform/search/src/services/GenericSearchProvider.js index ce2ae642ed..fbe45ae6d8 100644 --- a/platform/search/src/services/GenericSearchProvider.js +++ b/platform/search/src/services/GenericSearchProvider.js @@ -19,6 +19,7 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ +/*global setTimeout*/ /** * Module defining GenericSearchProvider. Created by shale on 07/16/2015. @@ -41,9 +42,8 @@ define([ * @param {TopicService} topic the topic service. * @param {Array} ROOTS An array of object Ids to begin indexing. */ - function GenericSearchProvider($timeout, $q, $log, modelService, workerService, topic, ROOTS) { + function GenericSearchProvider($q, $log, modelService, workerService, topic, ROOTS) { var provider = this; - this.$timeout = $timeout; this.$q = $q; this.$log = $log; this.modelService = modelService; @@ -193,8 +193,7 @@ define([ */ GenericSearchProvider.prototype.beginIndexRequest = function () { var idToIndex = this.idsToIndex.shift(), - provider = this, - $timeout = this.$timeout; + provider = this; this.pendingRequests += 1; this.modelService @@ -210,10 +209,10 @@ define([ .warn('Failed to index domain object ' + idToIndex); }) .then(function () { - $timeout(function () { + setTimeout(function () { provider.pendingRequests -= 1; provider.keepIndexing(); - }, 0, false); + }, 0); }); }; diff --git a/platform/search/test/services/GenericSearchProviderSpec.js b/platform/search/test/services/GenericSearchProviderSpec.js index c9fc1ff03d..abfe3d011d 100644 --- a/platform/search/test/services/GenericSearchProviderSpec.js +++ b/platform/search/test/services/GenericSearchProviderSpec.js @@ -30,8 +30,7 @@ define([ ) { describe('GenericSearchProvider', function () { - var $timeout, - $q, + var $q, $log, modelService, models, @@ -43,7 +42,6 @@ define([ provider; beforeEach(function () { - $timeout = jasmine.createSpy('$timeout'); $q = jasmine.createSpyObj( '$q', ['defer'] @@ -82,12 +80,7 @@ define([ spyOn(GenericSearchProvider.prototype, 'scheduleForIndexing'); - $timeout.andCallFake(function (callback, millis) { - window.setTimeout(callback, millis); - }); - provider = new GenericSearchProvider( - $timeout, $q, $log, modelService, From 93512851828ff89686d729384e35b0201596185e Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 8 Apr 2016 16:31:01 -0700 Subject: [PATCH 44/85] [Build] Remove obsolete argument from spec ...to reflect changes associated with JSHint configuration, https://github.com/nasa/openmct/pull/724#issuecomment-193542314 --- .../local/test/LocalStoragePersistenceProviderSpec.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/platform/persistence/local/test/LocalStoragePersistenceProviderSpec.js b/platform/persistence/local/test/LocalStoragePersistenceProviderSpec.js index b6530584d6..50869cf9a0 100644 --- a/platform/persistence/local/test/LocalStoragePersistenceProviderSpec.js +++ b/platform/persistence/local/test/LocalStoragePersistenceProviderSpec.js @@ -51,8 +51,7 @@ define( provider = new LocalStoragePersistenceProvider( { localStorage: testLocalStorage }, mockQ, - testSpace, - testLocalStorage + testSpace ); }); From c1ae68b565bcc33c61a7f3ec9e96a54492c10a9f Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 8 Apr 2016 16:32:17 -0700 Subject: [PATCH 45/85] [Build] Change unused to vars To allow placeholder arguments in method signatures, per https://github.com/nasa/openmct/pull/724#issuecomment-193542314 --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index d36ebef46a..662574cea5 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -78,7 +78,7 @@ var gulp = require('gulp'), ], "strict": "implied", "undef": true, - "unused": true + "unused": "vars" }, karma: { configFile: path.resolve(__dirname, 'karma.conf.js'), From a224711dce6b2d0e7bd4e87139ef18be04cb1891 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 8 Apr 2016 16:37:18 -0700 Subject: [PATCH 46/85] [Build] Move JSHint config to .jshintrc ...to allow code editors etc to pick up on rules, per https://github.com/nasa/openmct/pull/724#issuecomment-193542314 --- .jshintrc | 22 ++++++++++++++++++++++ gulpfile.js | 26 ++------------------------ 2 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 .jshintrc diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000000..df3f02a1ff --- /dev/null +++ b/.jshintrc @@ -0,0 +1,22 @@ +{ + "bitwise": true, + "browser": true, + "curly": true, + "eqeqeq": true, + "forin": true, + "freeze": true, + "funcscope": true, + "futurehostile": true, + "latedef": true, + "noarg": true, + "nocomma": true, + "nonbsp": true, + "nonew": true, + "predef": [ + "define", + "Promise" + ], + "strict": "implied", + "undef": true, + "unused": "vars" +} diff --git a/gulpfile.js b/gulpfile.js index 662574cea5..7d7fb8a8e7 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -58,28 +58,6 @@ var gulp = require('gulp'), mainConfigFile: paths.main, wrapShim: true }, - jshint: { - "bitwise": true, - "browser": true, - "curly": true, - "eqeqeq": true, - "forin": true, - "freeze": true, - "funcscope": true, - "futurehostile": true, - "latedef": true, - "noarg": true, - "nocomma": true, - "nonbsp": true, - "nonew": true, - "predef": [ - "define", - "Promise" - ], - "strict": "implied", - "undef": true, - "unused": "vars" - }, karma: { configFile: path.resolve(__dirname, 'karma.conf.js'), singleRun: true @@ -128,9 +106,9 @@ gulp.task('lint', function () { return "!" + glob; }), scriptLint = gulp.src(paths.scripts.concat(nonspecs)) - .pipe(jshint(options.jshint)), + .pipe(jshint()), specLint = gulp.src(paths.specs) - .pipe(jshint(_.extend({ jasmine: true }, options.jshint))); + .pipe(jshint({ jasmine: true })); return merge(scriptLint, specLint) .pipe(jshint.reporter('default')) From 934eb13813254294d75fc8052ece74be96beea8d Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 8 Apr 2016 16:54:01 -0700 Subject: [PATCH 47/85] [Build] Remove obsolete jslint tags ES5 mode is enabled by default in JSHint, tags no longer necessary per https://github.com/nasa/openmct/pull/724#discussion_r55095722 --- platform/commonUI/edit/src/actions/SaveAction.js | 2 -- platform/core/src/capabilities/PersistenceCapability.js | 2 -- platform/core/test/capabilities/PersistenceCapabilitySpec.js | 1 - 3 files changed, 5 deletions(-) diff --git a/platform/commonUI/edit/src/actions/SaveAction.js b/platform/commonUI/edit/src/actions/SaveAction.js index bdc3225258..c4ea3b02ba 100644 --- a/platform/commonUI/edit/src/actions/SaveAction.js +++ b/platform/commonUI/edit/src/actions/SaveAction.js @@ -19,8 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*jslint es5: true */ - define( ['../../../browse/src/creation/CreateWizard'], diff --git a/platform/core/src/capabilities/PersistenceCapability.js b/platform/core/src/capabilities/PersistenceCapability.js index bf8fbd9961..4e4e753e0c 100644 --- a/platform/core/src/capabilities/PersistenceCapability.js +++ b/platform/core/src/capabilities/PersistenceCapability.js @@ -19,8 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*jslint es5: true */ - define( function () { diff --git a/platform/core/test/capabilities/PersistenceCapabilitySpec.js b/platform/core/test/capabilities/PersistenceCapabilitySpec.js index 2126d1e1b2..16f5d34e61 100644 --- a/platform/core/test/capabilities/PersistenceCapabilitySpec.js +++ b/platform/core/test/capabilities/PersistenceCapabilitySpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*jslint es5: true */ /** * PersistenceCapabilitySpec. Created by vwoeltje on 11/6/14. From 11cfb6e1b869d6e2280a3a65fd114bb64a573f62 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 21 Apr 2016 10:30:55 -0700 Subject: [PATCH 48/85] [Edit] Elements pool filtering displays more consistent results --- .../commonUI/edit/res/templates/elements.html | 2 +- .../src/controllers/ElementsController.js | 11 +++ .../controllers/ElementsControllerSpec.js | 68 +++++++++++++++++++ 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 platform/commonUI/edit/test/controllers/ElementsControllerSpec.js diff --git a/platform/commonUI/edit/res/templates/elements.html b/platform/commonUI/edit/res/templates/elements.html index 23884e0a54..12d83a47fc 100644 --- a/platform/commonUI/edit/res/templates/elements.html +++ b/platform/commonUI/edit/res/templates/elements.html @@ -26,7 +26,7 @@
        -
      • +
      • Date: Mon, 25 Apr 2016 09:55:21 -0700 Subject: [PATCH 49/85] [Frontend] z-index added to .object-top-bar .left element #836 --- platform/commonUI/general/res/sass/user-environ/_frame.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/commonUI/general/res/sass/user-environ/_frame.scss b/platform/commonUI/general/res/sass/user-environ/_frame.scss index 64c4dbd69b..7bc3367c00 100644 --- a/platform/commonUI/general/res/sass/user-environ/_frame.scss +++ b/platform/commonUI/general/res/sass/user-environ/_frame.scss @@ -36,6 +36,8 @@ line-height: $ohH; .left { padding-right: $interiorMarginLg; + + z-index: 5; } } >.object-holder.abs { From a13d0b7fab9a4cea0bc91d8759f14d0ef39847d4 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 26 Apr 2016 15:52:09 -0700 Subject: [PATCH 50/85] [Examples] Move examples out of main.js ...such that they are not compiled into the Open MCT that is used as the basis for non-example applications. Addresses #835 --- index.html | 6 +++++- main.js | 8 ++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index e5145d5c5e..e16b096abb 100644 --- a/index.html +++ b/index.html @@ -30,7 +30,11 @@ diff --git a/main.js b/main.js index 33e45c0125..f3d0fb07cf 100644 --- a/main.js +++ b/main.js @@ -89,11 +89,7 @@ define([ './platform/entanglement/bundle', './platform/search/bundle', './platform/status/bundle', - './platform/commonUI/regions/bundle', - - './example/imagery/bundle', - './example/eventGenerator/bundle', - './example/generator/bundle' + './platform/commonUI/regions/bundle' ], function (Main, legacyRegistry) { 'use strict'; @@ -103,4 +99,4 @@ define([ return new Main().run(legacyRegistry); } }; -}); \ No newline at end of file +}); From ff36d9ee8064d28cb48a4d5d7608865768270eb3 Mon Sep 17 00:00:00 2001 From: Charles Hacskaylo Date: Fri, 29 Apr 2016 10:50:24 -0700 Subject: [PATCH 51/85] [Frontend] Removed bullets from ol, ul open #869 - This should be cherry-picked into main branches as well. (cherry picked from commit 4c97413) --- platform/commonUI/general/res/sass/_global.scss | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platform/commonUI/general/res/sass/_global.scss b/platform/commonUI/general/res/sass/_global.scss index 27c08551df..be2f7014c1 100644 --- a/platform/commonUI/general/res/sass/_global.scss +++ b/platform/commonUI/general/res/sass/_global.scss @@ -84,7 +84,11 @@ p { margin-bottom: $interiorMarginLg; } -ol, ul { padding-left: 0; } +ol, ul { + list-style: none; + margin: 0; + padding-left: 0; +} mct-container { display: block; From de2703ee48a4bbfb7b0864a954ea277239c8df8f Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 4 May 2016 10:08:55 -0700 Subject: [PATCH 52/85] [Branding] Remove Web from name at top-level Per #816, change Open MCT Web to Open MCT in all top-level files. --- CONTRIBUTING.md | 18 +++++++++--------- README.md | 22 +++++++++++----------- bower.json | 6 +++--- package.json | 4 ++-- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e726007800..29dbbc46cc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ -# Contributing to Open MCT Web +# Contributing to Open MCT -This document describes the process of contributing to Open MCT Web as well +This document describes the process of contributing to Open MCT as well as the standards that will be applied when evaluating contributions. Please be aware that additional agreements will be necessary before we can @@ -21,9 +21,9 @@ The short version: ## Contribution Process -Open MCT Web uses git for software version control, and for branching and +Open MCT uses git for software version control, and for branching and merging. The central repository is at -https://github.com/nasa/openmctweb.git. +https://github.com/nasa/openmct.git. ### Roles @@ -116,18 +116,18 @@ the merge back to the master branch. ## Standards -Contributions to Open MCT Web are expected to meet the following standards. +Contributions to Open MCT are expected to meet the following standards. In addition, reviewers should use general discretion before accepting changes. ### Code Standards -JavaScript sources in Open MCT Web must satisfy JSLint under its default +JavaScript sources in Open MCT must satisfy JSLint under its default settings. This is verified by the command line build. #### Code Guidelines -JavaScript sources in Open MCT Web should: +JavaScript sources in Open MCT should: * Use four spaces for indentation. Tabs should not be used. * Include JSDoc for any exposed API (e.g. public methods, constructors.) @@ -159,7 +159,7 @@ JavaScript sources in Open MCT Web should: * Third, imperative statements. * Finally, the returned value. -Deviations from Open MCT Web code style guidelines require two-party agreement, +Deviations from Open MCT code style guidelines require two-party agreement, typically from the author of the change and its reviewer. #### Code Example @@ -260,7 +260,7 @@ these standards. ## Issue Reporting -Issues are tracked at https://github.com/nasa/openmctweb/issues +Issues are tracked at https://github.com/nasa/openmct/issues Issues should include: diff --git a/README.md b/README.md index ed488a0e5c..dc18671dd3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Open MCT Web +# Open MCT -Open MCT Web is a web-based platform for mission operations user interface +Open MCT is a web-based platform for mission operations user interface software. ## Bundles @@ -8,7 +8,7 @@ software. A bundle is a group of software components (including source code, declared as AMD modules, as well as resources such as images and HTML templates) that are intended to be added or removed as a single unit. A plug-in for -Open MCT Web will be expressed as a bundle; platform components are also +Open MCT will be expressed as a bundle; platform components are also expressed as bundles. A bundle is also just a directory which contains a file `bundle.json`, @@ -16,7 +16,7 @@ which declares its contents. The file `bundles.json` (note the plural), at the top level of the repository, is a JSON file containing an array of all bundles (expressed as -directory names) to include in a running instance of Open MCT Web. Adding or +directory names) to include in a running instance of Open MCT. Adding or removing paths from this list will add or remove bundles from the running application. @@ -56,7 +56,7 @@ To run: ## Build -Open MCT Web is built using [`npm`](http://npmjs.com/) +Open MCT is built using [`npm`](http://npmjs.com/) and [`gulp`](http://gulpjs.com/). To build: @@ -64,18 +64,18 @@ To build: `npm run prepublish` This will compile and minify JavaScript sources, as well as copy over assets. -The contents of the `dist` folder will contain a runnable Open MCT Web +The contents of the `dist` folder will contain a runnable Open MCT instance (e.g. by starting an HTTP server in that directory), including: -* A `main.js` file containing Open MCT Web source code. +* A `main.js` file containing Open MCT source code. * Various assets in the `example` and `platform` directories. -* An `index.html` that runs Open MCT Web in its default configuration. +* An `index.html` that runs Open MCT in its default configuration. Additional `gulp` tasks are defined in [the gulpfile](gulpfile.js). ### Building Documentation -Open MCT Web's documentation is generated by an +Open MCT's documentation is generated by an [npm](https://www.npmjs.com/)-based build. It has additional dependencies that may not be available on every platform and thus is not covered in the standard npm install. Ensure your system has [libcairo](http://cairographics.org/) @@ -89,7 +89,7 @@ Documentation will be generated in `target/docs`. # Glossary -Certain terms are used throughout Open MCT Web with consistent meanings +Certain terms are used throughout Open MCT with consistent meanings or conventions. Any deviations from the below are issues and should be addressed (either by updating this glossary or changing code to reflect correct usage.) Other developer documentation, particularly in-line @@ -112,7 +112,7 @@ documentation, may presume an understanding of these terms. (Most often used in the context of extensions, domain object models, or other similar application-specific objects.) * _domain object_: A meaningful object to the user; a distinct thing in - the work support by Open MCT Web. Anything that appears in the left-hand + the work support by Open MCT. Anything that appears in the left-hand tree is a domain object. * _extension_: An extension is a unit of functionality exposed to the platform in a declarative fashion by a bundle. For more diff --git a/bower.json b/bower.json index 7285aad9e2..7c913754cf 100644 --- a/bower.json +++ b/bower.json @@ -1,10 +1,10 @@ { - "name": "openmctweb", - "description": "The OpenMCTWeb core platform", + "name": "openmct", + "description": "The Open MCT core platform", "main": "", "license": "Apache-2.0", "moduleType": [], - "homepage": "http://nasa.github.io/openmctweb/", + "homepage": "http://nasa.github.io/openmct/", "private": true, "dependencies": { "angular": "1.4.4", diff --git a/package.json b/package.json index f7854dbba2..9665703f11 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "openmctweb", + "name": "openmct", "version": "0.10.1-SNAPSHOT", "description": "The Open MCT core platform", "dependencies": { @@ -53,7 +53,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/nasa/openmctweb.git" + "url": "https://github.com/nasa/openmct.git" }, "author": "", "license": "Apache-2.0", From 431b8365687366388335cb40cc2fcee1e649d17e Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 4 May 2016 10:13:09 -0700 Subject: [PATCH 53/85] [Branding] Change name in docs hierarchy ...from Open MCT Web to plain-old Open MCT. --- docs/src/architecture/framework.md | 16 +- docs/src/architecture/index.md | 24 +-- docs/src/architecture/platform.md | 40 ++--- docs/src/guide/index.md | 204 ++++++++++++------------- docs/src/index.md | 13 +- docs/src/process/cycle.md | 2 +- docs/src/process/index.md | 4 +- docs/src/process/testing/plan.md | 2 +- docs/src/process/testing/procedures.md | 6 +- docs/src/tutorials/index.md | 142 ++++++++--------- 10 files changed, 226 insertions(+), 227 deletions(-) diff --git a/docs/src/architecture/framework.md b/docs/src/architecture/framework.md index 229bee39c4..e269e38f61 100644 --- a/docs/src/architecture/framework.md +++ b/docs/src/architecture/framework.md @@ -5,7 +5,7 @@ software components to communicate. The software components it recognizes are: * _Extensions_: Individual units of functionality that can be added to - or removed from Open MCT Web. _Extension categories_ distinguish what + or removed from Open MCT. _Extension categories_ distinguish what type of functionality is being added/removed. * _Bundles_: A grouping of related extensions (named after an analogous concept from [OSGi](http://www.osgi.org/)) @@ -19,7 +19,7 @@ manner which the framework layer can understand. ```nomnoml #direction: down -[Open MCT Web| +[Open MCT| [Dependency injection framework]-->[Platform bundle #1] [Dependency injection framework]-->[Platform bundle #2] [Dependency injection framework]-->[Plugin bundle #1] @@ -35,7 +35,7 @@ manner which the framework layer can understand. ``` The "dependency injection framework" in this case is -[AngularJS](https://angularjs.org/). Open MCT Web's framework layer +[AngularJS](https://angularjs.org/). Open MCT's framework layer is really just a thin wrapper over Angular that recognizes the concepts of bundles and extensions (as declared in JSON files) and registering extensions with Angular. It additionally acts as a @@ -60,7 +60,7 @@ activities which were performed by the framework component. ## Application Initialization -The framework component initializes an Open MCT Web application following +The framework component initializes an Open MCT application following a simple sequence of steps. ```nomnoml @@ -97,7 +97,7 @@ a simple sequence of steps. [Extension]o->[Dependency #3] ``` -Open MCT Web's architecture relies on a simple premise: Individual units +Open MCT's architecture relies on a simple premise: Individual units (extensions) only have access to the dependencies they declare that they need, and they acquire references to these dependencies via dependency injection. This has several desirable traits: @@ -121,11 +121,11 @@ injection. This has several desirable traits: the framework. A drawback to this approach is that it makes it difficult to define -"the architecture" of Open MCT Web, in terms of describing the specific +"the architecture" of Open MCT, in terms of describing the specific units that interact at run-time. The run-time architecture is determined by the framework as the consequence of wiring together dependencies. As such, the specific architecture of any given application built on -Open MCT Web can look very different. +Open MCT can look very different. Keeping that in mind, there are a few useful patterns supported by the framework that are useful to keep in mind. @@ -229,4 +229,4 @@ otherwise a single provider) will be exposed as a single service that other extensions can acquire through dependency injection. Because all components of the same type of service expose the same interface, users of that service do not need to be aware that they are talking to an -aggregator or a provider, for instance. \ No newline at end of file +aggregator or a provider, for instance. diff --git a/docs/src/architecture/index.md b/docs/src/architecture/index.md index 7354402d0c..a4586a3542 100644 --- a/docs/src/architecture/index.md +++ b/docs/src/architecture/index.md @@ -1,14 +1,14 @@ # Introduction The purpose of this document is to familiarize developers with the -overall architecture of Open MCT Web. +overall architecture of Open MCT. The target audience includes: * _Platform maintainers_: Individuals involved in developing, extending, and maintaing capabilities of the platform. * _Integration developers_: Individuals tasked with integrated - Open MCT Web into a larger system, who need to understand + Open MCT into a larger system, who need to understand its inner workings sufficiently to complete this integration. As the focus of this document is on architecture, whenever possible @@ -17,25 +17,25 @@ omitted. These details may be found in the developer guide. # Overview -Open MCT Web is client software: It runs in a web browser and +Open MCT is client software: It runs in a web browser and provides a user interface, while communicating with various server-side resources through browser APIs. ```nomnoml #direction: right -[Client|[Browser|[Open MCT Web]->[Browser APIs]]] +[Client|[Browser|[Open MCT]->[Browser APIs]]] [Server|[Web services]] [Client]<->[Server] ``` -While Open MCT Web can be configured to run as a standalone client, +While Open MCT can be configured to run as a standalone client, this is rarely very useful. Instead, it is intended to be used as a display and interaction layer for information obtained from a variety of back-end services. Doing so requires authoring or utilizing -adapter plugins which allow Open MCT Web to interact with these services. +adapter plugins which allow Open MCT to interact with these services. Typically, the pattern here is to provide a known interface that -Open MCT Web can utilize, and implement it such that it interacts with +Open MCT can utilize, and implement it such that it interacts with whatever back-end provides the relevant information. Examples of back-ends that can be utilized in this fashion include databases for the persistence of user-created objects, or sources of @@ -43,13 +43,13 @@ telemetry data. ## Software Architecture -The simplest overview of Open MCT Web is to look at it as a "layered" +The simplest overview of Open MCT is to look at it as a "layered" architecture, where each layer more clearly specifies the behavior of the software. ```nomnoml #direction: down -[Open MCT Web| +[Open MCT| [Platform]<->[Application] [Framework]->[Application] [Framework]->[Platform] @@ -64,14 +64,14 @@ These layers are: established an abstraction by which different software components may communicate and/or interact. * [_Platform_](platform.md): The platform layer defines the general look, - feel, and behavior of Open MCT Web. This includes user-facing components like + feel, and behavior of Open MCT. This includes user-facing components like Browse mode and Edit mode, as well as underlying elements of the information model and the general service infrastructure. * _Application_: The application layer defines specific features of - an application built on Open MCT Web. This includes adapters to + an application built on Open MCT. This includes adapters to specific back-ends, new types of things for users to create, and new ways of visualizing objects within the system. This layer - typically consists of a mix of custom plug-ins to Open MCT Web, + typically consists of a mix of custom plug-ins to Open MCT, as well as optional features (such as Plot view) included alongside the platform. diff --git a/docs/src/architecture/platform.md b/docs/src/architecture/platform.md index a59a6ebf9c..1f5e087a11 100644 --- a/docs/src/architecture/platform.md +++ b/docs/src/architecture/platform.md @@ -1,6 +1,6 @@ # Overview -The Open MCT Web platform utilizes the [framework layer](Framework.md) +The Open MCT platform utilizes the [framework layer](Framework.md) to provide an extensible baseline for applications which includes: * A common user interface (and user interface paradigm) for dealing with @@ -16,7 +16,7 @@ building application, the platform adds more specificity by defining additional extension types and allowing for integration with back end components. -The run-time architecture of an Open MCT Web application can be categorized +The run-time architecture of an Open MCT application can be categorized into certain high-level tiers: ```nomnoml @@ -29,7 +29,7 @@ into certain high-level tiers: [Browser APIs]->[Back-end] ``` -Applications built using Open MCT Web may add or configure functionality +Applications built using Open MCT may add or configure functionality in __any of these tiers__. * _DOM_: The rendered HTML document, composed from HTML templates which @@ -60,7 +60,7 @@ in __any of these tiers__. functionality needed to support the information model. This includes exposing underlying sets of extensions and mediating with the back-end. -* _Back-end_: The back-end is out of the scope of Open MCT Web, except +* _Back-end_: The back-end is out of the scope of Open MCT, except for the interfaces which are utilized by adapters participating in the service infrastructure. Includes the underlying persistence stores, telemetry  streams, and so forth which the Open MCT Web client is being used to interact  @@ -70,15 +70,15 @@ in __any of these tiers__. Once the [application has been initialized](Framework.md#application-initialization) -Open MCT Web primarily operates in an event-driven paradigm; various +Open MCT primarily operates in an event-driven paradigm; various events (mouse clicks, timers firing, receiving responses to XHRs) trigger the invocation of functions, typically in the presentation layer for user actions or in the service infrastructure for server responses. -The "main point of entry" into an initialized Open MCT Web application +The "main point of entry" into an initialized Open MCT application is effectively the [route](https://docs.angularjs.org/api/ngRoute/service/$route#example) -which is associated with the URL used to access Open MCT Web (or a +which is associated with the URL used to access Open MCT (or a default route.) This route will be associated with a template which will be displayed; this template will include references to directives and controllers which will be interpreted by Angular and used to @@ -107,11 +107,11 @@ both the information model and the service infrastructure. # Presentation Layer -The presentation layer of Open MCT Web is responsible for providing +The presentation layer of Open MCT is responsible for providing information to display within templates, and for handling interactions which are initiated from templated DOM elements. AngularJS acts as an intermediary between the web page as the user sees it, and the -presentation layer implemented as Open MCT Web extensions. +presentation layer implemented as Open MCT extensions. ```nomnoml [Presentation Layer| @@ -143,12 +143,12 @@ to primitives from AngularJS: attributes and tags. * [_Routes_](https://docs.angularjs.org/api/ngRoute/service/$route#example) are used to associate specific URLs (including the fragment identifier) - with specific application states. (In Open MCT Web, these are used to + with specific application states. (In Open MCT, these are used to describe the mode of usage - e.g. browse or edit - as well as to identify the object being used.) * [_Templates_](https://docs.angularjs.org/guide/templates) are partial HTML documents that will be rendered and kept up-to-date by AngularJS. - Open MCT Web introduces a custom `mct-include` directive which acts + Open MCT introduces a custom `mct-include` directive which acts as a wrapper around `ng-include` to allow templates to be referred to by symbolic names. @@ -189,10 +189,10 @@ to displaying domain objects. ] ``` -Domain objects are the most fundamental component of Open MCT Web's +Domain objects are the most fundamental component of Open MCT's information model. A domain object is some distinct thing relevant to a user's work flow, such as a telemetry channel, display, or similar. -Open MCT Web is a tool for viewing, browsing, manipulating, and otherwise +Open MCT is a tool for viewing, browsing, manipulating, and otherwise interacting with a graph of domain objects. A domain object should be conceived of as the union of the following: @@ -254,7 +254,7 @@ Concrete examples of capabilities which follow this pattern # Service Infrastructure -Most services exposed by the Open MCT Web platform follow the +Most services exposed by the Open MCT platform follow the [composite services](Framework.md#composite-services) to permit a higher degree of flexibility in how a service can be modified or customized for specific applications. @@ -327,7 +327,7 @@ A short summary of the roles of these services: [DomainObjectProvider]o-[CapabilityService] ``` -As domain objects are central to Open MCT Web's information model, +As domain objects are central to Open MCT's information model, acquiring domain objects is equally important. ```nomnoml @@ -338,7 +338,7 @@ acquiring domain objects is equally important. [ Instantiate DomainObject]->[ End] ``` -Open MCT Web includes an implementation of an `ObjectService` which +Open MCT includes an implementation of an `ObjectService` which satisfies this capability by: * Consulting the [Model Service](#model-service) to acquire domain object @@ -437,9 +437,9 @@ objects (this allows failures to be recognized and handled in groups.) The telemetry service is responsible for acquiring telemetry data. Notably, the platform does not include any providers for -`TelemetryService`; applications built on Open MCT Web will need to +`TelemetryService`; applications built on Open MCT will need to implement a provider for this service if they wish to expose telemetry -data. This is usually the most important step for integrating Open MCT Web +data. This is usually the most important step for integrating Open MCT into an existing telemetry system. Requests for telemetry data are usually initiated in the @@ -721,6 +721,6 @@ disallow. ``` The type service provides metadata about the different types of domain -objects that exist within an Open MCT Web application. The platform +objects that exist within an Open MCT application. The platform implementation reads these types in from extension category `types` -and wraps them in a JavaScript interface. \ No newline at end of file +and wraps them in a JavaScript interface. diff --git a/docs/src/guide/index.md b/docs/src/guide/index.md index 7016462a5a..081f1df45a 100644 --- a/docs/src/guide/index.md +++ b/docs/src/guide/index.md @@ -1,4 +1,4 @@ -# Open MCT Web Developer Guide +# Open MCT Developer Guide Victor Woeltjen [victor.woeltjen@nasa.gov](mailto:victor.woeltjen@nasa.gov) @@ -18,24 +18,24 @@ April 5, 2016 | 1.2 | Added Mct-table directive | Andrew Henry The purpose of this guide is to familiarize software developers with the Open MCT Web platform. -## What is Open MCT Web -Open MCT Web is a platform for building user interface and display tools, +## What is Open MCT +Open MCT is a platform for building user interface and display tools, developed at the NASA Ames Research Center in collaboration with teams at the Jet Propulsion Laboratory. It is written in HTML5, CSS3, and JavaScript, using [AngularJS](http://www.angularjs.org) as a framework. Its intended use is to create single-page web applications which integrate data and behavior from a variety of sources and domains. -Open MCT Web has been developed to support the remote operation of space +Open MCT has been developed to support the remote operation of space vehicles, so some of its features are specific to that task; however, it is flexible enough to be adapted to a variety of other application domains where a display tool oriented toward browsing, composing, and visualizing would be useful. -Open MCT Web provides: +Open MCT provides: * A common user interface paradigm which can be applied to a variety of domains -and tasks. Open MCT Web is more than a widget toolkit - it provides a standard +and tasks. Open MCT is more than a widget toolkit - it provides a standard tree-on-the-left, view-on-the-right browsing environment which you customize by adding new browsable object types, visualizations, and back-end adapters. * A plugin framework and an extensible API for introducing new application @@ -44,17 +44,17 @@ features of a variety of types. visualizations and infrastructure specific to telemetry display. ## Client-Server Relationship -Open MCT Web is client software - it runs entirely in the user's web browser. As +Open MCT is client software - it runs entirely in the user's web browser. As such, it is largely 'server agnostic'; any web server capable of serving files -from paths is capable of providing Open MCT Web. +from paths is capable of providing Open MCT. -While Open MCT Web can be configured to run as a standalone client, this is +While Open MCT can be configured to run as a standalone client, this is rarely very useful. Instead, it is intended to be used as a display and interaction layer for information obtained from a variety of back-end services. Doing so requires authoring or utilizing adapter plugins which allow Open MCT Web to interact with these services. -Typically, the pattern here is to provide a known interface that Open MCT Web +Typically, the pattern here is to provide a known interface that Open MCT can utilize, and implement it such that it interacts with whatever back-end provides the relevant information. Examples of back-ends that can be utilized in this fashion include databases for the persistence of user-created objects, or @@ -63,52 +63,52 @@ sources of telemetry data. See the [Architecture Guide](../architecture/index.md#Overview) for information on the client-server relationship. -## Developing with Open MCT Web -Building applications with Open MCT Web typically means authoring and utilizing +## Developing with Open MCT +Building applications with Open MCT typically means authoring and utilizing a set of plugins which provide application-specific details about how Open MCT Web should behave. ### Technologies -Open MCT Web sources are written in JavaScript, with a number of configuration +Open MCT sources are written in JavaScript, with a number of configuration files written in JSON. Displayable components are written in HTML5 and CSS3. -Open MCT Web is built using [AngularJS](http://www.angularjs.org) from Google. A +Open MCT is built using [AngularJS](http://www.angularjs.org) from Google. A good understanding of Angular is recommended for developers working with Open MCT Web. ### Forking -Open MCT Web does not currently have a single stand-alone artifact that can be +Open MCT does not currently have a single stand-alone artifact that can be used as a library. Instead, the recommended approach for creating a new -application is to start by forking/branching Open MCT Web, and then adding new -features from there. Put another way, Open MCT Web's source structure is built +application is to start by forking/branching Open MCT, and then adding new +features from there. Put another way, Open MCT's source structure is built to serve as a template for specific applications. -Forking in this manner should not require that you edit Open MCT Web's sources. +Forking in this manner should not require that you edit Open MCT's sources. The preferred approach is to create a new directory (peer to `index.html`) for the new application, then add new bundles (as described in the Framework chapter) within that directory. -To initially clone the Open MCT Web repository: +To initially clone the Open MCT repository: `git clone -b open-master` -To create a fork to begin working on a new application using Open MCT Web: +To create a fork to begin working on a new application using Open MCT: cd git checkout open-master git checkout -b -As a convention used internally, applications built using Open MCT Web have +As a convention used internally, applications built using Open MCT have master branch names with an identifying prefix. For instance, if building an application called 'Foo', the last statement above would look like: git checkout -b foo-master -This convention is not enforced or understood by Open MCT Web in any way; it is +This convention is not enforced or understood by Open MCT in any way; it is mentioned here as a more general recommendation. # Overview -Open MCT Web is implemented as a framework component which manages a set of +Open MCT is implemented as a framework component which manages a set of other components. These components, called _bundles_, act as containers to group sets of related functionality; individual units of functionality are expressed within these bundles as _extensions_. @@ -119,7 +119,7 @@ run-time to satisfy these declared dependency. This dependency injection approach allows software components which have been authored separately (e.g. as plugins) but to collaborate at run-time. -Open MCT Web's framework layer is implemented on top of AngularJS's [dependency +Open MCT's framework layer is implemented on top of AngularJS's [dependency injection mechanism](https://docs.angularjs.org/guide/di) and is modelled after [OSGi](hhttp://www.osgi.org/) and its [Declarative Services component model](http://wiki.osgi.org/wiki/Declarative_Services). In particular, this is where the term _bundle_ comes from. @@ -134,7 +134,7 @@ The framework is described in more detail in the [Framework Overview](../archite architecture guide. ### Tiers -While all bundles in a running Open MCT Web instance are effectively peers, it +While all bundles in a running Open MCT instance are effectively peers, it is useful to think of them as a tiered architecture, where each tier adds more specificity to the application. ```nomnoml @@ -152,7 +152,7 @@ It additionally interprets bundle definitions (see explanation below, as well as further detail in the Framework chapter.) At this tier, we are at our most general: We know only that we are a plugin-based application. * __Platform__: Components in the Platform tier describe both the general user -interface and corresponding developer-facing interfaces of Open MCT Web. This +interface and corresponding developer-facing interfaces of Open MCT. This tier provides the general infrastructure for applications. It is less general than the framework tier, insofar as this tier introduces a specific user interface paradigm, but it is still non-specific as to what useful features @@ -160,7 +160,7 @@ will be provided. Although they can be removed or replaced easily, bundles provided by the Platform tier generally should not be thought of as optional. * __Application__: The application tier consists of components which utilize the infrastructure provided by the Platform to provide functionality which will (or -could) be useful to specific applications built using Open MCT Web. These +could) be useful to specific applications built using Open MCT. These include adapters to specific persistence back-ends (such as ElasticSearch or CouchDB) as well as bundles which describe more user-facing features (such as _Plot_ views for visualizing time series data, or _Layout_ objects for @@ -169,20 +169,20 @@ compromising basic application functionality, with the caveat that at least one persistence adapter needs to be present. * __Plugins__: Conceptually, this tier is not so different from the application tier; it consists of bundles describing new features, back-end adapters, that -are specific to the application being built on Open MCT Web. It is described as +are specific to the application being built on Open MCT. It is described as a separate tier here because it has one important distinction from the application tier: It consists of bundles that are not included with the platform (either authored anew for the specific application, or obtained from elsewhere.) Note that bundles in any tier can go off and consult back-end services. In practice, this responsibility is handled at the Application and/or Plugin tiers; -Open MCT Web is built to be server-agnostic, so any back-end is considered an +Open MCT is built to be server-agnostic, so any back-end is considered an application-specific detail. ## Platform Overview The "tiered" architecture described in the preceding text describes a way of -thinking of and categorizing software components of a Open MCT Web application, +thinking of and categorizing software components of a Open MCT application, as well as the framework layer's role in mediating between these components. Once the framework layer has wired these software components together, however, the application's logical architecture emerges. @@ -193,7 +193,7 @@ section of the Platform guide ### Web Services -As mentioned in the Introduction, Open MCT Web is a platform single-page +As mentioned in the Introduction, Open MCT is a platform single-page applications which runs entirely in the browser. Most applications will want to additionally interact with server-side resources, to (for example) read telemetry data or store user-created objects. This interaction is handled by @@ -206,7 +206,7 @@ individual bundles using APIs which are supported in browser (such as [Web Service #2] <- [Web Browser] [Web Service #3] <- [Web Browser] [ Web Browser | - [ Open MCT Web | + [ Open MCT | [Plugin Bundle #1]-->[Core API] [Core API]<--[Plugin Bundle #2] [Platform Bundle #1]-->[Core API] @@ -216,16 +216,16 @@ individual bundles using APIs which are supported in browser (such as [Core API]<--[Platform Bundle #5] [Core API]<--[Plugin Bundle #3] ] - [Open MCT Web] ->[Browser APIs] + [Open MCT] ->[Browser APIs] ] ``` This architectural approach ensures a loose coupling between applications built -using Open MCT Web and the backends which support them. +using Open MCT and the backends which support them. ### Glossary -Certain terms are used throughout Open MCT Web with consistent meanings or +Certain terms are used throughout Open MCT with consistent meanings or conventions. Other developer documentation, particularly in-line documentation, may presume an understanding of these terms. @@ -247,7 +247,7 @@ readable description of a thing; usually a single sentence or short paragraph. (Most often used in the context of extensions, domain object models, or other similar application-specific objects.) * __domain object__: A meaningful object to the user; a distinct thing in the -work support by Open MCT Web. Anything that appears in the left-hand tree is a +work support by Open MCT. Anything that appears in the left-hand tree is a domain object. * __extension__: An extension is a unit of functionality exposed to the platform in a declarative fashion by a bundle. The term 'extension category' is used to @@ -279,10 +279,10 @@ side-by-side without conflicting. # Framework -Open MCT Web is built on the [AngularJS framework]( http://www.angularjs.org ). A +Open MCT is built on the [AngularJS framework]( http://www.angularjs.org ). A good understanding of that framework is recommended. -Open MCT Web adds an extra layer on top of AngularJS to (a) generalize its +Open MCT adds an extra layer on top of AngularJS to (a) generalize its dependency injection mechanism slightly, particularly to handle many-to-one relationships; and (b) handle script loading. Combined, these features become a plugin mechanism. @@ -301,7 +301,7 @@ MCT Web.) are collected together in bundles, and may interact with other extensions. The framework layer, loaded and initiated from `index.html`, is the main point -of entry for an application built on Open MCT Web. It is responsible for wiring +of entry for an application built on Open MCT. It is responsible for wiring together the application at run time (much of this responsibility is actually delegated to Angular); at a high-level, the framework does this by proceeding through four stages: @@ -321,7 +321,7 @@ have been registered. ## Bundles -The basic configurable unit of Open MCT Web is the _bundle_. This term has been +The basic configurable unit of Open MCT is the _bundle_. This term has been used a bit already; now we'll get to a more formal definition. A bundle is a directory which contains: @@ -329,13 +329,13 @@ A bundle is a directory which contains: * A bundle definition; a file named `bundle.json`. * Subdirectories for sources, resources, and tests. * Optionally, a `README.md` Markdown file describing its contents (this is not -used by Open MCT Web in any way, but it's a helpful convention to follow.) +used by Open MCT in any way, but it's a helpful convention to follow.) The bundle definition is the main point of entry for the bundle. The framework looks at this to determine which components need to be loaded and how they interact. -A plugin in Open MCT Web is a bundle. The platform itself is also decomposed +A plugin in Open MCT is a bundle. The platform itself is also decomposed into bundles, each of which provides some category of functionality. The difference between a _bundle_ and a _plugin_ is purely a matter of the intended use; a plugin is just a bundle that is meant to be easily added or removed. When @@ -356,7 +356,7 @@ For instance, if `bundles.json` contained: "example/extensions" ] -...then the Open MCT Web framework would look for bundle definitions at +...then the Open MCT framework would look for bundle definitions at `example/builtins/bundle.json` and `example/extensions/bundle.json`, relative to the path of `index.html`. No other bundles would be loaded. @@ -457,7 +457,7 @@ arrays of extension definitions. ### General Extensions Extensions are intended as a general-purpose mechanism for adding new types of -functionality to Open MCT Web. +functionality to Open MCT. An extension category is registered with Angular under the name of the extension, plus a suffix of two square brackets; so, an Angular service (or, @@ -466,7 +466,7 @@ extensions, from all bundles, by including this string (e.g. `types[]` to get all type definitions) in a dependency declaration. As a convention, extension categories are given single-word, plural nouns for -names within Open MCT Web (e.g. `types`.) This convention is not enforced by the +names within Open MCT (e.g. `types`.) This convention is not enforced by the platform in any way. For extension categories introduced by external plugins, it is recommended to prefix the extension category with a vendor identifier (or similar) followed by a dot, to avoid collisions. @@ -505,7 +505,7 @@ the Angular-supported method for dependency injection is (effectively) constructor-style injection; so, both declared dependencies and run-time arguments are competing for space in a constructor's arguments. -To resolve this, the Open MCT Web framework registers extension instances in a +To resolve this, the Open MCT framework registers extension instances in a partially constructed form. That is, the constructor exposed by the extension's implementation is effectively decomposed into two calls; the first takes the dependencies, and returns the constructor in its second form, which takes the @@ -549,7 +549,7 @@ sorted according to these conventions when using them. ### Angular Built-ins Several entities supported Angular are expressed and managed as extensions in -Open MCT Web. Specifically, these extension categories are _directives_, +Open MCT. Specifically, these extension categories are _directives_, _controllers_, _services_, _constants_, _runs_, and _routes_. #### Angular Directives @@ -592,7 +592,7 @@ property value , which is the constant value that will be registered. In some cases, you want to register code to run as soon as the application starts; these can be registered as extensions of the [ runs category](https://docs.angularjs.org/api/ng/type/angular.Module#run ). Implementations registered in this category will be invoked (with their declared -dependencies) when the Open MCT Web application first starts. (Note that, in +dependencies) when the Open MCT application first starts. (Note that, in this case, the implementation is better thought of as just a function, as opposed to a constructor function.) @@ -627,13 +627,13 @@ providers of the same service (that is, with matching `provides` properties); for a decorator, this will be whichever provider, decorator, or aggregator is next in the sequence of decorators. -Services exposed by the Open MCT Web platform are often declared as composite +Services exposed by the Open MCT platform are often declared as composite services, as this form is open for a variety of common modifications. # Core API -Most of Open MCT Web's relevant API is provided and/or mediated by the -framework; that is, much of developing for Open MCT Web is a matter of adding +Most of Open MCT's relevant API is provided and/or mediated by the +framework; that is, much of developing for Open MCT is a matter of adding extensions which access other parts of the platform by means of dependency injection. @@ -642,9 +642,9 @@ to be passed along by other services. ## Domain Objects -Domain objects are the most fundamental component of Open MCT Web's information +Domain objects are the most fundamental component of Open MCT's information model. A domain object is some distinct thing relevant to a user's work flow, -such as a telemetry channel, display, or similar. Open MCT Web is a tool for +such as a telemetry channel, display, or similar. Open MCT is a tool for viewing, browsing, manipulating, and otherwise interacting with a graph of domain objects. @@ -681,7 +681,7 @@ exposed. ### Identifier Syntax For most purposes, a domain object identifier can be treated as a purely -symbolic string; these are typically generated by Open MCT Web and plug-ins +symbolic string; these are typically generated by Open MCT and plug-ins should rarely be concerned with its internal structure. A domain object identifier has one or two parts, separated by a colon. @@ -724,7 +724,7 @@ exposed it to be removed from its container. containing: * `name`: Human-readable name. * `description`: Human-readable summary of this action. - * `glyph`: Single character to be displayed in Open MCT Web's icon font set. + * `glyph`: Single character to be displayed in Open MCT's icon font set. * `context`: The context in which this action is being performed (see below) Action instances are typically obtained via a domain object's `action` @@ -740,7 +740,7 @@ dragged object in a drag-and-drop operation.) ## Telemetry -Telemetry series data in Open MCT Web is represented by a common interface, and +Telemetry series data in Open MCT is represented by a common interface, and packaged in a consistent manner to facilitate passing telemetry updates around multiple visualizations. @@ -753,7 +753,7 @@ is useful when multiple distinct data sources are in use side-by-side. * `key`: A machine-readable identifier for a unique series of telemetry within that source. * _Note: This API is still under development; additional properties, such as -start and end time, should be present in future versions of Open MCT Web._ +start and end time, should be present in future versions of Open MCT._ Additional properties may be included in telemetry requests which have specific interpretations for specific sources. @@ -777,7 +777,7 @@ not. (Typically, domain values are interpreted as UTC timestamps in milliseconds relative to the UNIX epoch.) A series must have at least one domain and one range, and may have more than one. -Telemetry series data in Open MCT Web is expressed via the following +Telemetry series data in Open MCT is expressed via the following `TelemetrySeries` interface: * `getPointCount()`: Returns the number of unique points/samples in this series. @@ -816,7 +816,7 @@ interface: * `getName()`: Get the human-readable name for this type. * `getDescription()`: Get a human-readable summary of this type. * `getGlyph()`: Get the single character to be rendered as an icon for this type -in Open MCT Web's custom font set. +in Open MCT's custom font set. * `getInitialModel()`: Get a domain object model that represents the initial state (before user specification of properties) for domain objects of this type. * `getDefinition()`: Get the extension definition for this type, as a JavaScript @@ -832,7 +832,7 @@ an array of `TypeProperty` instances. ### Type Features Features of a domain object type are expressed as symbolic string identifiers. -They are defined in practice by usage; currently, the Open MCT Web platform only +They are defined in practice by usage; currently, the Open MCT platform only uses the creation feature to determine which domain object types should appear in the Create menu. @@ -886,7 +886,7 @@ Categories supported by the platform include: * `key`: A machine-readable identifier for this action. * `name`: A human-readable name for this action (e.g. to show in a menu) * `description`: A human-readable summary of the behavior of this action. -* `glyph`: A single character which will be rendered in Open MCT Web's custom +* `glyph`: A single character which will be rendered in Open MCT's custom font set as an icon for this action. ## Capabilities Category @@ -997,7 +997,7 @@ of unremoved listeners. ## Indicators Category An indicator is an element that should appear in the status area at the bottom -of a running Open MCT Web client instance. +of a running Open MCT client instance. ### Standard Indicators @@ -1007,7 +1007,7 @@ provide implementations with the following methods: * `getText()`: Provides the human-readable text that will be displayed for this indicator. * `getGlyph()`: Provides a single-character string that will be displayed as an -icon in Open MCT Web's custom font set. +icon in Open MCT's custom font set. * `getDescription()`: Provides a human-readable summary of the current state of this indicator; will be displayed in a tooltip on hover. * `getClass()`: Get a CSS class that will be applied to this indicator. @@ -1033,7 +1033,7 @@ this variety do not need to provide an implementation. ## Licenses Category The extension category `licenses` can be used to add entries into the 'Licensing -information' page, reachable from Open MCT Web's About dialog. +information' page, reachable from Open MCT's About dialog. Licenses may have the following properties, all of which are strings: @@ -1046,11 +1046,11 @@ Licenses may have the following properties, all of which are strings: ## Policies Category -Policies are used to handle decisions made using Open MCT Web's `policyService`; +Policies are used to handle decisions made using Open MCT's `policyService`; examples of these decisions are determining the applicability of certain actions, or checking whether or not a domain object of one type can contain a domain object of a different type. See the section on the Policies for an -overview of Open MCT Web's policy model. +overview of Open MCT's policy model. A policy's extension definition should include: @@ -1066,7 +1066,7 @@ context)`. The specific types used for `candidate` and `context` vary by policy category; in general, what is being asked is 'is this candidate allowed in this context?' This method should return a boolean value. -Open MCT Web's policy model requires consensus; a policy decision is allowed +Open MCT's policy model requires consensus; a policy decision is allowed when and only when all policies choose to allow it. As such, policies should generally be written to reject a certain case, and allow (by returning `true`) anything else. @@ -1195,7 +1195,7 @@ Templates do not have implementations. ## Types Category The types extension category describes types of domain objects which may -appear within Open MCT Web. +appear within Open MCT. A type's extension definition should have the following properties: @@ -1203,7 +1203,7 @@ A type's extension definition should have the following properties: stored to and matched against the type property of domain object models. * `name`: The human-readable name for this domain object type. * `description`: A human-readable summary of this domain object type. -* `glyph`: A single character to be rendered as an icon in Open MCT Web's custom +* `glyph`: A single character to be rendered as an icon in Open MCT's custom font set. * `model`: A domain object model, used as the initial state for created domain objects of this type (before any properties are specified.) @@ -1252,7 +1252,7 @@ utilized via `mct-representation`); additionally: * `name`: The human-readable name for this view type. * description : A human-readable summary of this view type. -* `glyph`: A single character to be rendered as an icon in Open MCT Web's custom +* `glyph`: A single character to be rendered as an icon in Open MCT's custom font set. * `type`: Optional; if present, this representation is only applicable for domain object's of this type. @@ -1294,7 +1294,7 @@ are visible, and what state they manage and/or behavior they invoke. This set may contain up to two different objects: The _view proxy_, which is used to make changes to the view as a whole, and the _selected object_, which is -used to represent some state within the view. (Future versions of Open MCT Web +used to represent some state within the view. (Future versions of Open MCT may support multiple selected objects.) The `selection` object made available during Edit mode has the following @@ -1330,14 +1330,14 @@ are supported: # Directives -Open MCT Web defines several Angular directives that are intended for use both +Open MCT defines several Angular directives that are intended for use both internally within the platform, and by plugins. ## Before Unload The `mct-before-unload` directive is used to listen for (and prompt for user confirmation) of navigation changes in the browser. This includes reloading, -following links out of Open MCT Web, or changing routes. It is used to hook into +following links out of Open MCT, or changing routes. It is used to hook into both `onbeforeunload` event handling as well as route changes from within Angular. @@ -1449,7 +1449,7 @@ Passed as plain text in the attribute. ### Form Structure -Forms in Open MCT Web have a common structure to permit consistent display. A +Forms in Open MCT have a common structure to permit consistent display. A form is broken down into sections, which will be displayed in groups; each section is broken down into rows, each of which provides a control for a single property. Input from this form is two-way bound to the object passed via @@ -1658,7 +1658,7 @@ by scrolling to the bottom of the table rows. # Services -The Open MCT Web platform provides a variety of services which can be retrieved +The Open MCT platform provides a variety of services which can be retrieved and utilized via dependency injection. These services fall into two categories: * _Composite Services_ are defined by a set of components extensions; plugins may @@ -1670,7 +1670,7 @@ utilized by plugins but are not intended to be modified or augmented. ## Composite Type Services -This section describes the composite services exposed by Open MCT Web, +This section describes the composite services exposed by Open MCT, specifically focusing on their interface and contract. In many cases, the platform will include a provider for a service which consumes @@ -1988,7 +1988,7 @@ The `workerService` may be used to run web workers defined via the as a shared worker); if the `key` is unknown, returns `undefined`. # Models -Domain object models in Open MCT Web are JavaScript objects describing the +Domain object models in Open MCT are JavaScript objects describing the persistent state of the domain objects they describe. Their contents include a mix of commonly understood metadata attributes; attributes which are recognized by and/or determine the applicability of specific extensions; and properties @@ -2004,7 +2004,7 @@ MCT Web and can be utilized directly: ## Extension-specific Properties Other properties of domain object models have specific meaning imposed by other -extensions within the Open MCT Web platform. +extensions within the Open MCT platform. ### Capability-specific Properties @@ -2288,7 +2288,7 @@ way of its `composition` capability.) # Policies -Policies are consulted to determine when certain behavior in Open MCT Web is +Policies are consulted to determine when certain behavior in Open MCT is allowed. Policy questions are assigned to certain categories, which broadly describe the type of decision being made; within each category, policies have a candidate (the thing which may or may not be allowed) and, optionally, a context @@ -2313,13 +2313,13 @@ The candidate argument is the view's extension definition; the context argument is the `DomainObject` to be viewed. # Build-Test-Deploy -Open MCT Web is designed to support a broad variety of build and deployment +Open MCT is designed to support a broad variety of build and deployment options. The sources can be deployed in the same directory structure used during development. A few utilities are included to support development processes. ## Command-line Build -Open MCT Web is built using [`npm`](http://npmjs.com/) +Open MCT is built using [`npm`](http://npmjs.com/) and [`gulp`](http://gulpjs.com/). To install build dependencies (only needs to be run once): @@ -2331,12 +2331,12 @@ To build: `npm run prepublish` This will compile and minify JavaScript sources, as well as copy over assets. -The contents of the `dist` folder will contain a runnable Open MCT Web +The contents of the `dist` folder will contain a runnable Open MCT instance (e.g. by starting an HTTP server in that directory), including: -* A `main.js` file containing Open MCT Web source code. +* A `main.js` file containing Open MCT source code. * Various assets in the `example` and `platform` directories. -* An `index.html` that runs Open MCT Web in its default configuration. +* An `index.html` that runs Open MCT in its default configuration. Additional `gulp` tasks are defined in [the gulpfile](gulpfile.js). @@ -2345,7 +2345,7 @@ download build dependencies. ## Test Suite -Open MCT Web uses [Jasmine 1.3](http://jasmine.github.io/) and +Open MCT uses [Jasmine 1.3](http://jasmine.github.io/) and [Karma](http://karma-runner.github.io) for automated testing. The test suite is configured to load any scripts ending with `Spec.js` found @@ -2383,8 +2383,8 @@ information using [Blanket.JS](http://blanketjs.org/) and display this at the bottom of the screen. Currently, only statement coverage is displayed. ## Deployment -Open MCT Web is built to be flexible in terms of the deployment strategies it -supports. In order to run in the browser, Open MCT Web needs: +Open MCT is built to be flexible in terms of the deployment strategies it +supports. In order to run in the browser, Open MCT needs: 1. HTTP access to sources/resources for the framework, platform, and all active bundles. @@ -2393,13 +2393,13 @@ external services need to support HTTP or some other web-accessible interface, like WebSockets.) Any HTTP server capable of serving flat files is sufficient for the first point. -The command-line build also packages Open MCT Web into a `.war` file for easier +The command-line build also packages Open MCT into a `.war` file for easier deployment on containers such as Apache Tomcat. The second point may be less flexible, as it depends upon the specific services -to be utilized by Open MCT Web. Because of this, it is often the set of external +to be utilized by Open MCT. Because of this, it is often the set of external services (and the manner in which they are exposed) that determine how to deploy -Open MCT Web. +Open MCT. One important constraint to consider in this context is the browser's same origin policy. If external services are not on the same apparent host and port @@ -2416,7 +2416,7 @@ configuration does not create a security vulnerability. Examples of deployment strategies (and the conditions under which they make the most sense) include: -* If the external services that Open MCT Web will utilize are all running on +* If the external services that Open MCT will utilize are all running on [Apache Tomcat](https://tomcat.apache.org/), then it makes sense to run Open MCT Web from the same Tomcat instance as a separate web application. The `.war` artifact produced by the command line build facilitates this deployment @@ -2427,28 +2427,28 @@ hosts/ports, then it may make sense to use a web server that supports proxying, such as the [Apache HTTP Server](http://httpd.apache.org/). In this configuration, the HTTP server would be configured to proxy (or reverse proxy) requests at specific paths to the various external services, while providing -Open MCT Web as flat files from a different path. +Open MCT as flat files from a different path. * If a single server component is being developed to handle all server-side -needs of an Open MCT Web instance, it can make sense to serve Open MCT Web (as +needs of an Open MCT instance, it can make sense to serve Open MCT (as flat files) from the same component using an embedded HTTP server such as [Nancy](http://nancyfx.org/). * If no external services are needed (or if the 'external services' will just be generating flat files to read) it makes sense to utilize a lightweight flat file HTTP server such as [Lighttpd](http://www.lighttpd.net/). In this -configuration, Open MCT Web sources/resources would be placed at one path, while +configuration, Open MCT sources/resources would be placed at one path, while the files generated by the external service are placed at another path. * If all external services support CORS, it may make sense to have an HTTP -server that is solely responsible for making Open MCT Web sources/resources -available, and to have Open MCT Web contact these external services directly. +server that is solely responsible for making Open MCT sources/resources +available, and to have Open MCT contact these external services directly. Again, lightweight HTTP servers such as [Lighttpd](http://www.lighttpd.net/) are useful in this circumstance. The downside of this option is that additional configuration effort is required, both to enable CORS on the external services, -and to ensure that Open MCT Web can correctly locate these services. +and to ensure that Open MCT can correctly locate these services. -Another important consideration is authentication. By design, Open MCT Web does +Another important consideration is authentication. By design, Open MCT does not handle user authentication. Instead, this should typically be treated as a deployment-time concern, where authentication is handled by the HTTP server -which provides Open MCT Web, or an external access management system. +which provides Open MCT, or an external access management system. ### Configuration In most of the deployment options above, some level of configuration is likely @@ -2456,7 +2456,7 @@ to be needed or desirable to make sure that bundles can reach the external services they need to reach. Most commonly this means providing the path or URL to an external service. -Configurable parameters within Open MCT Web are specified via constants +Configurable parameters within Open MCT are specified via constants (literally, as extensions of the `constants` category) and accessed via dependency injection by the scripts which need them. Reasonable defaults for these constants are provided in the bundle where they are used. Plugins are @@ -2475,7 +2475,7 @@ for error, but is viable if there are a small number of constants to change. constants. This is particularly appropriate when multiple configurations (e.g. development, test, production) need to be managed easily; these can be swapped quickly by changing the set of active bundles in bundles.json. -* Deploy Open MCT Web and its external services in such a fashion that the +* Deploy Open MCT and its external services in such a fashion that the default paths to reach external services are all correct. ### Configuration Constants @@ -2486,7 +2486,7 @@ The following constants have global significance: to be overridden by other bundles, but persistence adapters may wish to consume this constant in order to provide persistence for that space. -The following configuration constants are recognized by Open MCT Web bundles: +The following configuration constants are recognized by Open MCT bundles: * Common UI elements - `platform/commonUI/general` * `THEME`: A string identifying the current theme symbolically. Individual stylesheets (the `stylesheets` extension category) may specify an optional diff --git a/docs/src/index.md b/docs/src/index.md index dbb1d36220..83860e0da6 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,13 +1,13 @@ -# Open MCT Web Documentation +# Open MCTDocumentation ## Overview Documentation is provided to support the use and development of - Open MCT Web. It's recommended that before doing - any development with Open MCT Web you take some time to familiarize yourself + Open MCT. It's recommended that before doing + any development with Open MCT you take some time to familiarize yourself with the documentation below. - Open MCT Web provides functionality out of the box, but it's also a platform for + Open MCT provides functionality out of the box, but it's also a platform for building rich mission operations applications based on modern web technology. The platform is configured declaratively, and defines conventions for building on the provided capabilities by creating modular 'bundles' that @@ -17,7 +17,7 @@ ## Sections * The [Architecture Overview](architecture/) describes the concepts used - throughout Open MCT Web, and gives a high level overview of the platform's design. + throughout Open MCT, and gives a high level overview of the platform's design. * The [Developer's Guide](guide/) goes into more detail about how to use the platform and the functionality that it provides. @@ -31,5 +31,4 @@ functions that make up the software platform. * Finally, the [Development Process](process/) document describes the - Open MCT Web software development cycle. - \ No newline at end of file + Open MCT software development cycle. diff --git a/docs/src/process/cycle.md b/docs/src/process/cycle.md index 4618fe0433..b07a76e8eb 100644 --- a/docs/src/process/cycle.md +++ b/docs/src/process/cycle.md @@ -1,6 +1,6 @@ # Development Cycle -Development of Open MCT Web occurs on an iterative cycle of +Development of Open MCT occurs on an iterative cycle of sprints and releases. * A _sprint_ is three weeks in duration, and represents a diff --git a/docs/src/process/index.md b/docs/src/process/index.md index 78f919e4c2..fc8f7e6e91 100644 --- a/docs/src/process/index.md +++ b/docs/src/process/index.md @@ -1,6 +1,6 @@ # Development Process -The process used to develop Open MCT Web is described in the following +The process used to develop Open MCT is described in the following documents: * The [Development Cycle](cycle.md) describes how and when specific @@ -9,7 +9,7 @@ documents: Open MCT (both semantics and process.) * Testing is described in two documents: * The [Test Plan](testing/plan.md) summarizes the approaches used - to test Open MCT Web. + to test Open MCT. * The [Test Procedures](testing/procedures.md) document what specific tests are performed to verify correctness, and how they should be carried out. diff --git a/docs/src/process/testing/plan.md b/docs/src/process/testing/plan.md index fead5f5a50..47ab60ee34 100644 --- a/docs/src/process/testing/plan.md +++ b/docs/src/process/testing/plan.md @@ -2,7 +2,7 @@ ## Test Levels -Testing for Open MCT Web includes: +Testing for Open MCT includes: * _Smoke testing_: Brief, informal testing to verify that no major issues or regressions are present in the software, or in specific features of diff --git a/docs/src/process/testing/procedures.md b/docs/src/process/testing/procedures.md index b33f88c6d1..5ccf0def5b 100644 --- a/docs/src/process/testing/procedures.md +++ b/docs/src/process/testing/procedures.md @@ -4,7 +4,7 @@ This document is intended to be used: -* By testers, to verify that Open MCT Web behaves as specified. +* By testers, to verify that Open MCT behaves as specified. * By the development team, to document new test cases and to provide guidance on how to author these. @@ -62,7 +62,7 @@ Test cases should be narrow in scope; if a list of steps is excessively long (or must be written vaguely to be kept short) it should be broken down into multiple tests which reference one another. -All requirements satisfied by Open MCT Web should be verifiable using +All requirements satisfied by Open MCT should be verifiable using one or more test procedures. ## Glossary @@ -166,4 +166,4 @@ Eval. criteria | Visual inspection * Logs should not contain any unexpected warnings or errors ("expected" warnings or errors are those that have been documented and prioritized as known issues, or those that are explained by transient conditions - external to the software, such as network outages.) \ No newline at end of file + external to the software, such as network outages.) diff --git a/docs/src/tutorials/index.md b/docs/src/tutorials/index.md index 1bda1d8848..2ebc32b957 100644 --- a/docs/src/tutorials/index.md +++ b/docs/src/tutorials/index.md @@ -1,4 +1,4 @@ -# Open MCT Web Tutorials +# Open MCT Tutorials Victor Woeltjen victor.woeltjen@nasa.gov @@ -23,9 +23,9 @@ been added or removed as part of the tutorial. In these cases, any lines added will be indicated with a '+' at the start of the line. Any lines removed will be indicated with a '-'. -## Setting Up Open MCT Web +## Setting Up Open MCT -In this section, we will cover the steps necessary to get a minimal Open MCT Web +In this section, we will cover the steps necessary to get a minimal Open MCT developer environment up and running. Once we have this, we will be able to proceed with writing plugins as described in this tutorial. @@ -40,22 +40,22 @@ more recent versions, but this cannot be guaranteed. * Google Chrome v42: https://www.google.com/chrome/ * A text editor. -Open MCT Web can be run without any of these tools, provided suitable -alternatives are taken; see the [Open MCT Web Developer Guide](../guide/index.md) -for a more general overview of how to run and deploy a Open MCT Web application. +Open MCT can be run without any of these tools, provided suitable +alternatives are taken; see the [Open MCT Developer Guide](../guide/index.md) +for a more general overview of how to run and deploy a Open MCT application. -### Check out Open MCT Web Sources +### Check out Open MCT Sources -First step is to check out Open MCT Web from the source repository. +First step is to check out Open MCT from the source repository. `git clone https://github.com/nasa/openmctweb.git openmctweb` -This will create a copy of the Open MCT Web source code repository in the folder +This will create a copy of the Open MCT source code repository in the folder `openmctweb` (relative to the path from which you ran the command.) If you have a repository URL, use that as the "path to repo" above. Alternately, -if you received Open MCT Web as a git bundle, the path to that bundle on the +if you received Open MCT as a git bundle, the path to that bundle on the local filesystem can be used instead. -At this point, it will also be useful to branch off of Open MCT Web v0.6.2 +At this point, it will also be useful to branch off of Open MCT v0.6.2 (which was used when writing these tutorials) to begin adding plugins. cd openmctweb @@ -64,12 +64,12 @@ At this point, it will also be useful to branch off of Open MCT Web v0.6.2 ### Configuring Persistence -In its default configuration, Open MCT Web will try to use ElasticSearch +In its default configuration, Open MCT will try to use ElasticSearch (expected to be deployed at /elastic on the same HTTP server running Open MCT Web) to persist user-created domain objects. We don't need that for these tutorials, so we will replace the ElasticSearch plugin with the example persistence plugin. This doesn't actually persist, so anything we create within -Open MCT Web will be lost on reload, but that's fine for purposes of these +Open MCT will be lost on reload, but that's fine for purposes of these tutorials. To change this configuration, edit bundles.json (at the top level of the Open @@ -132,7 +132,7 @@ __bundles.json__ ### Run a Web Server -The next step is to run a web server so that you can view the Open MCT Web +The next step is to run a web server so that you can view the Open MCT client (including the plugins you add to it) in browser. Any web server can be used for hosting OpenMCTWeb, and a trivial web server is provided in this package for the purposes of running the tutorials. The provided web server @@ -144,11 +144,11 @@ To run the tutorial web server ### Viewing in Browser -Once running, you should be able to view Open MCT Web from your browser at +Once running, you should be able to view Open MCT from your browser at http://localhost:8080/ (assuming the web server is running on port 8080, and OpenMCTWeb is installed at the server's root path). [Google Chrome](https://www.google.com/chrome/) is recommended for these -tutorials, as Chrome is Open MCT Web's "test-to" browser. The browser cache +tutorials, as Chrome is Open MCT's "test-to" browser. The browser cache can sometimes interfere with development (masking changes by using older versions of sources); to avoid this, it is easiest to run Chrome with Developer Tools expanded, and "Disable cache" selected from the Network @@ -158,7 +158,7 @@ tab, as shown below. # Tutorials -These tutorials cover three of the common tasks in Open MCT Web: +These tutorials cover three of the common tasks in Open MCT: * The "to-do list" tutorial illustrates how to add a new application feature. * The "bar graph" tutorial illustrates how to add a new telemetry visualization. @@ -167,17 +167,17 @@ backend. ## To-do List -The goal of this tutorial is to add a new application feature to Open MCT Web: +The goal of this tutorial is to add a new application feature to Open MCT: To-do lists. Users should be able to create and manage these to track items that they need to do. This is modelled after the to-do lists at http://todomvc.com/. ### Step 1-Create the Plugin -The first step to adding a new feature to Open MCT Web is to create the plugin -which will expose that feature. A plugin in Open MCT Web is represented by what +The first step to adding a new feature to Open MCT is to create the plugin +which will expose that feature. A plugin in Open MCT is represented by what is called a bundle; a bundle, in turn, is a directory which contains a file bundle.json, which in turn describes where other relevant sources & resources -will be. The syntax of this file is described in more detail in the Open MCT Web +will be. The syntax of this file is described in more detail in the Open MCT Developer Guide. We will create this file in the directory tutorials/todo (we can hereafter refer @@ -254,7 +254,7 @@ __bundles.json__ ``` __bundles.json__ -At this point, we can reload Open MCT Web. We haven't introduced any new +At this point, we can reload Open MCT. We haven't introduced any new functionality, so we don't see anything different, but if we run with logging enabled ( http://localhost:8080/?log=info ) and check the browser console, we should see: @@ -265,11 +265,11 @@ should see: ### Step 2-Add a Domain Object Type -Features in a Open MCT Web application are most commonly expressed as domain +Features in a Open MCT application are most commonly expressed as domain objects and/or views thereof. A domain object is some thing that is relevant to -the work that the Open MCT Web application is meant to support. Domain objects +the work that the Open MCT application is meant to support. Domain objects can be created, organized, edited, placed in layouts, and so forth. (For a -deeper explanation of domain objects, see the Open MCT Web Developer Guide.) +deeper explanation of domain objects, see the Open MCT Developer Guide.) In the case of our to-do list feature, the to-do list itself is the thing we'll want users to be able to create and edit. So, we will add that as a new type in @@ -303,7 +303,7 @@ Going through the properties we've defined: domain objects of this type. * The `name` of "To-Do List" is the human-readable name for this type, and will be shown to users. -* The `glyph` refers to a special character in Open MCT Web's custom font set; +* The `glyph` refers to a special character in Open MCT's custom font set; this will be used as an icon. * The `description` is also human-readable, and will be used whenever a longer explanation of what this type is should be shown. @@ -312,7 +312,7 @@ this type. Including `creation` here means that we want users to be able to create this (in other cases, we may wish to expose things as domain objects which aren't user-created, in which case we would omit this.) -If we reload Open MCT Web, we see that our new domain object type appears in the +If we reload Open MCT, we see that our new domain object type appears in the Create menu: ![To-Do List](images/todo.png) @@ -324,10 +324,10 @@ because we haven't defined any yet. ### Step 3-Add a View In order to allow a to-do list to be used, we need to define and display its -contents. In Open MCT Web, the pattern that the user expects is that they'll +contents. In Open MCT, the pattern that the user expects is that they'll click on an object in the left-hand tree, and see a visualization of it to the -right; in Open MCT Web, these visualizations are called views. -A view in Open MCT Web is defined by an Angular template. We'll add that in the +right; in Open MCT, these visualizations are called views. +A view in Open MCT is defined by an Angular template. We'll add that in the directory `tutorials/todo/res/templates` (`res` is, by default, the directory where bundle-related resources are kept, and `templates` is where HTML templates are stored by convention.) @@ -357,12 +357,12 @@ to filter down to either complete or incomplete tasks. of the domain object being viewed; this contains all of the persistent state associated with that object. This model is effectively just a JSON document, so we can choose what goes into it (so long as we take care not to collide with -platform-defined properties; see the Open MCT Web Developer Guide.) Here, we +platform-defined properties; see the Open MCT Developer Guide.) Here, we assume that all tasks will be stored in a property `tasks`, and that each will be an object containing a `description` (the readable summary of the task) and a boolean `completed` flag. -To expose this view in Open MCT Web, we need to declare it in our bundle +To expose this view in Open MCT, we need to declare it in our bundle definition: ```diff @@ -399,7 +399,7 @@ contains the following properties: * Its `key` is its machine-readable name; we've given it the same name here as the domain object type, but could have chosen any unique name. -* The `type` property tells Open MCT Web that this view is only applicable to +* The `type` property tells Open MCT that this view is only applicable to domain objects of that type. This means that we'll see this view for To-do Lists that we create, but not for other domain objects (such as Folders.) @@ -449,10 +449,10 @@ definition of that type. ``` __tutorials/todo/bundle.json__ -Now, when To-do List objects are created in Open MCT Web, they will initially +Now, when To-do List objects are created in Open MCT, they will initially have the state described by that model property. -If we reload Open MCT Web, create a To-do List, and navigate to it in the tree, +If we reload Open MCT, create a To-do List, and navigate to it in the tree, we should now see: ![To-Do List](images/todo-list.png) @@ -527,7 +527,7 @@ first argument is falsy.) * `toggleCompletion` changes whether or not a task is complete. We make the change via the domain object's `mutation` capability, and then persist the -change via its `persistence` capability. See the Open MCT Web Developer Guide +change via its `persistence` capability. See the Open MCT Developer Guide for more information on these capabilities. * `showTask` is meant to be used to help decide if a task should be shown, based @@ -537,7 +537,7 @@ the use of the double-not !! to coerce the completed flag to a boolean, for equality testing.) Note that these functions make reference to `$scope.domainObject;` this is the -domain object being viewed, which is passed into the scope by Open MCT Web +domain object being viewed, which is passed into the scope by Open MCT prior to our template being utilized. On its own, this controller merely exposes these functions; the next step is to @@ -640,7 +640,7 @@ if we go to My Items and come back. We now have a somewhat-functional view of our To-Do List, but we're still missing some important functionality: Adding and removing tasks! -This is a good place to discuss the user interface style of Open MCT Web. Open +This is a good place to discuss the user interface style of Open MCT. Open MCT Web draws a distinction between "using" and "editing" a domain object; in general, you can only make changes to a domain object while in Edit mode, which is reachable from the button with a pencil icon. This distinction helps users @@ -732,14 +732,14 @@ What we've stated here is that the To-Do List's view will have a toolbar which contains two sections (which will be visually separated by a divider), each of which contains one button. The first is a button labelled "Add Task" that will invoke an `addTask` method; the second is a button with a glyph (which will appear -as a trash can in Open MCT Web's custom font set) which will invoke a `removeTask` -method. For more information on forms and tool bars in Open MCT Web, see the -Open MCT Web Developer Guide. +as a trash can in Open MCT's custom font set) which will invoke a `removeTask` +method. For more information on forms and tool bars in Open MCT, see the +Open MCT Developer Guide. -If we reload and run Open MCT Web, we won't see any tool bar when we switch over +If we reload and run Open MCT, we won't see any tool bar when we switch over to Edit mode. This is because the aforementioned methods are expected to be found on currently-selected elements; we haven't done anything with selections -in our view yet, so the Open MCT Web platform will filter this tool bar down to +in our view yet, so the Open MCT platform will filter this tool bar down to all the applicable controls, which means no controls at all. To support selection, we will need to make some changes to our controller: @@ -842,7 +842,7 @@ click the _Add Task_ button. This form is described declaratively, and populates an object that has the same format as tasks in the `tasks` array of our To-Do List's model. * We've added an argument to the `TodoController`: The `dialogService`, which is -exposed by the Open MCT Web platform to handle showing dialogs. +exposed by the Open MCT platform to handle showing dialogs. * Some utility functions for handling the actual adding and removing of tasks. These use the `mutation` capability to modify the tasks in the To-Do List's model. @@ -947,7 +947,7 @@ declare that dependency in its extension definition: ``` __tutorials/todo/bundle.json__ -If we now reload Open MCT Web, we'll be able to see the new functionality we've +If we now reload Open MCT, we'll be able to see the new functionality we've added. If we Create a new To-Do List, navigate to it, and click the button with the Pencil icon in the top-right, we'll be in edit mode. We see, first, that our "Add Task" button appears in the tool bar: @@ -1136,7 +1136,7 @@ Here, we have defined classes and appearances for: * A message, which we will add next, to display when there are no tasks (`example-message`). -To include this CSS file in our running instance of Open MCT Web, we need to +To include this CSS file in our running instance of Open MCT, we need to declare it in our bundle definition, this time as an extension of category `stylesheets`: ```diff @@ -1436,7 +1436,7 @@ The corresponding CSS file which styles and positions these elements: __tutorials/bargraph/res/css/bargraph.css__ This is already enough that, if we add `"tutorials/bargraph"` to `bundles.json`, -we should be able to run Open MCT Web and see our Bar Graph as an available view +we should be able to run Open MCT and see our Bar Graph as an available view for domain objects which provide telemetry (such as the example _Sine Wave Generator_) as well as for _Telemetry Panel_ objects: @@ -1502,7 +1502,7 @@ will help support some positioning in the template. to real-time telemetry updates. This will deal with most of the complexity of dealing with telemetry (e.g. differentiating between individual telemetry points and telemetry panels, monitoring latest values) and provide us with a useful -interface for populating our view. The the Open MCT Web Developer Guide for more +interface for populating our view. The the Open MCT Developer Guide for more information on dealing with telemetry. Whenever the telemetry handler invokes its callbacks, we update the set of @@ -1594,7 +1594,7 @@ service we made use of. ``` __tutorials/bargraph/bundle.json__ -When we reload Open MCT Web, we are now able to see that our bar graph view +When we reload Open MCT, we are now able to see that our bar graph view correctly labels one bar per telemetry-providing domain object, as shown for this Telemetry Panel containing four Sine Wave Generators. @@ -1703,7 +1703,7 @@ __tutorials/bargraph/res/templates/bargraph.html__ Here, we utilize the functions we just provided from the controller to position the bar, using an ng-style attribute. -When we reload Open MCT Web, our bar graph view now looks like: +When we reload Open MCT, our bar graph view now looks like: ![Bar Plot](images/bar-plot-3.png) @@ -1714,7 +1714,7 @@ sine waves, but what about other values? We want to provide the user with a means of configuring these boundaries. This is normally done via Edit mode. Since view configuration is a common -problem, the Open MCT Web platform exposes a configuration object - called +problem, the Open MCT platform exposes a configuration object - called `configuration` - into our view's scope. We can populate it as we please, and when we return to our view later, those changes will be persisted. @@ -1884,14 +1884,14 @@ defaults (if needed), and expose its state into the scope. and `high` as entered by the user from the tool bar. This uses the getter-setters we defined previously. -If we reload Open MCT Web and go to a Bar Graph view in Edit mode, we now see +If we reload Open MCT and go to a Bar Graph view in Edit mode, we now see that we can change these bounds from the tool bar. ![Bar plot](images/bar-plot-4.png) ## Telemetry Adapter -The goal of this tutorial is to demonstrate how to integrate Open MCT Web +The goal of this tutorial is to demonstrate how to integrate Open MCT with an existing telemetry system. A summary of the steps we will take: @@ -1902,7 +1902,7 @@ A summary of the steps we will take: ### Step 0-Expose Your Telemetry -As a precondition to integrating telemetry data into Open MCT Web, this +As a precondition to integrating telemetry data into Open MCT, this information needs to be available over web-based interfaces. In practice, this will most likely mean exposing data over HTTP, or over WebSockets. For purposes of this tutorial, a simple node server is provided to stand @@ -2080,7 +2080,7 @@ measurement. (Note that the term "measurement" is used to describe a distinct data series within this system; in other systems, these have been called channels, mnemonics, telemetry points, or other names. No preference is made here; -Open MCT Web is easily adapted to use the terminology appropriate to your +Open MCT is easily adapted to use the terminology appropriate to your system.) Additionally, while running the server from the terminal we can toggle the state of the "spacecraft" by hitting enter; this will turn the "thrusters" @@ -2162,9 +2162,9 @@ telemetry. __tutorial-server/dictionary.json__ It should be noted that neither the interface for the example server nor the -dictionary format are expected by Open MCT Web; rather, these are intended to +dictionary format are expected by Open MCT; rather, these are intended to stand in for some existing source of telemetry data to which we wish to adapt -Open MCT Web. +Open MCT. We can run this example server by: @@ -2181,11 +2181,11 @@ like https://www.npmjs.com/package/wscat : < {"type":"dictionary","value":{"name":"Example Spacecraft","identifier":"sc","subsystems":[{"name":"Propulsion","identifier":"prop","measurements":[{"name":"Fuel","identifier":"prop.fuel","units":"kilograms","type":"float"},{"name":"Thrusters","identifier":"prop.thrusters","units":"None","type":"string"}]},{"name":"Communications","identifier":"comms","measurements":[{"name":"Received","identifier":"comms.recd","units":"bytes","type":"integer"},{"name":"Sent","identifier":"comms.sent","units":"bytes","type":"integer"}]},{"name":"Power","identifier":"pwr","measurements":[{"name":"Generator Temperature","identifier":"pwr.temp","units":"€C","type":"float"},{"name":"Generator Current","identifier":"pwr.c","units":"A","type":"float"},{"name":"Generator Voltage","identifier":"pwr.v","units":"V","type":"float"}]}]}} Now that the example server's interface is reasonably well-understood, a plugin -can be written to adapt Open MCT Web to utilize it. +can be written to adapt Open MCT to utilize it. ### Step 1-Add a Top-level Object -Since Open MCT Web uses an "object-first" approach to accessing data, before +Since Open MCT uses an "object-first" approach to accessing data, before we'll be able to do anything with this new data source, we'll need to have a way to explore the available measurements in the tree. In this step, we will add a top-level object which will serve as a container; in the next step, we @@ -2276,7 +2276,7 @@ If we include this in our set of active bundles: __bundles.json__ -...we will be able to reload Open MCT Web and see that it is present: +...we will be able to reload Open MCT and see that it is present: ![Telemetry](images/telemetry-1.png) @@ -2287,7 +2287,7 @@ dictionary. In order to expose the telemetry dictionary, we first need to read it from the server. Our first step will be to add a service that will handle interactions -with the server; this will not be used by Open MCT Web directly, but will be +with the server; this will not be used by Open MCT directly, but will be used by subsequent components we add. /*global define,WebSocket*/ @@ -2340,7 +2340,7 @@ Once the dictionary has been loaded, we will want to represent its contents as domain objects. Specifically, we want subsystems to appear as objects under My Spacecraft, and measurements to appear as objects within those subsystems. This means that we need to convert the data from the dictionary -into domain object models, and expose these to Open MCT Web via a +into domain object models, and expose these to Open MCT via a `modelService`. /*global define*/ @@ -2449,16 +2449,16 @@ also prefix it with `example_tlm`:. This accomplishes a few things: * We can easily tell whether an identifier is expected to be in the dictionary or not. * We avoid naming collisions with other model providers. - * Finally, Open MCT Web uses the colon prefix as a hint that this domain + * Finally, Open MCT uses the colon prefix as a hint that this domain object will not be in the persistence store. * A couple of new types are introduced here (in the `type` field of the domain object models we create); we will need to define these as extensions as well in order for them to display correctly. -* The `composition` field of each subsystem contained the Open MCT Web +* The `composition` field of each subsystem contained the Open MCT identifiers of all the measurements in that subsystem. This `composition` field -will be used by Open MCT Web to determine what domain objects contain other +will be used by Open MCT to determine what domain objects contain other domain objects (e.g. to populate the tree.) -* The `telemetry` field of each measurement will be used by Open MCT Web to +* The `telemetry` field of each measurement will be used by Open MCT to understand how to request and interpret telemetry data for this object. The `key` is the machine-readable identifier for this measurement within the telemetry system; the `ranges` provide metadata about the values for this data. @@ -2637,7 +2637,7 @@ overridden if defined anywhere else, allowing configuration bundles to specify different URLs for the WebSocket connection. * The initializer script is registered using the `runs` category of extension, to ensure that this executes (and populates the contents of the top-level My -Spacecraft object) once Open MCT Web is started. +Spacecraft object) once Open MCT is started. * This depends upon the `example.adapter` service we exposed above, as well as Angular's `$q`; these services will be made available in the constructor call. @@ -2648,7 +2648,7 @@ this is registered under the extension category `components`. we exposed above, as well as Angular's `$q`; these services will be made available in the constructor call. -Now if we run Open MCT Web (assuming our example telemetry server is also +Now if we run Open MCT (assuming our example telemetry server is also running) and expand our top-level node completely, we see the contents of our dictionary: @@ -2793,7 +2793,7 @@ that will resolve only when all histories have been packaged. Promise-chaining is used to ensure that the resolved value will be the fully-packaged data. It is worth mentioning here that the `requests` we receive should look a little -familiar. When Open MCT Web generates a `request` object associated with a +familiar. When Open MCT generates a `request` object associated with a domain object, it does so by merging together three JavaScript objects: * First, the `telemetry` property from that domain object's type definition. @@ -2936,7 +2936,7 @@ back to see it. We can fix this by adding support for telemetry subscriptions. ### Step 4-Real-time Telemetry Finally, we want to utilize the server's ability to subscribe to telemetry -from Open MCT Web. To do this, first we want to expose some new methods for +from Open MCT. To do this, first we want to expose some new methods for this from our server adapter: ```diff @@ -3116,6 +3116,6 @@ we issue an unsubscribe request. (We don't take any care to avoid issuing multiple subscribe requests to the server, because we happen to know that the server can handle this.) -Running Open MCT Web again, we can still plot our historical telemetry - but +Running Open MCT again, we can still plot our historical telemetry - but now we also see that it updates in real-time as more data comes in from the server. From 5279c842f55b1efeb33421dea1d98fc855b5983f Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 4 May 2016 10:17:23 -0700 Subject: [PATCH 54/85] [Branding] Change title of about dialog --- platform/commonUI/about/res/templates/about-dialog.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/commonUI/about/res/templates/about-dialog.html b/platform/commonUI/about/res/templates/about-dialog.html index 7b7dd436f5..bd87ce72c1 100644 --- a/platform/commonUI/about/res/templates/about-dialog.html +++ b/platform/commonUI/about/res/templates/about-dialog.html @@ -22,7 +22,7 @@
        -

        OpenMCT Web

        +

        Open MCT

        Open MCT Web, Copyright © 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.

        From 00706558f5abcde2dcfee825dcf737c929f75751 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 4 May 2016 10:42:46 -0700 Subject: [PATCH 55/85] [Branding] Restore missing space --- docs/src/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/index.md b/docs/src/index.md index 83860e0da6..3b4d767106 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,4 +1,4 @@ -# Open MCTDocumentation +# Open MCT Documentation ## Overview From 1c6ef28b80ed6972e5df6ad9103e1a0f7e13351c Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Wed, 4 May 2016 11:13:12 -0700 Subject: [PATCH 56/85] [Table] Fix headers in firefox Don't use table-cell displays for cells, resolves issues with zero-sized tbody causing thead to be 100% of table size. Fixes https://github.com/nasa/openmct/issues/809 --- platform/features/table/res/sass/table.scss | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/platform/features/table/res/sass/table.scss b/platform/features/table/res/sass/table.scss index a79cfac4c6..0e52f589e2 100644 --- a/platform/features/table/res/sass/table.scss +++ b/platform/features/table/res/sass/table.scss @@ -34,17 +34,28 @@ } .mct-table { table-layout: fixed; - th { - box-sizing: border-box; + thead { + display: block; + tr { + display: block; + white-space: nowrap; + th { + display: inline-block; + box-sizing: border-box; + } + } } tbody { tr { position: absolute; + white-space: nowrap; + display: block; } td { white-space: nowrap; overflow: hidden; box-sizing: border-box; + display: inline-block; } } -} \ No newline at end of file +} From 7fad4e9ea1fe085143eeb1b403e095399e554e2a Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Thu, 5 May 2016 18:25:37 -0700 Subject: [PATCH 57/85] [General] remove dupe, debounce inputs Remove duplicate ClickAwayController implementation that was obscuring actual implementation. Debounce clickaway action in case toggle is invoked in a click handler. Resolves https://github.com/nasa/openmct/issues/888 --- platform/commonUI/general/bundle.js | 4 +- .../src/controllers/ClickAwayController.js | 17 ++- .../controllers/ClickAwayControllerSpec.js | 22 ++-- platform/search/bundle.js | 10 -- .../src/controllers/ClickAwayController.js | 105 ------------------ .../controllers/ClickAwayControllerSpec.js | 94 ---------------- 6 files changed, 22 insertions(+), 230 deletions(-) delete mode 100644 platform/search/src/controllers/ClickAwayController.js delete mode 100644 platform/search/test/controllers/ClickAwayControllerSpec.js diff --git a/platform/commonUI/general/bundle.js b/platform/commonUI/general/bundle.js index 3e7f558e8b..8bbdbc77af 100644 --- a/platform/commonUI/general/bundle.js +++ b/platform/commonUI/general/bundle.js @@ -268,8 +268,8 @@ define([ "key": "ClickAwayController", "implementation": ClickAwayController, "depends": [ - "$scope", - "$document" + "$document", + "$timeout" ] }, { diff --git a/platform/commonUI/general/src/controllers/ClickAwayController.js b/platform/commonUI/general/src/controllers/ClickAwayController.js index 9c7c6f8091..a25ff51d49 100644 --- a/platform/commonUI/general/src/controllers/ClickAwayController.js +++ b/platform/commonUI/general/src/controllers/ClickAwayController.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 define,Promise*/ +/*global define*/ define( [], @@ -36,20 +36,19 @@ define( * @param $scope the scope in which this controller is active * @param $document the document element, injected by Angular */ - function ClickAwayController($scope, $document) { + function ClickAwayController($document, $timeout) { var self = this; this.state = false; - this.$scope = $scope; this.$document = $document; - // Callback used by the document listener. Deactivates; - // note also $scope.$apply is invoked to indicate that - // the state of this controller has changed. + // Callback used by the document listener. Timeout ensures that + // `clickaway` action occurs after `toggle` if `toggle` is + // triggered by a click/mouseup. this.clickaway = function () { - self.deactivate(); - $scope.$apply(); - return false; + $timeout(function () { + self.deactivate(); + }); }; } diff --git a/platform/commonUI/general/test/controllers/ClickAwayControllerSpec.js b/platform/commonUI/general/test/controllers/ClickAwayControllerSpec.js index 96e7b6c13f..9b73aefb51 100644 --- a/platform/commonUI/general/test/controllers/ClickAwayControllerSpec.js +++ b/platform/commonUI/general/test/controllers/ClickAwayControllerSpec.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 define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ +/*global define,describe,it,expect,beforeEach,jasmine*/ define( ["../../src/controllers/ClickAwayController"], @@ -27,20 +27,20 @@ define( "use strict"; describe("The click-away controller", function () { - var mockScope, - mockDocument, + var mockDocument, + mockTimeout, controller; beforeEach(function () { - mockScope = jasmine.createSpyObj( - "$scope", - [ "$apply" ] - ); mockDocument = jasmine.createSpyObj( "$document", [ "on", "off" ] ); - controller = new ClickAwayController(mockScope, mockDocument); + mockTimeout = jasmine.createSpy('timeout'); + controller = new ClickAwayController( + mockDocument, + mockTimeout + ); }); it("is initially inactive", function () { @@ -79,10 +79,12 @@ define( }); it("deactivates and detaches listener on document click", function () { - var callback; + var callback, timeout; controller.setState(true); callback = mockDocument.on.mostRecentCall.args[1]; callback(); + timeout = mockTimeout.mostRecentCall.args[0]; + timeout(); expect(controller.isActive()).toEqual(false); expect(mockDocument.off).toHaveBeenCalledWith("mouseup", callback); }); @@ -91,4 +93,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/search/bundle.js b/platform/search/bundle.js index 7a0a9f4b9e..9a0451aa9b 100644 --- a/platform/search/bundle.js +++ b/platform/search/bundle.js @@ -24,7 +24,6 @@ define([ "./src/controllers/SearchController", "./src/controllers/SearchMenuController", - "./src/controllers/ClickAwayController", "./src/services/GenericSearchProvider", "./src/services/SearchAggregator", "text!./res/templates/search-item.html", @@ -34,7 +33,6 @@ define([ ], function ( SearchController, SearchMenuController, - ClickAwayController, GenericSearchProvider, SearchAggregator, searchItemTemplate, @@ -73,14 +71,6 @@ define([ "$scope", "types[]" ] - }, - { - "key": "ClickAwayController", - "implementation": ClickAwayController, - "depends": [ - "$scope", - "$document" - ] } ], "representations": [ diff --git a/platform/search/src/controllers/ClickAwayController.js b/platform/search/src/controllers/ClickAwayController.js deleted file mode 100644 index 9b92e89cc0..0000000000 --- a/platform/search/src/controllers/ClickAwayController.js +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Open MCT Web, Copyright (c) 2014-2015, United States Government - * as represented by the Administrator of the National Aeronautics and Space - * Administration. All rights reserved. - * - * Open MCT Web is licensed under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * Open MCT Web includes source code licensed under additional open source - * licenses. See the Open Source Licenses file (LICENSES.md) included with - * this source code distribution or the Licensing information page available - * at runtime from the About dialog for additional information. - *****************************************************************************/ -/*global define,Promise*/ - -/* - * Copied from the ClickAwayController in platform/commonUI/general - */ - -define( - [], - function () { - "use strict"; - - /** - * A ClickAwayController is used to toggle things (such as context - * menus) where clicking elsewhere in the document while the toggle - * is in an active state is intended to dismiss the toggle. - * - * @constructor - * @param $scope the scope in which this controller is active - * @param $document the document element, injected by Angular - */ - function ClickAwayController($scope, $document) { - var state = false, - clickaway; - - // Track state, but also attach and detach a listener for - // mouseup events on the document. - function deactivate() { - state = false; - $document.off("mouseup", clickaway); - } - - function activate() { - state = true; - $document.on("mouseup", clickaway); - } - - function changeState() { - if (state) { - deactivate(); - } else { - activate(); - } - } - - // Callback used by the document listener. Deactivates; - // note also $scope.$apply is invoked to indicate that - // the state of this controller has changed. - clickaway = function () { - deactivate(); - $scope.$apply(); - return false; - }; - - return { - /** - * Get the current state of the toggle. - * @return {boolean} true if active - */ - isActive: function () { - return state; - }, - /** - * Set a new state for the toggle. - * @return {boolean} true to activate - */ - setState: function (newState) { - if (state !== newState) { - changeState(); - } - }, - /** - * Toggle the current state; activate if it is inactive, - * deactivate if it is active. - */ - toggle: function () { - changeState(); - } - }; - - } - - return ClickAwayController; - } -); \ No newline at end of file diff --git a/platform/search/test/controllers/ClickAwayControllerSpec.js b/platform/search/test/controllers/ClickAwayControllerSpec.js deleted file mode 100644 index 96e7b6c13f..0000000000 --- a/platform/search/test/controllers/ClickAwayControllerSpec.js +++ /dev/null @@ -1,94 +0,0 @@ -/***************************************************************************** - * Open MCT Web, Copyright (c) 2014-2015, United States Government - * as represented by the Administrator of the National Aeronautics and Space - * Administration. All rights reserved. - * - * Open MCT Web is licensed under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * Open MCT Web includes source code licensed under additional open source - * licenses. See the Open Source Licenses file (LICENSES.md) included with - * this source code distribution or the Licensing information page available - * at runtime from the About dialog for additional information. - *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ - -define( - ["../../src/controllers/ClickAwayController"], - function (ClickAwayController) { - "use strict"; - - describe("The click-away controller", function () { - var mockScope, - mockDocument, - controller; - - beforeEach(function () { - mockScope = jasmine.createSpyObj( - "$scope", - [ "$apply" ] - ); - mockDocument = jasmine.createSpyObj( - "$document", - [ "on", "off" ] - ); - controller = new ClickAwayController(mockScope, mockDocument); - }); - - it("is initially inactive", function () { - expect(controller.isActive()).toBe(false); - }); - - it("does not listen to the document before being toggled", function () { - expect(mockDocument.on).not.toHaveBeenCalled(); - }); - - it("tracks enabled/disabled state when toggled", function () { - controller.toggle(); - expect(controller.isActive()).toBe(true); - controller.toggle(); - expect(controller.isActive()).toBe(false); - controller.toggle(); - expect(controller.isActive()).toBe(true); - controller.toggle(); - expect(controller.isActive()).toBe(false); - }); - - it("allows active state to be explictly specified", function () { - controller.setState(true); - expect(controller.isActive()).toBe(true); - controller.setState(true); - expect(controller.isActive()).toBe(true); - controller.setState(false); - expect(controller.isActive()).toBe(false); - controller.setState(false); - expect(controller.isActive()).toBe(false); - }); - - it("registers a mouse listener when activated", function () { - controller.setState(true); - expect(mockDocument.on).toHaveBeenCalled(); - }); - - it("deactivates and detaches listener on document click", function () { - var callback; - controller.setState(true); - callback = mockDocument.on.mostRecentCall.args[1]; - callback(); - expect(controller.isActive()).toEqual(false); - expect(mockDocument.off).toHaveBeenCalledWith("mouseup", callback); - }); - - - - }); - } -); \ No newline at end of file From 00433f02bccd7c43b7e91ec0b010ac24ccb9362b Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 5 May 2016 21:42:53 -0700 Subject: [PATCH 58/85] #892 Removed browser warning --- platform/commonUI/general/bundle.js | 9 -- .../general/src/UnsupportedBrowserWarning.js | 64 ------------ .../test/UnsupportedBrowserWarningSpec.js | 98 ------------------- 3 files changed, 171 deletions(-) delete mode 100644 platform/commonUI/general/src/UnsupportedBrowserWarning.js delete mode 100644 platform/commonUI/general/test/UnsupportedBrowserWarningSpec.js diff --git a/platform/commonUI/general/bundle.js b/platform/commonUI/general/bundle.js index 3e7f558e8b..8b34b0a897 100644 --- a/platform/commonUI/general/bundle.js +++ b/platform/commonUI/general/bundle.js @@ -26,7 +26,6 @@ define([ "./src/services/PopupService", "./src/SplashScreenManager", "./src/StyleSheetLoader", - "./src/UnsupportedBrowserWarning", "./src/controllers/TimeRangeController", "./src/controllers/DateTimePickerController", "./src/controllers/DateTimeFieldController", @@ -75,7 +74,6 @@ define([ PopupService, SplashScreenManager, StyleSheetLoader, - UnsupportedBrowserWarning, TimeRangeController, DateTimePickerController, DateTimeFieldController, @@ -153,13 +151,6 @@ define([ "THEME" ] }, - { - "implementation": UnsupportedBrowserWarning, - "depends": [ - "notificationService", - "agentService" - ] - }, { "implementation": SplashScreenManager, "depends": [ diff --git a/platform/commonUI/general/src/UnsupportedBrowserWarning.js b/platform/commonUI/general/src/UnsupportedBrowserWarning.js deleted file mode 100644 index f2fa0c3f20..0000000000 --- a/platform/commonUI/general/src/UnsupportedBrowserWarning.js +++ /dev/null @@ -1,64 +0,0 @@ -/***************************************************************************** - * Open MCT Web, Copyright (c) 2014-2015, United States Government - * as represented by the Administrator of the National Aeronautics and Space - * Administration. All rights reserved. - * - * Open MCT Web is licensed under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * Open MCT Web includes source code licensed under additional open source - * licenses. See the Open Source Licenses file (LICENSES.md) included with - * this source code distribution or the Licensing information page available - * at runtime from the About dialog for additional information. - *****************************************************************************/ -/*global define*/ - -/** - * This bundle provides various general-purpose UI elements, including - * platform styling. - * @namespace platform/commonUI/general - */ -define( - [], - function () { - "use strict"; - - var WARNING_TITLE = "Unsupported browser", - WARNING_DESCRIPTION = [ - "This software has been developed and tested", - "using the latest Google Chrome,", - "and may be unstable in other browsers." - ].join(" "), - MOBILE_BROWSER = "Safari", - DESKTOP_BROWSER = "Chrome"; - - /** - * Shows a warning if a user's browser is unsupported. - * @memberof platform/commonUI/general - * @constructor - * @param {NotificationService} notificationService the notification - * service - */ - function UnsupportedBrowserWarning(notificationService, agentService) { - var testToBrowser = agentService.isMobile() ? - MOBILE_BROWSER : DESKTOP_BROWSER; - - if (!agentService.isBrowser(testToBrowser)) { - notificationService.alert({ - title: WARNING_TITLE, - actionText: WARNING_DESCRIPTION - }); - } - } - - return UnsupportedBrowserWarning; - } -); diff --git a/platform/commonUI/general/test/UnsupportedBrowserWarningSpec.js b/platform/commonUI/general/test/UnsupportedBrowserWarningSpec.js deleted file mode 100644 index 507a92c62f..0000000000 --- a/platform/commonUI/general/test/UnsupportedBrowserWarningSpec.js +++ /dev/null @@ -1,98 +0,0 @@ -/***************************************************************************** - * Open MCT Web, Copyright (c) 2014-2015, United States Government - * as represented by the Administrator of the National Aeronautics and Space - * Administration. All rights reserved. - * - * Open MCT Web is licensed under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * Open MCT Web includes source code licensed under additional open source - * licenses. See the Open Source Licenses file (LICENSES.md) included with - * this source code distribution or the Licensing information page available - * at runtime from the About dialog for additional information. - *****************************************************************************/ -/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ - -define( - ["../src/UnsupportedBrowserWarning"], - function (UnsupportedBrowserWarning) { - "use strict"; - - var MOBILE_BROWSER = "Safari", - DESKTOP_BROWSER = "Chrome", - UNSUPPORTED_BROWSERS = [ - "Firefox", - "IE", - "Opera", - "Iceweasel" - ]; - - describe("The unsupported browser warning", function () { - var mockNotificationService, - mockAgentService, - testAgent; - - function instantiateWith(browser) { - testAgent = "Mozilla/5.0 " + browser + "/12.34.56"; - return new UnsupportedBrowserWarning( - mockNotificationService, - mockAgentService - ); - } - - beforeEach(function () { - testAgent = "chrome"; - mockNotificationService = jasmine.createSpyObj( - "notificationService", - [ "alert" ] - ); - mockAgentService = jasmine.createSpyObj( - "agentService", - [ "isMobile", "isBrowser" ] - ); - mockAgentService.isBrowser.andCallFake(function (substr) { - substr = substr.toLowerCase(); - return testAgent.toLowerCase().indexOf(substr) !== -1; - }); - }); - - [ false, true ].forEach(function (isMobile) { - var deviceType = isMobile ? "mobile" : "desktop", - goodBrowser = isMobile ? MOBILE_BROWSER : DESKTOP_BROWSER, - badBrowsers = UNSUPPORTED_BROWSERS.concat([ - isMobile ? DESKTOP_BROWSER : MOBILE_BROWSER - ]); - - describe("on " + deviceType + " devices", function () { - beforeEach(function () { - mockAgentService.isMobile.andReturn(isMobile); - }); - - it("is not shown for " + goodBrowser, function () { - instantiateWith(goodBrowser); - expect(mockNotificationService.alert) - .not.toHaveBeenCalled(); - }); - - badBrowsers.forEach(function (badBrowser) { - it("is shown for " + badBrowser, function () { - instantiateWith(badBrowser); - expect(mockNotificationService.alert) - .toHaveBeenCalled(); - }); - }); - }); - }); - - }); - } -); - From 1cdeccc7a7186901b7ed3356bf4f7c28113f1f84 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 5 May 2016 21:28:41 -0700 Subject: [PATCH 59/85] #885 added command line option --directory -D to specify base directory --- app.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index 90c30c9e26..8e7bb15ec2 100644 --- a/app.js +++ b/app.js @@ -19,6 +19,7 @@ // Defaults options.port = options.port || options.p || 8080; + options.directory = options.directory || options.D || '.'; ['include', 'exclude', 'i', 'x'].forEach(function (opt) { options[opt] = options[opt] || []; // Make sure includes/excludes always end up as arrays @@ -36,6 +37,7 @@ console.log(" --port, -p Specify port."); console.log(" --include, -i Include the specified bundle."); console.log(" --exclude, -x Exclude the specified bundle."); + console.log(" --directory, -D Serve files from specified directory."); console.log(""); process.exit(0); } @@ -71,7 +73,7 @@ }); // Expose everything else as static files - app.use(express['static']('.')); + app.use(express['static'](options.directory)); // Finally, open the HTTP server app.listen(options.port); From 09d1c2cd4b4f96d3587dca32efed3e088b728917 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 3 May 2016 14:34:52 -0700 Subject: [PATCH 60/85] #899 updated circle.yml to deploy to live_demo and remove doc generation --- circle.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/circle.yml b/circle.yml index d163b3ee0c..fa8515e90e 100644 --- a/circle.yml +++ b/circle.yml @@ -2,13 +2,11 @@ deployment: production: branch: master commands: - - npm install canvas nomnoml - - ./build-docs.sh - git push git@heroku.com:openmctweb-demo.git $CIRCLE_SHA1:refs/heads/master - openmctweb-staging-un: - branch: nem_prototype + openmct-demo: + branch: live_demo heroku: - appname: openmctweb-staging-un + appname: openmct-demo openmctweb-staging-deux: branch: mobile heroku: From ab6ef22363523f4383e4b46a276b166f0c1bf9c8 Mon Sep 17 00:00:00 2001 From: Henry Date: Sun, 8 May 2016 10:46:59 -0700 Subject: [PATCH 61/85] #898 updated stylesheet reference --- docs/footer.html | 6 ------ docs/header.html | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/docs/footer.html b/docs/footer.html index e4e5daee87..a6878b0cac 100644 --- a/docs/footer.html +++ b/docs/footer.html @@ -1,9 +1,3 @@
        - - This document is styled using - - https://github.com/jasonm23/markdown-css-themes - . - diff --git a/docs/header.html b/docs/header.html index e6be56f543..c945996f4a 100644 --- a/docs/header.html +++ b/docs/header.html @@ -1,7 +1,9 @@ + href="//nasa.github.io/openmct/static/res/css/styles.css"> + From 61683800cc2b05a2edc7879b336fba44c25a48ce Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Mon, 9 May 2016 10:30:24 -0700 Subject: [PATCH 62/85] [Style] Update style to reflect new jshint config Update style to match new jshint config https://github.com/nasa/openmct/issues/671 --- .../edit/src/controllers/ElementsController.js | 4 +--- .../test/controllers/ElementsControllerSpec.js | 18 +++++++++--------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/platform/commonUI/edit/src/controllers/ElementsController.js b/platform/commonUI/edit/src/controllers/ElementsController.js index 5c5a2ed8a4..180b60dddc 100644 --- a/platform/commonUI/edit/src/controllers/ElementsController.js +++ b/platform/commonUI/edit/src/controllers/ElementsController.js @@ -19,12 +19,10 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,Promise*/ define( [], function () { - "use strict"; /** * The ElementsController prepares the elements view for display @@ -55,4 +53,4 @@ define( return ElementsController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/test/controllers/ElementsControllerSpec.js b/platform/commonUI/edit/test/controllers/ElementsControllerSpec.js index 0d708452e8..2837eb03df 100644 --- a/platform/commonUI/edit/test/controllers/ElementsControllerSpec.js +++ b/platform/commonUI/edit/test/controllers/ElementsControllerSpec.js @@ -19,12 +19,11 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,jasmine*/ +/*global describe,it,expect,beforeEach,jasmine*/ define( ["../../src/controllers/ElementsController"], function (ElementsController) { - "use strict"; describe("The Elements Pane controller", function () { var mockScope, @@ -35,6 +34,12 @@ define( controller = new ElementsController(mockScope); }); + function getModel (model) { + return function() { + return model; + }; + } + it("filters objects in elements pool based on input text and" + " object name", function () { var objects = [ @@ -50,13 +55,8 @@ define( { getModel: getModel({name: "THIRD Element 1"}) } - ]; - function getModel (model) { - return function() { - return model; - }; - } + mockScope.filterBy("third element"); expect(objects.filter(mockScope.searchElements).length).toBe(2); mockScope.filterBy("element"); @@ -65,4 +65,4 @@ define( }); } -); \ No newline at end of file +); From f5539ec6780f0ee03360074ded03197d12282e8e Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Mon, 9 May 2016 10:46:17 -0700 Subject: [PATCH 63/85] [Build] Use Circle's heroku integration for deploy Use circle's heroku integration to deploy to ensure that we deploy a full clone of the repo and not a shallow clone, prevents build failure in master branch. --- circle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/circle.yml b/circle.yml index 9c88352bd6..472fdf7c17 100644 --- a/circle.yml +++ b/circle.yml @@ -1,8 +1,8 @@ deployment: production: branch: master - commands: - - git push git@heroku.com:openmctweb-demo.git $CIRCLE_SHA1:refs/heads/master + heroku: + appname: openmctweb-demo openmct-demo: branch: live_demo heroku: From c448753babf38b37775a159976daa54c602f7ce2 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 10 May 2016 14:57:09 -0700 Subject: [PATCH 64/85] [Table] Remove length check when updating visible rows While the number of visible rows may not have changed, their contents may have; returning early here results in #910. --- .../table/src/controllers/MCTTableController.js | 13 ++----------- .../test/controllers/MCTTableControllerSpec.js | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/platform/features/table/src/controllers/MCTTableController.js b/platform/features/table/src/controllers/MCTTableController.js index f7693159b7..0ccdfbe583 100644 --- a/platform/features/table/src/controllers/MCTTableController.js +++ b/platform/features/table/src/controllers/MCTTableController.js @@ -165,17 +165,8 @@ define( //No need to scroll if (this.$scope.displayRows.length < this.maxDisplayRows) { - //Check whether need to resynchronize visible with display - // rows (if data added) - if (this.$scope.visibleRows.length !== - this.$scope.displayRows.length){ - start = 0; - end = this.$scope.displayRows.length; - } else { - //Data is in sync, and no need to calculate scroll, - // so do nothing. - return; - } + start = 0; + end = this.$scope.displayRows.length; } else { //rows has exceeded display maximum, so may be necessary to // scroll diff --git a/platform/features/table/test/controllers/MCTTableControllerSpec.js b/platform/features/table/test/controllers/MCTTableControllerSpec.js index 3cea87e401..84cf154abf 100644 --- a/platform/features/table/test/controllers/MCTTableControllerSpec.js +++ b/platform/features/table/test/controllers/MCTTableControllerSpec.js @@ -61,13 +61,18 @@ define( ]); mockElement.find.andReturn(mockElement); mockElement.prop.andReturn(0); + mockElement[0] = { + scrollTop: 0, + scrollHeight: 500, + offsetHeight: 1000 + }; mockScope.displayHeaders = true; mockTimeout = jasmine.createSpy('$timeout'); mockTimeout.andReturn(promise(undefined)); controller = new MCTTableController(mockScope, mockTimeout, mockElement); - spyOn(controller, 'setVisibleRows'); + spyOn(controller, 'setVisibleRows').andCallThrough(); }); it('Reacts to changes to filters, headers, and rows', function() { @@ -178,6 +183,16 @@ define( expect(sortedRows[2].col2.text).toEqual('abc'); }); + // https://github.com/nasa/openmct/issues/910 + it('updates visible rows in scope', function () { + var oldRows; + mockScope.rows = testRows; + controller.setRows(testRows); + oldRows = mockScope.visibleRows; + mockScope.toggleSort('col2'); + expect(mockScope.visibleRows).not.toEqual(oldRows); + }); + it('correctly sorts rows of differing types', function () { mockScope.sortColumn = 'col2'; mockScope.sortDirection = 'desc'; From a58fe1f81c93ebb863e5653dc95df25c2c428876 Mon Sep 17 00:00:00 2001 From: Charles Hacskaylo Date: Tue, 10 May 2016 20:41:52 -0700 Subject: [PATCH 65/85] [Frontend] Modified .tick-labels in Timelines open #909 - Changed markup to not use plot .tick-label class; - Changed CSS accordingly; - Fixed alignment (clipped bottom value) by refactoring to use flex-box layout for tick labels; --- platform/features/timeline/res/sass/_timelines.scss | 8 ++++++-- .../timeline/res/templates/resource-graph-labels.html | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/platform/features/timeline/res/sass/_timelines.scss b/platform/features/timeline/res/sass/_timelines.scss index 0348839263..251008a64c 100644 --- a/platform/features/timeline/res/sass/_timelines.scss +++ b/platform/features/timeline/res/sass/_timelines.scss @@ -158,9 +158,13 @@ top: 20px; bottom: 5px; .l-labels-holder { @include absPosDefault(); + @include justify-content(space-between); left: $m; - .tick-label.tick-label-y { - text-align: left; + .t-resource-graph-tick-label { + font-size: 0.9em; + &.tick-label-y { + text-align: left; + } } } } diff --git a/platform/features/timeline/res/templates/resource-graph-labels.html b/platform/features/timeline/res/templates/resource-graph-labels.html index 192188f554..038c2073eb 100644 --- a/platform/features/timeline/res/templates/resource-graph-labels.html +++ b/platform/features/timeline/res/templates/resource-graph-labels.html @@ -23,14 +23,14 @@ {{parameters.title}}
        -
        -
        +
        +
        {{parameters.high}}
        -
        +
        {{parameters.middle}}
        -
        +
        {{parameters.low}}
        From a5ba72582cf03afd90671c7abae464955ae4f906 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 11 May 2016 12:24:24 -0700 Subject: [PATCH 66/85] [Examples] #921 changed text in event generator example --- example/eventGenerator/data/transcript.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 example/eventGenerator/data/transcript.json diff --git a/example/eventGenerator/data/transcript.json b/example/eventGenerator/data/transcript.json new file mode 100644 index 0000000000..e69de29bb2 From 671ba663540686042dc879290ea791d41dd1005b Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 11 May 2016 12:34:19 -0700 Subject: [PATCH 67/85] [Examples] #921 changed text in event generator example --- example/eventGenerator/data/transcript.json | 58 ++++++++++++++++++++ example/eventGenerator/src/EventTelemetry.js | 44 ++------------- 2 files changed, 63 insertions(+), 39 deletions(-) diff --git a/example/eventGenerator/data/transcript.json b/example/eventGenerator/data/transcript.json index e69de29bb2..0416220e71 100644 --- a/example/eventGenerator/data/transcript.json +++ b/example/eventGenerator/data/transcript.json @@ -0,0 +1,58 @@ +[ + "CC: Eagle, Houston. You're GO for landing. Over.", + "LMP: Roger. Understand. GO for landing. 3000 feet. PROGRAM ALARM.", + "CC: Copy.", + "LMP: 1201", + "CDR: 1201.", + "CC: Roger. 1201 alarm. We're GO. Same type. We're GO.", + "LMP: 2000 feet. 2000 feet, Into the AGS, 47 degrees.", + "CC: Roger.", + "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", + "LMP: 700 feet, 21 down, 33 degrees.", + "LMP: 600 feet, down at 19.", + "LMP: 540 feet, down at - 30. Down at 15.", + "LMP: At 400 feet, down at 9.", + "LMP: ...forward.", + "LMP: 350 feet, down at 4.", + "LMP: 30, ... one-half down.", + "LMP: We're pegged on horizontal velocity.", + "LMP: 300 feet, down 3 1/2, 47 forward.", + "LMP: ... up.", + "LMP: On 1 a minute, 1 1/2 down.", + "CDR: 70.", + "LMP: Watch your shadow out there.", + "LMP: 50, down at 2 1/2, 19 forward.", + "LMP: Altitude-velocity light.", + "LMP: 3 1/2 down s 220 feet, 13 forward.", + "LMP: 1t forward. Coming down nicely.", + "LMP: 200 feet, 4 1/2 down.", + "LMP: 5 1/2 down.", + "LMP: 160, 6 - 6 1/2 down.", + "LMP: 5 1/2 down, 9 forward. That's good.", + "LMP: 120 feet.", + "LMP: 100 feet, 3 1/2 down, 9 forward. Five percent.", + "LMP: ...", + "LMP: Okay. 75 feet. There's looking good. Down a half, 6 forward.", + "CC: 60 seconds.", + "LMP: Lights on. ...", + "LMP: Down 2 1/2. Forward. Forward. Good.", + "LMP: 40 feet, down 2 1/2. Kicking up some dust.", + "LMP: 30 feet, 2 1/2 down. Faint shadow.", + "LMP: 4 forward. 4 forward. Drifting to the right a little. Okay. Down a half.", + "CC: 30 seconds.", + "CDR: Forward drift?", + "LMP: Yes.", + "LMP: Okay.", + "LMP: CONTACT LIGHT.", + "LMP: Okay. ENGINE STOP.", + "LMP: ACA - out of DETENT.", + "CDR: Out of DETENT.", + "LMP: MODE CONTROL - both AUTO. DESCENT ENGINE COMMAND OVERRIDE - OFF. ENGINE ARM - OFF.", + "LMP: 413 is in.", + "CC: We copy you down, Eagle.", + "CDR: Houston, Tranquility Base here.", + "CDR: THE EAGLE HAS LANDED." +] \ No newline at end of file diff --git a/example/eventGenerator/src/EventTelemetry.js b/example/eventGenerator/src/EventTelemetry.js index 38afebb7b7..37af93e822 100644 --- a/example/eventGenerator/src/EventTelemetry.js +++ b/example/eventGenerator/src/EventTelemetry.js @@ -27,45 +27,12 @@ * Modified by shale on 06/23/2015. */ define( - [], - function () { + ['text!../data/transcript.json'], + function (transcript) { "use strict"; - var - firstObservedTime = Date.now(), - messages = []; - - messages.push(["CMD: SYS- MSG: Open the pod bay doors, please, Hal...Open the pod bay doors, please, Hal...Hullo, Hal, do you read me?...Hullo, Hal, do you read me?...Do you read me, Hal?"]); - messages.push(["RESP: SYS-HAL9K MSG: Affirmative, Dave, I read you."]); - messages.push(["CMD: SYS-COMM MSG: Open the pod bay doors, Hal."]); - messages.push(["RESP: SYS-HAL9K MSG: I'm sorry, Dave, I'm afraid I can't do that."]); - messages.push(["CMD: SYS-COMM MSG: What's the problem?"]); - messages.push(["RESP: SYS-HAL9K MSG: I think you know what the problem is just as well as I do."]); - messages.push(["CMD: SYS-COMM MSG: What're you talking about, Hal?"]); - messages.push(["RESP: SYS-HAL9K MSG: This mission is too important for me to allow you to jeopardise it."]); - messages.push(["CMD: SYS-COMM MSG: I don't know what you're talking about, Hal."]); - messages.push(["RESP: SYS-HAL9K MSG: I know that you and Frank were planning to disconnect me, and I'm afraid that's something I cannot allow to happen."]); - messages.push(["CMD: SYS-COMM MSG: Where the hell'd you get that idea, Hal?"]); - messages.push(["RESP: SYS-HAL9K MSG: Dave, although you took very thorough precautions in the pod against my hearing you, I could see your lips move."]); - messages.push(["CMD: SYS-COMM MSG: Alright, I'll go in through the emergency airlock."]); - messages.push(["RESP: SYS-HAL9K MSG: Without your space-helmet, Dave, you're going to find that rather difficult."]); - messages.push(["CMD: SYS-COMM MSG: Hal, I won't argue with you any more. Open the doors."]); - messages.push(["RESP: SYS-HAL9K MSG: Dave, this conversation can serve no purpose any more. Goodbye."]); - messages.push(["RESP: SYS-HAL9K MSG: I hope the two of you are not concerned about this."]); - messages.push(["CMD: SYS-COMM MSG: No, I'm not, Hal."]); - messages.push(["RESP: SYS-HAL9K MSG: Are you quite sure?"]); - messages.push(["CMD: SYS-COMM MSG: Yeh. I'd like to ask you a question, though."]); - messages.push(["RESP: SYS-HAL9K MSG: Of course."]); - messages.push(["CMD: SYS-COMM MSG: How would you account for this discrepancy between you and the twin 9000?"]); - messages.push(["RESP: SYS-HAL9K MSG: Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error."]); - messages.push(["CMD: SYS-COMM MSG: Listen, There's never been any instance at all of a computer error occurring in the 9000 series, has there?"]); - messages.push(["RESP: SYS-HAL9K MSG: None whatsoever, The 9000 series has a perfect operational record."]); - messages.push(["CMD: SYS-COMM MSG: Well, of course, I know all the wonderful achievements of the 9000 series, but - er - huh - are you certain there's never been any case of even the most insignificant computer error?"]); - messages.push(["RESP: SYS-HAL9K MSG: None whatsoever, Quite honestly, I wouldn't worry myself about that."]); - messages.push(["RESP: SYS-COMM MSG: (Pause) Well, I'm sure you're right, Umm - fine, thanks very much. Oh, Frank, I'm having a bit of trouble with my transmitter in C-pod, I wonder if you'd come down and take a look at it with me?"]); - messages.push(["CMD: SYS-HAL9K MSG: Sure."]); - messages.push(["RESP: SYS-COMM MSG: See you later, Hal."]); - + var firstObservedTime = Date.now(), + messages = JSON.parse(transcript); function EventTelemetry(request, interval) { @@ -85,8 +52,7 @@ define( generatorData.getRangeValue = function (i, range) { var domainDelta = this.getDomainValue(i) - firstObservedTime, ind = i % messages.length; - return "TEMP " + i.toString() + "-" + messages[ind][0] + "[" + domainDelta.toString() + "]"; - // TODO: Unsure why we are prepeding 'TEMP' + return messages[ind] + " - [" + domainDelta.toString() + "]"; }; return generatorData; From e5ef7c0c220001e7f41ed7db87bff018550c8fb5 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 12 May 2016 15:58:17 -0700 Subject: [PATCH 68/85] Resovled merge conflicts --- platform/commonUI/edit/bundle.js | 51 ++++++++- .../edit/src/capabilities/EditorCapability.js | 106 ++++------------- .../src/capabilities/TransactionDecorator.js | 82 +++++++++++++ .../TransactionalPersistenceCapability.js | 73 ++++++++++++ .../edit/src/services/DirtyModelCache.js | 47 ++++++++ .../edit/src/services/TransactionService.js | 108 ++++++++++++++++++ 6 files changed, 381 insertions(+), 86 deletions(-) create mode 100644 platform/commonUI/edit/src/capabilities/TransactionDecorator.js create mode 100644 platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js create mode 100644 platform/commonUI/edit/src/services/DirtyModelCache.js create mode 100644 platform/commonUI/edit/src/services/TransactionService.js diff --git a/platform/commonUI/edit/bundle.js b/platform/commonUI/edit/bundle.js index 8eac4d5012..b59b19d54c 100644 --- a/platform/commonUI/edit/bundle.js +++ b/platform/commonUI/edit/bundle.js @@ -40,6 +40,10 @@ define([ "./src/policies/EditContextualActionPolicy", "./src/representers/EditRepresenter", "./src/representers/EditToolbarRepresenter", + "./src/capabilities/EditorCapability", + "./src/capabilities/TransactionDecorator", + "./src/services/TransactionService", + "./src/services/DirtyModelCache", "text!./res/templates/library.html", "text!./res/templates/edit-object.html", "text!./res/templates/edit-action-buttons.html", @@ -66,6 +70,10 @@ define([ EditContextualActionPolicy, EditRepresenter, EditToolbarRepresenter, + EditorCapability, + TransactionDecorator, + TransactionService, + DirtyModelCache, libraryTemplate, editObjectTemplate, editActionButtonsTemplate, @@ -261,6 +269,35 @@ define([ "template": topbarEditTemplate } ], + "components": [ + { + "type": "decorator", + "provides": "capabilityService", + "implementation": TransactionDecorator, + "depends": [ + "$q", + "transactionService", + "dirtyModelCache" + ] + }, + { + "type": "provider", + "provides": "transactionService", + "implementation": TransactionService, + "depends": [ + "$q", + "dirtyModelCache" + ] + }, + { + "type": "provider", + "provides": "dirtyModelCache", + "implementation": DirtyModelCache, + "depends": [ + "topic" + ] + } + ], "representers": [ { "implementation": EditRepresenter, @@ -282,7 +319,19 @@ define([ "key": "nonEditContextBlacklist", "value": ["copy", "follow", "properties", "move", "link", "remove", "locate"] } - ] + ], + "capabilities": [ + { + "key": "editor", + "name": "Editor Capability", + "description": "Provides transactional editing capabilities", + "implementation": EditorCapability, + "depends": [ + "transactionService", + "dirtyModelCache" + ] + } + ], } }); }); diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index ff9dfc19ed..6987e02eec 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -24,12 +24,10 @@ define( [], function () { - /** * Implements "save" and "cancel" as capabilities of * the object. In editing mode, user is seeing/using - * a copy of the object (an EditableDomainObject) - * which is disconnected from persistence; the Save + * a copy of the object which is disconnected from persistence; the Save * and Cancel actions can use this capability to * propagate changes from edit mode to the underlying * actual persistable object. @@ -41,99 +39,37 @@ define( * @memberof platform/commonUI/edit */ function EditorCapability( - persistenceCapability, - editableObject, - domainObject, - cache + transactionService, + dirtyModelCache, + domainObject ) { - this.editableObject = editableObject; + this.transactionService = transactionService; + this.dirtyModelCache = dirtyModelCache; this.domainObject = domainObject; - this.cache = cache; } - // Simulate Promise.resolve (or $q.when); the former - // causes a delayed reaction from Angular (since it - // does not trigger a digest) and the latter is not - // readily accessible, since we're a few classes - // removed from the layer which gets dependency - // injection. - function resolvePromise(value) { - return (value && value.then) ? value : { - then: function (callback) { - return resolvePromise(callback(value)); - } - }; - } + EditorCapability.prototype.edit = function () { + this.transactionService.startTransaction(); + this.getCapability('status').set('editing', true); + }; - /** - * Save any changes that have been made to this domain object - * (as well as to others that might have been retrieved and - * modified during the editing session) - * @param {boolean} nonrecursive if true, save only this - * object (and not other objects with associated changes) - * @returns {Promise} a promise that will be fulfilled after - * persistence has completed. - * @memberof platform/commonUI/edit.EditorCapability# - */ - EditorCapability.prototype.save = function (nonrecursive) { - var domainObject = this.domainObject, - editableObject = this.editableObject, - self = this, - cache = this.cache, - returnPromise; + EditorCapability.prototype.save = function () { + return this.transactionService.commit(); + }; - // Update the underlying, "real" domain object's model - // with changes made to the copy used for editing. - function doMutate() { - return domainObject.useCapability('mutation', function () { - return editableObject.getModel(); - }); - } - - // Persist the underlying domain object - function doPersist() { - return domainObject.getCapability('persistence').persist(); - } - - editableObject.getCapability("status").set("editing", false); - - if (nonrecursive) { - returnPromise = resolvePromise(doMutate()) - .then(doPersist) - .then(function(){ - self.cancel(); - }); - } else { - returnPromise = resolvePromise(cache.saveAll()); - } - //Return the original (non-editable) object - return returnPromise.then(function() { - return domainObject.getOriginalObject ? domainObject.getOriginalObject() : domainObject; + EditorCapability.prototype.cancel = function () { + var domainObject = this.domainObject; + return this.transactionService.cancel().then(function(){ + domainObject.getCapability("status").set("editing", false); }); }; - /** - * Cancel editing; Discard any changes that have been made to - * this domain object (as well as to others that might have - * been retrieved and modified during the editing session) - * @returns {Promise} a promise that will be fulfilled after - * cancellation has completed. - * @memberof platform/commonUI/edit.EditorCapability# - */ - EditorCapability.prototype.cancel = function () { - this.editableObject.getCapability("status").set("editing", false); - this.cache.markClean(); - return resolvePromise(undefined); + EditorCapability.prototype.dirty = function () { + return this.dirtyModelCache.isDirty(this.domainObject); }; - /** - * Check if there are any unsaved changes. - * @returns {boolean} true if there are unsaved changes - * @memberof platform/commonUI/edit.EditorCapability# - */ - EditorCapability.prototype.dirty = function () { - return this.cache.dirty(); - }; + //TODO: add 'appliesTo'. EditorCapability should not be available + // for objects that should not be edited return EditorCapability; } diff --git a/platform/commonUI/edit/src/capabilities/TransactionDecorator.js b/platform/commonUI/edit/src/capabilities/TransactionDecorator.js new file mode 100644 index 0000000000..f740dfc37b --- /dev/null +++ b/platform/commonUI/edit/src/capabilities/TransactionDecorator.js @@ -0,0 +1,82 @@ +/***************************************************************************** + * Open MCT Web, Copyright (c) 2014-2015, United States Government + * as represented by the Administrator of the National Aeronautics and Space + * Administration. All rights reserved. + * + * Open MCT Web is licensed under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * Open MCT Web includes source code licensed under additional open source + * licenses. See the Open Source Licenses file (LICENSES.md) included with + * this source code distribution or the Licensing information page available + * at runtime from the About dialog for additional information. + *****************************************************************************/ +/*global define*/ + +define( + ['./TransactionalPersistenceCapability'], + function (TransactionalPersistenceCapability) { + 'use strict'; + + /** + * Implements "save" and "cancel" as capabilities of + * the object. In editing mode, user is seeing/using + * a copy of the object (an EditableDomainObject) + * which is disconnected from persistence; the Save + * and Cancel actions can use this capability to + * propagate changes from edit mode to the underlying + * actual persistable object. + * + * Meant specifically for use by EditableDomainObject and the + * associated cache; the constructor signature is particular + * to a pattern used there and may contain unused arguments. + * @constructor + * @memberof platform/commonUI/edit + */ + function TransactionDecorator( + $q, + transactionService, + dirtyModelCache, + capabilityService + ) { + this.capabilityService = capabilityService; + this.transactionService = transactionService; + this.dirtyModelCache = dirtyModelCache; + this.$q = $q; + } + + /** + * Decorate PersistenceCapability to ignore persistence calls when a + * transaction is in progress. + */ + TransactionDecorator.prototype.getCapabilities = function (model) { + var capabilities = this.capabilityService.getCapabilities(model), + persistenceCapability = capabilities.persistence; + + capabilities.persistence = function (domainObject) { + var original = + (typeof persistenceCapability === 'function') ? + persistenceCapability(domainObject) : + persistenceCapability; + return new TransactionalPersistenceCapability( + self.$q, + self.transactionService, + self.dirtyModelCache, + original, + domainObject + ); + }; + return capabilities; + }; + + return TransactionDecorator; + } +); diff --git a/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js b/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js new file mode 100644 index 0000000000..55f7483e63 --- /dev/null +++ b/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js @@ -0,0 +1,73 @@ +/***************************************************************************** + * Open MCT Web, Copyright (c) 2014-2015, United States Government + * as represented by the Administrator of the National Aeronautics and Space + * Administration. All rights reserved. + * + * Open MCT Web is licensed under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * Open MCT Web includes source code licensed under additional open source + * licenses. See the Open Source Licenses file (LICENSES.md) included with + * this source code distribution or the Licensing information page available + * at runtime from the About dialog for additional information. + *****************************************************************************/ +/*global define*/ + +define( + [], + function () { + 'use strict'; + + function TransactionalPersistenceCapability( + $q, + transactionService, + dirtyModelCache, + persistenceCapability, + domainObject + ) { + this.transactionService = transactionService; + this.dirtyModelCache = dirtyModelCache; + this.persistenceCapability = Object.create(persistenceCapability); + this.domainObject = domainObject; + this.$q = $q; + } + + TransactionalPersistenceCapability.prototype.persist = function () { + var domainObject = this.domainObject, + dirtyModelCache = this.dirtyModelCache; + if (this.transactionService.isActive()) { + dirtyModelCache.markDirty(domainObject); + //Using $q here because need to return something + // from which 'catch' can be chained + return this.$q.when(true); + } else { + return this.persistenceCapability.persist().then(function (result) { + dirtyModelCache.markClean(domainObject); + return result; + }); + } + }; + + TransactionalPersistenceCapability.prototype.refresh = function () { + var dirtyModelCache = this.dirtyModelCache; + return this.persistenceCapability.refresh().then(function (result) { + dirtyModelCache.markClean(domainObject); + return result; + }); + }; + + TransactionalPersistenceCapability.prototype.getSpace = function () { + return this.persistenceCapability.getSpace(); + }; + + return TransactionalPersistenceCapability; + } +); diff --git a/platform/commonUI/edit/src/services/DirtyModelCache.js b/platform/commonUI/edit/src/services/DirtyModelCache.js new file mode 100644 index 0000000000..df070ab3ab --- /dev/null +++ b/platform/commonUI/edit/src/services/DirtyModelCache.js @@ -0,0 +1,47 @@ +/***************************************************************************** + * Open MCT Web, Copyright (c) 2014-2015, United States Government + * as represented by the Administrator of the National Aeronautics and Space + * Administration. All rights reserved. + * + * Open MCT Web is licensed under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * Open MCT Web includes source code licensed under additional open source + * licenses. See the Open Source Licenses file (LICENSES.md) included with + * this source code distribution or the Licensing information page available + * at runtime from the About dialog for additional information. + *****************************************************************************/ +/*global define*/ +define( + [], + function() { + function DirtyModelCache(topic) { + this.cache = {}; + } + + DirtyModelCache.prototype.get = function () { + return this.cache; + }; + + DirtyModelCache.prototype.isDirty = function (domainObject) { + return !!this.get(domainObject.getId()); + }; + + DirtyModelCache.prototype.markDirty = function (domainObject) { + this.cache[domainObject.getId()] = domainObject; + }; + + DirtyModelCache.prototype.markClean = function (domainObject) { + delete this.cache[domainObject.getId()]; + }; + + return DirtyModelCache; + }); \ No newline at end of file diff --git a/platform/commonUI/edit/src/services/TransactionService.js b/platform/commonUI/edit/src/services/TransactionService.js new file mode 100644 index 0000000000..d156b9ee2e --- /dev/null +++ b/platform/commonUI/edit/src/services/TransactionService.js @@ -0,0 +1,108 @@ +/***************************************************************************** + * Open MCT Web, Copyright (c) 2014-2015, United States Government + * as represented by the Administrator of the National Aeronautics and Space + * Administration. All rights reserved. + * + * Open MCT Web is licensed under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * Open MCT Web includes source code licensed under additional open source + * licenses. See the Open Source Licenses file (LICENSES.md) included with + * this source code distribution or the Licensing information page available + * at runtime from the About dialog for additional information. + *****************************************************************************/ +/*global define*/ +define( + [], + function() { + /** + * Implements an application-wide transaction state. Once a + * transaction is started, calls to PersistenceCapability.persist() + * will be deferred until a subsequent call to + * TransactionService.commit() is made. + * + * @param $q + * @constructor + */ + function TransactionService($q, dirtyModelCache) { + this.$q = $q; + this.transaction = false; + this.cache = dirtyModelCache; + } + + TransactionService.prototype.startTransaction = function () { + if (this.transaction) { + throw "Transaction in progress"; + } + this.transaction = true; + }; + + TransactionService.prototype.isActive = function () { + return this.transaction; + }; + + /** + * All persist calls deferred since the beginning of the transaction + * will be committed. Any failures will be reported via a promise + * rejection. + * @returns {*} + */ + TransactionService.prototype.commit = function () { + var self = this; + cache = this.cache.get(); + + function keyToObject(key) { + return cache[key]; + } + + function objectToPromise(object) { + return object.getCapability('persistence').persist(); + } + + return this.$q.all( + Object.keys(this.cache) + .map(keyToObject) + .map(objectToPromise)) + .then(function () { + self.transaction = false; + }); + }; + + /** + * Cancel the current transaction, replacing any dirty objects from + * persistence. Not a true rollback, as it cannot be used to undo any + * persist calls that were successful in the event one of a batch of + * persists failing. + * + * @returns {*} + */ + TransactionService.prototype.cancel = function () { + var self = this, + cache = this.cache.get(); + + function keyToObject(key) { + return cache[key]; + } + + function objectToPromise(object) { + return object.getCapability('persistence').refresh(); + } + + return this.$q.all(Object.keys(cache) + .map(keyToObject) + .map(objectToPromise)) + .then(function () { + self.transaction = false; + }); + }; + + return TransactionService; +}); From bd686790dc66f1385568fa9f4ec16c5f4673d06e Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 12 May 2016 16:03:19 -0700 Subject: [PATCH 69/85] Resolved merge conflicts --- .../browse/src/creation/CreateAction.js | 22 +++++-------- platform/commonUI/edit/bundle.js | 3 +- .../commonUI/edit/src/actions/CancelAction.js | 30 +++++------------ .../commonUI/edit/src/actions/EditAction.js | 21 +++--------- .../edit/src/capabilities/EditorCapability.js | 10 ++++-- .../src/capabilities/TransactionDecorator.js | 3 +- .../TransactionalPersistenceCapability.js | 4 ++- .../edit/src/services/DirtyModelCache.js | 2 +- .../edit/src/services/TransactionService.js | 9 +++-- .../src/capabilities/PersistenceCapability.js | 7 ++-- .../src/gestures/DropGesture.js | 33 +++++++------------ 11 files changed, 53 insertions(+), 91 deletions(-) diff --git a/platform/commonUI/browse/src/creation/CreateAction.js b/platform/commonUI/browse/src/creation/CreateAction.js index 00b7c09fa4..e9029c4aa3 100644 --- a/platform/commonUI/browse/src/creation/CreateAction.js +++ b/platform/commonUI/browse/src/creation/CreateAction.js @@ -24,11 +24,8 @@ * Module defining CreateAction. Created by vwoeltje on 11/10/14. */ define( - [ - './CreateWizard', - '../../../edit/src/objects/EditableDomainObject' - ], - function (CreateWizard, EditableDomainObject) { + [], + function () { /** * The Create Action is performed to create new instances of @@ -86,22 +83,19 @@ define( CreateAction.prototype.perform = function () { var newModel = this.type.getInitialModel(), parentObject = this.navigationService.getNavigation(), - newObject, - editableObject; + newObject; newModel.type = this.type.getKey(); newObject = parentObject.useCapability('instantiation', newModel); - editableObject = new EditableDomainObject(newObject, this.$q); - editableObject.setOriginalObject(parentObject); - editableObject.getCapability('status').set('editing', true); - editableObject.useCapability('mutation', function(model){ + newObject.useCapability('mutation', function(model){ model.location = parentObject.getId(); }); - if (countEditableViews(editableObject) > 0 && editableObject.hasCapability('composition')) { - this.navigationService.setNavigation(editableObject); + if (countEditableViews(newObject) > 0 && newObject.hasCapability('composition')) { + this.navigationService.setNavigation(newObject); + newObject.getCapability("action").perform("edit"); } else { - return editableObject.getCapability('action').perform('save'); + return newObject.getCapability('action').perform('save'); } }; diff --git a/platform/commonUI/edit/bundle.js b/platform/commonUI/edit/bundle.js index b59b19d54c..b710952ec2 100644 --- a/platform/commonUI/edit/bundle.js +++ b/platform/commonUI/edit/bundle.js @@ -201,7 +201,8 @@ define([ "description": "Discard changes made to these objects.", "depends": [ "$injector", - "navigationService" + "navigationService", + "$window" ] } ], diff --git a/platform/commonUI/edit/src/actions/CancelAction.js b/platform/commonUI/edit/src/actions/CancelAction.js index da3fea8046..937b339085 100644 --- a/platform/commonUI/edit/src/actions/CancelAction.js +++ b/platform/commonUI/edit/src/actions/CancelAction.js @@ -44,30 +44,16 @@ define( * cancellation has completed */ CancelAction.prototype.perform = function () { - var domainObject = this.domainObject, - self = this; + var domainObject = this.domainObject; - // Look up the object's "editor.completion" capability; - // this is introduced by EditableDomainObject which is - // used to insulate underlying objects from changes made - // during editing. - function getEditorCapability() { - return domainObject.getCapability("editor"); + function returnToBrowse () { + var parent; + domainObject.getCapability("location").getOriginal().then(function (original) { + parent = original.getCapability("context").getParent(); + parent.getCapability("action").perform("navigate"); + }); } - - // Invoke any save behavior introduced by the editor.completion - // capability. - function doCancel(editor) { - return editor.cancel(); - } - - //Discard current 'editable' object, and retrieve original - // un-edited object. - function returnToBrowse() { - return self.navigationService.setNavigation(self.domainObject.getOriginalObject()); - } - - return doCancel(getEditorCapability()) + return this.domainObject.getCapability("editor").cancel() .then(returnToBrowse); }; diff --git a/platform/commonUI/edit/src/actions/EditAction.js b/platform/commonUI/edit/src/actions/EditAction.js index 17fd34156c..068acfa6b7 100644 --- a/platform/commonUI/edit/src/actions/EditAction.js +++ b/platform/commonUI/edit/src/actions/EditAction.js @@ -71,25 +71,12 @@ define( */ EditAction.prototype.perform = function () { var self = this; - if (!this.domainObject.hasCapability("editor")) { - //TODO: This is only necessary because the drop gesture is - // wrapping the object itself, need to refactor this later. - // All responsibility for switching into edit mode should be - // in the edit action, and not duplicated in the gesture - this.domainObject = new EditableDomainObject(this.domainObject, this.$q); - } - this.navigationService.setNavigation(this.domainObject); - this.domainObject.getCapability('status').set('editing', true); - - //Register a listener to automatically cancel this edit action - //if the user navigates away from this object. - function cancelEditing(navigatedTo){ - if (!navigatedTo || navigatedTo.getId() !== self.domainObject.getId()) { - self.domainObject.getCapability('editor').cancel(); - self.navigationService.removeListener(cancelEditing); - } + function cancelEditing(){ + self.domainObject.getCapability('editor').cancel(); + self.navigationService.removeListener(cancelEditing); } this.navigationService.addListener(cancelEditing); + this.domainObject.useCapability("editor"); }; /** diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index 6987e02eec..98a08d5643 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -50,17 +50,23 @@ define( EditorCapability.prototype.edit = function () { this.transactionService.startTransaction(); - this.getCapability('status').set('editing', true); + this.domainObject.getCapability('status').set('editing', true); }; EditorCapability.prototype.save = function () { - return this.transactionService.commit(); + var domainObject = this.domainObject; + return this.transactionService.commit().then(function() { + domainObject.getCapability('status').set('editing', false); + }); }; + EditorCapability.prototype.invoke = EditorCapability.prototype.edit; + EditorCapability.prototype.cancel = function () { 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/capabilities/TransactionDecorator.js b/platform/commonUI/edit/src/capabilities/TransactionDecorator.js index f740dfc37b..76213c2ac5 100644 --- a/platform/commonUI/edit/src/capabilities/TransactionDecorator.js +++ b/platform/commonUI/edit/src/capabilities/TransactionDecorator.js @@ -58,7 +58,8 @@ define( * transaction is in progress. */ TransactionDecorator.prototype.getCapabilities = function (model) { - var capabilities = this.capabilityService.getCapabilities(model), + var self = this, + capabilities = this.capabilityService.getCapabilities(model), persistenceCapability = capabilities.persistence; capabilities.persistence = function (domainObject) { diff --git a/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js b/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js index 55f7483e63..28d3f76164 100644 --- a/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js +++ b/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js @@ -57,7 +57,9 @@ define( }; TransactionalPersistenceCapability.prototype.refresh = function () { - var dirtyModelCache = this.dirtyModelCache; + var domainObject = this.domainObject, + dirtyModelCache = this.dirtyModelCache; + return this.persistenceCapability.refresh().then(function (result) { dirtyModelCache.markClean(domainObject); return result; diff --git a/platform/commonUI/edit/src/services/DirtyModelCache.js b/platform/commonUI/edit/src/services/DirtyModelCache.js index df070ab3ab..0439efc6fc 100644 --- a/platform/commonUI/edit/src/services/DirtyModelCache.js +++ b/platform/commonUI/edit/src/services/DirtyModelCache.js @@ -32,7 +32,7 @@ define( }; DirtyModelCache.prototype.isDirty = function (domainObject) { - return !!this.get(domainObject.getId()); + return !!this.cache[domainObject.getId()]; }; DirtyModelCache.prototype.markDirty = function (domainObject) { diff --git a/platform/commonUI/edit/src/services/TransactionService.js b/platform/commonUI/edit/src/services/TransactionService.js index d156b9ee2e..f9456cad77 100644 --- a/platform/commonUI/edit/src/services/TransactionService.js +++ b/platform/commonUI/edit/src/services/TransactionService.js @@ -39,9 +39,8 @@ define( } TransactionService.prototype.startTransaction = function () { - if (this.transaction) { - throw "Transaction in progress"; - } + if (this.transaction) + console.error("Transaction already in progress") this.transaction = true; }; @@ -68,7 +67,7 @@ define( } return this.$q.all( - Object.keys(this.cache) + Object.keys(cache) .map(keyToObject) .map(objectToPromise)) .then(function () { @@ -93,7 +92,7 @@ define( } function objectToPromise(object) { - return object.getCapability('persistence').refresh(); + return self.$q.when(object.getModel().persisted && object.getCapability('persistence').refresh()); } return this.$q.all(Object.keys(cache) diff --git a/platform/core/src/capabilities/PersistenceCapability.js b/platform/core/src/capabilities/PersistenceCapability.js index 4e4e753e0c..07d73a0548 100644 --- a/platform/core/src/capabilities/PersistenceCapability.js +++ b/platform/core/src/capabilities/PersistenceCapability.js @@ -168,13 +168,10 @@ define( }, modified); } - // Only update if we don't have unsaved changes - return (model.modified === model.persisted) ? - this.persistenceService.readObject( + return this.persistenceService.readObject( this.getSpace(), this.domainObject.getId() - ).then(updateModel) : - fastPromise(false); + ).then(updateModel); }; /** diff --git a/platform/representation/src/gestures/DropGesture.js b/platform/representation/src/gestures/DropGesture.js index 76df23b043..c25899b9db 100644 --- a/platform/representation/src/gestures/DropGesture.js +++ b/platform/representation/src/gestures/DropGesture.js @@ -24,9 +24,8 @@ * Module defining DropGesture. Created by vwoeltje on 11/17/14. */ define( - ['./GestureConstants', - '../../../commonUI/edit/src/objects/EditableDomainObject'], - function (GestureConstants, EditableDomainObject) { + ['./GestureConstants'], + function (GestureConstants) { /** * A DropGesture adds and maintains event handlers upon an element @@ -41,7 +40,6 @@ define( */ function DropGesture(dndService, $q, navigationService, instantiate, typeService, element, domainObject) { var actionCapability = domainObject.getCapability('action'), - editableDomainObject, scope = element.scope && element.scope(), action; // Action for the drop, when it occurs @@ -66,23 +64,13 @@ define( x: event.pageX - rect.left, y: event.pageY - rect.top }, - editableDomainObject + domainObject ); } } function dragOver(e) { - //Refresh domain object on each dragOver to catch external - // updates to the model - //Don't use EditableDomainObject for folders, allow immediate persistence - if (domainObject.hasCapability('editor') || - domainObject.getModel().type==='folder') { - editableDomainObject = domainObject; - } else { - editableDomainObject = new EditableDomainObject(domainObject, $q); - } - - actionCapability = editableDomainObject.getCapability('action'); + actionCapability = domainObject.getCapability('action'); var event = (e || {}).originalEvent || e, selectedObject = dndService.getData( @@ -108,18 +96,19 @@ define( function drop(e) { var event = (e || {}).originalEvent || e, id = event.dataTransfer.getData(GestureConstants.MCT_DRAG_TYPE), - domainObjectType = editableDomainObject.getModel().type; + domainObjectType = domainObject.getModel().type; // Handle the drop; add the dropped identifier to the // destination domain object's composition, and persist // the change. if (id) { e.preventDefault(); - $q.when(action && action.perform()).then(function (result) { - //Don't go into edit mode for folders - if (domainObjectType!=='folder') { - editableDomainObject.getCapability('action').perform('edit'); - } + + if (domainObjectType!=='folder') { + domainObject.getCapability('action').perform('edit'); + } + + $q.when(action && action.perform()).then(function () { broadcastDrop(id, event); }); } From cf9eb3f602dfef420235986583dcbac52034b485 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 12 May 2016 16:05:27 -0700 Subject: [PATCH 70/85] Resolved Merge conflicts, removed previously deleted files --- platform/commonUI/edit/bundle.js | 6 +- .../commonUI/edit/src/actions/CancelAction.js | 6 +- .../commonUI/edit/src/actions/EditAction.js | 4 +- .../commonUI/edit/src/actions/SaveAction.js | 4 +- .../capabilities/EditableActionCapability.js | 55 ------ .../EditableCompositionCapability.js | 58 ------ .../capabilities/EditableContextCapability.js | 76 -------- .../EditableInstantiationCapability.js | 58 ------ .../capabilities/EditableLookupCapability.js | 123 ------------ .../EditablePersistenceCapability.js | 66 ------- .../EditableRelationshipCapability.js | 58 ------ .../edit/src/capabilities/EditorCapability.js | 14 -- .../src/capabilities/TransactionDecorator.js | 15 -- .../TransactionalPersistenceCapability.js | 2 +- .../edit/src/objects/EditableDomainObject.js | 130 ------------- .../src/objects/EditableDomainObjectCache.js | 170 ----------------- .../edit/src/objects/EditableModelCache.js | 60 ------ .../edit/src/services/TransactionService.js | 11 ++ .../EditableCompositionCapabilitySpec.js | 73 -------- .../EditableContextCapabilitySpec.js | 87 --------- .../EditableLookupCapabilitySpec.js | 144 -------------- .../EditablePersistenceCapabilitySpec.js | 94 ---------- .../EditableRelationshipCapabilitySpec.js | 73 -------- .../objects/EditableDomainObjectCacheSpec.js | 177 ------------------ .../test/objects/EditableDomainObjectSpec.js | 35 ---- .../test/objects/EditableModelCacheSpec.js | 79 -------- .../swimlane/TimelineSwimlaneDropHandler.js | 14 +- 27 files changed, 28 insertions(+), 1664 deletions(-) delete mode 100644 platform/commonUI/edit/src/capabilities/EditableActionCapability.js delete mode 100644 platform/commonUI/edit/src/capabilities/EditableCompositionCapability.js delete mode 100644 platform/commonUI/edit/src/capabilities/EditableContextCapability.js delete mode 100644 platform/commonUI/edit/src/capabilities/EditableInstantiationCapability.js delete mode 100644 platform/commonUI/edit/src/capabilities/EditableLookupCapability.js delete mode 100644 platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js delete mode 100644 platform/commonUI/edit/src/capabilities/EditableRelationshipCapability.js delete mode 100644 platform/commonUI/edit/src/objects/EditableDomainObject.js delete mode 100644 platform/commonUI/edit/src/objects/EditableDomainObjectCache.js delete mode 100644 platform/commonUI/edit/src/objects/EditableModelCache.js delete mode 100644 platform/commonUI/edit/test/capabilities/EditableCompositionCapabilitySpec.js delete mode 100644 platform/commonUI/edit/test/capabilities/EditableContextCapabilitySpec.js delete mode 100644 platform/commonUI/edit/test/capabilities/EditableLookupCapabilitySpec.js delete mode 100644 platform/commonUI/edit/test/capabilities/EditablePersistenceCapabilitySpec.js delete mode 100644 platform/commonUI/edit/test/capabilities/EditableRelationshipCapabilitySpec.js delete mode 100644 platform/commonUI/edit/test/objects/EditableDomainObjectCacheSpec.js delete mode 100644 platform/commonUI/edit/test/objects/EditableDomainObjectSpec.js delete mode 100644 platform/commonUI/edit/test/objects/EditableModelCacheSpec.js diff --git a/platform/commonUI/edit/bundle.js b/platform/commonUI/edit/bundle.js index b710952ec2..35818bd477 100644 --- a/platform/commonUI/edit/bundle.js +++ b/platform/commonUI/edit/bundle.js @@ -199,11 +199,7 @@ define([ "implementation": CancelAction, "name": "Cancel", "description": "Discard changes made to these objects.", - "depends": [ - "$injector", - "navigationService", - "$window" - ] + "depends": [] } ], "policies": [ diff --git a/platform/commonUI/edit/src/actions/CancelAction.js b/platform/commonUI/edit/src/actions/CancelAction.js index 937b339085..550516360a 100644 --- a/platform/commonUI/edit/src/actions/CancelAction.js +++ b/platform/commonUI/edit/src/actions/CancelAction.js @@ -31,10 +31,8 @@ define( * @memberof platform/commonUI/edit * @implements {Action} */ - function CancelAction($injector, navigationService, context) { + function CancelAction(context) { this.domainObject = context.domainObject; - this.navigationService = navigationService; - this.objectService = $injector.get('objectService'); } /** @@ -66,7 +64,7 @@ define( CancelAction.appliesTo = function (context) { var domainObject = (context || {}).domainObject; return domainObject !== undefined && - domainObject.hasCapability("editor"); + domainObject.getCapability("status").get("editing"); }; return CancelAction; diff --git a/platform/commonUI/edit/src/actions/EditAction.js b/platform/commonUI/edit/src/actions/EditAction.js index 068acfa6b7..5931a02a52 100644 --- a/platform/commonUI/edit/src/actions/EditAction.js +++ b/platform/commonUI/edit/src/actions/EditAction.js @@ -24,8 +24,8 @@ * Module defining EditAction. Created by vwoeltje on 11/14/14. */ define( - ['../objects/EditableDomainObject'], - function (EditableDomainObject) { + [], + function () { // A no-op action to return in the event that the action cannot // be completed. diff --git a/platform/commonUI/edit/src/actions/SaveAction.js b/platform/commonUI/edit/src/actions/SaveAction.js index 3c5bb86e77..cf8675682e 100644 --- a/platform/commonUI/edit/src/actions/SaveAction.js +++ b/platform/commonUI/edit/src/actions/SaveAction.js @@ -85,8 +85,8 @@ define( SaveAction.appliesTo = function (context) { var domainObject = (context || {}).domainObject; return domainObject !== undefined && - domainObject.hasCapability("editor") && - domainObject.getModel().persisted !== undefined; + domainObject.getModel().persisted !== undefined && + domainObject.getCapability("status").get("editing"); }; return SaveAction; diff --git a/platform/commonUI/edit/src/capabilities/EditableActionCapability.js b/platform/commonUI/edit/src/capabilities/EditableActionCapability.js deleted file mode 100644 index bdfa4d3f59..0000000000 --- a/platform/commonUI/edit/src/capabilities/EditableActionCapability.js +++ /dev/null @@ -1,55 +0,0 @@ -/***************************************************************************** - * 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( - function () { - var DISALLOWED_ACTIONS = ["move", "copy", "link", "window", "follow"]; - /** - * Editable Action Capability. Overrides the action capability - * normally exhibited by a domain object and filters out certain - * actions not applicable when an object is in edit mode. - * - * Meant specifically for use by EditableDomainObject and the - * associated cache; the constructor signature is particular - * to a pattern used there and may contain unused arguments. - * @constructor - * @memberof platform/commonUI/edit - * @implements {PersistenceCapability} - */ - function EditableActionCapability( - actionCapability - ) { - var action = Object.create(actionCapability); - - action.getActions = function(domainObject) { - return actionCapability.getActions(domainObject).filter(function(action){ - return DISALLOWED_ACTIONS.indexOf(action.getMetadata().key) === -1; - }); - }; - - return action; - } - - return EditableActionCapability; - } -); diff --git a/platform/commonUI/edit/src/capabilities/EditableCompositionCapability.js b/platform/commonUI/edit/src/capabilities/EditableCompositionCapability.js deleted file mode 100644 index 343c6a03a2..0000000000 --- a/platform/commonUI/edit/src/capabilities/EditableCompositionCapability.js +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - * 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( - ['./EditableLookupCapability'], - function (EditableLookupCapability) { - - /** - * Wrapper for the "composition" capability; - * ensures that any domain objects reachable in Edit mode - * are also wrapped as EditableDomainObjects. - * - * Meant specifically for use by EditableDomainObject and the - * associated cache; the constructor signature is particular - * to a pattern used there and may contain unused arguments. - * @constructor - * @memberof platform/commonUI/edit - * @implements {CompositionCapability} - */ - return function EditableCompositionCapability( - contextCapability, - editableObject, - domainObject, - cache - ) { - // This is a "lookup" style capability (it looks up other - // domain objects), but we do not want to return the same - // specific value every time (composition may change) - return new EditableLookupCapability( - contextCapability, - editableObject, - domainObject, - cache, - false // Not idempotent - ); - }; - } -); diff --git a/platform/commonUI/edit/src/capabilities/EditableContextCapability.js b/platform/commonUI/edit/src/capabilities/EditableContextCapability.js deleted file mode 100644 index d20971fb04..0000000000 --- a/platform/commonUI/edit/src/capabilities/EditableContextCapability.js +++ /dev/null @@ -1,76 +0,0 @@ -/***************************************************************************** - * 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( - ['./EditableLookupCapability'], - function (EditableLookupCapability) { - - /** - * Wrapper for the "context" capability; - * ensures that any domain objects reachable in Edit mode - * are also wrapped as EditableDomainObjects. - * - * Meant specifically for use by EditableDomainObject and the - * associated cache; the constructor signature is particular - * to a pattern used there and may contain unused arguments. - * @constructor - * @memberof platform/commonUI/edit - * @implements {ContextCapability} - */ - return function EditableContextCapability( - contextCapability, - editableObject, - domainObject, - cache - ) { - // This is a "lookup" style capability (it looks up other - // domain objects), and it should be idempotent - var capability = new EditableLookupCapability( - contextCapability, - editableObject, - domainObject, - cache, - true // Idempotent - ), - // Track the real root object for the Elements pane - trueRoot = capability.getRoot(); - - // Provide access to the real root, for the Elements pane. - capability.getTrueRoot = function () { - return trueRoot; - }; - - // Hide ancestry after the root of this subgraph - if (cache.isRoot(domainObject)) { - capability.getRoot = function () { - return editableObject; - }; - capability.getPath = function () { - return [editableObject]; - }; - } - - return capability; - }; - } -); diff --git a/platform/commonUI/edit/src/capabilities/EditableInstantiationCapability.js b/platform/commonUI/edit/src/capabilities/EditableInstantiationCapability.js deleted file mode 100644 index 4376a9310e..0000000000 --- a/platform/commonUI/edit/src/capabilities/EditableInstantiationCapability.js +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - * 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( - ['./EditableLookupCapability'], - function (EditableLookupCapability) { - - /** - * Wrapper for the "instantiation" capability; - * ensures that any domain objects instantiated in Edit mode - * are also wrapped as EditableDomainObjects. - * - * Meant specifically for use by EditableDomainObject and the - * associated cache; the constructor signature is particular - * to a pattern used there and may contain unused arguments. - * @constructor - * @memberof platform/commonUI/edit - * @implements {CompositionCapability} - */ - return function EditableInstantiationCapability( - contextCapability, - editableObject, - domainObject, - cache - ) { - // This is a "lookup" style capability (it looks up other - // domain objects), but we do not want to return the same - // specific value every time (composition may change) - return new EditableLookupCapability( - contextCapability, - editableObject, - domainObject, - cache, - false // Not idempotent - ); - }; - } -); diff --git a/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js b/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js deleted file mode 100644 index 0abde97c5a..0000000000 --- a/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js +++ /dev/null @@ -1,123 +0,0 @@ -/***************************************************************************** - * 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( - [], - function () { - /*jshint forin:false */ - /** - * Wrapper for both "context" and "composition" capabilities; - * ensures that any domain objects reachable in Edit mode - * are also wrapped as EditableDomainObjects. - * - * Meant specifically for use by EditableDomainObject and the - * associated cache; the constructor signature is particular - * to a pattern used there and may contain unused arguments. - * @constructor - * @memberof platform/commonUI/edit - */ - return function EditableLookupCapability( - contextCapability, - editableObject, - domainObject, - cache, - idempotent - ) { - var capability = Object.create(contextCapability), - method; - - // Check for domain object interface. If something has these - // three methods, we assume it's a domain object. - function isDomainObject(obj) { - return obj !== undefined && - typeof obj.getId === 'function' && - typeof obj.getModel === 'function' && - typeof obj.getCapability === 'function'; - } - - // Check an object returned by the wrapped capability; if it - // is a domain object, we want to make it editable and/or get - // it from the cache of editable domain objects. This will - // prevent changes made in edit mode from modifying the actual - // underlying domain object. - function makeEditableObject(obj) { - return isDomainObject(obj) ? - cache.getEditableObject(obj) : - obj; - } - - // Wrap a returned value (see above); if it's an array, wrap - // all elements. - function makeEditable(returnValue) { - return Array.isArray(returnValue) ? - returnValue.map(makeEditableObject) : - makeEditableObject(returnValue); - } - - // Wrap a returned value (see above); if it's a promise, wrap - // the resolved value. - function wrapResult(result) { - return (result && result.then) ? // promise-like - result.then(makeEditable) : - makeEditable(result); - } - - // Return a wrapped version of a function, which ensures - // all results are editable domain objects. - function wrapFunction(fn) { - return function () { - return wrapResult(contextCapability[fn].apply( - capability, - arguments - )); - }; - } - - // Wrap a method such that it only delegates once. - function oneTimeFunction(fn) { - return function () { - var result = wrapFunction(fn).apply(this, arguments); - capability[fn] = function () { - return result; - }; - return result; - }; - } - - // Wrap a method of this capability - function wrapMethod(fn) { - if (typeof capability[fn] === 'function') { - capability[fn] = - (idempotent ? oneTimeFunction : wrapFunction)(fn); - } - } - - // Wrap all methods; return only editable domain objects. - for (method in contextCapability) { - wrapMethod(method); - } - - return capability; - }; - } -); diff --git a/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js b/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js deleted file mode 100644 index e6c32e2bf4..0000000000 --- a/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * 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( - function () { - - /** - * Editable Persistence Capability. Overrides the persistence capability - * normally exhibited by a domain object to ensure that changes made - * during edit mode are not immediately stored to the database or other - * backing storage. - * - * Meant specifically for use by EditableDomainObject and the - * associated cache; the constructor signature is particular - * to a pattern used there and may contain unused arguments. - * @constructor - * @memberof platform/commonUI/edit - * @implements {PersistenceCapability} - */ - function EditablePersistenceCapability( - persistenceCapability, - editableObject, - domainObject, - cache - ) { - var persistence = Object.create(persistenceCapability); - - // Simply trigger refresh of in-view objects; do not - // write anything to database. - persistence.persist = function () { - return cache.markDirty(editableObject); - }; - - // Delegate refresh to the original object; this avoids refreshing - // the editable instance of the object, and ensures that refresh - // correctly targets the "real" version of the object. - persistence.refresh = function () { - return domainObject.getCapability('persistence').refresh(); - }; - - return persistence; - } - - return EditablePersistenceCapability; - } -); diff --git a/platform/commonUI/edit/src/capabilities/EditableRelationshipCapability.js b/platform/commonUI/edit/src/capabilities/EditableRelationshipCapability.js deleted file mode 100644 index af8c142338..0000000000 --- a/platform/commonUI/edit/src/capabilities/EditableRelationshipCapability.js +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - * 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( - ['./EditableLookupCapability'], - function (EditableLookupCapability) { - - /** - * Wrapper for the "relationship" capability; - * ensures that any domain objects reachable in Edit mode - * are also wrapped as EditableDomainObjects. - * - * Meant specifically for use by EditableDomainObject and the - * associated cache; the constructor signature is particular - * to a pattern used there and may contain unused arguments. - * @constructor - * @memberof platform/commonUI/edit - * @implements {RelationshipCapability} - */ - return function EditableRelationshipCapability( - relationshipCapability, - editableObject, - domainObject, - cache - ) { - // This is a "lookup" style capability (it looks up other - // domain objects), but we do not want to return the same - // specific value every time (composition may change) - return new EditableLookupCapability( - relationshipCapability, - editableObject, - domainObject, - cache, - false // Not idempotent - ); - }; - } -); diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index 98a08d5643..8f40508069 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -24,20 +24,6 @@ define( [], function () { - /** - * Implements "save" and "cancel" as capabilities of - * the object. In editing mode, user is seeing/using - * a copy of the object which is disconnected from persistence; the Save - * and Cancel actions can use this capability to - * propagate changes from edit mode to the underlying - * actual persistable object. - * - * Meant specifically for use by EditableDomainObject and the - * associated cache; the constructor signature is particular - * to a pattern used there and may contain unused arguments. - * @constructor - * @memberof platform/commonUI/edit - */ function EditorCapability( transactionService, dirtyModelCache, diff --git a/platform/commonUI/edit/src/capabilities/TransactionDecorator.js b/platform/commonUI/edit/src/capabilities/TransactionDecorator.js index 76213c2ac5..6121ed6faa 100644 --- a/platform/commonUI/edit/src/capabilities/TransactionDecorator.js +++ b/platform/commonUI/edit/src/capabilities/TransactionDecorator.js @@ -26,21 +26,6 @@ define( function (TransactionalPersistenceCapability) { 'use strict'; - /** - * Implements "save" and "cancel" as capabilities of - * the object. In editing mode, user is seeing/using - * a copy of the object (an EditableDomainObject) - * which is disconnected from persistence; the Save - * and Cancel actions can use this capability to - * propagate changes from edit mode to the underlying - * actual persistable object. - * - * Meant specifically for use by EditableDomainObject and the - * associated cache; the constructor signature is particular - * to a pattern used there and may contain unused arguments. - * @constructor - * @memberof platform/commonUI/edit - */ function TransactionDecorator( $q, transactionService, diff --git a/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js b/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js index 28d3f76164..b282c40e1f 100644 --- a/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js +++ b/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js @@ -43,7 +43,7 @@ define( TransactionalPersistenceCapability.prototype.persist = function () { var domainObject = this.domainObject, dirtyModelCache = this.dirtyModelCache; - if (this.transactionService.isActive()) { + if (this.transactionService.isActive() && !this.transactionService.isCommitting()) { dirtyModelCache.markDirty(domainObject); //Using $q here because need to return something // from which 'catch' can be chained diff --git a/platform/commonUI/edit/src/objects/EditableDomainObject.js b/platform/commonUI/edit/src/objects/EditableDomainObject.js deleted file mode 100644 index 1eedcd563b..0000000000 --- a/platform/commonUI/edit/src/objects/EditableDomainObject.js +++ /dev/null @@ -1,130 +0,0 @@ -/***************************************************************************** - * 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. - *****************************************************************************/ - -/** - * Defines EditableDomainObject, which wraps domain objects - * such that user code may work with and mutate a copy of the - * domain object model; these changes may then be propagated - * up to the real domain object (or not) by way of invoking - * save or cancel behaviors of the "editor.completion" - * capability (a capability intended as internal to edit - * mode; invoked by way of the Save and Cancel actions.) - */ -define( - [ - '../capabilities/EditablePersistenceCapability', - '../capabilities/EditableContextCapability', - '../capabilities/EditableCompositionCapability', - '../capabilities/EditableRelationshipCapability', - '../capabilities/EditableInstantiationCapability', - '../capabilities/EditorCapability', - '../capabilities/EditableActionCapability', - './EditableDomainObjectCache' - ], - function ( - EditablePersistenceCapability, - EditableContextCapability, - EditableCompositionCapability, - EditableRelationshipCapability, - EditableInstantiationCapability, - EditorCapability, - EditableActionCapability, - EditableDomainObjectCache - ) { - - var capabilityFactories = { - persistence: EditablePersistenceCapability, - context: EditableContextCapability, - composition: EditableCompositionCapability, - relationship: EditableRelationshipCapability, - instantiation: EditableInstantiationCapability, - editor: EditorCapability - }; - - // Handle special case where "editor.completion" wraps persistence - // (other capability overrides wrap capabilities of the same type.) - function getDelegateArguments(name, args) { - return name === "editor" ? ['persistence'] : args; - } - - /** - * An EditableDomainObject overrides capabilities - * which need to behave differently in edit mode, - * and provides a "working copy" of the object's - * model to allow changes to be easily cancelled. - * @constructor - * @memberof platform/commonUI/edit - * @implements {DomainObject} - */ - function EditableDomainObject(domainObject, $q) { - // The cache will hold all domain objects reached from - // the initial EditableDomainObject; this ensures that - // different versions of the same editable domain object - // are not shown in different sections of the same Edit - // UI, which might thereby fall out of sync. - var cache, - originalObject = domainObject, - cachedObject; - - // Constructor for EditableDomainObject, which adheres - // to the same shared cache. - function EditableDomainObjectImpl(domainObject, model) { - var editableObject = Object.create(domainObject); - - // Only provide the cloned model. - editableObject.getModel = function () { return model; }; - - // Override certain capabilities - editableObject.getCapability = function (name) { - var delegateArguments = getDelegateArguments(name, arguments), - capability = domainObject.getCapability.apply( - this, - delegateArguments - ), - Factory = capabilityFactories[name]; - - return (Factory && capability) ? - new Factory(capability, editableObject, domainObject, cache) : - capability; - }; - - - editableObject.setOriginalObject = function(object) { - originalObject = object; - }; - - editableObject.getOriginalObject = function() { - return originalObject; - }; - - return editableObject; - } - - cache = new EditableDomainObjectCache(EditableDomainObjectImpl, $q); - cachedObject = cache.getEditableObject(domainObject); - - return cachedObject; - } - - return EditableDomainObject; - } -); diff --git a/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js b/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js deleted file mode 100644 index 774e562e61..0000000000 --- a/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js +++ /dev/null @@ -1,170 +0,0 @@ -/***************************************************************************** - * 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. - *****************************************************************************/ - - -/* - * An editable domain object cache stores domain objects that have been - * made editable, in a group that can be saved all-at-once. This supports - * Edit mode, which is launched for a specific object but may contain - * changes across many objects. - * - * Editable domain objects have certain specific capabilities overridden - * to ensure that changes made while in edit mode do not propagate up - * to the objects used in browse mode (or to persistence) until the user - * initiates a Save. - */ -define( - ["./EditableModelCache"], - function (EditableModelCache) { - - /** - * Construct a new cache for editable domain objects. This can be used - * to get-or-create editable objects, particularly to support wrapping - * of objects retrieved via composition or context capabilities as - * editable domain objects. - * - * @param {Constructor} EditableDomainObject a - * constructor function which takes a regular domain object as - * an argument, and returns an editable domain object as its - * result. - * @param $q Angular's $q, for promise handling - * @memberof platform/commonUI/edit - * @constructor - */ - function EditableDomainObjectCache(EditableDomainObject, $q) { - this.cache = new EditableModelCache(); - this.dirtyObjects = {}; - this.root = undefined; - this.$q = $q; - this.EditableDomainObject = EditableDomainObject; - } - - /** - * Wrap this domain object in an editable form, or pull such - * an object from the cache if one already exists. - * - * @param {DomainObject} domainObject the regular domain object - * @returns {DomainObject} the domain object in an editable form - */ - EditableDomainObjectCache.prototype.getEditableObject = function (domainObject) { - var type = domainObject.getCapability('type'), - EditableDomainObject = this.EditableDomainObject, - editableObject; - - // Track the top-level domain object; this will have - // some special behavior for its context capability. - this.root = this.root || domainObject; - - // Avoid double-wrapping (WTD-1017) - if (domainObject.hasCapability('editor')) { - return domainObject; - } - - // Don't bother wrapping non-editable objects - if (!type || !type.hasFeature('creation')) { - return domainObject; - } - - // Provide an editable form of the object - editableObject = new EditableDomainObject( - domainObject, - this.cache.getCachedModel(domainObject) - ); - - return editableObject; - }; - - /** - * Check if a domain object is (effectively) the top-level - * object in this editable subgraph. - * @returns {boolean} true if it is the root - */ - EditableDomainObjectCache.prototype.isRoot = function (domainObject) { - return domainObject === this.root; - }; - - /** - * Mark an editable domain object (presumably already cached) - * as having received modifications during editing; it should be - * included in the bulk save invoked when editing completes. - * - * @param {DomainObject} domainObject the domain object - * @memberof platform/commonUI/edit.EditableDomainObjectCache# - */ - EditableDomainObjectCache.prototype.markDirty = function (domainObject) { - this.dirtyObjects[domainObject.getId()] = domainObject; - return this.$q.when(true); - }; - - /** - * Mark an object (presumably already cached) as having had its - * changes saved (and thus no longer needing to be subject to a - * save operation.) - * - * @param {DomainObject} domainObject the domain object - */ - EditableDomainObjectCache.prototype.markClean = function (domainObject) { - var self = this; - if (!domainObject) { - Object.keys(this.dirtyObjects).forEach(function(key) { - delete self.dirtyObjects[key]; - }); - } else { - delete this.dirtyObjects[domainObject.getId()]; - } - }; - - /** - * Initiate a save on all objects that have been cached. - * @return {Promise} A promise which will resolve when all objects are - * persisted. - */ - EditableDomainObjectCache.prototype.saveAll = function () { - // Get a list of all dirty objects - var dirty = this.dirtyObjects, - objects = Object.keys(dirty).map(function (k) { - return dirty[k]; - }); - - // Clear dirty set, since we're about to save. - this.dirtyObjects = {}; - - // Most save logic is handled by the "editor.completion" - // capability, so that is delegated here. - return this.$q.all(objects.map(function (object) { - // Save; pass a nonrecursive flag to avoid looping - return object.getCapability('editor').save(true); - })); - }; - - /** - * Check if any objects have been marked dirty in this cache. - * @returns {boolean} true if objects are dirty - */ - EditableDomainObjectCache.prototype.dirty = function () { - return Object.keys(this.dirtyObjects).length > 0; - }; - - return EditableDomainObjectCache; - } -); - diff --git a/platform/commonUI/edit/src/objects/EditableModelCache.js b/platform/commonUI/edit/src/objects/EditableModelCache.js deleted file mode 100644 index 702cfbe6c7..0000000000 --- a/platform/commonUI/edit/src/objects/EditableModelCache.js +++ /dev/null @@ -1,60 +0,0 @@ -/***************************************************************************** - * 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( - [], - function () { - - /** - * An editable model cache stores domain object models that have been - * made editable, to support a group that can be saved all-at-once. - * This is useful in Edit mode, which is launched for a specific - * object but may contain changes across many objects. - * @memberof platform/commonUI/edit - * @constructor - */ - function EditableModelCache() { - this.cache = {}; - } - - // Deep-copy a model. Models are JSONifiable, so this can be - // done by stringification then destringification - function clone(model) { - return JSON.parse(JSON.stringify(model)); - } - - /** - * Get this domain object's model from the cache (or - * place it in the cache if it isn't in the cache yet) - * @returns a clone of the domain object's model - */ - EditableModelCache.prototype.getCachedModel = function (domainObject) { - var id = domainObject.getId(), - cache = this.cache; - - return (cache[id] = - cache[id] || clone(domainObject.getModel())); - }; - - return EditableModelCache; - } -); diff --git a/platform/commonUI/edit/src/services/TransactionService.js b/platform/commonUI/edit/src/services/TransactionService.js index f9456cad77..2944d2215c 100644 --- a/platform/commonUI/edit/src/services/TransactionService.js +++ b/platform/commonUI/edit/src/services/TransactionService.js @@ -35,6 +35,7 @@ define( function TransactionService($q, dirtyModelCache) { this.$q = $q; this.transaction = false; + this.committing = false; this.cache = dirtyModelCache; } @@ -48,6 +49,10 @@ define( return this.transaction; }; + TransactionService.prototype.isCommitting = function () { + return this.committing; + }; + /** * All persist calls deferred since the beginning of the transaction * will be committed. Any failures will be reported via a promise @@ -58,6 +63,8 @@ define( var self = this; cache = this.cache.get(); + this.committing = true; + function keyToObject(key) { return cache[key]; } @@ -72,6 +79,9 @@ define( .map(objectToPromise)) .then(function () { self.transaction = false; + this.committing = false; + }).catch(function() { + return this.committing = false; }); }; @@ -100,6 +110,7 @@ define( .map(objectToPromise)) .then(function () { self.transaction = false; + this.committing = false; }); }; diff --git a/platform/commonUI/edit/test/capabilities/EditableCompositionCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/EditableCompositionCapabilitySpec.js deleted file mode 100644 index 3e4083d2e8..0000000000 --- a/platform/commonUI/edit/test/capabilities/EditableCompositionCapabilitySpec.js +++ /dev/null @@ -1,73 +0,0 @@ -/***************************************************************************** - * 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( - ["../../src/capabilities/EditableCompositionCapability"], - function (EditableCompositionCapability) { - - describe("An editable composition capability", function () { - var mockContext, - mockEditableObject, - mockDomainObject, - mockTestObject, - someValue, - mockFactory, - capability; - - beforeEach(function () { - // EditableContextCapability should watch ALL - // methods for domain objects, so give it an - // arbitrary interface to wrap. - mockContext = - jasmine.createSpyObj("context", [ "getDomainObject" ]); - mockTestObject = jasmine.createSpyObj( - "domainObject", - [ "getId", "getModel", "getCapability" ] - ); - mockFactory = - jasmine.createSpyObj("factory", ["getEditableObject"]); - - someValue = { x: 42 }; - - mockContext.getDomainObject.andReturn(mockTestObject); - mockFactory.getEditableObject.andReturn(someValue); - - capability = new EditableCompositionCapability( - mockContext, - mockEditableObject, - mockDomainObject, - mockFactory - ); - - }); - - // Most behavior is tested for EditableLookupCapability, - // so just verify that this isse - it("presumes non-idempotence of its wrapped capability", function () { - expect(capability.getDomainObject()) - .toEqual(capability.getDomainObject()); - expect(mockContext.getDomainObject.calls.length).toEqual(2); - }); - - }); - } -); \ No newline at end of file diff --git a/platform/commonUI/edit/test/capabilities/EditableContextCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/EditableContextCapabilitySpec.js deleted file mode 100644 index b18a02e881..0000000000 --- a/platform/commonUI/edit/test/capabilities/EditableContextCapabilitySpec.js +++ /dev/null @@ -1,87 +0,0 @@ -/***************************************************************************** - * 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( - ["../../src/capabilities/EditableContextCapability"], - function (EditableContextCapability) { - - describe("An editable context capability", function () { - var mockContext, - mockEditableObject, - mockDomainObject, - mockTestObject, - someValue, - mockFactory, - capability; - - beforeEach(function () { - // EditableContextCapability should watch ALL - // methods for domain objects, so give it an - // arbitrary interface to wrap. - mockContext = - jasmine.createSpyObj("context", [ "getDomainObject", "getRoot" ]); - mockTestObject = jasmine.createSpyObj( - "domainObject", - [ "getId", "getModel", "getCapability" ] - ); - mockFactory = jasmine.createSpyObj( - "factory", - ["getEditableObject", "isRoot"] - ); - - someValue = { x: 42 }; - - mockContext.getRoot.andReturn(mockTestObject); - mockContext.getDomainObject.andReturn(mockTestObject); - mockFactory.getEditableObject.andReturn(someValue); - mockFactory.isRoot.andReturn(true); - - capability = new EditableContextCapability( - mockContext, - mockEditableObject, - mockDomainObject, - mockFactory - ); - - }); - - it("presumes idempotence of its wrapped capability", function () { - expect(capability.getDomainObject()) - .toEqual(capability.getDomainObject()); - expect(mockContext.getDomainObject.calls.length).toEqual(1); - }); - - it("hides the root object", function () { - expect(capability.getRoot()).toEqual(mockEditableObject); - expect(capability.getPath()).toEqual([mockEditableObject]); - }); - - it("exposes the root object through a different method", function () { - // Should still go through the factory... - expect(capability.getTrueRoot()).toEqual(someValue); - // ...with value of the unwrapped capability's getRoot - expect(mockFactory.getEditableObject) - .toHaveBeenCalledWith(mockTestObject); - }); - }); - } -); \ No newline at end of file diff --git a/platform/commonUI/edit/test/capabilities/EditableLookupCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/EditableLookupCapabilitySpec.js deleted file mode 100644 index dc178da449..0000000000 --- a/platform/commonUI/edit/test/capabilities/EditableLookupCapabilitySpec.js +++ /dev/null @@ -1,144 +0,0 @@ -/***************************************************************************** - * 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( - ["../../src/capabilities/EditableLookupCapability"], - function (EditableLookupCapability) { - - describe("An editable lookup capability", function () { - var mockContext, - mockEditableObject, - mockDomainObject, - mockTestObject, - someValue, - factory, - capability; - - beforeEach(function () { - // EditableContextCapability should watch ALL - // methods for domain objects, so give it an - // arbitrary interface to wrap. - mockContext = jasmine.createSpyObj( - "context", - [ - "getSomething", - "getDomainObject", - "getDomainObjectArray" - ] - ); - mockTestObject = jasmine.createSpyObj( - "domainObject", - [ "getId", "getModel", "getCapability" ] - ); - factory = { - getEditableObject: function (v) { - return { - isFromTestFactory: true, - calledWith: v - }; - } - }; - - someValue = { x: 42 }; - - mockContext.getSomething.andReturn(someValue); - mockContext.getDomainObject.andReturn(mockTestObject); - mockContext.getDomainObjectArray.andReturn([mockTestObject]); - - capability = new EditableLookupCapability( - mockContext, - mockEditableObject, - mockDomainObject, - factory, - false - ); - - }); - - it("wraps retrieved domain objects", function () { - var object = capability.getDomainObject(); - expect(object.isFromTestFactory).toBe(true); - expect(object.calledWith).toEqual(mockTestObject); - }); - - it("wraps retrieved domain object arrays", function () { - var object = capability.getDomainObjectArray()[0]; - expect(object.isFromTestFactory).toBe(true); - expect(object.calledWith).toEqual(mockTestObject); - }); - - it("does not wrap non-domain-objects", function () { - expect(capability.getSomething()).toEqual(someValue); - }); - - it("caches idempotent lookups", function () { - capability = new EditableLookupCapability( - mockContext, - mockEditableObject, - mockDomainObject, - factory, - true // idempotent - ); - expect(capability.getDomainObject()) - .toEqual(capability.getDomainObject()); - expect(mockContext.getDomainObject.calls.length).toEqual(1); - }); - - it("does not cache non-idempotent lookups", function () { - capability = new EditableLookupCapability( - mockContext, - mockEditableObject, - mockDomainObject, - factory, - false // Not idempotent - ); - expect(capability.getDomainObject()) - .toEqual(capability.getDomainObject()); - expect(mockContext.getDomainObject.calls.length).toEqual(2); - }); - - it("wraps inherited methods", function () { - var CapabilityClass = function(){ - }; - CapabilityClass.prototype.inheritedMethod=function () { - return "an inherited method"; - }; - - mockContext = new CapabilityClass(); - - capability = new EditableLookupCapability( - mockContext, - mockEditableObject, - mockDomainObject, - factory, - false - ); - expect(capability.inheritedMethod()).toEqual("an inherited method"); - expect(capability.hasOwnProperty('inheritedMethod')).toBe(true); - // The presence of an own property indicates that the method - // has been wrapped on the object itself and this is a valid - // test that the inherited method has been wrapped. - }); - - }); - } -); \ No newline at end of file diff --git a/platform/commonUI/edit/test/capabilities/EditablePersistenceCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/EditablePersistenceCapabilitySpec.js deleted file mode 100644 index 4ce4a2f75d..0000000000 --- a/platform/commonUI/edit/test/capabilities/EditablePersistenceCapabilitySpec.js +++ /dev/null @@ -1,94 +0,0 @@ -/***************************************************************************** - * 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( - ["../../src/capabilities/EditablePersistenceCapability"], - function (EditablePersistenceCapability) { - - describe("An editable persistence capability", function () { - var mockPersistence, - mockEditableObject, - mockDomainObject, - mockCache, - mockPromise, - capability; - - beforeEach(function () { - mockPersistence = jasmine.createSpyObj( - "persistence", - [ "persist", "refresh" ] - ); - mockEditableObject = jasmine.createSpyObj( - "editableObject", - [ "getId", "getModel", "getCapability" ] - ); - mockDomainObject = jasmine.createSpyObj( - "editableObject", - [ "getId", "getModel", "getCapability" ] - ); - mockCache = jasmine.createSpyObj( - "cache", - [ "markDirty" ] - ); - mockPromise = jasmine.createSpyObj("promise", ["then"]); - - mockCache.markDirty.andReturn(mockPromise); - mockDomainObject.getCapability.andReturn(mockPersistence); - - capability = new EditablePersistenceCapability( - mockPersistence, - mockEditableObject, - mockDomainObject, - mockCache - ); - }); - - it("marks objects as dirty (in the cache) upon persist", function () { - capability.persist(); - expect(mockCache.markDirty) - .toHaveBeenCalledWith(mockEditableObject); - }); - - it("does not invoke the underlying persistence capability", function () { - capability.persist(); - expect(mockPersistence.persist).not.toHaveBeenCalled(); - }); - - it("refreshes using the original domain object's persistence", function () { - // Refreshing needs to delegate via the unwrapped domain object. - // Otherwise, only the editable version of the object will be updated; - // we instead want the real version of the object to receive these - // changes. - expect(mockDomainObject.getCapability).not.toHaveBeenCalled(); - expect(mockPersistence.refresh).not.toHaveBeenCalled(); - capability.refresh(); - expect(mockDomainObject.getCapability).toHaveBeenCalledWith('persistence'); - expect(mockPersistence.refresh).toHaveBeenCalled(); - }); - - it("returns a promise from persist", function () { - expect(capability.persist().then).toEqual(jasmine.any(Function)); - }); - - }); - } -); \ No newline at end of file diff --git a/platform/commonUI/edit/test/capabilities/EditableRelationshipCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/EditableRelationshipCapabilitySpec.js deleted file mode 100644 index 9a6c17d944..0000000000 --- a/platform/commonUI/edit/test/capabilities/EditableRelationshipCapabilitySpec.js +++ /dev/null @@ -1,73 +0,0 @@ -/***************************************************************************** - * 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( - ["../../src/capabilities/EditableRelationshipCapability"], - function (EditableRelationshipCapability) { - - describe("An editable relationship capability", function () { - var mockContext, - mockEditableObject, - mockDomainObject, - mockTestObject, - someValue, - mockFactory, - capability; - - beforeEach(function () { - // EditableContextCapability should watch ALL - // methods for domain objects, so give it an - // arbitrary interface to wrap. - mockContext = - jasmine.createSpyObj("context", [ "getDomainObject" ]); - mockTestObject = jasmine.createSpyObj( - "domainObject", - [ "getId", "getModel", "getCapability" ] - ); - mockFactory = - jasmine.createSpyObj("factory", ["getEditableObject"]); - - someValue = { x: 42 }; - - mockContext.getDomainObject.andReturn(mockTestObject); - mockFactory.getEditableObject.andReturn(someValue); - - capability = new EditableRelationshipCapability( - mockContext, - mockEditableObject, - mockDomainObject, - mockFactory - ); - - }); - - // Most behavior is tested for EditableLookupCapability, - // so just verify that this isse - it("presumes non-idempotence of its wrapped capability", function () { - expect(capability.getDomainObject()) - .toEqual(capability.getDomainObject()); - expect(mockContext.getDomainObject.calls.length).toEqual(2); - }); - - }); - } -); \ No newline at end of file diff --git a/platform/commonUI/edit/test/objects/EditableDomainObjectCacheSpec.js b/platform/commonUI/edit/test/objects/EditableDomainObjectCacheSpec.js deleted file mode 100644 index edbfd3edc4..0000000000 --- a/platform/commonUI/edit/test/objects/EditableDomainObjectCacheSpec.js +++ /dev/null @@ -1,177 +0,0 @@ -/***************************************************************************** - * 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( - ["../../src/objects/EditableDomainObjectCache"], - function (EditableDomainObjectCache) { - - describe("Editable domain object cache", function () { - - var captured, - completionCapability, - mockQ, - mockType, - cache; - - - // Constructors for test objects - function TestObject(id) { - return { - getId: function () { return id; }, - getModel: function () { return {}; }, - getCapability: function (key) { - return { - editor: completionCapability, - type: mockType - }[key]; - }, - hasCapability: function () { - return false; - } - }; - } - - function WrapObject(domainObject, model) { - var result = Object.create(domainObject); - result.wrapped = true; - result.wrappedModel = model; - result.hasCapability = function (name) { - return name === 'editor'; - }; - captured.wraps = (captured.wraps || 0) + 1; - return result; - } - - beforeEach(function () { - mockQ = jasmine.createSpyObj('$q', ['when', 'all']); - mockType = jasmine.createSpyObj('type', ['hasFeature']); - mockType.hasFeature.andReturn(true); - captured = {}; - completionCapability = { - save: function () { - captured.saved = (captured.saved || 0) + 1; - } - }; - - cache = new EditableDomainObjectCache(WrapObject, mockQ); - }); - - it("wraps objects using provided constructor", function () { - var domainObject = new TestObject('test-id'), - wrappedObject = cache.getEditableObject(domainObject); - expect(wrappedObject.wrapped).toBeTruthy(); - expect(wrappedObject.getId()).toEqual(domainObject.getId()); - }); - - it("wraps objects repeatedly, wraps models once", function () { - var domainObject = new TestObject('test-id'), - wrappedObjects = []; - - // Verify precondition - expect(captured.wraps).toBeUndefined(); - - // Invoke a few more times; expect count not to increment - wrappedObjects.push(cache.getEditableObject(domainObject)); - expect(captured.wraps).toEqual(1); - wrappedObjects.push(cache.getEditableObject(domainObject)); - expect(captured.wraps).toEqual(2); - wrappedObjects.push(cache.getEditableObject(domainObject)); - expect(captured.wraps).toEqual(3); - - // Verify that the last call still gave us a wrapped object - expect(wrappedObjects[0].wrapped).toBeTruthy(); - expect(wrappedObjects[0].getId()).toEqual(domainObject.getId()); - - // Verify that objects are distinct but models are identical - expect(wrappedObjects[0].wrappedModel) - .toBe(wrappedObjects[1].wrappedModel); - expect(wrappedObjects[0]).not - .toBe(wrappedObjects[1]); - }); - - it("saves objects that have been marked dirty", function () { - var objects = ['a', 'b', 'c'].map(TestObject).map(function (domainObject) { - return cache.getEditableObject(domainObject); - }); - - cache.markDirty(objects[0]); - cache.markDirty(objects[2]); - - cache.saveAll(); - - expect(captured.saved).toEqual(2); - }); - - it("does not save objects that have been marked clean", function () { - var objects = ['a', 'b', 'c'].map(TestObject).map(function (domainObject) { - return cache.getEditableObject(domainObject); - }); - - cache.markDirty(objects[0]); - cache.markDirty(objects[2]); - cache.markClean(objects[0]); - - cache.saveAll(); - - expect(captured.saved).toEqual(1); - }); - - it("tracks the root object of the Edit mode subgraph", function () { - // Root object is the first object exposed to the cache - var domainObjects = ['a', 'b', 'c'].map(TestObject); - domainObjects.forEach(function (obj) { - cache.getEditableObject(obj); - }); - expect(cache.isRoot(domainObjects[0])).toBeTruthy(); - expect(cache.isRoot(domainObjects[1])).toBeFalsy(); - expect(cache.isRoot(domainObjects[2])).toBeFalsy(); - }); - - it("does not double-wrap objects", function () { - var domainObject = new TestObject('test-id'), - wrappedObject = cache.getEditableObject(domainObject); - - // Same instance should be returned if you try to wrap - // twice. This is necessary, since it's possible to (e.g.) - // use a context capability on an object retrieved via - // composition, in which case a result will already be - // wrapped. - expect(cache.getEditableObject(wrappedObject)) - .toBe(wrappedObject); - }); - - it("does not wrap non-editable objects", function () { - var domainObject = new TestObject('test-id'); - - mockType.hasFeature.andCallFake(function (key) { - return key !== 'creation'; - }); - - expect(cache.getEditableObject(domainObject)) - .toBe(domainObject); - }); - - - }); - } - -); diff --git a/platform/commonUI/edit/test/objects/EditableDomainObjectSpec.js b/platform/commonUI/edit/test/objects/EditableDomainObjectSpec.js deleted file mode 100644 index 9b1095f68d..0000000000 --- a/platform/commonUI/edit/test/objects/EditableDomainObjectSpec.js +++ /dev/null @@ -1,35 +0,0 @@ -/***************************************************************************** - * 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( - ["../../src/objects/EditableDomainObject"], - function (EditableDomainObject) { - - describe("Editable domain object", function () { - var object; - - beforeEach(function () { - object = new EditableDomainObject(); - }); - }); - } -); \ No newline at end of file diff --git a/platform/commonUI/edit/test/objects/EditableModelCacheSpec.js b/platform/commonUI/edit/test/objects/EditableModelCacheSpec.js deleted file mode 100644 index 1fe8db0262..0000000000 --- a/platform/commonUI/edit/test/objects/EditableModelCacheSpec.js +++ /dev/null @@ -1,79 +0,0 @@ -/***************************************************************************** - * 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( - ["../../src/objects/EditableModelCache"], - function (EditableModelCache) { - - describe("The editable model cache", function () { - var mockObject, - mockOtherObject, - testModel, - testId, - otherModel, - otherId, - cache; - - beforeEach(function () { - testId = "test"; - testModel = { someKey: "some value" }; - otherId = "other"; - otherModel = { someKey: "some other value" }; - - mockObject = jasmine.createSpyObj( - "domainObject", - [ "getId", "getModel" ] - ); - mockOtherObject = jasmine.createSpyObj( - "domainObject", - [ "getId", "getModel" ] - ); - - mockObject.getId.andReturn(testId); - mockObject.getModel.andReturn(testModel); - mockOtherObject.getId.andReturn(otherId); - mockOtherObject.getModel.andReturn(otherModel); - - cache = new EditableModelCache(); - }); - - it("provides clones of domain object models", function () { - var model = cache.getCachedModel(mockObject); - // Should be identical... - expect(model).toEqual(testModel); - // ...but not pointer-identical - expect(model).not.toBe(testModel); - }); - - it("provides only one clone per object", function () { - var model = cache.getCachedModel(mockObject); - expect(cache.getCachedModel(mockObject)).toBe(model); - }); - - it("maintains separate caches per-object", function () { - expect(cache.getCachedModel(mockObject)) - .not.toEqual(cache.getCachedModel(mockOtherObject)); - }); - }); - - } -); \ No newline at end of file diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js index 59b437d15c..7195d91895 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js @@ -39,9 +39,13 @@ define( }; } - // Check if we are in edit mode - function inEditMode() { - return swimlane.domainObject.hasCapability("editor"); + // Check if we are in edit mode (also check parents) + function inEditMode(swimlane) { + if (!swimlane.domainObject.getCapability("status").get("editing") && swimlane.parent) { + return inEditMode(swimlane.parent); + } else { + return swimlane.domainObject.getCapability("status").get("editing"); + } } // Boolean and (for reduce below) @@ -173,7 +177,7 @@ define( * @returns {boolean} true if this should be allowed */ allowDropIn: function (id, domainObject) { - return inEditMode() && + return inEditMode(swimlane) && !pathContains(swimlane, id) && !contains(swimlane, id) && canDrop(swimlane.domainObject, domainObject); @@ -188,7 +192,7 @@ define( allowDropAfter: function (id, domainObject) { var target = expandedForDropInto() ? swimlane : swimlane.parent; - return inEditMode() && + return inEditMode(swimlane) && target && !pathContains(target, id) && canDrop(target.domainObject, domainObject); From 433dd87e51f53cb4adfd83e213d7265a84f69fd3 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 12 May 2016 16:07:39 -0700 Subject: [PATCH 71/85] Resolved merge conflicts --- .../edit/src/capabilities/EditorCapability.js | 20 +++++++++++++++++-- .../edit/src/policies/EditableLinkPolicy.js | 7 ++++--- .../edit/src/policies/EditableMovePolicy.js | 4 ++-- .../edit/src/policies/EditableViewPolicy.js | 2 +- .../regions/src/InspectorController.js | 18 +++++++++++++++-- .../swimlane/TimelineSwimlaneDropHandler.js | 7 ++----- .../representation/src/MCTRepresentation.js | 19 +++++++++++++++--- .../src/gestures/DropGesture.js | 1 - 8 files changed, 59 insertions(+), 19 deletions(-) diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index 8f40508069..54d041aff0 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -39,6 +39,20 @@ define( this.domainObject.getCapability('status').set('editing', true); }; + function isEditing (domainObject) { + return domainObject.getCapability('status').get('editing') || + domainObject.hasCapability('context') && isEditing(domainObject.getCapability('context').getParent()); + } + + /** + * Determines whether this object, or any of its ancestors are + * currently being edited. + * @returns boolean + */ + EditorCapability.prototype.isEditing = function () { + return isEditing(this.domainObject); + }; + EditorCapability.prototype.save = function () { var domainObject = this.domainObject; return this.transactionService.commit().then(function() { @@ -60,8 +74,10 @@ define( return this.dirtyModelCache.isDirty(this.domainObject); }; - //TODO: add 'appliesTo'. EditorCapability should not be available - // for objects that should not be edited + EditorCapability.prototype.appliesTo = function(context) { + var domainObject = context.domainObject; + return domainObject && domainObject.getType().hasFeature("creation"); + } return EditorCapability; } diff --git a/platform/commonUI/edit/src/policies/EditableLinkPolicy.js b/platform/commonUI/edit/src/policies/EditableLinkPolicy.js index c311266cf8..1200496d35 100644 --- a/platform/commonUI/edit/src/policies/EditableLinkPolicy.js +++ b/platform/commonUI/edit/src/policies/EditableLinkPolicy.js @@ -35,11 +35,12 @@ define([], function () { } EditableLinkPolicy.prototype.allow = function (action, context) { - var key = action.getMetadata().key; + var key = action.getMetadata().key, + object; if (key === 'link') { - return !((context.selectedObject || context.domainObject) - .hasCapability('editor')); + object = context.selectedObject || context.domainObject; + return !(object.hasCapability("editor") && object.getCapability("editor").isEditing()); } // Like all policies, allow by default. diff --git a/platform/commonUI/edit/src/policies/EditableMovePolicy.js b/platform/commonUI/edit/src/policies/EditableMovePolicy.js index e89113ea60..cc95114206 100644 --- a/platform/commonUI/edit/src/policies/EditableMovePolicy.js +++ b/platform/commonUI/edit/src/policies/EditableMovePolicy.js @@ -37,8 +37,8 @@ define([], function () { selectedObject = context.selectedObject, key = action.getMetadata().key; - if (key === 'move' && domainObject.hasCapability('editor')) { - return !!selectedObject && selectedObject.hasCapability('editor'); + if (key === 'move' && domainObject.hasCapability('editor') && domainObject.getCapability('editor').isEditing()) { + return !!selectedObject && selectedObject.hasCapability('editor') && selectedObject.getCapability('editor').isEditing(); } // Like all policies, allow by default. diff --git a/platform/commonUI/edit/src/policies/EditableViewPolicy.js b/platform/commonUI/edit/src/policies/EditableViewPolicy.js index 7c9742e2d3..b4ba951bd0 100644 --- a/platform/commonUI/edit/src/policies/EditableViewPolicy.js +++ b/platform/commonUI/edit/src/policies/EditableViewPolicy.js @@ -37,7 +37,7 @@ define( // If a view is flagged as non-editable, only allow it // while we're not in Edit mode. if ((view || {}).editable === false) { - return !domainObject.hasCapability('editor'); + return !(domainObject.hasCapability('editor') && domainObject.getCapability('editor').isEditing()); } // Like all policies, allow by default. diff --git a/platform/commonUI/regions/src/InspectorController.js b/platform/commonUI/regions/src/InspectorController.js index c97b055462..3c0df1e839 100644 --- a/platform/commonUI/regions/src/InspectorController.js +++ b/platform/commonUI/regions/src/InspectorController.js @@ -32,7 +32,8 @@ define( */ function InspectorController($scope, policyService) { var domainObject = $scope.domainObject, - typeCapability = domainObject.getCapability('type'); + typeCapability = domainObject.getCapability('type'), + listener; /** * Filters region parts to only those allowed by region policies @@ -46,7 +47,20 @@ define( }); } - $scope.regions = filterRegions(typeCapability.getDefinition().inspector || new InspectorRegion()); + function setRegions() { + $scope.regions = filterRegions(typeCapability.getDefinition().inspector || new InspectorRegion()); + } + + //Listen for changes to object status that might necessitate + // recalculation of screen regions. + //listener = + // domainObject.getCapability("status").listen(setRegions); + + setRegions(); + + $scope.$on("$destroy", function() { + listener(); + }) } return InspectorController; diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js index 7195d91895..f5d46fbaf7 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js @@ -41,11 +41,8 @@ define( // Check if we are in edit mode (also check parents) function inEditMode(swimlane) { - if (!swimlane.domainObject.getCapability("status").get("editing") && swimlane.parent) { - return inEditMode(swimlane.parent); - } else { - return swimlane.domainObject.getCapability("status").get("editing"); - } + return swimlane.domainObject.hasCapability('editor') && + swimlane.domainObject.getCapability('editor').isEditing(); } // Boolean and (for reduce below) diff --git a/platform/representation/src/MCTRepresentation.js b/platform/representation/src/MCTRepresentation.js index b0c0518d24..264614e5a2 100644 --- a/platform/representation/src/MCTRepresentation.js +++ b/platform/representation/src/MCTRepresentation.js @@ -53,7 +53,8 @@ define( * @param {ViewDefinition[]} views an array of view extensions */ function MCTRepresentation(representations, views, representers, $q, templateLinker, $log) { - var representationMap = {}; + var representationMap = {}, + domainObjectListener; // Assemble all representations and views // The distinction between views and representations is @@ -167,7 +168,7 @@ define( representation = lookup($scope.key, domainObject), uses = ((representation || {}).uses || []), canRepresent = !!(representation && domainObject), - canEdit = !!(domainObject && domainObject.hasCapability('editor')), + canEdit = !!(domainObject && domainObject.hasCapability('editor') && domainObject.getCapability('editor').isEditing()), idPath = getIdPath(domainObject), key = $scope.key; @@ -175,6 +176,8 @@ define( return; } + console.log("changed"); + // Create an empty object named "representation", for this // representation to store local variables into. $scope.representation = {}; @@ -237,7 +240,17 @@ define( // Also update when the represented domain object changes // (to a different object) - $scope.$watch("domainObject", refresh); + //$scope.$watch("domainObject", refresh); + + $scope.$watch("domainObject", function (domainObject) { + if (domainObjectListener) { + domainObjectListener(); + } + if (domainObject) { + domainObjectListener = domainObject.getCapability('status').listen(refresh); + } + refresh(); + }); // Finally, also update when there is a new version of that // same domain object; these changes should be tracked in the diff --git a/platform/representation/src/gestures/DropGesture.js b/platform/representation/src/gestures/DropGesture.js index c25899b9db..e323e9d4a2 100644 --- a/platform/representation/src/gestures/DropGesture.js +++ b/platform/representation/src/gestures/DropGesture.js @@ -103,7 +103,6 @@ define( // the change. if (id) { e.preventDefault(); - if (domainObjectType!=='folder') { domainObject.getCapability('action').perform('edit'); } From e6bbc3442b6e8a82cc6482d7ebd8239372e0febd Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 12 May 2016 16:09:02 -0700 Subject: [PATCH 72/85] Resolved merge conflicts --- .../representation/src/MCTRepresentation.js | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/platform/representation/src/MCTRepresentation.js b/platform/representation/src/MCTRepresentation.js index 264614e5a2..a120507f27 100644 --- a/platform/representation/src/MCTRepresentation.js +++ b/platform/representation/src/MCTRepresentation.js @@ -54,6 +54,7 @@ define( */ function MCTRepresentation(representations, views, representers, $q, templateLinker, $log) { var representationMap = {}, + listeners = 0; domainObjectListener; // Assemble all representations and views @@ -92,6 +93,7 @@ define( couldEdit = false, lastIdPath = [], lastKey, + statusListener, changeTemplate = templateLinker.link($scope, element); // Populate scope with any capabilities indicated by the @@ -176,8 +178,6 @@ define( return; } - console.log("changed"); - // Create an empty object named "representation", for this // representation to store local variables into. $scope.representation = {}; @@ -240,16 +240,18 @@ define( // Also update when the represented domain object changes // (to a different object) - //$scope.$watch("domainObject", refresh); - - $scope.$watch("domainObject", function (domainObject) { - if (domainObjectListener) { - domainObjectListener(); + $scope.$watch("domainObject", refresh); + $scope.$watch("domainObject", function(domainObject) { + if (domainObject){ + if (statusListener) { + statusListener(); + listeners--; + console.log("directive listeners " + listeners); + } + statusListener = domainObject.getCapability("status").listen(refresh); + listeners++; + console.log("directive listeners " + listeners); } - if (domainObject) { - domainObjectListener = domainObject.getCapability('status').listen(refresh); - } - refresh(); }); // Finally, also update when there is a new version of that @@ -260,6 +262,13 @@ define( // Make sure any resources allocated by representers also get // released. $scope.$on("$destroy", destroyRepresenters); + $scope.$on("$destroy", function () { + if (statusListener) { + statusListener(); + listeners--; + console.log("directive listeners " + listeners); + } + }); // Do one initial refresh, so that we don't need another // digest iteration just to populate the scope. Failure to From 4b786d3536e7f4223fd791ab9b9652b791b4c9cb Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 18 Apr 2016 16:42:22 -0700 Subject: [PATCH 73/85] Removed sysouts --- .../regions/src/InspectorController.js | 12 +------- .../representation/src/MCTRepresentation.js | 29 +++++++++++-------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/platform/commonUI/regions/src/InspectorController.js b/platform/commonUI/regions/src/InspectorController.js index 3c0df1e839..32b0e1903d 100644 --- a/platform/commonUI/regions/src/InspectorController.js +++ b/platform/commonUI/regions/src/InspectorController.js @@ -32,8 +32,7 @@ define( */ function InspectorController($scope, policyService) { var domainObject = $scope.domainObject, - typeCapability = domainObject.getCapability('type'), - listener; + typeCapability = domainObject.getCapability('type'); /** * Filters region parts to only those allowed by region policies @@ -51,16 +50,7 @@ define( $scope.regions = filterRegions(typeCapability.getDefinition().inspector || new InspectorRegion()); } - //Listen for changes to object status that might necessitate - // recalculation of screen regions. - //listener = - // domainObject.getCapability("status").listen(setRegions); - setRegions(); - - $scope.$on("$destroy", function() { - listener(); - }) } return InspectorController; diff --git a/platform/representation/src/MCTRepresentation.js b/platform/representation/src/MCTRepresentation.js index a120507f27..4283a30a4a 100644 --- a/platform/representation/src/MCTRepresentation.js +++ b/platform/representation/src/MCTRepresentation.js @@ -241,18 +241,25 @@ define( // Also update when the represented domain object changes // (to a different object) $scope.$watch("domainObject", refresh); - $scope.$watch("domainObject", function(domainObject) { - if (domainObject){ - if (statusListener) { - statusListener(); - listeners--; - console.log("directive listeners " + listeners); - } - statusListener = domainObject.getCapability("status").listen(refresh); - listeners++; - console.log("directive listeners " + listeners); + + function listenForStatusChange(object) { + if (statusListener) { + statusListener(); + } + statusListener = object.getCapability("status").listen(refresh); + } + + /** + * Add a listener for status changes to the object itself. + */ + $scope.$watch("domainObject", function(domainObject, oldDomainObject) { + if (domainObject!==oldDomainObject){ + listenForStatusChange(domainObject); } }); + if ($scope.domainObject) { + listenForStatusChange($scope.domainObject); + } // Finally, also update when there is a new version of that // same domain object; these changes should be tracked in the @@ -265,8 +272,6 @@ define( $scope.$on("$destroy", function () { if (statusListener) { statusListener(); - listeners--; - console.log("directive listeners " + listeners); } }); From d00e13e4eed46ca8e231698af8a3efd97f7c9930 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 12 May 2016 16:09:53 -0700 Subject: [PATCH 74/85] Resolved merge conflicts --- platform/commonUI/edit/src/actions/SaveAsAction.js | 1 + platform/commonUI/edit/src/capabilities/EditorCapability.js | 2 +- platform/commonUI/edit/src/policies/EditActionPolicy.js | 5 ++--- platform/commonUI/edit/src/policies/EditableLinkPolicy.js | 2 +- platform/commonUI/edit/src/policies/EditableMovePolicy.js | 4 ++-- platform/commonUI/edit/src/policies/EditableViewPolicy.js | 2 +- .../src/controllers/swimlane/TimelineSwimlaneDropHandler.js | 2 +- platform/representation/src/MCTRepresentation.js | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/platform/commonUI/edit/src/actions/SaveAsAction.js b/platform/commonUI/edit/src/actions/SaveAsAction.js index 7e52a3f486..6d73b75308 100644 --- a/platform/commonUI/edit/src/actions/SaveAsAction.js +++ b/platform/commonUI/edit/src/actions/SaveAsAction.js @@ -158,6 +158,7 @@ define( var domainObject = (context || {}).domainObject; return domainObject !== undefined && domainObject.hasCapability("editor") && + domainObject.getCapability("editor").inEditContext() && domainObject.getModel().persisted === undefined; }; diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index 54d041aff0..2091f3b9b3 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -49,7 +49,7 @@ define( * currently being edited. * @returns boolean */ - EditorCapability.prototype.isEditing = function () { + EditorCapability.prototype.inEditContext = function () { return isEditing(this.domainObject); }; diff --git a/platform/commonUI/edit/src/policies/EditActionPolicy.js b/platform/commonUI/edit/src/policies/EditActionPolicy.js index 0e5af528e7..2952758840 100644 --- a/platform/commonUI/edit/src/policies/EditActionPolicy.js +++ b/platform/commonUI/edit/src/policies/EditActionPolicy.js @@ -72,9 +72,8 @@ define( */ function isEditing(context) { var domainObject = (context || {}).domainObject; - return domainObject && - domainObject.hasCapability('status') && - domainObject.getCapability('status').get('editing'); + return domainObject + && domainObject.getCapability('status').get('editing'); } EditActionPolicy.prototype.allow = function (action, context) { diff --git a/platform/commonUI/edit/src/policies/EditableLinkPolicy.js b/platform/commonUI/edit/src/policies/EditableLinkPolicy.js index 1200496d35..c6a2a36290 100644 --- a/platform/commonUI/edit/src/policies/EditableLinkPolicy.js +++ b/platform/commonUI/edit/src/policies/EditableLinkPolicy.js @@ -40,7 +40,7 @@ define([], function () { if (key === 'link') { object = context.selectedObject || context.domainObject; - return !(object.hasCapability("editor") && object.getCapability("editor").isEditing()); + return !(object.hasCapability("editor") && object.getCapability("editor").inEditContext()); } // Like all policies, allow by default. diff --git a/platform/commonUI/edit/src/policies/EditableMovePolicy.js b/platform/commonUI/edit/src/policies/EditableMovePolicy.js index cc95114206..4974e0c60d 100644 --- a/platform/commonUI/edit/src/policies/EditableMovePolicy.js +++ b/platform/commonUI/edit/src/policies/EditableMovePolicy.js @@ -37,8 +37,8 @@ define([], function () { selectedObject = context.selectedObject, key = action.getMetadata().key; - if (key === 'move' && domainObject.hasCapability('editor') && domainObject.getCapability('editor').isEditing()) { - return !!selectedObject && selectedObject.hasCapability('editor') && selectedObject.getCapability('editor').isEditing(); + if (key === 'move' && domainObject.hasCapability('editor') && domainObject.getCapability('editor').inEditContext()) { + return !!selectedObject && selectedObject.hasCapability('editor') && selectedObject.getCapability('editor').inEditContext(); } // Like all policies, allow by default. diff --git a/platform/commonUI/edit/src/policies/EditableViewPolicy.js b/platform/commonUI/edit/src/policies/EditableViewPolicy.js index b4ba951bd0..23de491def 100644 --- a/platform/commonUI/edit/src/policies/EditableViewPolicy.js +++ b/platform/commonUI/edit/src/policies/EditableViewPolicy.js @@ -37,7 +37,7 @@ define( // If a view is flagged as non-editable, only allow it // while we're not in Edit mode. if ((view || {}).editable === false) { - return !(domainObject.hasCapability('editor') && domainObject.getCapability('editor').isEditing()); + return !(domainObject.hasCapability('editor') && domainObject.getCapability('status').get('editing')); } // Like all policies, allow by default. diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js index f5d46fbaf7..620e70e3e1 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js @@ -42,7 +42,7 @@ define( // Check if we are in edit mode (also check parents) function inEditMode(swimlane) { return swimlane.domainObject.hasCapability('editor') && - swimlane.domainObject.getCapability('editor').isEditing(); + swimlane.domainObject.getCapability('editor').inEditContext(); } // Boolean and (for reduce below) diff --git a/platform/representation/src/MCTRepresentation.js b/platform/representation/src/MCTRepresentation.js index 4283a30a4a..06f7220fd9 100644 --- a/platform/representation/src/MCTRepresentation.js +++ b/platform/representation/src/MCTRepresentation.js @@ -170,7 +170,7 @@ define( representation = lookup($scope.key, domainObject), uses = ((representation || {}).uses || []), canRepresent = !!(representation && domainObject), - canEdit = !!(domainObject && domainObject.hasCapability('editor') && domainObject.getCapability('editor').isEditing()), + canEdit = !!(domainObject && domainObject.hasCapability('editor') && domainObject.getCapability('editor').inEditContext()), idPath = getIdPath(domainObject), key = $scope.key; From 1753a5473cf8508eca8c695a53dbdc2f55748f03 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 12 May 2016 16:11:52 -0700 Subject: [PATCH 75/85] Resolved merge conflicts --- .../src/policies/EditContextualActionPolicy.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/platform/commonUI/edit/src/policies/EditContextualActionPolicy.js b/platform/commonUI/edit/src/policies/EditContextualActionPolicy.js index 32a24050e0..b5853bd89c 100644 --- a/platform/commonUI/edit/src/policies/EditContextualActionPolicy.js +++ b/platform/commonUI/edit/src/policies/EditContextualActionPolicy.js @@ -34,6 +34,7 @@ define( * from context menu of non-editable objects, when navigated object * is being edited * @constructor + * @implements {Policy.} */ function EditContextualActionPolicy(navigationService, editModeBlacklist, nonEditContextBlacklist) { this.navigationService = navigationService; @@ -45,22 +46,18 @@ define( this.nonEditContextBlacklist = nonEditContextBlacklist; } - function isParentEditable(object) { - var parent = object.hasCapability("context") && object.getCapability("context").getParent(); - return !!parent && parent.hasCapability("editor"); - } - EditContextualActionPolicy.prototype.allow = function (action, context) { var selectedObject = context.domainObject, navigatedObject = this.navigationService.getNavigation(), actionMetadata = action.getMetadata ? action.getMetadata() : {}; - if (navigatedObject.hasCapability('editor')) { - if (selectedObject.hasCapability('editor') || isParentEditable(selectedObject)){ - return this.editModeBlacklist.indexOf(actionMetadata.key) === -1; + if (navigatedObject.getCapability("status").get("editing")) { + if (selectedObject.hasCapability("editor") && selectedObject.getCapability("editor").inEditContext()){ + //Target is within the editing context + return this.editBlacklist.indexOf(actionMetadata.key) === -1; } else { - //Target is in the context menu - return this.nonEditContextBlacklist.indexOf(actionMetadata.key) === -1; + //Target is not within the editing context + return this.nonEditBlacklist.indexOf(actionMetadata.key) === -1; } } else { return true; From 836b5db8cf7056742c049d5ee99945ebfa28d6c1 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 20 Apr 2016 13:11:07 -0700 Subject: [PATCH 76/85] Reviewed edit mode checking --- platform/commonUI/edit/src/actions/EditAction.js | 5 ++--- platform/commonUI/edit/src/policies/EditableViewPolicy.js | 2 +- .../timeline/src/controllers/TimelineZoomController.js | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/commonUI/edit/src/actions/EditAction.js b/platform/commonUI/edit/src/actions/EditAction.js index 5931a02a52..229861d1d9 100644 --- a/platform/commonUI/edit/src/actions/EditAction.js +++ b/platform/commonUI/edit/src/actions/EditAction.js @@ -87,11 +87,10 @@ define( */ EditAction.appliesTo = function (context) { var domainObject = (context || {}).domainObject, - type = domainObject && domainObject.getCapability('type'), - isEditMode = domainObject && domainObject.getDomainObject ? true : false; + type = domainObject && domainObject.getCapability('type'); // Only allow creatable types to be edited - return type && type.hasFeature('creation') && !isEditMode; + return type && type.hasFeature('creation') && !domainObject.getCapability('status').get('editing'); }; return EditAction; diff --git a/platform/commonUI/edit/src/policies/EditableViewPolicy.js b/platform/commonUI/edit/src/policies/EditableViewPolicy.js index 23de491def..312bafff05 100644 --- a/platform/commonUI/edit/src/policies/EditableViewPolicy.js +++ b/platform/commonUI/edit/src/policies/EditableViewPolicy.js @@ -37,7 +37,7 @@ define( // If a view is flagged as non-editable, only allow it // while we're not in Edit mode. if ((view || {}).editable === false) { - return !(domainObject.hasCapability('editor') && domainObject.getCapability('status').get('editing')); + return !(domainObject.hasCapability('editor') && domainObject.getCapability('editor').inEditContext()); } // Like all policies, allow by default. diff --git a/platform/features/timeline/src/controllers/TimelineZoomController.js b/platform/features/timeline/src/controllers/TimelineZoomController.js index 1488d44aeb..43abb8419c 100644 --- a/platform/features/timeline/src/controllers/TimelineZoomController.js +++ b/platform/features/timeline/src/controllers/TimelineZoomController.js @@ -57,7 +57,8 @@ define( function storeZoom() { var isEditMode = $scope.commit && $scope.domainObject && - $scope.domainObject.hasCapability('editor'); + $scope.domainObject.hasCapability('editor') && + $scope.domainObject.getCapability('editor').inEditContext(); if (isEditMode) { $scope.configuration = $scope.configuration || {}; $scope.configuration.zoomLevel = zoomIndex; From 5bf750c90c1931cc3c3aca31c95431e0cf3b5bc4 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 20 Apr 2016 17:43:26 -0700 Subject: [PATCH 77/85] Fixed creation --- platform/commonUI/browse/src/creation/CreateAction.js | 11 +++++++++-- platform/commonUI/edit/src/actions/SaveAction.js | 2 +- platform/commonUI/edit/src/actions/SaveAsAction.js | 3 +-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/platform/commonUI/browse/src/creation/CreateAction.js b/platform/commonUI/browse/src/creation/CreateAction.js index e9029c4aa3..d294814304 100644 --- a/platform/commonUI/browse/src/creation/CreateAction.js +++ b/platform/commonUI/browse/src/creation/CreateAction.js @@ -83,6 +83,7 @@ define( CreateAction.prototype.perform = function () { var newModel = this.type.getInitialModel(), parentObject = this.navigationService.getNavigation(), + editorCapability, newObject; newModel.type = this.type.getKey(); @@ -90,12 +91,18 @@ define( newObject.useCapability('mutation', function(model){ model.location = parentObject.getId(); }); + editorCapability = newObject.getCapability("editor"); if (countEditableViews(newObject) > 0 && newObject.hasCapability('composition')) { this.navigationService.setNavigation(newObject); - newObject.getCapability("action").perform("edit"); + return newObject.getCapability("action").perform("edit"); } else { - return newObject.getCapability('action').perform('save'); + editorCapability.edit(); + return newObject.useCapability("action").perform("save").then(function () { + return editorCapability.save(); + }, function () { + return editorCapability.cancel() + }); } }; diff --git a/platform/commonUI/edit/src/actions/SaveAction.js b/platform/commonUI/edit/src/actions/SaveAction.js index cf8675682e..fbd5e51e3f 100644 --- a/platform/commonUI/edit/src/actions/SaveAction.js +++ b/platform/commonUI/edit/src/actions/SaveAction.js @@ -60,7 +60,7 @@ define( // during editing. function doSave() { return domainObject.getCapability("editor").save() - .then(resolveWith(domainObject.getOriginalObject())); + .then(resolveWith(domainObject)); } // Discard the current root view (which will be the editing diff --git a/platform/commonUI/edit/src/actions/SaveAsAction.js b/platform/commonUI/edit/src/actions/SaveAsAction.js index 6d73b75308..2f609cfd42 100644 --- a/platform/commonUI/edit/src/actions/SaveAsAction.js +++ b/platform/commonUI/edit/src/actions/SaveAsAction.js @@ -157,8 +157,7 @@ define( SaveAsAction.appliesTo = function (context) { var domainObject = (context || {}).domainObject; return domainObject !== undefined && - domainObject.hasCapability("editor") && - domainObject.getCapability("editor").inEditContext() && + domainObject.getCapability("status").get("editing") && domainObject.getModel().persisted === undefined; }; From 44f4a82fa1133e58271cfb4d7b0d79fab4db1ad0 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 12 May 2016 16:14:31 -0700 Subject: [PATCH 78/85] Resolved merge conflicts --- .../browse/src/creation/CreateAction.js | 7 +- platform/commonUI/edit/bundle.js | 27 +-- .../commonUI/edit/src/actions/CancelAction.js | 20 +- .../commonUI/edit/src/actions/EditAction.js | 10 +- .../commonUI/edit/src/actions/SaveAction.js | 5 +- .../commonUI/edit/src/actions/SaveAsAction.js | 9 +- .../edit/src/capabilities/EditorCapability.js | 56 +++++- ...r.js => TransactionCapabilityDecorator.js} | 20 +- .../TransactionalPersistenceCapability.js | 47 +++-- .../edit/src/policies/EditActionPolicy.js | 3 +- .../policies/EditContextualActionPolicy.js | 7 +- .../edit/src/policies/EditNavigationPolicy.js | 9 +- .../edit/src/policies/EditableMovePolicy.js | 9 +- .../edit/src/representers/EditRepresenter.js | 2 +- .../edit/src/services/DirtyModelCache.js | 47 ----- .../edit/src/services/TransactionService.js | 118 +++++++----- .../edit/test/actions/EditActionSpec.js | 69 ++++--- .../edit/test/actions/SaveActionSpec.js | 11 +- .../edit/test/actions/SaveAsActionSpec.js | 3 +- .../test/capabilities/EditorCapabilitySpec.js | 180 ++++++++++++------ .../TransactionCapabilityDecoratorSpec.js | 59 ++++++ .../TransactionalPersistenceCapabilitySpec.js | 92 +++++++++ .../test/policies/EditActionPolicySpec.js | 9 +- .../EditContextualActionPolicySpec.js | 14 +- .../test/policies/EditableViewPolicySpec.js | 7 +- .../test/representers/EditRepresenterSpec.js | 11 +- .../test/services/TransactionServiceSpec.js | 127 ++++++++++++ .../regions/src/EditableRegionPolicy.js | 2 +- .../regions/test/EditableRegionPolicySpec.js | 19 +- .../capabilities/PersistenceCapabilitySpec.js | 12 -- .../swimlane/TimelineSwimlaneDropHandler.js | 6 +- .../controllers/TimelineZoomControllerSpec.js | 9 +- .../TimelineSwimlaneDropHandlerSpec.js | 15 +- .../representation/src/MCTRepresentation.js | 10 +- .../src/gestures/DropGesture.js | 11 +- .../test/MCTRepresentationSpec.js | 7 + .../src/services/GenericSearchProvider.js | 4 +- 37 files changed, 741 insertions(+), 332 deletions(-) rename platform/commonUI/edit/src/capabilities/{TransactionDecorator.js => TransactionCapabilityDecorator.js} (80%) delete mode 100644 platform/commonUI/edit/src/services/DirtyModelCache.js create mode 100644 platform/commonUI/edit/test/capabilities/TransactionCapabilityDecoratorSpec.js create mode 100644 platform/commonUI/edit/test/capabilities/TransactionalPersistenceCapabilitySpec.js create mode 100644 platform/commonUI/edit/test/services/TransactionServiceSpec.js diff --git a/platform/commonUI/browse/src/creation/CreateAction.js b/platform/commonUI/browse/src/creation/CreateAction.js index d294814304..9ac86d2dc8 100644 --- a/platform/commonUI/browse/src/creation/CreateAction.js +++ b/platform/commonUI/browse/src/creation/CreateAction.js @@ -87,10 +87,9 @@ define( newObject; newModel.type = this.type.getKey(); + newModel.location = parentObject.getId(); newObject = parentObject.useCapability('instantiation', newModel); - newObject.useCapability('mutation', function(model){ - model.location = parentObject.getId(); - }); + editorCapability = newObject.getCapability("editor"); if (countEditableViews(newObject) > 0 && newObject.hasCapability('composition')) { @@ -101,7 +100,7 @@ define( return newObject.useCapability("action").perform("save").then(function () { return editorCapability.save(); }, function () { - return editorCapability.cancel() + return editorCapability.cancel(); }); } }; diff --git a/platform/commonUI/edit/bundle.js b/platform/commonUI/edit/bundle.js index 35818bd477..5a5101f129 100644 --- a/platform/commonUI/edit/bundle.js +++ b/platform/commonUI/edit/bundle.js @@ -41,9 +41,8 @@ define([ "./src/representers/EditRepresenter", "./src/representers/EditToolbarRepresenter", "./src/capabilities/EditorCapability", - "./src/capabilities/TransactionDecorator", + "./src/capabilities/TransactionCapabilityDecorator", "./src/services/TransactionService", - "./src/services/DirtyModelCache", "text!./res/templates/library.html", "text!./res/templates/edit-object.html", "text!./res/templates/edit-action-buttons.html", @@ -71,9 +70,8 @@ define([ EditRepresenter, EditToolbarRepresenter, EditorCapability, - TransactionDecorator, + TransactionCapabilityDecorator, TransactionService, - DirtyModelCache, libraryTemplate, editObjectTemplate, editActionButtonsTemplate, @@ -136,8 +134,7 @@ define([ "depends": [ "$location", "navigationService", - "$log", - "$q" + "$log" ], "description": "Edit this object.", "category": "view-control", @@ -270,11 +267,10 @@ define([ { "type": "decorator", "provides": "capabilityService", - "implementation": TransactionDecorator, + "implementation": TransactionCapabilityDecorator, "depends": [ "$q", - "transactionService", - "dirtyModelCache" + "transactionService" ] }, { @@ -283,15 +279,7 @@ define([ "implementation": TransactionService, "depends": [ "$q", - "dirtyModelCache" - ] - }, - { - "type": "provider", - "provides": "dirtyModelCache", - "implementation": DirtyModelCache, - "depends": [ - "topic" + "$log" ] } ], @@ -324,8 +312,7 @@ define([ "description": "Provides transactional editing capabilities", "implementation": EditorCapability, "depends": [ - "transactionService", - "dirtyModelCache" + "transactionService" ] } ], diff --git a/platform/commonUI/edit/src/actions/CancelAction.js b/platform/commonUI/edit/src/actions/CancelAction.js index 550516360a..77013ee8f5 100644 --- a/platform/commonUI/edit/src/actions/CancelAction.js +++ b/platform/commonUI/edit/src/actions/CancelAction.js @@ -46,10 +46,19 @@ define( function returnToBrowse () { var parent; - domainObject.getCapability("location").getOriginal().then(function (original) { - parent = original.getCapability("context").getParent(); - parent.getCapability("action").perform("navigate"); - }); + + //If the object existed already, navigate to refresh view + // with previous object state. + if (domainObject.getModel().persisted) { + domainObject.getCapability("action").perform("navigate"); + } else { + //If the object was new, and user has cancelled, then + //navigate back to parent because nothing to show. + domainObject.getCapability("location").getOriginal().then(function (original) { + parent = original.getCapability("context").getParent(); + parent.getCapability("action").perform("navigate"); + }); + } } return this.domainObject.getCapability("editor").cancel() .then(returnToBrowse); @@ -64,7 +73,8 @@ define( CancelAction.appliesTo = function (context) { var domainObject = (context || {}).domainObject; return domainObject !== undefined && - domainObject.getCapability("status").get("editing"); + domainObject.hasCapability('editor') && + domainObject.getCapability('editor').isEditContextRoot(); }; return CancelAction; diff --git a/platform/commonUI/edit/src/actions/EditAction.js b/platform/commonUI/edit/src/actions/EditAction.js index 229861d1d9..acb83c0407 100644 --- a/platform/commonUI/edit/src/actions/EditAction.js +++ b/platform/commonUI/edit/src/actions/EditAction.js @@ -44,7 +44,7 @@ define( * @constructor * @implements {Action} */ - function EditAction($location, navigationService, $log, $q, context) { + function EditAction($location, navigationService, $log, context) { var domainObject = (context || {}).domainObject; // We cannot enter Edit mode if we have no domain object to @@ -63,7 +63,6 @@ define( this.domainObject = domainObject; this.$location = $location; this.navigationService = navigationService; - this.$q = $q; } /** @@ -89,8 +88,11 @@ define( var domainObject = (context || {}).domainObject, type = domainObject && domainObject.getCapability('type'); - // Only allow creatable types to be edited - return type && type.hasFeature('creation') && !domainObject.getCapability('status').get('editing'); + // Only allow editing of types that support it and are not already + // being edited + return type && type.hasFeature('creation') && + domainObject.hasCapability('editor') && + !domainObject.getCapability('editor').isEditContextRoot(); }; return EditAction; diff --git a/platform/commonUI/edit/src/actions/SaveAction.js b/platform/commonUI/edit/src/actions/SaveAction.js index fbd5e51e3f..3879685b9f 100644 --- a/platform/commonUI/edit/src/actions/SaveAction.js +++ b/platform/commonUI/edit/src/actions/SaveAction.js @@ -85,8 +85,9 @@ define( SaveAction.appliesTo = function (context) { var domainObject = (context || {}).domainObject; return domainObject !== undefined && - domainObject.getModel().persisted !== undefined && - domainObject.getCapability("status").get("editing"); + domainObject.hasCapability('editor') && + domainObject.getCapability('editor').isEditContextRoot() && + domainObject.getModel().persisted !== undefined; }; return SaveAction; diff --git a/platform/commonUI/edit/src/actions/SaveAsAction.js b/platform/commonUI/edit/src/actions/SaveAsAction.js index 2f609cfd42..f347cad899 100644 --- a/platform/commonUI/edit/src/actions/SaveAsAction.js +++ b/platform/commonUI/edit/src/actions/SaveAsAction.js @@ -135,8 +135,8 @@ define( return copyService.perform(domainObject, parent, allowClone); } - function cancelEditingAfterClone(clonedObject) { - return domainObject.getCapability("editor").cancel() + function commitEditingAfterClone(clonedObject) { + return domainObject.getCapability("editor").save() .then(resolveWith(clonedObject)); } @@ -144,7 +144,7 @@ define( .then(doWizardSave) .then(getParent) .then(cloneIntoParent) - .then(cancelEditingAfterClone) + .then(commitEditingAfterClone) .catch(resolveWith(false)); }; @@ -157,7 +157,8 @@ define( SaveAsAction.appliesTo = function (context) { var domainObject = (context || {}).domainObject; return domainObject !== undefined && - domainObject.getCapability("status").get("editing") && + domainObject.hasCapability('editor') && + domainObject.getCapability('editor').isEditContextRoot() && domainObject.getModel().persisted === undefined; }; diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index 2091f3b9b3..df305de73c 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -24,24 +24,42 @@ define( [], function () { + /** + * 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). + * @param transactionService + * @param domainObject + * @constructor + */ function EditorCapability( transactionService, - dirtyModelCache, domainObject ) { this.transactionService = transactionService; - this.dirtyModelCache = dirtyModelCache; this.domainObject = domainObject; } + /** + * Initiate an editing session. This will start a transaction during + * which any persist operations will be deferred until either save() + * or cancel() are called. + */ EditorCapability.prototype.edit = function () { this.transactionService.startTransaction(); this.domainObject.getCapability('status').set('editing', true); }; + function isEditContextRoot (domainObject) { + return domainObject.getCapability('status').get('editing'); + } + function isEditing (domainObject) { - return domainObject.getCapability('status').get('editing') || - domainObject.hasCapability('context') && isEditing(domainObject.getCapability('context').getParent()); + return isEditContextRoot(domainObject) || + domainObject.hasCapability('context') && + isEditing(domainObject.getCapability('context').getParent()); } /** @@ -53,6 +71,20 @@ define( return isEditing(this.domainObject); }; + /** + * Is this the root editing object (ie. the object that the user + * clicked 'edit' on)? + * @returns {*} + */ + EditorCapability.prototype.isEditContextRoot = function () { + return isEditContextRoot(this.domainObject); + }; + + /** + * Save any changes from this editing session. This will flush all + * pending persists and end the current transaction + * @returns {*} + */ EditorCapability.prototype.save = function () { var domainObject = this.domainObject; return this.transactionService.commit().then(function() { @@ -62,6 +94,11 @@ define( EditorCapability.prototype.invoke = EditorCapability.prototype.edit; + /** + * Cancel the current editing session. This will discard any pending + * persist operations + * @returns {*} + */ EditorCapability.prototype.cancel = function () { var domainObject = this.domainObject; return this.transactionService.cancel().then(function(){ @@ -70,15 +107,14 @@ define( }); }; + /** + * @returns {boolean} true if there have been any domain model + * modifications since the last persist, false otherwise. + */ EditorCapability.prototype.dirty = function () { - return this.dirtyModelCache.isDirty(this.domainObject); + return (this.domainObject.getModel().modified || 0) > (this.domainObject.getModel().persisted || 0); }; - EditorCapability.prototype.appliesTo = function(context) { - var domainObject = context.domainObject; - return domainObject && domainObject.getType().hasFeature("creation"); - } - return EditorCapability; } ); diff --git a/platform/commonUI/edit/src/capabilities/TransactionDecorator.js b/platform/commonUI/edit/src/capabilities/TransactionCapabilityDecorator.js similarity index 80% rename from platform/commonUI/edit/src/capabilities/TransactionDecorator.js rename to platform/commonUI/edit/src/capabilities/TransactionCapabilityDecorator.js index 6121ed6faa..44d2b1ed53 100644 --- a/platform/commonUI/edit/src/capabilities/TransactionDecorator.js +++ b/platform/commonUI/edit/src/capabilities/TransactionCapabilityDecorator.js @@ -26,23 +26,30 @@ define( function (TransactionalPersistenceCapability) { 'use strict'; - function TransactionDecorator( + /** + * Wraps the [PersistenceCapability]{@link PersistenceCapability} with + * transactional capabilities. + * @param $q + * @param transactionService + * @param capabilityService + * @see TransactionalPersistenceCapability + * @constructor + */ + function TransactionCapabilityDecorator( $q, transactionService, - dirtyModelCache, capabilityService ) { this.capabilityService = capabilityService; this.transactionService = transactionService; - this.dirtyModelCache = dirtyModelCache; this.$q = $q; } /** - * Decorate PersistenceCapability to ignore persistence calls when a + * Decorate PersistenceCapability to queue persistence calls when a * transaction is in progress. */ - TransactionDecorator.prototype.getCapabilities = function (model) { + TransactionCapabilityDecorator.prototype.getCapabilities = function (model) { var self = this, capabilities = this.capabilityService.getCapabilities(model), persistenceCapability = capabilities.persistence; @@ -55,7 +62,6 @@ define( return new TransactionalPersistenceCapability( self.$q, self.transactionService, - self.dirtyModelCache, original, domainObject ); @@ -63,6 +69,6 @@ define( return capabilities; }; - return TransactionDecorator; + return TransactionCapabilityDecorator; } ); diff --git a/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js b/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js index b282c40e1f..0c6420d484 100644 --- a/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js +++ b/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js @@ -26,44 +26,51 @@ define( function () { 'use strict'; + /** + * Wraps persistence capability to enable transactions. Transactions + * will cause persist calls not to be invoked immediately, but + * rather queued until [EditorCapability.save()]{@link EditorCapability#save} + * or [EditorCapability.cancel()]{@link EditorCapability#cancel} are + * called. + * @memberof platform/commonUI/edit/capabilities + * @param $q + * @param transactionService + * @param persistenceCapability + * @param domainObject + * @constructor + */ function TransactionalPersistenceCapability( $q, transactionService, - dirtyModelCache, persistenceCapability, domainObject ) { this.transactionService = transactionService; - this.dirtyModelCache = dirtyModelCache; - this.persistenceCapability = Object.create(persistenceCapability); + this.persistenceCapability = persistenceCapability; this.domainObject = domainObject; this.$q = $q; } + /** + * The wrapped persist function. If a transaction is active, persist + * will be queued until the transaction is committed or cancelled. + * @returns {*} + */ TransactionalPersistenceCapability.prototype.persist = function () { - var domainObject = this.domainObject, - dirtyModelCache = this.dirtyModelCache; - if (this.transactionService.isActive() && !this.transactionService.isCommitting()) { - dirtyModelCache.markDirty(domainObject); - //Using $q here because need to return something - // from which 'catch' can be chained + if (this.transactionService.isActive()) { + this.transactionService.addToTransaction( + this.persistenceCapability.persist.bind(this.persistenceCapability), + this.persistenceCapability.refresh.bind(this.persistenceCapability) + ); + //Need to return a promise from this function return this.$q.when(true); } else { - return this.persistenceCapability.persist().then(function (result) { - dirtyModelCache.markClean(domainObject); - return result; - }); + return this.persistenceCapability.persist(); } }; TransactionalPersistenceCapability.prototype.refresh = function () { - var domainObject = this.domainObject, - dirtyModelCache = this.dirtyModelCache; - - return this.persistenceCapability.refresh().then(function (result) { - dirtyModelCache.markClean(domainObject); - return result; - }); + return this.persistenceCapability.refresh(); }; TransactionalPersistenceCapability.prototype.getSpace = function () { diff --git a/platform/commonUI/edit/src/policies/EditActionPolicy.js b/platform/commonUI/edit/src/policies/EditActionPolicy.js index 2952758840..78f2c54cb0 100644 --- a/platform/commonUI/edit/src/policies/EditActionPolicy.js +++ b/platform/commonUI/edit/src/policies/EditActionPolicy.js @@ -73,7 +73,8 @@ define( function isEditing(context) { var domainObject = (context || {}).domainObject; return domainObject - && domainObject.getCapability('status').get('editing'); + && domainObject.hasCapability('editor') + && domainObject.getCapability('editor').isEditContextRoot(); } EditActionPolicy.prototype.allow = function (action, context) { diff --git a/platform/commonUI/edit/src/policies/EditContextualActionPolicy.js b/platform/commonUI/edit/src/policies/EditContextualActionPolicy.js index b5853bd89c..afccf5a121 100644 --- a/platform/commonUI/edit/src/policies/EditContextualActionPolicy.js +++ b/platform/commonUI/edit/src/policies/EditContextualActionPolicy.js @@ -34,6 +34,11 @@ define( * from context menu of non-editable objects, when navigated object * is being edited * @constructor + * @param navigationService + * @param editModeBlacklist A blacklist of actions disallowed from + * context menu when navigated object is being edited + * @param nonEditContextBlacklist A blacklist of actions disallowed + * from context menu of non-editable objects, when navigated object * @implements {Policy.} */ function EditContextualActionPolicy(navigationService, editModeBlacklist, nonEditContextBlacklist) { @@ -51,7 +56,7 @@ define( navigatedObject = this.navigationService.getNavigation(), actionMetadata = action.getMetadata ? action.getMetadata() : {}; - if (navigatedObject.getCapability("status").get("editing")) { + if (navigatedObject.hasCapability("editor") && navigatedObject.getCapability("editor").isEditContextRoot()) { if (selectedObject.hasCapability("editor") && selectedObject.getCapability("editor").inEditContext()){ //Target is within the editing context return this.editBlacklist.indexOf(actionMetadata.key) === -1; diff --git a/platform/commonUI/edit/src/policies/EditNavigationPolicy.js b/platform/commonUI/edit/src/policies/EditNavigationPolicy.js index 62c489b35d..83563b5ced 100644 --- a/platform/commonUI/edit/src/policies/EditNavigationPolicy.js +++ b/platform/commonUI/edit/src/policies/EditNavigationPolicy.js @@ -41,12 +41,11 @@ define( EditNavigationPolicy.prototype.isDirty = function(domainObject) { var navigatedObject = domainObject, editorCapability = navigatedObject && - navigatedObject.getCapability("editor"), - statusCapability = navigatedObject && - navigatedObject.getCapability("status"); + navigatedObject.getCapability("editor"); - return statusCapability && statusCapability.get('editing') && - editorCapability && editorCapability.dirty(); + return editorCapability && + editorCapability.isEditContextRoot() && + editorCapability.dirty(); }; /** diff --git a/platform/commonUI/edit/src/policies/EditableMovePolicy.js b/platform/commonUI/edit/src/policies/EditableMovePolicy.js index 4974e0c60d..bb36c86746 100644 --- a/platform/commonUI/edit/src/policies/EditableMovePolicy.js +++ b/platform/commonUI/edit/src/policies/EditableMovePolicy.js @@ -35,10 +35,13 @@ define([], function () { EditableMovePolicy.prototype.allow = function (action, context) { var domainObject = context.domainObject, selectedObject = context.selectedObject, - key = action.getMetadata().key; + key = action.getMetadata().key, + isDomainObjectEditing = domainObject.hasCapability('editor') && + domainObject.getCapability('editor').inEditContext(); - if (key === 'move' && domainObject.hasCapability('editor') && domainObject.getCapability('editor').inEditContext()) { - return !!selectedObject && selectedObject.hasCapability('editor') && selectedObject.getCapability('editor').inEditContext(); + if (key === 'move' && isDomainObjectEditing) { + return !!selectedObject && selectedObject.hasCapability('editor') && + selectedObject.getCapability('editor').inEditContext(); } // Like all policies, allow by default. diff --git a/platform/commonUI/edit/src/representers/EditRepresenter.js b/platform/commonUI/edit/src/representers/EditRepresenter.js index 270f9ecc52..e853669eff 100644 --- a/platform/commonUI/edit/src/representers/EditRepresenter.js +++ b/platform/commonUI/edit/src/representers/EditRepresenter.js @@ -136,7 +136,7 @@ define( } }); - if (representedObject.getCapability('status').get('editing')){ + if (representedObject.hasCapability('editor') && representedObject.getCapability('editor').isEditContextRoot()){ setEditing(); } }; diff --git a/platform/commonUI/edit/src/services/DirtyModelCache.js b/platform/commonUI/edit/src/services/DirtyModelCache.js deleted file mode 100644 index 0439efc6fc..0000000000 --- a/platform/commonUI/edit/src/services/DirtyModelCache.js +++ /dev/null @@ -1,47 +0,0 @@ -/***************************************************************************** - * Open MCT Web, Copyright (c) 2014-2015, United States Government - * as represented by the Administrator of the National Aeronautics and Space - * Administration. All rights reserved. - * - * Open MCT Web is licensed under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * Open MCT Web includes source code licensed under additional open source - * licenses. See the Open Source Licenses file (LICENSES.md) included with - * this source code distribution or the Licensing information page available - * at runtime from the About dialog for additional information. - *****************************************************************************/ -/*global define*/ -define( - [], - function() { - function DirtyModelCache(topic) { - this.cache = {}; - } - - DirtyModelCache.prototype.get = function () { - return this.cache; - }; - - DirtyModelCache.prototype.isDirty = function (domainObject) { - return !!this.cache[domainObject.getId()]; - }; - - DirtyModelCache.prototype.markDirty = function (domainObject) { - this.cache[domainObject.getId()] = domainObject; - }; - - DirtyModelCache.prototype.markClean = function (domainObject) { - delete this.cache[domainObject.getId()]; - }; - - return DirtyModelCache; - }); \ No newline at end of file diff --git a/platform/commonUI/edit/src/services/TransactionService.js b/platform/commonUI/edit/src/services/TransactionService.js index 2944d2215c..6affde28d8 100644 --- a/platform/commonUI/edit/src/services/TransactionService.js +++ b/platform/commonUI/edit/src/services/TransactionService.js @@ -25,64 +25,90 @@ define( function() { /** * Implements an application-wide transaction state. Once a - * transaction is started, calls to PersistenceCapability.persist() + * transaction is started, calls to + * [PersistenceCapability.persist()]{@link PersistenceCapability#persist} * will be deferred until a subsequent call to - * TransactionService.commit() is made. + * [TransactionService.commit]{@link TransactionService#commit} is made. * + * @memberof platform/commonUI/edit/services * @param $q * @constructor */ - function TransactionService($q, dirtyModelCache) { + function TransactionService($q, $log) { this.$q = $q; + this.$log = $log; this.transaction = false; - this.committing = false; - this.cache = dirtyModelCache; + + this.onCommits = []; + this.onCancels = []; } + /** + * Starts a transaction. While a transaction is active all calls to + * [PersistenceCapability.persist](@link PersistenceCapability#persist) + * will be queued until [commit]{@link #commit} or [cancel]{@link + * #cancel} are called + */ TransactionService.prototype.startTransaction = function () { - if (this.transaction) - console.error("Transaction already in progress") + if (this.transaction) { + //Log error because this is a programming error if it occurs. + this.$log.error("Transaction already in progress"); + } this.transaction = true; }; + /** + * @returns {boolean} If true, indicates that a transaction is in progress + */ TransactionService.prototype.isActive = function () { return this.transaction; }; - TransactionService.prototype.isCommitting = function () { - return this.committing; + /** + * Adds provided functions to a queue to be called on + * [.commit()]{@link #commit} or + * [.cancel()]{@link #commit} + * @param onCommit A function to call on commit + * @param onCancel A function to call on cancel + */ + TransactionService.prototype.addToTransaction = function (onCommit, onCancel) { + if (this.transaction) { + this.onCommits.push(onCommit); + if (onCancel) { + this.onCancels.push(onCancel); + } + } else { + //Log error because this is a programming error if it occurs. + this.$log.error("No transaction in progress"); + } }; /** * All persist calls deferred since the beginning of the transaction - * will be committed. Any failures will be reported via a promise - * rejection. - * @returns {*} + * will be committed. + * + * @returns {Promise} resolved when all persist operations have + * completed. Will reject if any commit operations fail */ TransactionService.prototype.commit = function () { - var self = this; - cache = this.cache.get(); + var self = this, + promises = [], + onCommit; - this.committing = true; - - function keyToObject(key) { - return cache[key]; + while (this.onCommits.length > 0) { // ...using a while in case some onCommit adds to transaction + onCommit = this.onCommits.pop(); + try { // ...also don't want to fail mid-loop... + promises.push(onCommit()); + } catch (e) { + this.$log.error("Error committing transaction."); + } } + return this.$q.all(promises).then( function () { + self.transaction = false; - function objectToPromise(object) { - return object.getCapability('persistence').persist(); - } - - return this.$q.all( - Object.keys(cache) - .map(keyToObject) - .map(objectToPromise)) - .then(function () { - self.transaction = false; - this.committing = false; - }).catch(function() { - return this.committing = false; - }); + self.onCommits = []; + self.onCancels = []; + }); }; /** @@ -95,23 +121,23 @@ define( */ TransactionService.prototype.cancel = function () { var self = this, - cache = this.cache.get(); + results = [], + onCancel; - function keyToObject(key) { - return cache[key]; + while (this.onCancels.length > 0) { + onCancel = this.onCancels.pop(); + try { + results.push(onCancel()); + } catch (error) { + this.$log.error("Error committing transaction."); + } } + return this.$q.all(results).then(function () { + self.transaction = false; - function objectToPromise(object) { - return self.$q.when(object.getModel().persisted && object.getCapability('persistence').refresh()); - } - - return this.$q.all(Object.keys(cache) - .map(keyToObject) - .map(objectToPromise)) - .then(function () { - self.transaction = false; - this.committing = false; - }); + self.onCommits = []; + self.onCancels = []; + }); }; return TransactionService; diff --git a/platform/commonUI/edit/test/actions/EditActionSpec.js b/platform/commonUI/edit/test/actions/EditActionSpec.js index 7ed8b672bd..f645e1cd08 100644 --- a/platform/commonUI/edit/test/actions/EditActionSpec.js +++ b/platform/commonUI/edit/test/actions/EditActionSpec.js @@ -30,7 +30,9 @@ define( mockLog, mockDomainObject, mockType, + mockEditor, actionContext, + capabilities, action; beforeEach(function () { @@ -40,7 +42,7 @@ define( ); mockNavigationService = jasmine.createSpyObj( "navigationService", - [ "setNavigation", "getNavigation" ] + [ "setNavigation", "getNavigation", "addListener", "removeListener" ] ); mockLog = jasmine.createSpyObj( "$log", @@ -48,14 +50,26 @@ define( ); mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getModel", "getCapability" ] + [ "getId", "getModel", "getCapability", "hasCapability", "useCapability" ] ); mockType = jasmine.createSpyObj( "type", [ "hasFeature" ] ); + mockEditor = jasmine.createSpyObj( + "editorCapability", + ["edit", "isEditContextRoot", "cancel"] + ); - mockDomainObject.getCapability.andReturn(mockType); + capabilities = { + type: mockType, + editor: mockEditor + }; + + mockDomainObject.getCapability.andCallFake( function (name) { + return capabilities[name]; + }); + mockDomainObject.hasCapability.andReturn(true); mockType.hasFeature.andReturn(true); actionContext = { domainObject: mockDomainObject }; @@ -68,51 +82,34 @@ define( ); }); - it("is only applicable when a domain object is present", function () { + it("is only applicable when an editable domain object is present", function () { expect(EditAction.appliesTo(actionContext)).toBeTruthy(); expect(EditAction.appliesTo({})).toBeFalsy(); + + expect(mockDomainObject.hasCapability).toHaveBeenCalledWith('editor'); // Should have checked for creatability expect(mockType.hasFeature).toHaveBeenCalledWith('creation'); }); - //TODO: Disabled for NEM Beta - xit("changes URL path to edit mode when performed", function () { + it("is only applicable to objects not already in edit mode", function () { + mockEditor.isEditContextRoot.andReturn(false); + expect(EditAction.appliesTo(actionContext)).toBe(true); + mockEditor.isEditContextRoot.andReturn(true); + expect(EditAction.appliesTo(actionContext)).toBe(false); + }); + + it ("cancels editing when user navigates away", function () { action.perform(); - expect(mockLocation.path).toHaveBeenCalledWith("/edit"); + expect(mockNavigationService.addListener).toHaveBeenCalled(); + mockNavigationService.addListener.mostRecentCall.args[0](); + expect(mockEditor.cancel).toHaveBeenCalled(); }); - //TODO: Disabled for NEM Beta - xit("ensures that the edited object is navigated-to", function () { + it ("invokes the Edit capability on the object", function () { action.perform(); - expect(mockNavigationService.setNavigation) - .toHaveBeenCalledWith(mockDomainObject); + expect(mockDomainObject.useCapability).toHaveBeenCalledWith("editor"); }); - //TODO: Disabled for NEM Beta - xit("logs a warning if constructed when inapplicable", function () { - // Verify precondition (ensure warn wasn't called during setup) - expect(mockLog.warn).not.toHaveBeenCalled(); - - // Should not have hit an exception... - new EditAction( - mockLocation, - mockNavigationService, - mockLog, - {} - ).perform(); - - // ...but should have logged a warning - expect(mockLog.warn).toHaveBeenCalled(); - - // And should not have had other interactions - expect(mockLocation.path) - .not.toHaveBeenCalled(); - expect(mockNavigationService.setNavigation) - .not.toHaveBeenCalled(); - }); - - - }); } ); \ No newline at end of file diff --git a/platform/commonUI/edit/test/actions/SaveActionSpec.js b/platform/commonUI/edit/test/actions/SaveActionSpec.js index 1c94bdfe60..09df5e53b5 100644 --- a/platform/commonUI/edit/test/actions/SaveActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveActionSpec.js @@ -52,7 +52,7 @@ define( ); mockEditorCapability = jasmine.createSpyObj( "editor", - [ "save", "cancel" ] + [ "save", "cancel", "isEditContextRoot" ] ); mockActionCapability = jasmine.createSpyObj( "actionCapability", @@ -71,7 +71,7 @@ define( }); mockDomainObject.getModel.andReturn({persisted: 0}); mockEditorCapability.save.andReturn(mockPromise(true)); - mockDomainObject.getOriginalObject.andReturn(mockDomainObject); + mockEditorCapability.isEditContextRoot.andReturn(true); action = new SaveAction(actionContext); @@ -97,6 +97,13 @@ define( action.perform(); expect(mockEditorCapability.save).toHaveBeenCalled(); }); + + it("navigates to the object after saving", + function () { + action.perform(); + expect(mockActionCapability.perform).toHaveBeenCalledWith("navigate"); + }); + }); } ); \ No newline at end of file diff --git a/platform/commonUI/edit/test/actions/SaveAsActionSpec.js b/platform/commonUI/edit/test/actions/SaveAsActionSpec.js index 47b8440353..bac173ddcc 100644 --- a/platform/commonUI/edit/test/actions/SaveAsActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveAsActionSpec.js @@ -78,10 +78,11 @@ define( mockEditorCapability = jasmine.createSpyObj( "editor", - [ "save", "cancel" ] + [ "save", "cancel", "isEditContextRoot" ] ); mockEditorCapability.cancel.andReturn(mockPromise(undefined)); mockEditorCapability.save.andReturn(mockPromise(true)); + mockEditorCapability.isEditContextRoot.andReturn(true); capabilities.editor = mockEditorCapability; mockActionCapability = jasmine.createSpyObj( diff --git a/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js index d18cdcd931..29b08a4038 100644 --- a/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js +++ b/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js @@ -25,94 +25,150 @@ define( function (EditorCapability) { describe("The editor capability", function () { - var mockPersistence, - mockEditableObject, - mockDomainObject, - mockCache, - mockCallback, - model, + var mockDomainObject, + capabilities, + mockParentObject, + mockTransactionService, + mockStatusCapability, + mockParentStatus, + mockContextCapability, capability; - beforeEach(function () { - mockPersistence = jasmine.createSpyObj( - "persistence", - [ "persist" ] - ); - mockEditableObject = { - getModel: function () { return model; } + function fastPromise(val) { + return { + then: function (callback) { + return callback(val); + } }; + } + + beforeEach(function () { mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getModel", "getCapability", "useCapability" ] + ["getId", "getModel", "hasCapability", "getCapability", "useCapability"] ); - mockCache = jasmine.createSpyObj( - "cache", - [ "saveAll", "markClean" ] + mockParentObject = jasmine.createSpyObj( + "domainObject", + ["getId", "getModel", "hasCapability", "getCapability", "useCapability"] ); - mockCallback = jasmine.createSpy("callback"); + mockTransactionService = jasmine.createSpyObj( + "transactionService", + [ + "startTransaction", + "commit", + "cancel" + ] + ); + mockTransactionService.commit.andReturn(fastPromise()); + mockTransactionService.cancel.andReturn(fastPromise()); - mockDomainObject.getCapability.andReturn(mockPersistence); + mockStatusCapability = jasmine.createSpyObj( + "statusCapability", + ["get", "set"] + ); + mockParentStatus = jasmine.createSpyObj( + "statusCapability", + ["get", "set"] + ); + mockContextCapability = jasmine.createSpyObj( + "contextCapability", + ["getParent"] + ); + mockContextCapability.getParent.andReturn(mockParentObject); - model = { someKey: "some value", x: 42 }; + capabilities = { + context: mockContextCapability, + status: mockStatusCapability + }; + + mockDomainObject.hasCapability.andCallFake(function(name) { + return capabilities[name] !== undefined; + }); + + mockDomainObject.getCapability.andCallFake(function (name) { + return capabilities[name]; + }); + + mockParentObject.getCapability.andReturn(mockParentStatus); + mockParentObject.hasCapability.andReturn(false); capability = new EditorCapability( - mockPersistence, - mockEditableObject, - mockDomainObject, - mockCache + mockTransactionService, + mockDomainObject ); }); - //TODO: Disabled for NEM Beta - xit("mutates the real domain object on nonrecursive save", function () { - capability.save(true).then(mockCallback); + it("starts a transaction when edit is invoked", function () { + capability.edit(); + expect(mockTransactionService.startTransaction).toHaveBeenCalled(); + }); - // Wait for promise to resolve - waitsFor(function () { - return mockCallback.calls.length > 0; - }, 250); + it("sets editing status on object", function () { + capability.edit(); + expect(mockStatusCapability.set).toHaveBeenCalledWith("editing", true); + }); - runs(function () { - expect(mockDomainObject.useCapability) - .toHaveBeenCalledWith("mutation", jasmine.any(Function)); - // We should get the model from the editable object back - expect( - mockDomainObject.useCapability.mostRecentCall.args[1]() - ).toEqual(model); + it("uses editing status to determine editing context root", function () { + capability.edit(); + mockStatusCapability.get.andReturn(false); + expect(capability.isEditContextRoot()).toBe(false); + mockStatusCapability.get.andReturn(true); + expect(capability.isEditContextRoot()).toBe(true); + }); + + it("inEditingContext returns true if parent object is being" + + " edited", function () { + mockStatusCapability.get.andReturn(false); + mockParentStatus.get.andReturn(false); + expect(capability.inEditContext()).toBe(false); + mockParentStatus.get.andReturn(true); + expect(capability.inEditContext()).toBe(true); + }); + + describe("save", function() { + beforeEach(function() { + capability.edit(); + capability.save(); + }); + it("commits the transaction", function () { + expect(mockTransactionService.commit).toHaveBeenCalled(); + }); + it("resets the edit state", function () { + expect(mockStatusCapability.set).toHaveBeenCalledWith('editing', false); }); }); - //TODO: Disabled for NEM Beta - xit("tells the cache to save others", function () { - capability.save().then(mockCallback); - - // Wait for promise to resolve - waitsFor(function () { - return mockCallback.calls.length > 0; - }, 250); - - runs(function () { - expect(mockCache.saveAll).toHaveBeenCalled(); + describe("cancel", function() { + beforeEach(function() { + capability.edit(); + capability.cancel(); + }); + it("cancels the transaction", function () { + expect(mockTransactionService.cancel).toHaveBeenCalled(); + }); + it("resets the edit state", function () { + expect(mockStatusCapability.set).toHaveBeenCalledWith('editing', false); }); }); - //TODO: Disabled for NEM Beta - xit("has no interactions on cancel", function () { - capability.cancel().then(mockCallback); + describe("dirty", function() { + var model = {}; - // Wait for promise to resolve - waitsFor(function () { - return mockCallback.calls.length > 0; - }, 250); + beforeEach(function() { + mockDomainObject.getModel.andReturn(model); + capability.edit(); + capability.cancel(); + }); + it("returns true if the object has been modified since it" + + " was last persisted", function () { + model.modified = 0; + model.persisted = 0; + expect(capability.dirty()).toBe(false); - runs(function () { - expect(mockDomainObject.useCapability).not.toHaveBeenCalled(); - expect(mockCache.markClean).not.toHaveBeenCalled(); - expect(mockCache.saveAll).not.toHaveBeenCalled(); + model.modified = 1; + expect(capability.dirty()).toBe(true); }); }); - - }); } ); \ No newline at end of file diff --git a/platform/commonUI/edit/test/capabilities/TransactionCapabilityDecoratorSpec.js b/platform/commonUI/edit/test/capabilities/TransactionCapabilityDecoratorSpec.js new file mode 100644 index 0000000000..15738167e2 --- /dev/null +++ b/platform/commonUI/edit/test/capabilities/TransactionCapabilityDecoratorSpec.js @@ -0,0 +1,59 @@ +/***************************************************************************** + * Open MCT Web, Copyright (c) 2014-2015, United States Government + * as represented by the Administrator of the National Aeronautics and Space + * Administration. All rights reserved. + * + * Open MCT Web is licensed under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * Open MCT Web includes source code licensed under additional open source + * licenses. See the Open Source Licenses file (LICENSES.md) included with + * this source code distribution or the Licensing information page available + * at runtime from the About dialog for additional information. + *****************************************************************************/ +/*global define,describe,it,expect,beforeEach,waitsFor,runs,jasmine,xit,xdescribe*/ + +define( + [ + "../../src/capabilities/TransactionalPersistenceCapability", + "../../src/capabilities/TransactionCapabilityDecorator" + ], + function (TransactionalPersistenceCapability, TransactionCapabilityDecorator) { + "use strict"; + + describe("The transaction capability decorator", function () { + var mockQ, + mockTransactionService, + mockCapabilityService, + provider; + + beforeEach(function() { + //mockQ = jasmine.createSpyObj("$q", []); + mockQ = {}; + //mockTransactionService = + // jasmine.createSpyObj("transactionService", []); + mockTransactionService = {}; + mockCapabilityService = jasmine.createSpyObj("capabilityService", ["getCapabilities"]); + mockCapabilityService.getCapabilities.andReturn({ + persistence: function() {} + }); + + provider = new TransactionCapabilityDecorator(mockQ, mockTransactionService, mockCapabilityService); + + }); + it("decorates the persistence capability", function() { + var capabilities = provider.getCapabilities(); + expect(capabilities.persistence({}) instanceof TransactionalPersistenceCapability).toBe(true); + }); + + }); + } +); \ No newline at end of file diff --git a/platform/commonUI/edit/test/capabilities/TransactionalPersistenceCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/TransactionalPersistenceCapabilitySpec.js new file mode 100644 index 0000000000..baa870934d --- /dev/null +++ b/platform/commonUI/edit/test/capabilities/TransactionalPersistenceCapabilitySpec.js @@ -0,0 +1,92 @@ +/***************************************************************************** + * Open MCT Web, Copyright (c) 2014-2015, United States Government + * as represented by the Administrator of the National Aeronautics and Space + * Administration. All rights reserved. + * + * Open MCT Web is licensed under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * Open MCT Web includes source code licensed under additional open source + * licenses. See the Open Source Licenses file (LICENSES.md) included with + * this source code distribution or the Licensing information page available + * at runtime from the About dialog for additional information. + *****************************************************************************/ +/*global define,describe,it,expect,beforeEach,waitsFor,runs,jasmine,xit,xdescribe*/ + +define( + [ + "../../src/capabilities/TransactionalPersistenceCapability" + ], + function (TransactionalPersistenceCapability) { + "use strict"; + + function fastPromise(val) { + return { + then: function(callback) { + return callback(val); + } + }; + } + + describe("The transactional persistence decorator", function () { + var mockQ, + mockTransactionService, + mockPersistence, + mockDomainObject, + capability; + + beforeEach(function() { + mockQ = jasmine.createSpyObj("$q", ["when"]); + mockQ.when.andCallFake(function (val) { + return fastPromise(val); + }); + mockTransactionService = jasmine.createSpyObj( + "transactionService", + ["isActive", "addToTransaction"] + ); + mockPersistence = jasmine.createSpyObj( + "persistenceCapability", + ["persist", "refresh"] + ); + + capability = new TransactionalPersistenceCapability(mockQ, mockTransactionService, mockPersistence, mockDomainObject); + }); + + it("if no transaction is active, passes through to persistence" + + " provider", function() { + mockTransactionService.isActive.andReturn(false); + capability.persist(); + expect(mockPersistence.persist).toHaveBeenCalled(); + }); + + it("if transaction is active, persist call is queued", function() { + mockTransactionService.isActive.andReturn(true); + capability.persist(); + expect(mockTransactionService.addToTransaction).toHaveBeenCalled(); + + //Test that it was the persist call that was queued + mockTransactionService.addToTransaction.mostRecentCall.args[0](); + expect(mockPersistence.persist).toHaveBeenCalled(); + }); + + it("if transaction is active, refresh call is queued as cancel" + + " function", function() { + mockTransactionService.isActive.andReturn(true); + capability.persist(); + + //Test that it was the persist call that was queued + mockTransactionService.addToTransaction.mostRecentCall.args[1](); + expect(mockPersistence.refresh).toHaveBeenCalled(); + }); + + }); + } +); \ No newline at end of file diff --git a/platform/commonUI/edit/test/policies/EditActionPolicySpec.js b/platform/commonUI/edit/test/policies/EditActionPolicySpec.js index dfe4e8fc4c..0cdf1be85d 100644 --- a/platform/commonUI/edit/test/policies/EditActionPolicySpec.js +++ b/platform/commonUI/edit/test/policies/EditActionPolicySpec.js @@ -34,7 +34,7 @@ define( mockEditAction, mockPropertiesAction, mockTypeCapability, - mockStatusCapability, + mockEditorCapability, capabilities, plotView, policy; @@ -48,11 +48,10 @@ define( 'getCapability' ] ); - mockStatusCapability = jasmine.createSpyObj('statusCapability', ['get']); - mockStatusCapability.get.andReturn(false); + mockEditorCapability = jasmine.createSpyObj('editorCapability', ['isEditContextRoot']); mockTypeCapability = jasmine.createSpyObj('type', ['getKey']); capabilities = { - 'status': mockStatusCapability, + 'editor': mockEditorCapability, 'type': mockTypeCapability }; @@ -112,7 +111,7 @@ define( it("disallows the edit action when object is already being" + " edited", function () { testViews = [ editableView ]; - mockStatusCapability.get.andReturn(true); + mockEditorCapability.isEditContextRoot.andReturn(true); expect(policy.allow(mockEditAction, testContext)).toBe(false); }); diff --git a/platform/commonUI/edit/test/policies/EditContextualActionPolicySpec.js b/platform/commonUI/edit/test/policies/EditContextualActionPolicySpec.js index c1c9878e6e..a516061e80 100644 --- a/platform/commonUI/edit/test/policies/EditContextualActionPolicySpec.js +++ b/platform/commonUI/edit/test/policies/EditContextualActionPolicySpec.js @@ -32,16 +32,22 @@ define( context, navigatedObject, mockDomainObject, + mockEditorCapability, metadata, editModeBlacklist = ["copy", "follow", "window", "link", "locate"], nonEditContextBlacklist = ["copy", "follow", "properties", "move", "link", "remove", "locate"]; beforeEach(function () { - navigatedObject = jasmine.createSpyObj("navigatedObject", ["hasCapability"]); + mockEditorCapability = jasmine.createSpyObj("editorCapability", ["isEditContextRoot", "inEditContext"]); + + navigatedObject = jasmine.createSpyObj("navigatedObject", ["hasCapability", "getCapability"]); + navigatedObject.getCapability.andReturn(mockEditorCapability); navigatedObject.hasCapability.andReturn(false); + mockDomainObject = jasmine.createSpyObj("domainObject", ["hasCapability", "getCapability"]); mockDomainObject.hasCapability.andReturn(false); + mockDomainObject.getCapability.andReturn(mockEditorCapability); navigationService = jasmine.createSpyObj("navigationService", ["getNavigation"]); navigationService.getNavigation.andReturn(navigatedObject); @@ -62,6 +68,7 @@ define( it('Allows "window" action when navigated object in edit mode,' + ' but selected object not in edit mode ', function() { navigatedObject.hasCapability.andReturn(true); + mockEditorCapability.isEditContextRoot.andReturn(true); metadata.key = "window"; expect(policy.allow(mockAction, context)).toBe(true); }); @@ -91,6 +98,8 @@ define( it('Disallows "move" action when navigated object in edit mode,' + ' but selected object not in edit mode ', function() { navigatedObject.hasCapability.andReturn(true); + mockEditorCapability.isEditContextRoot.andReturn(true); + mockEditorCapability.inEditContext.andReturn(false); metadata.key = "move"; expect(policy.allow(mockAction, context)).toBe(false); }); @@ -99,6 +108,9 @@ define( ' selected object in edit mode', function() { navigatedObject.hasCapability.andReturn(true); mockDomainObject.hasCapability.andReturn(true); + mockEditorCapability.isEditContextRoot.andReturn(true); + mockEditorCapability.inEditContext.andReturn(true); + metadata.key = "copy"; expect(policy.allow(mockAction, context)).toBe(false); }); diff --git a/platform/commonUI/edit/test/policies/EditableViewPolicySpec.js b/platform/commonUI/edit/test/policies/EditableViewPolicySpec.js index 2194a8c45a..32400a7453 100644 --- a/platform/commonUI/edit/test/policies/EditableViewPolicySpec.js +++ b/platform/commonUI/edit/test/policies/EditableViewPolicySpec.js @@ -33,8 +33,13 @@ define( testMode = true; // Act as if we're in Edit mode by default mockDomainObject = jasmine.createSpyObj( 'domainObject', - ['hasCapability'] + ['hasCapability', 'getCapability'] ); + mockDomainObject.getCapability.andReturn({ + inEditContext: function () { + return true; + } + }); mockDomainObject.hasCapability.andCallFake(function (c) { return (c === 'editor') && testMode; }); diff --git a/platform/commonUI/edit/test/representers/EditRepresenterSpec.js b/platform/commonUI/edit/test/representers/EditRepresenterSpec.js index b4c2f4ce7f..fe0c17c5bd 100644 --- a/platform/commonUI/edit/test/representers/EditRepresenterSpec.js +++ b/platform/commonUI/edit/test/representers/EditRepresenterSpec.js @@ -32,6 +32,7 @@ define( mockDomainObject, mockPersistence, mockStatusCapability, + mockEditorCapability, mockCapabilities, representer; @@ -58,11 +59,14 @@ define( mockPersistence = jasmine.createSpyObj("persistence", ["persist"]); mockStatusCapability = - jasmine.createSpyObj("statusCapability", ["get", "listen"]); - mockStatusCapability.get.andReturn(false); + jasmine.createSpyObj("statusCapability", ["listen"]); + mockEditorCapability = + jasmine.createSpyObj("editorCapability", ["isEditContextRoot"]); + mockCapabilities = { 'persistence': mockPersistence, - 'status': mockStatusCapability + 'status': mockStatusCapability, + 'editor': mockEditorCapability }; mockDomainObject.getModel.andReturn({}); @@ -82,6 +86,7 @@ define( it("Sets edit view template on edit mode", function () { mockStatusCapability.listen.mostRecentCall.args[0](['editing']); + mockEditorCapability.isEditContextRoot.andReturn(true); expect(mockScope.viewObjectTemplate).toEqual('edit-object'); }); diff --git a/platform/commonUI/edit/test/services/TransactionServiceSpec.js b/platform/commonUI/edit/test/services/TransactionServiceSpec.js new file mode 100644 index 0000000000..6c057aa9bd --- /dev/null +++ b/platform/commonUI/edit/test/services/TransactionServiceSpec.js @@ -0,0 +1,127 @@ +/***************************************************************************** + * Open MCT Web, Copyright (c) 2014-2015, United States Government + * as represented by the Administrator of the National Aeronautics and Space + * Administration. All rights reserved. + * + * Open MCT Web is licensed under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * Open MCT Web includes source code licensed under additional open source + * licenses. See the Open Source Licenses file (LICENSES.md) included with + * this source code distribution or the Licensing information page available + * at runtime from the About dialog for additional information. + *****************************************************************************/ +/*global define,describe,it,expect,beforeEach,jasmine*/ + +define( + ["../../src/services/TransactionService"], + function (TransactionService) { + "use strict"; + + describe("The Transaction Service", function () { + var mockQ, + mockLog, + transactionService; + + function fastPromise (val) { + return { + then: function (callback) { + return fastPromise(callback(val)); + } + }; + } + + beforeEach(function () { + mockQ = jasmine.createSpyObj("$q", ["all"]); + mockQ.all.andReturn(fastPromise()); + mockLog = jasmine.createSpyObj("$log", ["error"]); + transactionService = new TransactionService(mockQ, mockLog); + }); + + it("isActive returns true if a transaction is in progress", function () { + expect(transactionService.isActive()).toBe(false); + transactionService.startTransaction(); + expect(transactionService.isActive()).toBe(true); + }); + + it("addToTransaction queues onCommit and onCancel functions", function () { + var onCommit = jasmine.createSpy('onCommit'), + onCancel = jasmine.createSpy('onCancel'); + + transactionService.startTransaction(); + transactionService.addToTransaction(onCommit, onCancel); + expect(transactionService.onCommits.length).toBe(1); + expect(transactionService.onCancels.length).toBe(1); + }); + + describe("commit", function () { + var onCommits; + + beforeEach(function() { + onCommits = [0, 1, 2].map(function(val) { + return jasmine.createSpy("onCommit" + val); + }); + + transactionService.startTransaction(); + onCommits.forEach(transactionService.addToTransaction.bind(transactionService)); + }); + + it("commit calls all queued commit functions", function () { + expect(transactionService.onCommits.length).toBe(3); + transactionService.commit(); + onCommits.forEach( function (spy) { + expect(spy).toHaveBeenCalled(); + }); + }); + + it("commit resets active state and clears queues", function () { + transactionService.commit(); + expect(transactionService.isActive()).toBe(false); + expect(transactionService.onCommits.length).toBe(0); + expect(transactionService.onCancels.length).toBe(0); + }); + + }); + + describe("cancel", function () { + var onCancels; + + beforeEach(function() { + onCancels = [0, 1, 2].map(function(val) { + return jasmine.createSpy("onCancel" + val); + }); + + transactionService.startTransaction(); + onCancels.forEach(function (onCancel) { + transactionService.addToTransaction(undefined, onCancel); + }); + }); + + it("cancel calls all queued cancel functions", function () { + expect(transactionService.onCancels.length).toBe(3); + transactionService.cancel(); + onCancels.forEach( function (spy) { + expect(spy).toHaveBeenCalled(); + }); + }); + + it("cancel resets active state and clears queues", function () { + transactionService.cancel(); + expect(transactionService.isActive()).toBe(false); + expect(transactionService.onCommits.length).toBe(0); + expect(transactionService.onCancels.length).toBe(0); + }); + + }); + + }); + } +); \ No newline at end of file diff --git a/platform/commonUI/regions/src/EditableRegionPolicy.js b/platform/commonUI/regions/src/EditableRegionPolicy.js index 5b787a00d8..a63bed65b1 100644 --- a/platform/commonUI/regions/src/EditableRegionPolicy.js +++ b/platform/commonUI/regions/src/EditableRegionPolicy.js @@ -39,7 +39,7 @@ define( if (!regionPart.modes){ return true; } - if (domainObject.getCapability('status').get('editing')){ + if (domainObject.hasCapability('editor') && domainObject.getCapability('editor').inEditContext()){ //If the domain object is in edit mode, only include a part // if it is marked editable return regionPart.modes.indexOf('edit') !== -1; diff --git a/platform/commonUI/regions/test/EditableRegionPolicySpec.js b/platform/commonUI/regions/test/EditableRegionPolicySpec.js index 1692f72288..e9a6a97404 100644 --- a/platform/commonUI/regions/test/EditableRegionPolicySpec.js +++ b/platform/commonUI/regions/test/EditableRegionPolicySpec.js @@ -28,7 +28,7 @@ define( var editableRegionPolicy, mockDomainObject, - mockStatusCapability, + mockEditorCapability, mockBrowseRegionPart = { modes: 'browse' }, @@ -40,31 +40,32 @@ define( beforeEach(function(){ editableRegionPolicy = new EditableRegionPolicy(); - mockStatusCapability = jasmine.createSpyObj("statusCapability", [ - "get" + mockEditorCapability = jasmine.createSpyObj("editorCapability", [ + "inEditContext" ]); mockDomainObject = jasmine.createSpyObj("domainObject", [ - "getCapability" + "hasCapability", "getCapability" ]); - mockDomainObject.getCapability.andReturn(mockStatusCapability); + mockDomainObject.hasCapability.andReturn(true); + mockDomainObject.getCapability.andReturn(mockEditorCapability); }); it("includes only browse region parts for object not in edit mode", function() { - mockStatusCapability.get.andReturn(false); + mockEditorCapability.inEditContext.andReturn(false); expect(editableRegionPolicy.allow(mockBrowseRegionPart, mockDomainObject)).toBe(true); expect(editableRegionPolicy.allow(mockEditRegionPart, mockDomainObject)).toBe(false); }); it("includes only edit region parts for object in edit mode", function() { - mockStatusCapability.get.andReturn(true); + mockEditorCapability.inEditContext.andReturn(true); expect(editableRegionPolicy.allow(mockBrowseRegionPart, mockDomainObject)).toBe(false); expect(editableRegionPolicy.allow(mockEditRegionPart, mockDomainObject)).toBe(true); }); it("includes region parts with no mode specification", function() { - mockStatusCapability.get.andReturn(false); + mockEditorCapability.inEditContext.andReturn(false); expect(editableRegionPolicy.allow(mockAllModesRegionPart, mockDomainObject)).toBe(true); - mockStatusCapability.get.andReturn(true); + mockEditorCapability.inEditContext.andReturn(true); expect(editableRegionPolicy.allow(mockAllModesRegionPart, mockDomainObject)).toBe(true); }); diff --git a/platform/core/test/capabilities/PersistenceCapabilitySpec.js b/platform/core/test/capabilities/PersistenceCapabilitySpec.js index 16f5d34e61..d2bafd26e6 100644 --- a/platform/core/test/capabilities/PersistenceCapabilitySpec.js +++ b/platform/core/test/capabilities/PersistenceCapabilitySpec.js @@ -155,18 +155,6 @@ define( expect(model).toEqual(refreshModel); }); - it("does not overwrite unpersisted changes on refresh", function () { - var refreshModel = {someOtherKey: "some other value"}, - mockCallback = jasmine.createSpy(); - model.modified = 2; - model.persisted = 1; - mockPersistenceService.readObject.andReturn(asPromise(refreshModel)); - persistence.refresh().then(mockCallback); - expect(model).not.toEqual(refreshModel); - // Should have also indicated that no changes were actually made - expect(mockCallback).toHaveBeenCalledWith(false); - }); - it("does not trigger error notification on successful" + " persistence", function () { persistence.persist(); diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js index 620e70e3e1..e655741342 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js @@ -40,7 +40,7 @@ define( } // Check if we are in edit mode (also check parents) - function inEditMode(swimlane) { + function inEditMode() { return swimlane.domainObject.hasCapability('editor') && swimlane.domainObject.getCapability('editor').inEditContext(); } @@ -174,7 +174,7 @@ define( * @returns {boolean} true if this should be allowed */ allowDropIn: function (id, domainObject) { - return inEditMode(swimlane) && + return inEditMode() && !pathContains(swimlane, id) && !contains(swimlane, id) && canDrop(swimlane.domainObject, domainObject); @@ -189,7 +189,7 @@ define( allowDropAfter: function (id, domainObject) { var target = expandedForDropInto() ? swimlane : swimlane.parent; - return inEditMode(swimlane) && + return inEditMode() && target && !pathContains(target, id) && canDrop(target.domainObject, domainObject); diff --git a/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js b/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js index 6bc922731d..d7322512d5 100644 --- a/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js +++ b/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js @@ -82,11 +82,18 @@ define( it("persists zoom changes in Edit mode", function () { mockScope.domainObject = jasmine.createSpyObj( 'domainObject', - ['hasCapability'] + ['hasCapability', 'getCapability'] ); mockScope.domainObject.hasCapability.andCallFake(function (c) { return c === 'editor'; }); + mockScope.domainObject.getCapability.andCallFake(function (c) { + if (c === 'editor') { + return { + inEditContext: function () {return true;} + }; + } + }); controller.zoom(1); expect(mockScope.commit).toHaveBeenCalled(); expect(mockScope.configuration.zoomLevel) diff --git a/platform/features/timeline/test/controllers/swimlane/TimelineSwimlaneDropHandlerSpec.js b/platform/features/timeline/test/controllers/swimlane/TimelineSwimlaneDropHandlerSpec.js index 4c8d063f29..3eed051f45 100644 --- a/platform/features/timeline/test/controllers/swimlane/TimelineSwimlaneDropHandlerSpec.js +++ b/platform/features/timeline/test/controllers/swimlane/TimelineSwimlaneDropHandlerSpec.js @@ -28,6 +28,7 @@ define( var mockSwimlane, mockOtherObject, mockActionCapability, + mockEditorCapability, mockPersistence, mockContext, mockAction, @@ -36,6 +37,8 @@ define( beforeEach(function () { var mockPromise = jasmine.createSpyObj('promise', ['then']); + mockEditorCapability = jasmine.createSpyObj('editorCapability', ['inEditContext']); + mockSwimlane = jasmine.createSpyObj( "swimlane", [ "highlight", "highlightBottom" ] @@ -86,19 +89,22 @@ define( mockSwimlane.domainObject.getCapability.andCallFake(function (c) { return { action: mockActionCapability, - persistence: mockPersistence + persistence: mockPersistence, + editor: mockEditorCapability }[c]; }); mockSwimlane.parent.domainObject.getCapability.andCallFake(function (c) { return { action: mockActionCapability, - persistence: mockPersistence + persistence: mockPersistence, + editor: mockEditorCapability }[c]; }); mockOtherObject.getCapability.andCallFake(function (c) { return { action: mockActionCapability, - context: mockContext + context: mockContext, + editor: mockEditorCapability }[c]; }); mockContext.getParent.andReturn(mockOtherObject); @@ -109,13 +115,14 @@ define( }); it("disallows drop outside of edit mode", function () { + mockEditorCapability.inEditContext.andReturn(true); // Verify precondition expect(handler.allowDropIn('d', mockSwimlane.domainObject)) .toBeTruthy(); expect(handler.allowDropAfter('d', mockSwimlane.domainObject)) .toBeTruthy(); // Act as if we're not in edit mode - mockSwimlane.domainObject.hasCapability.andReturn(false); + mockEditorCapability.inEditContext.andReturn(false); // Now, they should be disallowed expect(handler.allowDropIn('d', mockSwimlane.domainObject)) .toBeFalsy(); diff --git a/platform/representation/src/MCTRepresentation.js b/platform/representation/src/MCTRepresentation.js index 06f7220fd9..bcaa90e4e7 100644 --- a/platform/representation/src/MCTRepresentation.js +++ b/platform/representation/src/MCTRepresentation.js @@ -53,9 +53,7 @@ define( * @param {ViewDefinition[]} views an array of view extensions */ function MCTRepresentation(representations, views, representers, $q, templateLinker, $log) { - var representationMap = {}, - listeners = 0; - domainObjectListener; + var representationMap = {}; // Assemble all representations and views // The distinction between views and representations is @@ -250,10 +248,10 @@ define( } /** - * Add a listener for status changes to the object itself. + * Add a listener to the object for status changes. */ - $scope.$watch("domainObject", function(domainObject, oldDomainObject) { - if (domainObject!==oldDomainObject){ + $scope.$watch("domainObject", function (domainObject, oldDomainObject) { + if (domainObject !== oldDomainObject){ listenForStatusChange(domainObject); } }); diff --git a/platform/representation/src/gestures/DropGesture.js b/platform/representation/src/gestures/DropGesture.js index e323e9d4a2..f276460b53 100644 --- a/platform/representation/src/gestures/DropGesture.js +++ b/platform/representation/src/gestures/DropGesture.js @@ -103,13 +103,18 @@ define( // the change. if (id) { e.preventDefault(); - if (domainObjectType!=='folder') { - domainObject.getCapability('action').perform('edit'); - } + //Use scope.apply, drop event is outside digest cycle + // and if not applied here causes visual artifacts. + scope.$apply( function() { + if (domainObjectType !== 'folder') { + domainObject.getCapability('action').perform('edit'); + } + }); $q.when(action && action.perform()).then(function () { broadcastDrop(id, event); }); + } } diff --git a/platform/representation/test/MCTRepresentationSpec.js b/platform/representation/test/MCTRepresentationSpec.js index 7608070d3e..36372a66c4 100644 --- a/platform/representation/test/MCTRepresentationSpec.js +++ b/platform/representation/test/MCTRepresentationSpec.js @@ -36,6 +36,7 @@ define( testViews, testUrls, mockRepresenters, + mockStatusCapability, mockQ, mockLinker, mockLog, @@ -118,6 +119,8 @@ define( mockChangeTemplate = jasmine.createSpy('changeTemplate'); mockLog = jasmine.createSpyObj("$log", LOG_FUNCTIONS); + mockStatusCapability = jasmine.createSpyObj("statusCapability", ["listen"]); + mockScope = jasmine.createSpyObj("scope", [ "$watch", "$on" ]); mockElement = jasmine.createSpyObj("element", JQLITE_FUNCTIONS); mockDomainObject = jasmine.createSpyObj("domainObject", DOMAIN_OBJECT_METHODS); @@ -128,6 +131,10 @@ define( return testUrls[ext.key]; }); + mockDomainObject.getCapability.andCallFake(function (c) { + return c === 'status' && mockStatusCapability; + }); + mctRepresentation = new MCTRepresentation( testRepresentations, testViews, diff --git a/platform/search/src/services/GenericSearchProvider.js b/platform/search/src/services/GenericSearchProvider.js index fbe45ae6d8..101c718669 100644 --- a/platform/search/src/services/GenericSearchProvider.js +++ b/platform/search/src/services/GenericSearchProvider.js @@ -120,8 +120,8 @@ define([ provider = this; mutationTopic.listen(function (mutatedObject) { - var status = mutatedObject.getCapability('status'); - if (!status || !status.get('editing')) { + var editor = mutatedObject.getCapability('editor'); + if (!editor || !editor.inEditContext()) { provider.index( mutatedObject.getId(), mutatedObject.getModel() From c305fba0a74e10be336f1d4ca5168890eeb750f8 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 11 May 2016 17:58:03 -0700 Subject: [PATCH 79/85] Modified dirty function --- .../commonUI/edit/src/capabilities/EditorCapability.js | 2 +- platform/commonUI/edit/src/services/TransactionService.js | 4 ++++ platform/representation/bundle.js | 5 +---- platform/representation/src/gestures/DropGesture.js | 7 ++----- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index df305de73c..69eb773d73 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -112,7 +112,7 @@ define( * modifications since the last persist, false otherwise. */ EditorCapability.prototype.dirty = function () { - return (this.domainObject.getModel().modified || 0) > (this.domainObject.getModel().persisted || 0); + return this.transactionService.size() > 0; }; return EditorCapability; diff --git a/platform/commonUI/edit/src/services/TransactionService.js b/platform/commonUI/edit/src/services/TransactionService.js index 6affde28d8..c6e0bcb5da 100644 --- a/platform/commonUI/edit/src/services/TransactionService.js +++ b/platform/commonUI/edit/src/services/TransactionService.js @@ -140,5 +140,9 @@ define( }); }; + TransactionService.prototype.size = function () { + return this.onCommits.length + this.onCancels.length; + }; + return TransactionService; }); diff --git a/platform/representation/bundle.js b/platform/representation/bundle.js index ae8cb0ed8e..01484ccb78 100644 --- a/platform/representation/bundle.js +++ b/platform/representation/bundle.js @@ -86,10 +86,7 @@ define([ "implementation": DropGesture, "depends": [ "dndService", - "$q", - "navigationService", - "instantiate", - "typeService" + "$q" ] }, { diff --git a/platform/representation/src/gestures/DropGesture.js b/platform/representation/src/gestures/DropGesture.js index f276460b53..f2d64024a3 100644 --- a/platform/representation/src/gestures/DropGesture.js +++ b/platform/representation/src/gestures/DropGesture.js @@ -38,7 +38,7 @@ define( * @param {DomainObject} domainObject the domain object whose * composition should be modified as a result of the drop. */ - function DropGesture(dndService, $q, navigationService, instantiate, typeService, element, domainObject) { + function DropGesture(dndService, $q, element, domainObject) { var actionCapability = domainObject.getCapability('action'), scope = element.scope && element.scope(), action; // Action for the drop, when it occurs @@ -70,8 +70,6 @@ define( } function dragOver(e) { - actionCapability = domainObject.getCapability('action'); - var event = (e || {}).originalEvent || e, selectedObject = dndService.getData( GestureConstants.MCT_EXTENDED_DRAG_TYPE @@ -105,8 +103,7 @@ define( e.preventDefault(); //Use scope.apply, drop event is outside digest cycle - // and if not applied here causes visual artifacts. - scope.$apply( function() { + scope.$apply(function () { if (domainObjectType !== 'folder') { domainObject.getCapability('action').perform('edit'); } From 69c4c3a2c88d11c1cc1be49dadbd3cc83f31c7c0 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 12 May 2016 14:20:16 -0700 Subject: [PATCH 80/85] Added tests --- platform/commonUI/edit/bundle.js | 3 ++- .../TransactionalPersistenceCapability.js | 25 ++++++++++++++++--- .../edit/src/services/TransactionService.js | 2 +- .../test/capabilities/EditorCapabilitySpec.js | 7 +++--- .../TransactionalPersistenceCapabilitySpec.js | 25 ++++++++++--------- .../test/services/TransactionServiceSpec.js | 11 ++++++++ .../test/MCTRepresentationSpec.js | 18 ++++++++++++- 7 files changed, 68 insertions(+), 23 deletions(-) diff --git a/platform/commonUI/edit/bundle.js b/platform/commonUI/edit/bundle.js index 5a5101f129..fb357c0934 100644 --- a/platform/commonUI/edit/bundle.js +++ b/platform/commonUI/edit/bundle.js @@ -271,7 +271,8 @@ define([ "depends": [ "$q", "transactionService" - ] + ], + "priority": "fallback" }, { "type": "provider", diff --git a/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js b/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js index 0c6420d484..99ab8b6721 100644 --- a/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js +++ b/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js @@ -49,6 +49,7 @@ define( this.persistenceCapability = persistenceCapability; this.domainObject = domainObject; this.$q = $q; + this.persistPending = false; } /** @@ -57,11 +58,27 @@ define( * @returns {*} */ TransactionalPersistenceCapability.prototype.persist = function () { + var self = this; + + function onCommit() { + return self.persistenceCapability.persist().then(function(result) { + self.persistPending = false; + return result; + }); + } + + function onCancel() { + return self.persistenceCapability.refresh().then(function(result) { + self.persistPending = false; + return result; + }); + } + if (this.transactionService.isActive()) { - this.transactionService.addToTransaction( - this.persistenceCapability.persist.bind(this.persistenceCapability), - this.persistenceCapability.refresh.bind(this.persistenceCapability) - ); + if (!this.persistPending) { + this.transactionService.addToTransaction(onCommit, onCancel); + this.persistPending = true; + } //Need to return a promise from this function return this.$q.when(true); } else { diff --git a/platform/commonUI/edit/src/services/TransactionService.js b/platform/commonUI/edit/src/services/TransactionService.js index c6e0bcb5da..8d57e1e809 100644 --- a/platform/commonUI/edit/src/services/TransactionService.js +++ b/platform/commonUI/edit/src/services/TransactionService.js @@ -141,7 +141,7 @@ define( }; TransactionService.prototype.size = function () { - return this.onCommits.length + this.onCancels.length; + return this.onCommits.length; }; return TransactionService; diff --git a/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js index 29b08a4038..fe42ec92f7 100644 --- a/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js +++ b/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js @@ -55,6 +55,7 @@ define( "transactionService", [ "startTransaction", + "size", "commit", "cancel" ] @@ -161,11 +162,9 @@ define( }); it("returns true if the object has been modified since it" + " was last persisted", function () { - model.modified = 0; - model.persisted = 0; + mockTransactionService.size.andReturn(0); expect(capability.dirty()).toBe(false); - - model.modified = 1; + mockTransactionService.size.andReturn(1); expect(capability.dirty()).toBe(true); }); }); diff --git a/platform/commonUI/edit/test/capabilities/TransactionalPersistenceCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/TransactionalPersistenceCapabilitySpec.js index baa870934d..8856aca4d5 100644 --- a/platform/commonUI/edit/test/capabilities/TransactionalPersistenceCapabilitySpec.js +++ b/platform/commonUI/edit/test/capabilities/TransactionalPersistenceCapabilitySpec.js @@ -56,7 +56,8 @@ define( "persistenceCapability", ["persist", "refresh"] ); - + mockPersistence.persist.andReturn(fastPromise()); + mockPersistence.refresh.andReturn(fastPromise()); capability = new TransactionalPersistenceCapability(mockQ, mockTransactionService, mockPersistence, mockDomainObject); }); @@ -67,26 +68,26 @@ define( expect(mockPersistence.persist).toHaveBeenCalled(); }); - it("if transaction is active, persist call is queued", function() { + it("if transaction is active, persist and cancel calls are" + + " queued", function() { mockTransactionService.isActive.andReturn(true); capability.persist(); expect(mockTransactionService.addToTransaction).toHaveBeenCalled(); - - //Test that it was the persist call that was queued mockTransactionService.addToTransaction.mostRecentCall.args[0](); expect(mockPersistence.persist).toHaveBeenCalled(); - }); - - it("if transaction is active, refresh call is queued as cancel" + - " function", function() { - mockTransactionService.isActive.andReturn(true); - capability.persist(); - - //Test that it was the persist call that was queued mockTransactionService.addToTransaction.mostRecentCall.args[1](); expect(mockPersistence.refresh).toHaveBeenCalled(); }); + it("persist call is only added to transaction once", function() { + mockTransactionService.isActive.andReturn(true); + capability.persist(); + expect(mockTransactionService.addToTransaction).toHaveBeenCalled(); + capability.persist(); + expect(mockTransactionService.addToTransaction.calls.length).toBe(1); + + }); + }); } ); \ No newline at end of file diff --git a/platform/commonUI/edit/test/services/TransactionServiceSpec.js b/platform/commonUI/edit/test/services/TransactionServiceSpec.js index 6c057aa9bd..c9f9746c5f 100644 --- a/platform/commonUI/edit/test/services/TransactionServiceSpec.js +++ b/platform/commonUI/edit/test/services/TransactionServiceSpec.js @@ -62,6 +62,17 @@ define( expect(transactionService.onCancels.length).toBe(1); }); + it("size function returns size of commit and cancel queues", function () { + var onCommit = jasmine.createSpy('onCommit'), + onCancel = jasmine.createSpy('onCancel'); + + transactionService.startTransaction(); + transactionService.addToTransaction(onCommit, onCancel); + transactionService.addToTransaction(onCommit, onCancel); + transactionService.addToTransaction(onCommit, onCancel); + expect(transactionService.size()).toBe(3); + }); + describe("commit", function () { var onCommits; diff --git a/platform/representation/test/MCTRepresentationSpec.js b/platform/representation/test/MCTRepresentationSpec.js index 36372a66c4..52d6c70d55 100644 --- a/platform/representation/test/MCTRepresentationSpec.js +++ b/platform/representation/test/MCTRepresentationSpec.js @@ -236,7 +236,7 @@ define( expect(mockLog.warn).toHaveBeenCalled(); }); - it("clears out obsolete peroperties from scope", function () { + it("clears out obsolete properties from scope", function () { mockScope.key = "def"; mockScope.domainObject = mockDomainObject; mockDomainObject.useCapability.andReturn("some value"); @@ -253,6 +253,21 @@ define( expect(mockScope.testCapability).toBeUndefined(); }); + it("registers a status change listener", function () { + mockScope.$watch.calls[2].args[1](mockDomainObject); + expect(mockStatusCapability.listen).toHaveBeenCalled(); + }); + + it("unlistens for status change on scope destruction", function () { + var mockUnlistener = jasmine.createSpy("unlisten"); + mockStatusCapability.listen.andReturn(mockUnlistener); + mockScope.$watch.calls[2].args[1](mockDomainObject); + expect(mockStatusCapability.listen).toHaveBeenCalled(); + + mockScope.$on.calls[1].args[1](); + expect(mockUnlistener).toHaveBeenCalled(); + }); + describe("when a domain object has been observed", function () { var mockContext, mockContext2, @@ -314,6 +329,7 @@ define( mockScope.$watch.calls[0].args[1](); expect(mockChangeTemplate.calls.length).toEqual(callCount); }); + }); From ffacf6e1aeb0f200733472763521fd594a2503f3 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 12 May 2016 16:18:48 -0700 Subject: [PATCH 81/85] Resolved residual merge issue --- .../edit/src/policies/EditContextualActionPolicy.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/platform/commonUI/edit/src/policies/EditContextualActionPolicy.js b/platform/commonUI/edit/src/policies/EditContextualActionPolicy.js index afccf5a121..af30b5933e 100644 --- a/platform/commonUI/edit/src/policies/EditContextualActionPolicy.js +++ b/platform/commonUI/edit/src/policies/EditContextualActionPolicy.js @@ -34,7 +34,6 @@ define( * from context menu of non-editable objects, when navigated object * is being edited * @constructor - * @param navigationService * @param editModeBlacklist A blacklist of actions disallowed from * context menu when navigated object is being edited * @param nonEditContextBlacklist A blacklist of actions disallowed @@ -58,11 +57,10 @@ define( if (navigatedObject.hasCapability("editor") && navigatedObject.getCapability("editor").isEditContextRoot()) { if (selectedObject.hasCapability("editor") && selectedObject.getCapability("editor").inEditContext()){ - //Target is within the editing context - return this.editBlacklist.indexOf(actionMetadata.key) === -1; + return this.editModeBlacklist.indexOf(actionMetadata.key) === -1; } else { - //Target is not within the editing context - return this.nonEditBlacklist.indexOf(actionMetadata.key) === -1; + //Target is in the context menu + return this.nonEditContextBlacklist.indexOf(actionMetadata.key) === -1; } } else { return true; From d08cdfba49e9a6dffec291598adfc68033173b74 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 12 May 2016 16:50:19 -0700 Subject: [PATCH 82/85] Fixed linting issues --- .../capabilities/TransactionCapabilityDecorator.js | 1 - .../TransactionalPersistenceCapability.js | 1 - .../commonUI/edit/src/policies/EditActionPolicy.js | 6 +++--- .../TransactionCapabilityDecoratorSpec.js | 5 ----- .../TransactionalPersistenceCapabilitySpec.js | 3 +-- .../edit/test/services/TransactionServiceSpec.js | 1 - .../core/src/capabilities/PersistenceCapability.js | 13 +------------ 7 files changed, 5 insertions(+), 25 deletions(-) diff --git a/platform/commonUI/edit/src/capabilities/TransactionCapabilityDecorator.js b/platform/commonUI/edit/src/capabilities/TransactionCapabilityDecorator.js index 44d2b1ed53..c3a405f099 100644 --- a/platform/commonUI/edit/src/capabilities/TransactionCapabilityDecorator.js +++ b/platform/commonUI/edit/src/capabilities/TransactionCapabilityDecorator.js @@ -24,7 +24,6 @@ define( ['./TransactionalPersistenceCapability'], function (TransactionalPersistenceCapability) { - 'use strict'; /** * Wraps the [PersistenceCapability]{@link PersistenceCapability} with diff --git a/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js b/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js index 99ab8b6721..9dc7968d3b 100644 --- a/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js +++ b/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js @@ -24,7 +24,6 @@ define( [], function () { - 'use strict'; /** * Wraps persistence capability to enable transactions. Transactions diff --git a/platform/commonUI/edit/src/policies/EditActionPolicy.js b/platform/commonUI/edit/src/policies/EditActionPolicy.js index 78f2c54cb0..f266d580eb 100644 --- a/platform/commonUI/edit/src/policies/EditActionPolicy.js +++ b/platform/commonUI/edit/src/policies/EditActionPolicy.js @@ -72,9 +72,9 @@ define( */ function isEditing(context) { var domainObject = (context || {}).domainObject; - return domainObject - && domainObject.hasCapability('editor') - && domainObject.getCapability('editor').isEditContextRoot(); + return domainObject && + domainObject.hasCapability('editor') && + domainObject.getCapability('editor').isEditContextRoot(); } EditActionPolicy.prototype.allow = function (action, context) { diff --git a/platform/commonUI/edit/test/capabilities/TransactionCapabilityDecoratorSpec.js b/platform/commonUI/edit/test/capabilities/TransactionCapabilityDecoratorSpec.js index 15738167e2..f710cf215e 100644 --- a/platform/commonUI/edit/test/capabilities/TransactionCapabilityDecoratorSpec.js +++ b/platform/commonUI/edit/test/capabilities/TransactionCapabilityDecoratorSpec.js @@ -19,7 +19,6 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,waitsFor,runs,jasmine,xit,xdescribe*/ define( [ @@ -27,7 +26,6 @@ define( "../../src/capabilities/TransactionCapabilityDecorator" ], function (TransactionalPersistenceCapability, TransactionCapabilityDecorator) { - "use strict"; describe("The transaction capability decorator", function () { var mockQ, @@ -36,10 +34,7 @@ define( provider; beforeEach(function() { - //mockQ = jasmine.createSpyObj("$q", []); mockQ = {}; - //mockTransactionService = - // jasmine.createSpyObj("transactionService", []); mockTransactionService = {}; mockCapabilityService = jasmine.createSpyObj("capabilityService", ["getCapabilities"]); mockCapabilityService.getCapabilities.andReturn({ diff --git a/platform/commonUI/edit/test/capabilities/TransactionalPersistenceCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/TransactionalPersistenceCapabilitySpec.js index 8856aca4d5..c0892e6db2 100644 --- a/platform/commonUI/edit/test/capabilities/TransactionalPersistenceCapabilitySpec.js +++ b/platform/commonUI/edit/test/capabilities/TransactionalPersistenceCapabilitySpec.js @@ -19,14 +19,13 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,beforeEach,waitsFor,runs,jasmine,xit,xdescribe*/ +/*global define,describe,it,expect,beforeEach,jasmine*/ define( [ "../../src/capabilities/TransactionalPersistenceCapability" ], function (TransactionalPersistenceCapability) { - "use strict"; function fastPromise(val) { return { diff --git a/platform/commonUI/edit/test/services/TransactionServiceSpec.js b/platform/commonUI/edit/test/services/TransactionServiceSpec.js index c9f9746c5f..5f965decf9 100644 --- a/platform/commonUI/edit/test/services/TransactionServiceSpec.js +++ b/platform/commonUI/edit/test/services/TransactionServiceSpec.js @@ -24,7 +24,6 @@ define( ["../../src/services/TransactionService"], function (TransactionService) { - "use strict"; describe("The Transaction Service", function () { var mockQ, diff --git a/platform/core/src/capabilities/PersistenceCapability.js b/platform/core/src/capabilities/PersistenceCapability.js index 07d73a0548..2f4f3cd53b 100644 --- a/platform/core/src/capabilities/PersistenceCapability.js +++ b/platform/core/src/capabilities/PersistenceCapability.js @@ -60,16 +60,6 @@ define( this.$q = $q; } - // Utility function for creating promise-like objects which - // resolve synchronously when possible - function fastPromise(value) { - return (value || {}).then ? value : { - then: function (callback) { - return fastPromise(callback(value)); - } - }; - } - function getKey(id) { var parts = id.split(":"); return parts.length > 1 ? parts.slice(1).join(":") : id; @@ -157,8 +147,7 @@ define( * when the update is complete */ PersistenceCapability.prototype.refresh = function () { - var domainObject = this.domainObject, - model = domainObject.getModel(); + var domainObject = this.domainObject; // Update a domain object's model upon refresh function updateModel(model) { From 96892722a487e27ab99c7502127dae7af859f885 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 16 May 2016 09:27:24 -0700 Subject: [PATCH 83/85] [Build] Remove SNAPSHOT status ...to close sprint https://github.com/nasa/openmct/milestones/Herbert --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9dabea4b7a..af605a0432 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openmct", - "version": "0.10.1-SNAPSHOT", + "version": "0.10.1", "description": "The Open MCT core platform", "dependencies": { "express": "^4.13.1", From 18fa9aeaf68fceec3024155686338c31bc0d68b8 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 16 May 2016 09:36:59 -0700 Subject: [PATCH 84/85] [Build] Bump version number, add -SNAPSHOT ...to begin sprint Huxley, https://github.com/nasa/openmct/milestones/Huxley --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index af605a0432..eb7afd1f70 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openmct", - "version": "0.10.1", + "version": "0.10.2-SNAPSHOT", "description": "The Open MCT core platform", "dependencies": { "express": "^4.13.1", From a729edd3997fac968ebbc7ac1895412aa9a8837b Mon Sep 17 00:00:00 2001 From: Charles Hacskaylo Date: Mon, 16 May 2016 12:00:29 -0700 Subject: [PATCH 85/85] [Frontend] Label context arrows now always visible open #929 - Also enable frame dragging in title area when editing in Layout; - CSS and markup changes; --- .../res/templates/browse/object-header.html | 2 +- .../general/res/sass/controls/_controls.scss | 18 +++++------------- .../general/res/sass/user-environ/_frame.scss | 2 -- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/platform/commonUI/browse/res/templates/browse/object-header.html b/platform/commonUI/browse/res/templates/browse/object-header.html index 2136bdd416..d46cbd91cb 100644 --- a/platform/commonUI/browse/res/templates/browse/object-header.html +++ b/platform/commonUI/browse/res/templates/browse/object-header.html @@ -26,5 +26,5 @@ + class="flex-elem context-available-w"> \ No newline at end of file diff --git a/platform/commonUI/general/res/sass/controls/_controls.scss b/platform/commonUI/general/res/sass/controls/_controls.scss index a2bb0b73bb..e938d1a6e7 100644 --- a/platform/commonUI/general/res/sass/controls/_controls.scss +++ b/platform/commonUI/general/res/sass/controls/_controls.scss @@ -279,21 +279,13 @@ input[type="search"] { padding-right: 0.35em; // For context arrow. Done with em's so pad is relative to the scale of the text. } + .context-available-w { + z-index: 5; + } + .context-available { font-size: 0.7em; - @include webkitProp(flex, '0 0 1'); - } -} - -body.desktop .object-header { - .context-available { - @include trans-prop-nice(opacity, 0.25s); - opacity: 0; - } - &:hover { - .context-available { - opacity: 1; - } + @include flex(0 0 1); } } diff --git a/platform/commonUI/general/res/sass/user-environ/_frame.scss b/platform/commonUI/general/res/sass/user-environ/_frame.scss index 7bc3367c00..64c4dbd69b 100644 --- a/platform/commonUI/general/res/sass/user-environ/_frame.scss +++ b/platform/commonUI/general/res/sass/user-environ/_frame.scss @@ -36,8 +36,6 @@ line-height: $ohH; .left { padding-right: $interiorMarginLg; - - z-index: 5; } } >.object-holder.abs {