Compare commits
	
		
			28 Commits
		
	
	
		
			v1.3
			...
			eslint-one
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | c70ac9759c | ||
|   | 10241ee87d | ||
|   | 46d4ecc497 | ||
|   | d83adec21f | ||
|   | 4512fe960a | ||
|   | 529aa3a2cd | ||
|   | 35062b164a | ||
|   | 976d070402 | ||
|   | d2161d692c | ||
|   | aa3aa23b95 | ||
|   | 3fc20995c7 | ||
|   | b378b6e465 | ||
|   | 3a4c205f55 | ||
|   | 5071328c90 | ||
|   | 04c258ccd3 | ||
|   | 6d37adde0e | ||
|   | 25aad22562 | ||
|   | 6e3e7a50d7 | ||
|   | cfcfb31193 | ||
|   | db0d5bd974 | ||
|   | 01407ffbe2 | ||
|   | 26d3fce0c8 | ||
|   | 539e0773f8 | ||
|   | 4d34fad8db | ||
|   | bfea0e89e6 | ||
|   | 8e04a9c550 | ||
|   | e6cd94123c | ||
|   | 1be7927303 | 
| @@ -11,12 +11,12 @@ jobs: | ||||
|             name: Update npm | ||||
|             command: 'sudo npm install -g npm@latest' | ||||
|         - restore_cache: | ||||
|             key: dependency-cache-{{ checksum "package.json" }} | ||||
|             key: dependency-cache-13-{{ checksum "package.json" }} | ||||
|         - run: | ||||
|             name: Installing dependencies (npm install) | ||||
|             command: npm install | ||||
|         - save_cache: | ||||
|             key: dependency-cache-{{ checksum "package.json" }} | ||||
|             key: dependency-cache-13-{{ checksum "package.json" }} | ||||
|             paths: | ||||
|               - node_modules | ||||
|         - run: | ||||
|   | ||||
							
								
								
									
										101
									
								
								.eslintrc.js
									
									
									
									
									
								
							
							
						
						
									
										101
									
								
								.eslintrc.js
									
									
									
									
									
								
							| @@ -120,91 +120,8 @@ module.exports = { | ||||
|         "no-useless-computed-key": "error", | ||||
|         // https://eslint.org/docs/rules/rest-spread-spacing | ||||
|         "rest-spread-spacing": ["error"], | ||||
|         // https://eslint.org/docs/rules/no-var | ||||
|         "no-var": "error", | ||||
|         // https://eslint.org/docs/rules/one-var | ||||
|         "one-var": ["error", "never"], | ||||
|         // https://eslint.org/docs/rules/default-case-last | ||||
|         "default-case-last": "error", | ||||
|         // https://eslint.org/docs/rules/default-param-last | ||||
|         "default-param-last": "error", | ||||
|         // https://eslint.org/docs/rules/grouped-accessor-pairs | ||||
|         "grouped-accessor-pairs": "error", | ||||
|         // https://eslint.org/docs/rules/no-constructor-return | ||||
|         "no-constructor-return": "error", | ||||
|         // https://eslint.org/docs/rules/array-callback-return | ||||
|         "array-callback-return": "error", | ||||
|         // https://eslint.org/docs/rules/no-invalid-this | ||||
|         "no-invalid-this": "error", // Believe this one actually surfaces some bugs | ||||
|         // https://eslint.org/docs/rules/func-style | ||||
|         "func-style": ["error", "declaration"], | ||||
|         // https://eslint.org/docs/rules/no-unused-expressions | ||||
|         "no-unused-expressions": "error", | ||||
|         // https://eslint.org/docs/rules/no-useless-concat | ||||
|         "no-useless-concat": "error", | ||||
|         // https://eslint.org/docs/rules/radix | ||||
|         "radix": "error", | ||||
|         // https://eslint.org/docs/rules/require-await | ||||
|         "require-await": "error", | ||||
|         // https://eslint.org/docs/rules/no-alert | ||||
|         "no-alert": "error", | ||||
|         // https://eslint.org/docs/rules/no-useless-constructor | ||||
|         "no-useless-constructor": "error", | ||||
|         // https://eslint.org/docs/rules/no-duplicate-imports | ||||
|         "no-duplicate-imports": "error", | ||||
|  | ||||
|         // https://eslint.org/docs/rules/no-implicit-coercion | ||||
|         "no-implicit-coercion": "error", | ||||
|         //https://eslint.org/docs/rules/no-unneeded-ternary | ||||
|         "no-unneeded-ternary": "error", | ||||
|         // https://eslint.org/docs/rules/semi | ||||
|         "semi": ["error", "always"], | ||||
|         // https://eslint.org/docs/rules/no-multi-spaces | ||||
|         "no-multi-spaces": "error", | ||||
|         // https://eslint.org/docs/rules/key-spacing | ||||
|         "key-spacing": ["error", { | ||||
|             "afterColon": true | ||||
|         }], | ||||
|         // https://eslint.org/docs/rules/keyword-spacing | ||||
|         "keyword-spacing": ["error", { | ||||
|             "before": true, | ||||
|             "after": true | ||||
|         }], | ||||
|         // https://eslint.org/docs/rules/comma-spacing | ||||
|         // Also requires one line code fix | ||||
|         "comma-spacing": ["error", { | ||||
|             "after": true | ||||
|         }], | ||||
|         //https://eslint.org/docs/rules/no-whitespace-before-property | ||||
|         "no-whitespace-before-property": "error", | ||||
|         // https://eslint.org/docs/rules/object-curly-newline | ||||
|         "object-curly-newline": ["error", {"consistent": true, "multiline": true}], | ||||
|         // https://eslint.org/docs/rules/object-property-newline | ||||
|         "object-property-newline": "error", | ||||
|         // https://eslint.org/docs/rules/brace-style | ||||
|         "brace-style": "error", | ||||
|         // https://eslint.org/docs/rules/no-multiple-empty-lines | ||||
|         "no-multiple-empty-lines": ["error", {"max": 1}], | ||||
|         // https://eslint.org/docs/rules/operator-linebreak | ||||
|         "operator-linebreak": ["error", "before", {"overrides": {"=": "after"}}], | ||||
|         // https://eslint.org/docs/rules/padding-line-between-statements | ||||
|         "padding-line-between-statements":["error", { | ||||
|             "blankLine": "always", | ||||
|             "prev": "multiline-block-like", | ||||
|             "next": "*" | ||||
|         }, { | ||||
|             "blankLine": "always", | ||||
|             "prev": "*", | ||||
|             "next": "return" | ||||
|         }], | ||||
|         // https://eslint.org/docs/rules/space-infix-ops | ||||
|         "space-infix-ops": "error", | ||||
|         // https://eslint.org/docs/rules/space-unary-ops | ||||
|         "space-unary-ops": ["error", {"words": true, "nonwords": false}], | ||||
|         // https://eslint.org/docs/rules/arrow-spacing | ||||
|         "arrow-spacing": "error", | ||||
|         // https://eslint.org/docs/rules/semi-spacing | ||||
|         "semi-spacing": ["error", {"before": false, "after": true}], | ||||
|  | ||||
|         "vue/html-indent": [ | ||||
|             "error", | ||||
| @@ -236,24 +153,28 @@ module.exports = { | ||||
|             } | ||||
|         }], | ||||
|         "vue/multiline-html-element-content-newline": "off", | ||||
|         "vue/singleline-html-element-content-newline": "off", | ||||
|  | ||||
|         "vue/singleline-html-element-content-newline": "off" | ||||
|     }, | ||||
|     "overrides": [ | ||||
|         { | ||||
|             "files": LEGACY_FILES, | ||||
|             "files": ["*Spec.js"], | ||||
|             "rules": { | ||||
|                 "no-unused-vars": [ | ||||
|                     "warn", | ||||
|                     { | ||||
|                         "vars": "all", | ||||
|                         "args": "none", | ||||
|                         "varsIgnorePattern": "controller" | ||||
|                         "varsIgnorePattern": "controller", | ||||
|  | ||||
|                     } | ||||
|                 ], | ||||
|                 ] | ||||
|             } | ||||
|         }, { | ||||
|             "files": LEGACY_FILES, | ||||
|             "rules": { | ||||
|                 // https://eslint.org/docs/rules/no-nested-ternary | ||||
|                 "no-nested-ternary": "off", | ||||
|                 "no-var": "off", | ||||
|                 "one-var": "off" | ||||
|                 "no-var": "off" | ||||
|             } | ||||
|         } | ||||
|     ] | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /***************************************************************************** | ||||
|  * Open MCT, Copyright (c) 2014-2020, United States Government | ||||
|  * Open MCT, Copyright (c) 2014-2017, United States Government | ||||
|  * as represented by the Administrator of the National Aeronautics and Space | ||||
|  * Administration. All rights reserved. | ||||
|  * | ||||
| @@ -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*/ | ||||
|  | ||||
| define([ | ||||
|     "./src/EventTelemetryProvider" | ||||
| @@ -28,7 +29,7 @@ define([ | ||||
|     "use strict"; | ||||
|  | ||||
|     return { | ||||
|         name: "example/eventGenerator", | ||||
|         name:"example/eventGenerator", | ||||
|         definition: { | ||||
|             "name": "Event Message Generator", | ||||
|             "description": "For development use. Creates sample event message data that mimics a live data stream.", | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /***************************************************************************** | ||||
|  * Open MCT, Copyright (c) 2014-2020, United States Government | ||||
|  * Open MCT, Copyright (c) 2014-2017, United States Government | ||||
|  * as represented by the Administrator of the National Aeronautics and Space | ||||
|  * Administration. All rights reserved. | ||||
|  * | ||||
| @@ -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 */ | ||||
|  | ||||
| /** | ||||
|  * Module defining EventTelemetry. | ||||
| @@ -34,23 +35,22 @@ define( | ||||
|  | ||||
|         function EventTelemetry(request, interval) { | ||||
|  | ||||
|             var latestObservedTime = Date.now(), | ||||
|                 count = Math.floor((latestObservedTime - firstObservedTime) / interval), | ||||
|                 generatorData = {}; | ||||
|             var latestObservedTime = Date.now(); | ||||
|             var count = Math.floor((latestObservedTime - firstObservedTime) / interval); | ||||
|             var generatorData = {}; | ||||
|  | ||||
|             generatorData.getPointCount = function () { | ||||
|                 return count; | ||||
|             }; | ||||
|  | ||||
|             generatorData.getDomainValue = function (i, domain) { | ||||
|                 return i * interval | ||||
|                         + (domain !== 'delta' ? firstObservedTime : 0); | ||||
|                 return i * interval + | ||||
|                         (domain !== 'delta' ? firstObservedTime : 0); | ||||
|             }; | ||||
|  | ||||
|             generatorData.getRangeValue = function (i, range) { | ||||
|                 var domainDelta = this.getDomainValue(i) - firstObservedTime, | ||||
|                     ind = i % messages.length; | ||||
|  | ||||
|                 var domainDelta = this.getDomainValue(i) - firstObservedTime; | ||||
|                 var ind = i % messages.length; | ||||
|                 return messages[ind] + " - [" + domainDelta.toString() + "]"; | ||||
|             }; | ||||
|  | ||||
|   | ||||
| @@ -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,Promise*/ | ||||
|  | ||||
| /** | ||||
|  * Module defining EventTelemetryProvider. Created by chacskaylo on 06/18/2015. | ||||
| @@ -33,9 +34,9 @@ define( | ||||
|          * @constructor | ||||
|          */ | ||||
|         function EventTelemetryProvider($q, $timeout) { | ||||
|             var subscriptions = [], | ||||
|                 genInterval = 1000, | ||||
|                 generating = false; | ||||
|             var subscriptions = []; | ||||
|             var genInterval = 1000; | ||||
|             var generating = false; | ||||
|  | ||||
|             // | ||||
|             function matchesSource(request) { | ||||
| @@ -56,7 +57,6 @@ define( | ||||
|                 results.forEach(function (result) { | ||||
|                     packaged[result.key] = result.telemetry; | ||||
|                 }); | ||||
|  | ||||
|                 // Format as expected (sources -> keys -> telemetry) | ||||
|                 return { eventGenerator: packaged }; | ||||
|             } | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define([], function () { | ||||
|     'use strict'; | ||||
| @@ -39,23 +40,23 @@ define([], function () { | ||||
|     } | ||||
|  | ||||
|     ExportTelemetryAsCSVAction.prototype.perform = function () { | ||||
|         var context = this.context, | ||||
|             domainObject = context.domainObject, | ||||
|             telemetry = domainObject.getCapability("telemetry"), | ||||
|             metadata = telemetry.getMetadata(), | ||||
|             domains = metadata.domains, | ||||
|             ranges = metadata.ranges, | ||||
|             exportService = this.exportService; | ||||
|         var context = this.context; | ||||
|         var domainObject = context.domainObject; | ||||
|         var telemetry = domainObject.getCapability("telemetry"); | ||||
|         var metadata = telemetry.getMetadata(); | ||||
|         var domains = metadata.domains; | ||||
|         var ranges = metadata.ranges; | ||||
|         var exportService = this.exportService; | ||||
|  | ||||
|         function getName(domainOrRange) { | ||||
|             return domainOrRange.name; | ||||
|         } | ||||
|  | ||||
|         telemetry.requestData({}).then(function (series) { | ||||
|             var headers = domains.map(getName).concat(ranges.map(getName)), | ||||
|                 rows = [], | ||||
|                 row, | ||||
|                 i; | ||||
|             var headers = domains.map(getName).concat(ranges.map(getName)); | ||||
|             var rows = []; | ||||
|             var row; | ||||
|             var i; | ||||
|  | ||||
|             function copyDomainsToRow(telemetryRow, index) { | ||||
|                 domains.forEach(function (domain) { | ||||
| @@ -75,14 +76,13 @@ define([], function () { | ||||
|                 copyRangesToRow(row, i); | ||||
|                 rows.push(row); | ||||
|             } | ||||
|  | ||||
|             exportService.exportCSV(rows, { headers: headers }); | ||||
|         }); | ||||
|     }; | ||||
|  | ||||
|     ExportTelemetryAsCSVAction.appliesTo = function (context) { | ||||
|         return context.domainObject | ||||
|             && context.domainObject.hasCapability("telemetry"); | ||||
|         return context.domainObject && | ||||
|             context.domainObject.hasCapability("telemetry"); | ||||
|     }; | ||||
|  | ||||
|     return ExportTelemetryAsCSVAction; | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define([ | ||||
|     './ExportTelemetryAsCSVAction' | ||||
| @@ -26,7 +27,7 @@ define([ | ||||
|     "use strict"; | ||||
|  | ||||
|     return { | ||||
|         name: "example/export", | ||||
|         name:"example/export", | ||||
|         definition: { | ||||
|             "name": "Example of using CSV Export", | ||||
|             "extensions": { | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define([ | ||||
|     "./src/ExampleFormController" | ||||
| @@ -28,7 +29,7 @@ define([ | ||||
|     "use strict"; | ||||
|  | ||||
|     return { | ||||
|         name: "example/forms", | ||||
|         name:"example/forms", | ||||
|         definition: { | ||||
|             "name": "Declarative Forms example", | ||||
|             "sources": "src", | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /***************************************************************************** | ||||
|  * Open MCT, Copyright (c) 2014-2020, United States Government | ||||
|  * Open MCT, Copyright (c) 2014-2017, United States Government | ||||
|  * as represented by the Administrator of the National Aeronautics and Space | ||||
|  * Administration. All rights reserved. | ||||
|  * | ||||
| @@ -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,window*/ | ||||
|  | ||||
| define( | ||||
|     [], | ||||
| @@ -79,7 +80,7 @@ define( | ||||
|                                 control: "button", | ||||
|                                 csslass: "icon-save", | ||||
|                                 click: function () { | ||||
|                                     console.log("Save"); | ||||
|                                     window.alert("Save"); | ||||
|                                 } | ||||
|                             }, | ||||
|                             { | ||||
| @@ -87,7 +88,7 @@ define( | ||||
|                                 csslass: "icon-x", | ||||
|                                 description: "Button B", | ||||
|                                 click: function () { | ||||
|                                     console.log("Cancel"); | ||||
|                                     window.alert("Cancel"); | ||||
|                                 } | ||||
|                             }, | ||||
|                             { | ||||
| @@ -96,7 +97,7 @@ define( | ||||
|                                 description: "Button C", | ||||
|                                 disabled: true, | ||||
|                                 click: function () { | ||||
|                                     console.log("Delete"); | ||||
|                                     window.alert("Delete"); | ||||
|                                 } | ||||
|                             } | ||||
|                         ] | ||||
| @@ -151,22 +152,10 @@ define( | ||||
|                                 name: "Choose something", | ||||
|                                 control: "select", | ||||
|                                 options: [ | ||||
|                                     { | ||||
|                                         name: "Hats", | ||||
|                                         value: "hats" | ||||
|                                     }, | ||||
|                                     { | ||||
|                                         name: "Bats", | ||||
|                                         value: "bats" | ||||
|                                     }, | ||||
|                                     { | ||||
|                                         name: "Cats", | ||||
|                                         value: "cats" | ||||
|                                     }, | ||||
|                                     { | ||||
|                                         name: "Mats", | ||||
|                                         value: "mats" | ||||
|                                     } | ||||
|                                     { name: "Hats", value: "hats" }, | ||||
|                                     { name: "Bats", value: "bats" }, | ||||
|                                     { name: "Cats", value: "cats" }, | ||||
|                                     { name: "Mats", value: "mats" } | ||||
|                                 ], | ||||
|                                 key: "aChoice" | ||||
|                             }, | ||||
| @@ -175,22 +164,10 @@ define( | ||||
|                                 control: "select", | ||||
|                                 required: true, | ||||
|                                 options: [ | ||||
|                                     { | ||||
|                                         name: "Hats", | ||||
|                                         value: "hats" | ||||
|                                     }, | ||||
|                                     { | ||||
|                                         name: "Bats", | ||||
|                                         value: "bats" | ||||
|                                     }, | ||||
|                                     { | ||||
|                                         name: "Cats", | ||||
|                                         value: "cats" | ||||
|                                     }, | ||||
|                                     { | ||||
|                                         name: "Mats", | ||||
|                                         value: "mats" | ||||
|                                     } | ||||
|                                     { name: "Hats", value: "hats" }, | ||||
|                                     { name: "Bats", value: "bats" }, | ||||
|                                     { name: "Cats", value: "cats" }, | ||||
|                                     { name: "Mats", value: "mats" } | ||||
|                                 ], | ||||
|                                 key: "aRequiredChoice" | ||||
|                             } | ||||
|   | ||||
| @@ -41,7 +41,6 @@ define([ | ||||
|                 { | ||||
|                     key: "sin", | ||||
|                     name: "Sine", | ||||
|                     unit: "Hz", | ||||
|                     formatString: '%0.2f', | ||||
|                     hints: { | ||||
|                         range: 1 | ||||
| @@ -50,7 +49,6 @@ define([ | ||||
|                 { | ||||
|                     key: "cos", | ||||
|                     name: "Cosine", | ||||
|                     unit: "deg", | ||||
|                     formatString: '%0.2f', | ||||
|                     hints: { | ||||
|                         range: 2 | ||||
| @@ -110,14 +108,14 @@ define([ | ||||
|                 } | ||||
|             ] | ||||
|         } | ||||
|     }; | ||||
|     } | ||||
|  | ||||
|     function GeneratorMetadataProvider() { | ||||
|  | ||||
|     } | ||||
|  | ||||
|     GeneratorMetadataProvider.prototype.supportsMetadata = function (domainObject) { | ||||
|         return Object.prototype.hasOwnProperty.call(METADATA_BY_TYPE, domainObject.type); | ||||
|         return METADATA_BY_TYPE.hasOwnProperty(domainObject.type); | ||||
|     }; | ||||
|  | ||||
|     GeneratorMetadataProvider.prototype.getMetadata = function (domainObject) { | ||||
|   | ||||
| @@ -62,22 +62,18 @@ define([ | ||||
|         var workerRequest = {}; | ||||
|  | ||||
|         props.forEach(function (prop) { | ||||
|             if (domainObject.telemetry && Object.prototype.hasOwnProperty.call(domainObject.telemetry, prop)) { | ||||
|             if (domainObject.telemetry && domainObject.telemetry.hasOwnProperty(prop)) { | ||||
|                 workerRequest[prop] = domainObject.telemetry[prop]; | ||||
|             } | ||||
|  | ||||
|             if (request && Object.prototype.hasOwnProperty.call(request, prop)) { | ||||
|             if (request && request.hasOwnProperty(prop)) { | ||||
|                 workerRequest[prop] = request[prop]; | ||||
|             } | ||||
|  | ||||
|             if (!Object.prototype.hasOwnProperty.call(workerRequest, prop)) { | ||||
|             if (!workerRequest.hasOwnProperty(prop)) { | ||||
|                 workerRequest[prop] = REQUEST_DEFAULTS[prop]; | ||||
|             } | ||||
|  | ||||
|             workerRequest[prop] = Number(workerRequest[prop]); | ||||
|         }); | ||||
|         workerRequest.name = domainObject.name; | ||||
|  | ||||
|         return workerRequest; | ||||
|     }; | ||||
|  | ||||
| @@ -85,13 +81,11 @@ define([ | ||||
|         var workerRequest = this.makeWorkerRequest(domainObject, request); | ||||
|         workerRequest.start = request.start; | ||||
|         workerRequest.end = request.end; | ||||
|  | ||||
|         return this.workerInterface.request(workerRequest); | ||||
|     }; | ||||
|  | ||||
|     GeneratorProvider.prototype.subscribe = function (domainObject, callback) { | ||||
|         var workerRequest = this.makeWorkerRequest(domainObject, {}); | ||||
|  | ||||
|         return this.workerInterface.subscribe(workerRequest, callback); | ||||
|     }; | ||||
|  | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define([ | ||||
|  | ||||
| @@ -27,39 +28,39 @@ define([ | ||||
| ) { | ||||
|  | ||||
|     var RED = { | ||||
|             sin: 0.9, | ||||
|             cos: 0.9 | ||||
|         sin: 0.9, | ||||
|         cos: 0.9 | ||||
|     }; | ||||
|     var YELLOW = { | ||||
|         sin: 0.5, | ||||
|         cos: 0.5 | ||||
|     }; | ||||
|     var LIMITS = { | ||||
|         rh: { | ||||
|             cssClass: "is-limit--upr is-limit--red", | ||||
|             low: RED, | ||||
|             high: Number.POSITIVE_INFINITY, | ||||
|             name: "Red High" | ||||
|         }, | ||||
|         YELLOW = { | ||||
|             sin: 0.5, | ||||
|             cos: 0.5 | ||||
|         rl: { | ||||
|             cssClass: "is-limit--lwr is-limit--red", | ||||
|             high: -RED, | ||||
|             low: Number.NEGATIVE_INFINITY, | ||||
|             name: "Red Low" | ||||
|         }, | ||||
|         LIMITS = { | ||||
|             rh: { | ||||
|                 cssClass: "is-limit--upr is-limit--red", | ||||
|                 low: RED, | ||||
|                 high: Number.POSITIVE_INFINITY, | ||||
|                 name: "Red High" | ||||
|             }, | ||||
|             rl: { | ||||
|                 cssClass: "is-limit--lwr is-limit--red", | ||||
|                 high: -RED, | ||||
|                 low: Number.NEGATIVE_INFINITY, | ||||
|                 name: "Red Low" | ||||
|             }, | ||||
|             yh: { | ||||
|                 cssClass: "is-limit--upr is-limit--yellow", | ||||
|                 low: YELLOW, | ||||
|                 high: RED, | ||||
|                 name: "Yellow High" | ||||
|             }, | ||||
|             yl: { | ||||
|                 cssClass: "is-limit--lwr is-limit--yellow", | ||||
|                 low: -RED, | ||||
|                 high: -YELLOW, | ||||
|                 name: "Yellow Low" | ||||
|             } | ||||
|         }; | ||||
|         yh: { | ||||
|             cssClass: "is-limit--upr is-limit--yellow", | ||||
|             low: YELLOW, | ||||
|             high: RED, | ||||
|             name: "Yellow High" | ||||
|         }, | ||||
|         yl: { | ||||
|             cssClass: "is-limit--lwr is-limit--yellow", | ||||
|             low: -RED, | ||||
|             high: -YELLOW, | ||||
|             name: "Yellow Low" | ||||
|         } | ||||
|     }; | ||||
|  | ||||
|     function SinewaveLimitProvider() { | ||||
|  | ||||
| @@ -77,15 +78,12 @@ define([ | ||||
|                 if (datum[range] > RED[range]) { | ||||
|                     return LIMITS.rh; | ||||
|                 } | ||||
|  | ||||
|                 if (datum[range] < -RED[range]) { | ||||
|                     return LIMITS.rl; | ||||
|                 } | ||||
|  | ||||
|                 if (datum[range] > YELLOW[range]) { | ||||
|                     return LIMITS.yh; | ||||
|                 } | ||||
|  | ||||
|                 if (datum[range] < -YELLOW[range]) { | ||||
|                     return LIMITS.yl; | ||||
|                 } | ||||
|   | ||||
| @@ -48,7 +48,7 @@ define([ | ||||
|         var interval = setInterval(function () { | ||||
|             var now = Date.now(); | ||||
|             var datum = pointForTimestamp(now, duration, domainObject.name); | ||||
|             datum.value = String(datum.value); | ||||
|             datum.value += ""; | ||||
|             callback(datum); | ||||
|         }, duration); | ||||
|  | ||||
| @@ -57,6 +57,7 @@ define([ | ||||
|         }; | ||||
|     }; | ||||
|  | ||||
|  | ||||
|     StateGeneratorProvider.prototype.supportsRequest = function (domainObject, options) { | ||||
|         return domainObject.type === 'example.state-generator'; | ||||
|     }; | ||||
| @@ -68,13 +69,11 @@ define([ | ||||
|         if (options.strategy === 'latest' || options.size === 1) { | ||||
|             start = end; | ||||
|         } | ||||
|  | ||||
|         var data = []; | ||||
|         while (start <= end && data.length < 5000) { | ||||
|             data.push(pointForTimestamp(start, duration, domainObject.name)); | ||||
|             start += duration; | ||||
|         } | ||||
|  | ||||
|         return Promise.resolve(data); | ||||
|     }; | ||||
|  | ||||
|   | ||||
| @@ -72,16 +72,13 @@ define([ | ||||
|         }); | ||||
|         var messageId; | ||||
|  | ||||
|         let self = this; | ||||
|         function callback(message) { | ||||
|             if (message.error) { | ||||
|                 deferred.reject(message.error); | ||||
|             } else { | ||||
|                 deferred.resolve(message.data); | ||||
|             } | ||||
|  | ||||
|             delete self.callbacks[messageId]; | ||||
|  | ||||
|             delete this.callbacks[messageId]; | ||||
|         } | ||||
|  | ||||
|         messageId = this.dispatch('request', request, callback.bind(this)); | ||||
| @@ -104,5 +101,8 @@ define([ | ||||
|         }.bind(this); | ||||
|     }; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     return WorkerInterface; | ||||
| }); | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /***************************************************************************** | ||||
|  * Open MCT, Copyright (c) 2014-2020, United States Government | ||||
|  * Open MCT, Copyright (c) 2014-2017, United States Government | ||||
|  * as represented by the Administrator of the National Aeronautics and Space | ||||
|  * Administration. All rights reserved. | ||||
|  * | ||||
| @@ -20,6 +20,8 @@ | ||||
|  * at runtime from the About dialog for additional information. | ||||
|  *****************************************************************************/ | ||||
|  | ||||
| /*global self*/ | ||||
|  | ||||
| (function () { | ||||
|  | ||||
|     var FIFTEEN_MINUTES = 15 * 60 * 1000; | ||||
| @@ -62,14 +64,13 @@ | ||||
|                     data: { | ||||
|                         name: data.name, | ||||
|                         utc: nextStep, | ||||
|                         yesterday: nextStep - 60 * 60 * 24 * 1000, | ||||
|                         yesterday: nextStep - 60*60*24*1000, | ||||
|                         sin: sin(nextStep, data.period, data.amplitude, data.offset, data.phase, data.randomness), | ||||
|                         cos: cos(nextStep, data.period, data.amplitude, data.offset, data.phase, data.randomness) | ||||
|                     } | ||||
|                 }); | ||||
|                 nextStep += step; | ||||
|             } | ||||
|  | ||||
|             return nextStep; | ||||
|         } | ||||
|  | ||||
| @@ -86,7 +87,6 @@ | ||||
|         if (request.end === undefined) { | ||||
|             request.end = Date.now(); | ||||
|         } | ||||
|  | ||||
|         if (request.start === undefined) { | ||||
|             request.start = request.end - FIFTEEN_MINUTES; | ||||
|         } | ||||
| @@ -110,12 +110,11 @@ | ||||
|             data.push({ | ||||
|                 name: request.name, | ||||
|                 utc: nextStep, | ||||
|                 yesterday: nextStep - 60 * 60 * 24 * 1000, | ||||
|                 yesterday: nextStep - 60*60*24*1000, | ||||
|                 sin: sin(nextStep, period, amplitude, offset, phase, randomness), | ||||
|                 cos: cos(nextStep, period, amplitude, offset, phase, randomness) | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|         self.postMessage({ | ||||
|             id: message.id, | ||||
|             data: data | ||||
| @@ -123,13 +122,13 @@ | ||||
|     } | ||||
|  | ||||
|     function cos(timestamp, period, amplitude, offset, phase, randomness) { | ||||
|         return amplitude | ||||
|             * Math.cos(phase + (timestamp / period / 1000 * Math.PI * 2)) + (amplitude * Math.random() * randomness) + offset; | ||||
|         return amplitude * | ||||
|             Math.cos(phase + (timestamp / period / 1000 * Math.PI * 2)) + (amplitude * Math.random() * randomness) + offset; | ||||
|     } | ||||
|  | ||||
|     function sin(timestamp, period, amplitude, offset, phase, randomness) { | ||||
|         return amplitude | ||||
|             * Math.sin(phase + (timestamp / period / 1000 * Math.PI * 2)) + (amplitude * Math.random() * randomness) + offset; | ||||
|         return amplitude * | ||||
|             Math.sin(phase + (timestamp / period / 1000 * Math.PI * 2)) + (amplitude * Math.random() * randomness) + offset; | ||||
|     } | ||||
|  | ||||
|     function sendError(error, message) { | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define([ | ||||
|     "./GeneratorProvider", | ||||
| @@ -55,7 +56,7 @@ define([ | ||||
|             initialize: function (object) { | ||||
|                 object.telemetry = { | ||||
|                     duration: 5 | ||||
|                 }; | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
|  | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define([ | ||||
|     "./src/ExampleIdentityService" | ||||
| @@ -28,7 +29,7 @@ define([ | ||||
|     "use strict"; | ||||
|  | ||||
|     return { | ||||
|         name: "example/identity", | ||||
|         name:"example/identity", | ||||
|         definition: { | ||||
|             "extensions": { | ||||
|                 "components": [ | ||||
|   | ||||
| @@ -19,34 +19,31 @@ | ||||
|  * 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 DEFAULT_IDENTITY = { | ||||
|                 key: "user", | ||||
|                 name: "Example User" | ||||
|             }, | ||||
|             DIALOG_STRUCTURE = { | ||||
|                 name: "Identify Yourself", | ||||
|                 sections: [{ | ||||
|                     rows: [ | ||||
|                         { | ||||
|                             name: "User ID", | ||||
|                             control: "textfield", | ||||
|                             key: "key", | ||||
|                             required: true | ||||
|                         }, | ||||
|                         { | ||||
|                             name: "Human name", | ||||
|                             control: "textfield", | ||||
|                             key: "name", | ||||
|                             required: true | ||||
|                         } | ||||
|                     ] | ||||
|                 }] | ||||
|             }; | ||||
|         var DEFAULT_IDENTITY = { key: "user", name: "Example User" }; | ||||
|         var DIALOG_STRUCTURE = { | ||||
|             name: "Identify Yourself", | ||||
|             sections: [{ rows: [ | ||||
|                 { | ||||
|                     name: "User ID", | ||||
|                     control: "textfield", | ||||
|                     key: "key", | ||||
|                     required: true | ||||
|                 }, | ||||
|                 { | ||||
|                     name: "Human name", | ||||
|                     control: "textfield", | ||||
|                     key: "name", | ||||
|                     required: true | ||||
|                 } | ||||
|             ]}] | ||||
|         }; | ||||
|  | ||||
|  | ||||
|         /** | ||||
|          * Example implementation of an identity service. This prompts the | ||||
| @@ -80,14 +77,14 @@ define( | ||||
|          */ | ||||
|         ExampleIdentityProvider.prototype.returnUser = function (user) { | ||||
|             return this.user = user; | ||||
|         }; | ||||
|         } | ||||
|  | ||||
|         /** | ||||
|          * @private | ||||
|          */ | ||||
|         ExampleIdentityProvider.prototype.returnUndefined = function () { | ||||
|             return undefined; | ||||
|         }; | ||||
|         } | ||||
|  | ||||
|         return ExampleIdentityProvider; | ||||
|     } | ||||
|   | ||||
| @@ -85,28 +85,28 @@ define([ | ||||
|                     data.push(pointForTimestamp(start, domainObject.name)); | ||||
|                     start += 5000; | ||||
|                 } | ||||
|  | ||||
|                 return Promise.resolve(data); | ||||
|             } | ||||
|         }; | ||||
|  | ||||
|         var ladProvider = { | ||||
|             supportsRequest: function (domainObject, options) { | ||||
|                 return domainObject.type === 'example.imagery' | ||||
|                     && options.strategy === 'latest'; | ||||
|                 return domainObject.type === 'example.imagery' && | ||||
|                     options.strategy === 'latest'; | ||||
|             }, | ||||
|             request: function (domainObject, options) { | ||||
|                 return Promise.resolve([pointForTimestamp(Date.now(), domainObject.name)]); | ||||
|             } | ||||
|         }; | ||||
|  | ||||
|  | ||||
|         return function install(openmct) { | ||||
|             openmct.types.addType('example.imagery', { | ||||
|                 key: 'example.imagery', | ||||
|                 name: 'Example Imagery', | ||||
|                 cssClass: 'icon-image', | ||||
|                 description: 'For development use. Creates example imagery ' | ||||
|                     + 'data that mimics a live imagery stream.', | ||||
|                 description: 'For development use. Creates example imagery ' + | ||||
|                     'data that mimics a live imagery stream.', | ||||
|                 creatable: true, | ||||
|                 initialize: function (object) { | ||||
|                     object.telemetry = { | ||||
| @@ -140,7 +140,7 @@ define([ | ||||
|                                 } | ||||
|                             } | ||||
|                         ] | ||||
|                     }; | ||||
|                     } | ||||
|                 } | ||||
|             }); | ||||
|  | ||||
|   | ||||
| @@ -19,12 +19,13 @@ | ||||
|  * 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"; | ||||
|  | ||||
|     return { | ||||
|         name: "example/mobile", | ||||
|         name:"example/mobile", | ||||
|         definition: { | ||||
|             "name": "Mobile", | ||||
|             "description": "Allows elements with pertinence to mobile usage and development", | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define([ | ||||
|     "./src/RemsTelemetryServerAdapter", | ||||
| @@ -30,15 +31,14 @@ define([ | ||||
|     RemsTelemetryProvider | ||||
| ) { | ||||
|     "use strict"; | ||||
|  | ||||
|     return { | ||||
|         name: "example/msl", | ||||
|         name:"example/msl", | ||||
|         definition: { | ||||
|             "name": "Mars Science Laboratory Data Adapter", | ||||
|             "extensions": { | ||||
|             "name" : "Mars Science Laboratory Data Adapter", | ||||
|             "extensions" : { | ||||
|                 "types": [ | ||||
|                     { | ||||
|                         "name": "Mars Science Laboratory", | ||||
|                         "name":"Mars Science Laboratory", | ||||
|                         "key": "msl.curiosity", | ||||
|                         "cssClass": "icon-object" | ||||
|                     }, | ||||
| @@ -89,7 +89,7 @@ define([ | ||||
|                 ], | ||||
|                 "services": [ | ||||
|                     { | ||||
|                         "key": "rems.adapter", | ||||
|                         "key":"rems.adapter", | ||||
|                         "implementation": RemsTelemetryServerAdapter, | ||||
|                         "depends": ["$http", "$log", "REMS_WS_URL"] | ||||
|                     } | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define( | ||||
|     [], | ||||
| @@ -37,7 +38,7 @@ define( | ||||
|             "identifier": "msl", | ||||
|             "instruments": [ | ||||
|                 { | ||||
|                     "name": "rems", | ||||
|                     "name":"rems", | ||||
|                     "identifier": "rems", | ||||
|                     "measurements": [ | ||||
|                         { | ||||
|   | ||||
| @@ -19,17 +19,18 @@ | ||||
|  * 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 PREFIX = "msl_tlm:", | ||||
|             FORMAT_MAPPINGS = { | ||||
|                 float: "number", | ||||
|                 integer: "number", | ||||
|                 string: "string" | ||||
|             }; | ||||
|         var PREFIX = "msl_tlm:"; | ||||
|         var FORMAT_MAPPINGS = { | ||||
|             float: "number", | ||||
|             integer: "number", | ||||
|             string: "string" | ||||
|         }; | ||||
|  | ||||
|         function RemsTelemetryModelProvider(adapter) { | ||||
|  | ||||
| @@ -63,8 +64,8 @@ define( | ||||
|                 } | ||||
|  | ||||
|                 function addInstrument(subsystem, spacecraftId) { | ||||
|                     var measurements = (subsystem.measurements || []), | ||||
|                         instrumentId = makeId(subsystem); | ||||
|                     var measurements = (subsystem.measurements || []); | ||||
|                     var instrumentId = makeId(subsystem); | ||||
|  | ||||
|                     models[instrumentId] = { | ||||
|                         type: "msl.instrument", | ||||
| @@ -80,7 +81,6 @@ define( | ||||
|                 (dictionary.instruments || []).forEach(function (instrument) { | ||||
|                     addInstrument(instrument, "msl:curiosity"); | ||||
|                 }); | ||||
|  | ||||
|                 return models; | ||||
|             } | ||||
|  | ||||
| @@ -90,7 +90,6 @@ define( | ||||
|                 } | ||||
|             }; | ||||
|         } | ||||
|  | ||||
|         return RemsTelemetryModelProvider; | ||||
|     } | ||||
| ); | ||||
|   | ||||
| @@ -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 */ | ||||
| define ( | ||||
|     ['./RemsTelemetrySeries'], | ||||
|     function (RemsTelemetrySeries) { | ||||
| @@ -41,9 +42,9 @@ define ( | ||||
|          * object that wraps the telemetry returned from the telemetry source. | ||||
|          */ | ||||
|         RemsTelemetryProvider.prototype.requestTelemetry = function (requests) { | ||||
|             var packaged = {}, | ||||
|                 relevantReqs, | ||||
|                 adapter = this.adapter; | ||||
|             var packaged = {}; | ||||
|             var relevantReqs; | ||||
|             var adapter = this.adapter; | ||||
|  | ||||
|             function matchesSource(request) { | ||||
|                 return (request.source === SOURCE); | ||||
| @@ -73,7 +74,6 @@ define ( | ||||
|         RemsTelemetryProvider.prototype.subscribe = function (callback, requests) { | ||||
|             return function () {}; | ||||
|         }; | ||||
|  | ||||
|         RemsTelemetryProvider.prototype.unsubscribe = function (callback, requests) { | ||||
|             return function () {}; | ||||
|         }; | ||||
|   | ||||
| @@ -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 */ | ||||
| define( | ||||
|     function () { | ||||
|         "use strict"; | ||||
| @@ -56,7 +57,6 @@ define( | ||||
|         RemsTelemetrySeries.prototype.getPointCount = function () { | ||||
|             return this.data.length; | ||||
|         }; | ||||
|  | ||||
|         /** | ||||
|          * The domain value at the given index. The Rems telemetry data is | ||||
|          * time ordered, so the domain value is the time stamp of each data | ||||
|   | ||||
| @@ -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*/ | ||||
| /*jslint es5: true */ | ||||
|  | ||||
| define( | ||||
| @@ -29,8 +30,8 @@ define( | ||||
|     function (MSLDataDictionary, module) { | ||||
|         "use strict"; | ||||
|  | ||||
|         var TERRESTRIAL_DATE = "terrestrial_date", | ||||
|             LOCAL_DATA = "../data/rems.json"; | ||||
|         var TERRESTRIAL_DATE = "terrestrial_date"; | ||||
|         var LOCAL_DATA = "../data/rems.json"; | ||||
|  | ||||
|         /** | ||||
|          * Fetches historical data from the REMS instrument on the Curiosity | ||||
| @@ -68,8 +69,8 @@ define( | ||||
|          * @private | ||||
|          */ | ||||
|         RemsTelemetryServerAdapter.prototype.requestHistory = function (request) { | ||||
|             var self = this, | ||||
|                 id = request.key; | ||||
|             var self = this; | ||||
|             var id = request.key; | ||||
|  | ||||
|             var dataTransforms = this.dataTransforms; | ||||
|  | ||||
| @@ -94,32 +95,28 @@ define( | ||||
|                         }); | ||||
|                     } | ||||
|                 }); | ||||
|  | ||||
|                 return data; | ||||
|             } | ||||
|  | ||||
|             function fallbackToLocal() { | ||||
|                 self.$log.warn("Loading REMS data failed, probably due to" | ||||
|                     + " cross origin policy. Falling back to local data"); | ||||
|  | ||||
|                 self.$log.warn("Loading REMS data failed, probably due to" + | ||||
|                     " cross origin policy. Falling back to local data"); | ||||
|                 return self.$http.get(self.localDataURI); | ||||
|             } | ||||
|  | ||||
|             //Filter results to match request parameters | ||||
|             function filterResults(results) { | ||||
|                 return results.filter(function (result) { | ||||
|                     return result.date >= (request.start || Number.MIN_VALUE) | ||||
|                         && result.date <= (request.end || Number.MAX_VALUE); | ||||
|                     return result.date >= (request.start || Number.MIN_VALUE) && | ||||
|                         result.date <= (request.end || Number.MAX_VALUE); | ||||
|                 }); | ||||
|             } | ||||
|  | ||||
|             function packageAndResolve(results) { | ||||
|                 return { | ||||
|                     id: id, | ||||
|                     values: results | ||||
|                 }; | ||||
|                 return {id: id, values: results}; | ||||
|             } | ||||
|  | ||||
|  | ||||
|             return (this.promise = this.promise || this.$http.get(this.REMS_WS_URL)) | ||||
|                 .catch(fallbackToLocal) | ||||
|                 .then(processResponse) | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define([ | ||||
|     "./src/DialogLaunchController", | ||||
| @@ -38,7 +39,7 @@ define([ | ||||
|     "use strict"; | ||||
|  | ||||
|     return { | ||||
|         name: "example/notifications", | ||||
|         name:"example/notifications", | ||||
|         definition: { | ||||
|             "extensions": { | ||||
|                 "templates": [ | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define( | ||||
|     [], | ||||
| @@ -43,31 +44,31 @@ define( | ||||
|              periodically with the progress of an ongoing process. | ||||
|              */ | ||||
|             $scope.launchProgress = function (knownProgress) { | ||||
|                 var dialog, | ||||
|                     model = { | ||||
|                         title: "Progress Dialog Example", | ||||
|                         progress: 0, | ||||
|                         hint: "Do not navigate away from this page or close this browser tab while this operation is in progress.", | ||||
|                         actionText: "Calculating...", | ||||
|                         unknownProgress: !knownProgress, | ||||
|                         unknownDuration: false, | ||||
|                         severity: "info", | ||||
|                         options: [ | ||||
|                             { | ||||
|                                 label: "Cancel Operation", | ||||
|                                 callback: function () { | ||||
|                                     $log.debug("Operation cancelled"); | ||||
|                                     dialog.dismiss(); | ||||
|                                 } | ||||
|                             }, | ||||
|                             { | ||||
|                                 label: "Do something else...", | ||||
|                                 callback: function () { | ||||
|                                     $log.debug("Something else pressed"); | ||||
|                                 } | ||||
|                 var dialog; | ||||
|                 var model = { | ||||
|                     title: "Progress Dialog Example", | ||||
|                     progress: 0, | ||||
|                     hint: "Do not navigate away from this page or close this browser tab while this operation is in progress.", | ||||
|                     actionText: "Calculating...", | ||||
|                     unknownProgress: !knownProgress, | ||||
|                     unknownDuration: false, | ||||
|                     severity: "info", | ||||
|                     options: [ | ||||
|                         { | ||||
|                             label: "Cancel Operation", | ||||
|                             callback: function () { | ||||
|                                 $log.debug("Operation cancelled"); | ||||
|                                 dialog.dismiss(); | ||||
|                             } | ||||
|                         ] | ||||
|                     }; | ||||
|                         }, | ||||
|                         { | ||||
|                             label: "Do something else...", | ||||
|                             callback: function () { | ||||
|                                 $log.debug("Something else pressed"); | ||||
|                             } | ||||
|                         } | ||||
|                     ] | ||||
|                 }; | ||||
|  | ||||
|                 function incrementProgress() { | ||||
|                     model.progress = Math.min(100, Math.floor(model.progress + Math.random() * 30)); | ||||
| @@ -90,32 +91,33 @@ define( | ||||
|                 } | ||||
|             }; | ||||
|  | ||||
|  | ||||
|             /* | ||||
|              Demonstrates launching an error dialog | ||||
|              */ | ||||
|             $scope.launchError = function () { | ||||
|                 var dialog, | ||||
|                     model = { | ||||
|                         title: "Error Dialog Example", | ||||
|                         actionText: "Something happened, and it was not good.", | ||||
|                         severity: "error", | ||||
|                         options: [ | ||||
|                             { | ||||
|                                 label: "Try Again", | ||||
|                                 callback: function () { | ||||
|                                     $log.debug("Try Again Pressed"); | ||||
|                                     dialog.dismiss(); | ||||
|                                 } | ||||
|                             }, | ||||
|                             { | ||||
|                                 label: "Cancel", | ||||
|                                 callback: function () { | ||||
|                                     $log.debug("Cancel Pressed"); | ||||
|                                     dialog.dismiss(); | ||||
|                                 } | ||||
|                 var dialog; | ||||
|                 var model = { | ||||
|                     title: "Error Dialog Example", | ||||
|                     actionText: "Something happened, and it was not good.", | ||||
|                     severity: "error", | ||||
|                     options: [ | ||||
|                         { | ||||
|                             label: "Try Again", | ||||
|                             callback: function () { | ||||
|                                 $log.debug("Try Again Pressed"); | ||||
|                                 dialog.dismiss(); | ||||
|                             } | ||||
|                         ] | ||||
|                     }; | ||||
|                         }, | ||||
|                         { | ||||
|                             label: "Cancel", | ||||
|                             callback: function () { | ||||
|                                 $log.debug("Cancel Pressed"); | ||||
|                                 dialog.dismiss(); | ||||
|                             } | ||||
|                         } | ||||
|                     ] | ||||
|                 }; | ||||
|                 dialog = dialogService.showBlockingMessage(model); | ||||
|  | ||||
|                 if (!dialog) { | ||||
| @@ -127,21 +129,21 @@ define( | ||||
|              Demonstrates launching an error dialog | ||||
|              */ | ||||
|             $scope.launchInfo = function () { | ||||
|                 var dialog, | ||||
|                     model = { | ||||
|                         title: "Info Dialog Example", | ||||
|                         actionText: "This is an example of a blocking info" | ||||
|                         + " dialog. This dialog can be used to draw the user's" | ||||
|                         + " attention to an event.", | ||||
|                         severity: "info", | ||||
|                         primaryOption: { | ||||
|                             label: "OK", | ||||
|                             callback: function () { | ||||
|                                 $log.debug("OK Pressed"); | ||||
|                                 dialog.dismiss(); | ||||
|                             } | ||||
|                 var dialog; | ||||
|                 var model = { | ||||
|                     title: "Info Dialog Example", | ||||
|                     actionText: "This is an example of a blocking info" + | ||||
|                     " dialog. This dialog can be used to draw the user's" + | ||||
|                     " attention to an event.", | ||||
|                     severity: "info", | ||||
|                     primaryOption: { | ||||
|                         label: "OK", | ||||
|                         callback: function () { | ||||
|                             $log.debug("OK Pressed"); | ||||
|                             dialog.dismiss(); | ||||
|                         } | ||||
|                     }; | ||||
|                     } | ||||
|                 }; | ||||
|  | ||||
|                 dialog = dialogService.showBlockingMessage(model); | ||||
|  | ||||
| @@ -151,7 +153,6 @@ define( | ||||
|             }; | ||||
|  | ||||
|         } | ||||
|  | ||||
|         return DialogLaunchController; | ||||
|     } | ||||
| ); | ||||
|   | ||||
| @@ -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,window*/ | ||||
|  | ||||
| define( | ||||
|     [], | ||||
| @@ -41,11 +42,9 @@ define( | ||||
|         DialogLaunchIndicator.prototype.getGlyphClass = function () { | ||||
|             return 'ok'; | ||||
|         }; | ||||
|  | ||||
|         DialogLaunchIndicator.prototype.getText = function () { | ||||
|             return "Launch test dialog"; | ||||
|         }; | ||||
|  | ||||
|         DialogLaunchIndicator.prototype.getDescription = function () { | ||||
|             return "Launch test dialog"; | ||||
|         }; | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define( | ||||
|     [], | ||||
| @@ -47,8 +48,7 @@ define( | ||||
|                     "Eros turpis, pulvinar turpis eros eu", | ||||
|                     "Lundium nascetur a, lectus montes ac, parturient in natoque, duis risus risus pulvinar pid rhoncus, habitasse auctor natoque!" | ||||
|                 ]; | ||||
|  | ||||
|                 return actionTexts[Math.floor(Math.random() * 3)]; | ||||
|                 return actionTexts[Math.floor(Math.random()*3)]; | ||||
|             } | ||||
|  | ||||
|             /** | ||||
| @@ -61,7 +61,6 @@ define( | ||||
|                     severity: "error" | ||||
|                 }); | ||||
|             }; | ||||
|  | ||||
|             /** | ||||
|              * Launch a new notification with a severity of 'Alert'. | ||||
|              */ | ||||
| @@ -74,6 +73,7 @@ define( | ||||
|                 }); | ||||
|             }; | ||||
|  | ||||
|  | ||||
|             /** | ||||
|              * Launch a new notification with a progress bar that is updated | ||||
|              * periodically, tracking an ongoing process. | ||||
| @@ -93,10 +93,10 @@ define( | ||||
|                  * @param notification | ||||
|                  */ | ||||
|                 function incrementProgress() { | ||||
|                     progress = Math.min(100, Math.floor(progress + Math.random() * 30)); | ||||
|                     let progressText = ["Estimated time" | ||||
|                     + " remaining:" | ||||
|                     + " about ", 60 - Math.floor((progress / 100) * 60), " seconds"].join(" "); | ||||
|                     progress = Math.min(100, Math.floor(progress + Math.random() * 30)) | ||||
|                     let progressText = ["Estimated time" + | ||||
|                     " remaining:" + | ||||
|                     " about ", 60 - Math.floor((progress / 100) * 60), " seconds"].join(" "); | ||||
|                     notification.progress(progress, progressText); | ||||
|  | ||||
|                     if (progress < 100) { | ||||
| @@ -120,7 +120,6 @@ define( | ||||
|             }; | ||||
|  | ||||
|         } | ||||
|  | ||||
|         return NotificationLaunchController; | ||||
|     } | ||||
| ); | ||||
|   | ||||
| @@ -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,window*/ | ||||
|  | ||||
| define( | ||||
|     [], | ||||
| @@ -41,11 +42,9 @@ define( | ||||
|         NotificationLaunchIndicator.prototype.getGlyphClass = function () { | ||||
|             return 'ok'; | ||||
|         }; | ||||
|  | ||||
|         NotificationLaunchIndicator.prototype.getText = function () { | ||||
|             return "Launch notification"; | ||||
|         }; | ||||
|  | ||||
|         NotificationLaunchIndicator.prototype.getDescription = function () { | ||||
|             return "Launch notification"; | ||||
|         }; | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define([ | ||||
|     "./src/BrowserPersistenceProvider" | ||||
| @@ -28,7 +29,7 @@ define([ | ||||
|     "use strict"; | ||||
|  | ||||
|     return { | ||||
|         name: "example/persistence", | ||||
|         name:"example/persistence", | ||||
|         definition: { | ||||
|             "extensions": { | ||||
|                 "components": [ | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| /** | ||||
|  * Stubbed implementation of a persistence provider, | ||||
| @@ -29,14 +30,16 @@ define( | ||||
|     function () { | ||||
|         'use strict'; | ||||
|  | ||||
|  | ||||
|  | ||||
|         function BrowserPersistenceProvider($q, SPACE) { | ||||
|             var spaces = SPACE ? [SPACE] : [], | ||||
|                 caches = {}, | ||||
|                 promises = { | ||||
|                     as: function (value) { | ||||
|                         return $q.when(value); | ||||
|                     } | ||||
|                 }; | ||||
|             var spaces = SPACE ? [SPACE] : []; | ||||
|             var caches = {}; | ||||
|             var promises = { | ||||
|                 as: function (value) { | ||||
|                     return $q.when(value); | ||||
|                 } | ||||
|             }; | ||||
|  | ||||
|             spaces.forEach(function (space) { | ||||
|                 caches[space] = {}; | ||||
| @@ -48,7 +51,6 @@ define( | ||||
|                 }, | ||||
|                 listObjects: function (space) { | ||||
|                     var cache = caches[space]; | ||||
|  | ||||
|                     return promises.as( | ||||
|                         cache ? Object.keys(cache) : null | ||||
|                     ); | ||||
| @@ -66,7 +68,6 @@ define( | ||||
|                 }, | ||||
|                 readObject: function (space, key) { | ||||
|                     var cache = caches[space]; | ||||
|  | ||||
|                     return promises.as( | ||||
|                         cache ? cache[key] : null | ||||
|                     ); | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define([ | ||||
|     "./src/ExamplePolicy" | ||||
| @@ -28,7 +29,7 @@ define([ | ||||
|     "use strict"; | ||||
|  | ||||
|     return { | ||||
|         name: "example/policy", | ||||
|         name:"example/policy", | ||||
|         definition: { | ||||
|             "name": "Example Policy", | ||||
|             "description": "Provides an example of using policies to prohibit actions.", | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define( | ||||
|     [], | ||||
| @@ -32,11 +33,10 @@ define( | ||||
|                  * "foo." | ||||
|                  */ | ||||
|                 allow: function (action, context) { | ||||
|                     var domainObject = (context || {}).domainObject, | ||||
|                         model = (domainObject && domainObject.getModel()) || {}, | ||||
|                         name = model.name || "", | ||||
|                         metadata = action.getMetadata() || {}; | ||||
|  | ||||
|                     var domainObject = (context || {}).domainObject; | ||||
|                     var model = (domainObject && domainObject.getModel()) || {}; | ||||
|                     var name = model.name || ""; | ||||
|                     var metadata = action.getMetadata() || {}; | ||||
|                     return metadata.key !== 'remove' || name.indexOf('foo') < 0; | ||||
|                 } | ||||
|             }; | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define([ | ||||
|     "./src/WatchIndicator", | ||||
| @@ -30,7 +31,7 @@ define([ | ||||
|     "use strict"; | ||||
|  | ||||
|     return { | ||||
|         name: "example/profiling", | ||||
|         name:"example/profiling", | ||||
|         definition: { | ||||
|             "extensions": { | ||||
|                 "indicators": [ | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define( | ||||
|     [], | ||||
| @@ -33,13 +34,13 @@ define( | ||||
|          * @implements {Indicator} | ||||
|          */ | ||||
|         function DigestIndicator($interval, $rootScope) { | ||||
|             var digests = 0, | ||||
|                 displayed = 0, | ||||
|                 start = Date.now(); | ||||
|             var digests = 0; | ||||
|             var displayed = 0; | ||||
|             var start = Date.now(); | ||||
|  | ||||
|             function update() { | ||||
|                 var now = Date.now(), | ||||
|                     secs = (now - start) / 1000; | ||||
|                 var now = Date.now(); | ||||
|                 var secs = (now - start) / 1000; | ||||
|                 displayed = Math.round(digests / secs); | ||||
|                 start = now; | ||||
|                 digests = 0; | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define( | ||||
|     [], | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define([ | ||||
|     "./src/ScratchPersistenceProvider" | ||||
| @@ -28,7 +29,7 @@ define([ | ||||
|     "use strict"; | ||||
|  | ||||
|     return { | ||||
|         name: "example/scratchpad", | ||||
|         name:"example/scratchpad", | ||||
|         definition: { | ||||
|             "extensions": { | ||||
|                 "roots": [ | ||||
|   | ||||
| @@ -20,6 +20,8 @@ | ||||
|  * at runtime from the About dialog for additional information. | ||||
|  *****************************************************************************/ | ||||
|  | ||||
| /*global define,window*/ | ||||
|  | ||||
| define( | ||||
|     [], | ||||
|     function () { | ||||
| @@ -52,14 +54,13 @@ define( | ||||
|             if (space === 'scratch') { | ||||
|                 this.table[key] = JSON.stringify(value); | ||||
|             } | ||||
|  | ||||
|             return this.$q.when(space === 'scratch'); | ||||
|         }; | ||||
|  | ||||
|         ScratchPersistenceProvider.prototype.readObject = function (space, key) { | ||||
|             return this.$q.when( | ||||
|                 (space === 'scratch' && this.table[key]) | ||||
|                     ? JSON.parse(this.table[key]) : undefined | ||||
|                 (space === 'scratch' && this.table[key]) ? | ||||
|                     JSON.parse(this.table[key]) : undefined | ||||
|             ); | ||||
|         }; | ||||
|  | ||||
| @@ -67,7 +68,6 @@ define( | ||||
|             if (space === 'scratch') { | ||||
|                 delete this.table[key]; | ||||
|             } | ||||
|  | ||||
|             return this.$q.when(space === 'scratch'); | ||||
|         }; | ||||
|  | ||||
|   | ||||
| @@ -7,9 +7,9 @@ export default { | ||||
|     data() { | ||||
|         return { | ||||
|             msg: 'Hello world!' | ||||
|         }; | ||||
|         } | ||||
|     } | ||||
| }; | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style> | ||||
|   | ||||
| @@ -17,7 +17,6 @@ function SimpleVuePlugin() { | ||||
|             }, | ||||
|             view: function (domainObject) { | ||||
|                 var vm; | ||||
|  | ||||
|                 return { | ||||
|                     show: function (container) { | ||||
|                         vm = new Vue(HelloWorld); | ||||
| @@ -30,7 +29,7 @@ function SimpleVuePlugin() { | ||||
|             } | ||||
|         }); | ||||
|  | ||||
|     }; | ||||
|     } | ||||
| } | ||||
|  | ||||
| export default SimpleVuePlugin; | ||||
| export default SimpleVuePlugin | ||||
|   | ||||
| @@ -22,111 +22,31 @@ define([ | ||||
|     menusTemplate | ||||
| ) { | ||||
|     return { | ||||
|         name: "example/styleguide", | ||||
|         name:"example/styleguide", | ||||
|         definition: { | ||||
|             "name": "Open MCT Style Guide", | ||||
|             "description": "Examples and documentation illustrating UI styles in use in Open MCT.", | ||||
|             "extensions": | ||||
|         { | ||||
|             "types": [ | ||||
|                 { | ||||
|                     "key": "styleguide.intro", | ||||
|                     "name": "Introduction", | ||||
|                     "cssClass": "icon-page", | ||||
|                     "description": "Introduction and overview to the style guide" | ||||
|                 }, | ||||
|                 { | ||||
|                     "key": "styleguide.standards", | ||||
|                     "name": "Standards", | ||||
|                     "cssClass": "icon-page", | ||||
|                     "description": "" | ||||
|                 }, | ||||
|                 { | ||||
|                     "key": "styleguide.colors", | ||||
|                     "name": "Colors", | ||||
|                     "cssClass": "icon-page", | ||||
|                     "description": "" | ||||
|                 }, | ||||
|                 { | ||||
|                     "key": "styleguide.status", | ||||
|                     "name": "status", | ||||
|                     "cssClass": "icon-page", | ||||
|                     "description": "Limits, telemetry paused, etc." | ||||
|                 }, | ||||
|                 { | ||||
|                     "key": "styleguide.glyphs", | ||||
|                     "name": "Glyphs", | ||||
|                     "cssClass": "icon-page", | ||||
|                     "description": "Glyphs overview" | ||||
|                 }, | ||||
|                 { | ||||
|                     "key": "styleguide.controls", | ||||
|                     "name": "Controls", | ||||
|                     "cssClass": "icon-page", | ||||
|                     "description": "Buttons, selects, HTML controls" | ||||
|                 }, | ||||
|                 { | ||||
|                     "key": "styleguide.input", | ||||
|                     "name": "Text Inputs", | ||||
|                     "cssClass": "icon-page", | ||||
|                     "description": "Various text inputs" | ||||
|                 }, | ||||
|                 { | ||||
|                     "key": "styleguide.menus", | ||||
|                     "name": "Menus", | ||||
|                     "cssClass": "icon-page", | ||||
|                     "description": "Context menus, dropdowns" | ||||
|                 } | ||||
|                 { "key": "styleguide.intro", "name": "Introduction", "cssClass": "icon-page", "description": "Introduction and overview to the style guide" }, | ||||
|                 { "key": "styleguide.standards", "name": "Standards", "cssClass": "icon-page", "description": "" }, | ||||
|                 { "key": "styleguide.colors", "name": "Colors", "cssClass": "icon-page", "description": "" }, | ||||
|                 { "key": "styleguide.status", "name": "status", "cssClass": "icon-page", "description": "Limits, telemetry paused, etc." }, | ||||
|                 { "key": "styleguide.glyphs", "name": "Glyphs", "cssClass": "icon-page", "description": "Glyphs overview" }, | ||||
|                 { "key": "styleguide.controls", "name": "Controls", "cssClass": "icon-page", "description": "Buttons, selects, HTML controls" }, | ||||
|                 { "key": "styleguide.input", "name": "Text Inputs", "cssClass": "icon-page", "description": "Various text inputs" }, | ||||
|                 { "key": "styleguide.menus", "name": "Menus", "cssClass": "icon-page", "description": "Context menus, dropdowns" } | ||||
|             ], | ||||
|             "views": [ | ||||
|                 { | ||||
|                     "key": "styleguide.intro", | ||||
|                     "type": "styleguide.intro", | ||||
|                     "template": introTemplate, | ||||
|                     "editable": false | ||||
|                 }, | ||||
|                 { | ||||
|                     "key": "styleguide.standards", | ||||
|                     "type": "styleguide.standards", | ||||
|                     "template": standardsTemplate, | ||||
|                     "editable": false | ||||
|                 }, | ||||
|                 { | ||||
|                     "key": "styleguide.colors", | ||||
|                     "type": "styleguide.colors", | ||||
|                     "template": colorsTemplate, | ||||
|                     "editable": false | ||||
|                 }, | ||||
|                 { | ||||
|                     "key": "styleguide.status", | ||||
|                     "type": "styleguide.status", | ||||
|                     "template": statusTemplate, | ||||
|                     "editable": false | ||||
|                 }, | ||||
|                 { | ||||
|                     "key": "styleguide.glyphs", | ||||
|                     "type": "styleguide.glyphs", | ||||
|                     "template": glyphsTemplate, | ||||
|                     "editable": false | ||||
|                 }, | ||||
|                 { | ||||
|                     "key": "styleguide.controls", | ||||
|                     "type": "styleguide.controls", | ||||
|                     "template": controlsTemplate, | ||||
|                     "editable": false | ||||
|                 }, | ||||
|                 { | ||||
|                     "key": "styleguide.input", | ||||
|                     "type": "styleguide.input", | ||||
|                     "template": inputTemplate, | ||||
|                     "editable": false | ||||
|                 }, | ||||
|                 { | ||||
|                     "key": "styleguide.menus", | ||||
|                     "type": "styleguide.menus", | ||||
|                     "template": menusTemplate, | ||||
|                     "editable": false | ||||
|                 } | ||||
|                 { "key": "styleguide.intro", "type": "styleguide.intro", "template": introTemplate, "editable": false }, | ||||
|                 { "key": "styleguide.standards", "type": "styleguide.standards", "template": standardsTemplate, "editable": false }, | ||||
|                 { "key": "styleguide.colors", "type": "styleguide.colors", "template": colorsTemplate, "editable": false }, | ||||
|                 { "key": "styleguide.status", "type": "styleguide.status", "template": statusTemplate, "editable": false }, | ||||
|                 { "key": "styleguide.glyphs", "type": "styleguide.glyphs", "template": glyphsTemplate, "editable": false }, | ||||
|                 { "key": "styleguide.controls", "type": "styleguide.controls", "template": controlsTemplate, "editable": false }, | ||||
|                 { "key": "styleguide.input", "type": "styleguide.input", "template": inputTemplate, "editable": false }, | ||||
|                 { "key": "styleguide.menus", "type": "styleguide.menus", "template": menusTemplate, "editable": false } | ||||
|             ], | ||||
|             "roots": [ | ||||
|                 { | ||||
| @@ -136,7 +56,7 @@ define([ | ||||
|             "models": [ | ||||
|                 { | ||||
|                     "id": "styleguide:home", | ||||
|                     "priority": "preferred", | ||||
|                     "priority" : "preferred", | ||||
|                     "model": { | ||||
|                         "type": "folder", | ||||
|                         "name": "Style Guide Home", | ||||
| @@ -153,7 +73,7 @@ define([ | ||||
|                 }, | ||||
|                 { | ||||
|                     "id": "styleguide:ui-elements", | ||||
|                     "priority": "preferred", | ||||
|                     "priority" : "preferred", | ||||
|                     "model": { | ||||
|                         "type": "folder", | ||||
|                         "name": "UI Elements", | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define( | ||||
|     [], | ||||
| @@ -29,46 +30,14 @@ define( | ||||
|             var pages = {}; | ||||
|  | ||||
|             // Add pages | ||||
|             pages.intro = { | ||||
|                 name: "Introduction", | ||||
|                 type: "styleguide.intro", | ||||
|                 location: "styleguide:home" | ||||
|             }; | ||||
|             pages.standards = { | ||||
|                 name: "Standards", | ||||
|                 type: "styleguide.standards", | ||||
|                 location: "styleguide:home" | ||||
|             }; | ||||
|             pages.colors = { | ||||
|                 name: "Colors", | ||||
|                 type: "styleguide.colors", | ||||
|                 location: "styleguide:home" | ||||
|             }; | ||||
|             pages.glyphs = { | ||||
|                 name: "Glyphs", | ||||
|                 type: "styleguide.glyphs", | ||||
|                 location: "styleguide:home" | ||||
|             }; | ||||
|             pages.status = { | ||||
|                 name: "Status Indication", | ||||
|                 type: "styleguide.status", | ||||
|                 location: "styleguide:home" | ||||
|             }; | ||||
|             pages.controls = { | ||||
|                 name: "Controls", | ||||
|                 type: "styleguide.controls", | ||||
|                 location: "styleguide:ui-elements" | ||||
|             }; | ||||
|             pages.input = { | ||||
|                 name: "Text Inputs", | ||||
|                 type: "styleguide.input", | ||||
|                 location: "styleguide:ui-elements" | ||||
|             }; | ||||
|             pages.menus = { | ||||
|                 name: "Menus", | ||||
|                 type: "styleguide.menus", | ||||
|                 location: "styleguide:ui-elements" | ||||
|             }; | ||||
|             pages.intro = { name: "Introduction", type: "styleguide.intro", location: "styleguide:home" }; | ||||
|             pages.standards = { name: "Standards", type: "styleguide.standards", location: "styleguide:home" }; | ||||
|             pages.colors = { name: "Colors", type: "styleguide.colors", location: "styleguide:home" }; | ||||
|             pages.glyphs = { name: "Glyphs", type: "styleguide.glyphs", location: "styleguide:home" }; | ||||
|             pages.status = { name: "Status Indication", type: "styleguide.status", location: "styleguide:home" }; | ||||
|             pages.controls = { name: "Controls", type: "styleguide.controls", location: "styleguide:ui-elements" }; | ||||
|             pages.input = { name: "Text Inputs", type: "styleguide.input", location: "styleguide:ui-elements" }; | ||||
|             pages.menus = { name: "Menus", type: "styleguide.menus", location: "styleguide:ui-elements" }; | ||||
|  | ||||
|             return { | ||||
|                 getModels: function () { | ||||
| @@ -77,6 +46,6 @@ define( | ||||
|             }; | ||||
|         } | ||||
|  | ||||
|         return ExampleStyleGuideModelProvider; | ||||
|         return ExampleStyleGuideModelProvider | ||||
|     } | ||||
| ); | ||||
|   | ||||
| @@ -1,3 +0,0 @@ | ||||
| const testsContext = require.context('.', true, /\/(src|platform)\/.*Spec.js$/); | ||||
|  | ||||
| testsContext.keys().forEach(testsContext); | ||||
| @@ -52,16 +52,12 @@ module.exports = (config) => { | ||||
|         basePath: '', | ||||
|         frameworks: ['jasmine'], | ||||
|         files: [ | ||||
|             'indexTest.js' | ||||
|             'platform/**/*Spec.js', | ||||
|             'src/**/*Spec.js' | ||||
|         ], | ||||
|         port: 9876, | ||||
|         reporters: reporters, | ||||
|         browsers: browsers, | ||||
|         client: { | ||||
|             jasmine: { | ||||
|                 random: false | ||||
|             } | ||||
|         }, | ||||
|         customLaunchers: { | ||||
|             ChromeDebugging: { | ||||
|                 base: 'Chrome', | ||||
| @@ -86,20 +82,20 @@ module.exports = (config) => { | ||||
|             reports: ['html', 'lcovonly', 'text-summary'], | ||||
|             thresholds: { | ||||
|                 global: { | ||||
|                     lines: 64 | ||||
|                     lines: 62 | ||||
|                 } | ||||
|             } | ||||
|         }, | ||||
|         preprocessors: { | ||||
|             'indexTest.js': ['webpack', 'sourcemap'] | ||||
|             'platform/**/*Spec.js': ['webpack', 'sourcemap'], | ||||
|             'src/**/*Spec.js': ['webpack', 'sourcemap'] | ||||
|         }, | ||||
|         webpack: webpackConfig, | ||||
|         webpackMiddleware: { | ||||
|             stats: 'errors-only', | ||||
|             logLevel: 'warn' | ||||
|         }, | ||||
|         concurrency: 1, | ||||
|         singleRun: true, | ||||
|         browserNoActivityTimeout: 400000 | ||||
|         browserNoActivityTimeout: 90000 | ||||
|     }); | ||||
| }; | ||||
| } | ||||
|   | ||||
| @@ -32,6 +32,6 @@ if (document.currentScript) { | ||||
|  | ||||
| const MCT = require('./src/MCT'); | ||||
|  | ||||
| const openmct = new MCT(); | ||||
| var openmct = new MCT(); | ||||
|  | ||||
| module.exports = openmct; | ||||
|   | ||||
							
								
								
									
										30
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								package.json
									
									
									
									
									
								
							| @@ -1,12 +1,12 @@ | ||||
| { | ||||
|   "name": "openmct", | ||||
|   "version": "1.3.0", | ||||
|   "version": "1.0.0-snapshot", | ||||
|   "description": "The Open MCT core platform", | ||||
|   "dependencies": {}, | ||||
|   "devDependencies": { | ||||
|     "angular": ">=1.8.0", | ||||
|     "angular-route": "1.4.14", | ||||
|     "babel-eslint": "10.0.3", | ||||
|     "babel-eslint": "8.2.6", | ||||
|     "comma-separated-values": "^3.6.4", | ||||
|     "concurrently": "^3.6.1", | ||||
|     "copy-webpack-plugin": "^4.5.2", | ||||
| @@ -22,7 +22,7 @@ | ||||
|     "d3-selection": "1.3.x", | ||||
|     "d3-time": "1.0.x", | ||||
|     "d3-time-format": "2.1.x", | ||||
|     "eslint": "7.0.0", | ||||
|     "eslint": "5.2.0", | ||||
|     "eslint-plugin-vue": "^6.0.0", | ||||
|     "eslint-plugin-you-dont-need-lodash-underscore": "^6.10.0", | ||||
|     "eventemitter3": "^1.2.0", | ||||
| @@ -39,27 +39,27 @@ | ||||
|     "istanbul-instrumenter-loader": "^3.0.1", | ||||
|     "jasmine-core": "^3.1.0", | ||||
|     "jsdoc": "^3.3.2", | ||||
|     "karma": "5.1.1", | ||||
|     "karma-chrome-launcher": "3.1.0", | ||||
|     "karma-firefox-launcher": "1.3.0", | ||||
|     "karma-cli": "2.0.0", | ||||
|     "karma-coverage": "2.0.3", | ||||
|     "karma-coverage-istanbul-reporter": "3.0.3", | ||||
|     "karma-html-reporter": "0.2.7", | ||||
|     "karma-jasmine": "3.3.1", | ||||
|     "karma-sourcemap-loader": "0.3.7", | ||||
|     "karma-webpack": "4.0.2", | ||||
|     "karma": "^2.0.3", | ||||
|     "karma-chrome-launcher": "^2.2.0", | ||||
|     "karma-firefox-launcher": "^1.3.0", | ||||
|     "karma-cli": "^1.0.1", | ||||
|     "karma-coverage": "^1.1.2", | ||||
|     "karma-coverage-istanbul-reporter": "^2.1.1", | ||||
|     "karma-html-reporter": "^0.2.7", | ||||
|     "karma-jasmine": "^1.1.2", | ||||
|     "karma-sourcemap-loader": "^0.3.7", | ||||
|     "karma-webpack": "^3.0.0", | ||||
|     "location-bar": "^3.0.1", | ||||
|     "lodash": "^4.17.12", | ||||
|     "markdown-toc": "^0.11.7", | ||||
|     "marked": "^0.3.5", | ||||
|     "mini-css-extract-plugin": "^0.4.1", | ||||
|     "minimist": "^1.2.5", | ||||
|     "minimist": "^1.1.1", | ||||
|     "moment": "2.25.3", | ||||
|     "moment-duration-format": "^2.2.2", | ||||
|     "moment-timezone": "0.5.28", | ||||
|     "node-bourbon": "^4.2.3", | ||||
|     "node-sass": "^4.14.1", | ||||
|     "node-sass": "^4.9.2", | ||||
|     "painterro": "^1.0.35", | ||||
|     "printj": "^1.2.1", | ||||
|     "raw-loader": "^0.5.1", | ||||
|   | ||||
| @@ -47,7 +47,7 @@ define([ | ||||
| ) { | ||||
|  | ||||
|     return { | ||||
|         name: "platform/commonUI/about", | ||||
|         name:"platform/commonUI/about", | ||||
|         definition: { | ||||
|             "name": "About Open MCT", | ||||
|             "extensions": { | ||||
|   | ||||
| @@ -20,6 +20,7 @@ | ||||
|  * at runtime from the About dialog for additional information. | ||||
|  *****************************************************************************/ | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Implements Open MCT's About dialog. | ||||
|  * @namespace platform/commonUI/about | ||||
|   | ||||
| @@ -25,20 +25,14 @@ define( | ||||
|     function (AboutController) { | ||||
|  | ||||
|         describe("The About controller", function () { | ||||
|             let testVersions; | ||||
|             let mockWindow; | ||||
|             let controller; | ||||
|             var testVersions; | ||||
|             var mockWindow; | ||||
|             var controller; | ||||
|  | ||||
|             beforeEach(function () { | ||||
|                 testVersions = [ | ||||
|                     { | ||||
|                         name: "Some name", | ||||
|                         value: "1.2.3" | ||||
|                     }, | ||||
|                     { | ||||
|                         name: "Some other name", | ||||
|                         value: "3.2.1" | ||||
|                     } | ||||
|                     { name: "Some name", value: "1.2.3" }, | ||||
|                     { name: "Some other name", value: "3.2.1" } | ||||
|                 ]; | ||||
|                 mockWindow = jasmine.createSpyObj("$window", ["open"]); | ||||
|                 controller = new AboutController(testVersions, mockWindow); | ||||
| @@ -56,6 +50,8 @@ define( | ||||
|                 controller.openLicenses(); | ||||
|                 expect(mockWindow.open).toHaveBeenCalledWith("#/licenses"); | ||||
|             }); | ||||
|  | ||||
|  | ||||
|         }); | ||||
|  | ||||
|     } | ||||
|   | ||||
| @@ -25,8 +25,8 @@ define( | ||||
|     function (LicenseController) { | ||||
|  | ||||
|         describe("The License controller", function () { | ||||
|             var testLicenses, | ||||
|                 controller; | ||||
|             var testLicenses; | ||||
|             var controller; | ||||
|  | ||||
|             beforeEach(function () { | ||||
|                 testLicenses = [ | ||||
|   | ||||
| @@ -25,8 +25,8 @@ define( | ||||
|     function (LogoController) { | ||||
|  | ||||
|         describe("The About controller", function () { | ||||
|             var mockOverlayService, | ||||
|                 controller; | ||||
|             var mockOverlayService; | ||||
|             var controller; | ||||
|  | ||||
|             beforeEach(function () { | ||||
|                 mockOverlayService = jasmine.createSpyObj( | ||||
|   | ||||
| @@ -49,7 +49,7 @@ define([ | ||||
| ) { | ||||
|  | ||||
|     return { | ||||
|         name: "platform/commonUI/browse", | ||||
|         name:"platform/commonUI/browse", | ||||
|         definition: { | ||||
|             "extensions": { | ||||
|                 "routes": [ | ||||
|   | ||||
| @@ -46,7 +46,6 @@ define( | ||||
|         NavigateAction.prototype.perform = function () { | ||||
|             if (this.navigationService.shouldNavigate()) { | ||||
|                 this.navigationService.setNavigation(this.domainObject, true); | ||||
|  | ||||
|                 return Promise.resolve({}); | ||||
|             } | ||||
|  | ||||
|   | ||||
| @@ -69,10 +69,8 @@ define( | ||||
|         NavigationService.prototype.setNavigation = function (domainObject, force) { | ||||
|             if (force) { | ||||
|                 this.doNavigation(domainObject); | ||||
|  | ||||
|                 return true; | ||||
|             } | ||||
|  | ||||
|             if (this.navigated === domainObject) { | ||||
|                 return true; | ||||
|             } | ||||
| @@ -83,7 +81,6 @@ define( | ||||
|             } | ||||
|  | ||||
|             this.doNavigation(domainObject); | ||||
|  | ||||
|             return true; | ||||
|         }; | ||||
|  | ||||
| @@ -123,7 +120,6 @@ define( | ||||
|          */ | ||||
|         NavigationService.prototype.shouldNavigate = function () { | ||||
|             var doNotNavigate = this.shouldWarnBeforeNavigate(); | ||||
|  | ||||
|             return !doNotNavigate || this.$window.confirm(doNotNavigate); | ||||
|         }; | ||||
|  | ||||
| @@ -139,7 +135,6 @@ define( | ||||
|          */ | ||||
|         NavigationService.prototype.checkBeforeNavigation = function (checkFn) { | ||||
|             this.checks.push(checkFn); | ||||
|  | ||||
|             return function removeCheck() { | ||||
|                 this.checks = this.checks.filter(function (fn) { | ||||
|                     return checkFn !== fn; | ||||
| @@ -177,7 +172,6 @@ define( | ||||
|             if (reasons.length) { | ||||
|                 return reasons.join('\n'); | ||||
|             } | ||||
|  | ||||
|             return false; | ||||
|         }; | ||||
|  | ||||
| @@ -192,7 +186,6 @@ define( | ||||
|             if (shouldWarnBeforeNavigate) { | ||||
|                 return shouldWarnBeforeNavigate; | ||||
|             } | ||||
|  | ||||
|             if (this.oldUnload) { | ||||
|                 return this.oldUnload.apply(undefined, [].slice.apply(arguments)); | ||||
|             } | ||||
|   | ||||
| @@ -40,7 +40,6 @@ define([], function () { | ||||
|  | ||||
|         function getParent(domainObject) { | ||||
|             var context = domainObject.getCapability('context'); | ||||
|  | ||||
|             return context.getParent(); | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -30,9 +30,9 @@ define([ | ||||
| ) { | ||||
|  | ||||
|     describe("The navigate action", function () { | ||||
|         var mockNavigationService, | ||||
|             mockDomainObject, | ||||
|             action; | ||||
|         var mockNavigationService; | ||||
|         var mockDomainObject; | ||||
|         var action; | ||||
|  | ||||
|         beforeEach(function () { | ||||
|             mockNavigationService = jasmine.createSpyObj( | ||||
| @@ -53,7 +53,6 @@ define([ | ||||
|  | ||||
|         it("sets navigation if it is allowed", function () { | ||||
|             mockNavigationService.shouldNavigate.and.returnValue(true); | ||||
|  | ||||
|             return action.perform() | ||||
|                 .then(function () { | ||||
|                     expect(mockNavigationService.setNavigation) | ||||
| @@ -64,7 +63,6 @@ define([ | ||||
|         it("does not set navigation if it is not allowed", function () { | ||||
|             mockNavigationService.shouldNavigate.and.returnValue(false); | ||||
|             var onSuccess = jasmine.createSpy('onSuccess'); | ||||
|  | ||||
|             return action.perform() | ||||
|                 .then(onSuccess, function () { | ||||
|                     expect(onSuccess).not.toHaveBeenCalled(); | ||||
|   | ||||
| @@ -28,8 +28,8 @@ define( | ||||
|     function (NavigationService) { | ||||
|  | ||||
|         describe("The navigation service", function () { | ||||
|             var $window, | ||||
|                 navigationService; | ||||
|             let $window; | ||||
|             let navigationService; | ||||
|  | ||||
|             beforeEach(function () { | ||||
|                 $window = jasmine.createSpyObj('$window', ['confirm']); | ||||
| @@ -37,8 +37,8 @@ define( | ||||
|             }); | ||||
|  | ||||
|             it("stores navigation state", function () { | ||||
|                 var testObject = { someKey: 42 }, | ||||
|                     otherObject = { someKey: "some value" }; | ||||
|                 var testObject = { someKey: 42 }; | ||||
|                 var otherObject = { someKey: "some value" }; | ||||
|                 expect(navigationService.getNavigation()) | ||||
|                     .toBeUndefined(); | ||||
|                 navigationService.setNavigation(testObject); | ||||
| @@ -52,8 +52,8 @@ define( | ||||
|             }); | ||||
|  | ||||
|             it("notifies listeners on change", function () { | ||||
|                 var testObject = { someKey: 42 }, | ||||
|                     callback = jasmine.createSpy("callback"); | ||||
|                 var testObject = { someKey: 42 }; | ||||
|                 var callback = jasmine.createSpy("callback"); | ||||
|  | ||||
|                 navigationService.addListener(callback); | ||||
|                 expect(callback).not.toHaveBeenCalled(); | ||||
| @@ -63,8 +63,8 @@ define( | ||||
|             }); | ||||
|  | ||||
|             it("does not notify listeners when no changes occur", function () { | ||||
|                 var testObject = { someKey: 42 }, | ||||
|                     callback = jasmine.createSpy("callback"); | ||||
|                 var testObject = { someKey: 42 }; | ||||
|                 var callback = jasmine.createSpy("callback"); | ||||
|  | ||||
|                 navigationService.addListener(callback); | ||||
|                 navigationService.setNavigation(testObject); | ||||
| @@ -73,12 +73,13 @@ define( | ||||
|             }); | ||||
|  | ||||
|             it("stops notifying listeners after removal", function () { | ||||
|                 var testObject = { someKey: 42 }, | ||||
|                     callback = jasmine.createSpy("callback"); | ||||
|                 var testObject = { someKey: 42 }; | ||||
|                 var callback = jasmine.createSpy("callback"); | ||||
|  | ||||
|                 navigationService.addListener(callback); | ||||
|                 navigationService.removeListener(callback); | ||||
|  | ||||
|  | ||||
|                 navigationService.setNavigation(testObject); | ||||
|                 expect(callback).not.toHaveBeenCalled(); | ||||
|             }); | ||||
|   | ||||
| @@ -24,18 +24,18 @@ define([ | ||||
|     '../../src/navigation/OrphanNavigationHandler' | ||||
| ], function (OrphanNavigationHandler) { | ||||
|     describe("OrphanNavigationHandler", function () { | ||||
|         var mockTopic, | ||||
|             mockThrottle, | ||||
|             mockMutationTopic, | ||||
|             mockNavigationService, | ||||
|             mockDomainObject, | ||||
|             mockParentObject, | ||||
|             mockContext, | ||||
|             mockActionCapability, | ||||
|             mockEditor, | ||||
|             testParentComposition, | ||||
|             testId, | ||||
|             mockThrottledFns; | ||||
|         var mockTopic; | ||||
|         var mockThrottle; | ||||
|         var mockMutationTopic; | ||||
|         var mockNavigationService; | ||||
|         var mockDomainObject; | ||||
|         var mockParentObject; | ||||
|         var mockContext; | ||||
|         var mockActionCapability; | ||||
|         var mockEditor; | ||||
|         var testParentComposition; | ||||
|         var testId; | ||||
|         var mockThrottledFns; | ||||
|  | ||||
|         beforeEach(function () { | ||||
|             testId = 'some-identifier'; | ||||
| @@ -70,7 +70,6 @@ define([ | ||||
|                     jasmine.createSpy('throttled-' + mockThrottledFns.length); | ||||
|                 mockThrottledFn.and.callFake(fn); | ||||
|                 mockThrottledFns.push(mockThrottledFn); | ||||
|  | ||||
|                 return mockThrottledFn; | ||||
|             }); | ||||
|             mockTopic.and.returnValue(mockMutationTopic); | ||||
| @@ -82,7 +81,7 @@ define([ | ||||
|                 }[c]; | ||||
|             }); | ||||
|             mockDomainObject.hasCapability.and.callFake(function (c) { | ||||
|                 return Boolean(mockDomainObject.getCapability(c)); | ||||
|                 return !!mockDomainObject.getCapability(c); | ||||
|             }); | ||||
|             mockParentObject.getCapability.and.callFake(function (c) { | ||||
|                 return { | ||||
| @@ -103,6 +102,7 @@ define([ | ||||
|             ); | ||||
|         }); | ||||
|  | ||||
|  | ||||
|         it("listens for mutation with a throttled function", function () { | ||||
|             expect(mockMutationTopic.listen) | ||||
|                 .toHaveBeenCalledWith(jasmine.any(Function)); | ||||
| @@ -129,8 +129,8 @@ define([ | ||||
|                 }); | ||||
|  | ||||
|                 [false, true].forEach(function (isEditRoot) { | ||||
|                     var caseName = isEditRoot | ||||
|                         ? "that are being edited" : "that are not being edited"; | ||||
|                     var caseName = isEditRoot ? | ||||
|                         "that are being edited" : "that are not being edited"; | ||||
|  | ||||
|                     function itNavigatesAsExpected() { | ||||
|                         if (isOrphan && !isEditRoot) { | ||||
|   | ||||
| @@ -25,12 +25,12 @@ define( | ||||
|     function (NewTabAction) { | ||||
|  | ||||
|         describe("The new tab action", function () { | ||||
|             var actionSelected, | ||||
|                 actionCurrent, | ||||
|                 mockWindow, | ||||
|                 mockContextCurrent, | ||||
|                 mockContextSelected, | ||||
|                 mockUrlService; | ||||
|             var actionSelected; | ||||
|             var actionCurrent; | ||||
|             var mockWindow; | ||||
|             var mockContextCurrent; | ||||
|             var mockContextSelected; | ||||
|             var mockUrlService; | ||||
|  | ||||
|             beforeEach(function () { | ||||
|                 mockWindow = jasmine.createSpyObj("$window", ["open", "location"]); | ||||
|   | ||||
| @@ -45,7 +45,7 @@ define([ | ||||
| ) { | ||||
|  | ||||
|     return { | ||||
|         name: "platform/commonUI/dialog", | ||||
|         name:"platform/commonUI/dialog", | ||||
|         definition: { | ||||
|             "extensions": { | ||||
|                 "services": [ | ||||
|   | ||||
| @@ -62,10 +62,10 @@ define( | ||||
|         DialogService.prototype.getDialogResponse = function (key, model, resultGetter, typeClass) { | ||||
|             // We will return this result as a promise, because user | ||||
|             // input is asynchronous. | ||||
|             var deferred = this.$q.defer(), | ||||
|                 self = this, | ||||
|                 overlay, | ||||
|                 handleEscKeydown; | ||||
|             var deferred = this.$q.defer(); | ||||
|             var self = this; | ||||
|             var overlay; | ||||
|             var handleEscKeydown; | ||||
|  | ||||
|             // Confirm function; this will be passed in to the | ||||
|             // overlay-dialog template and associated with a | ||||
| @@ -247,12 +247,12 @@ define( | ||||
|             if (this.canShowDialog(dialogModel)) { | ||||
|                 // Add the overlay using the OverlayService, which | ||||
|                 // will handle actual insertion into the DOM | ||||
|                 var self = this, | ||||
|                     overlay = this.overlayService.createOverlay( | ||||
|                         "overlay-blocking-message", | ||||
|                         dialogModel, | ||||
|                         "t-dialog-sm" | ||||
|                     ); | ||||
|                 var self = this; | ||||
|                 var overlay = this.overlayService.createOverlay( | ||||
|                     "overlay-blocking-message", | ||||
|                     dialogModel, | ||||
|                     "t-dialog-sm" | ||||
|                 ); | ||||
|  | ||||
|                 this.activeOverlay = overlay; | ||||
|  | ||||
|   | ||||
| @@ -28,6 +28,7 @@ define( | ||||
|         // the a specific template that can be included via mct-include | ||||
|         var TEMPLATE = '<mct-include ng-model="overlay" key="key" ng-class="typeClass"></mct-include>'; | ||||
|  | ||||
|  | ||||
|         /** | ||||
|          * The OverlayService is responsible for pre-pending templates to | ||||
|          * the body of the document, which is useful for displaying templates | ||||
| @@ -52,7 +53,6 @@ define( | ||||
|             this.findBody = function () { | ||||
|                 return $document.find('body'); | ||||
|             }; | ||||
|  | ||||
|             this.newScope = function () { | ||||
|                 return $rootScope.$new(); | ||||
|             }; | ||||
| @@ -76,8 +76,8 @@ define( | ||||
|          */ | ||||
|         OverlayService.prototype.createOverlay = function (key, overlayModel, typeClass) { | ||||
|             // Create a new scope for this overlay | ||||
|             var scope = this.newScope(), | ||||
|                 element; | ||||
|             var scope = this.newScope(); | ||||
|             var element; | ||||
|  | ||||
|             // Stop showing the overlay; additionally, release the scope | ||||
|             // that it uses. | ||||
|   | ||||
| @@ -28,14 +28,14 @@ define( | ||||
|     function (DialogService) { | ||||
|  | ||||
|         describe("The dialog service", function () { | ||||
|             var mockOverlayService, | ||||
|                 mockQ, | ||||
|                 mockLog, | ||||
|                 mockOverlay, | ||||
|                 mockDeferred, | ||||
|                 mockDocument, | ||||
|                 mockBody, | ||||
|                 dialogService; | ||||
|             var mockOverlayService; | ||||
|             var mockQ; | ||||
|             var mockLog; | ||||
|             var mockOverlay; | ||||
|             var mockDeferred; | ||||
|             var mockDocument; | ||||
|             var mockBody; | ||||
|             var dialogService; | ||||
|  | ||||
|             beforeEach(function () { | ||||
|                 mockOverlayService = jasmine.createSpyObj( | ||||
| @@ -129,8 +129,8 @@ define( | ||||
|                 ); | ||||
|             }); | ||||
|  | ||||
|             it("invokes the overlay service with the correct parameters when" | ||||
|                 + " a blocking dialog is requested", function () { | ||||
|             it("invokes the overlay service with the correct parameters when" + | ||||
|                 " a blocking dialog is requested", function () { | ||||
|                 var dialogModel = {}; | ||||
|                 expect(dialogService.showBlockingMessage(dialogModel)).not.toBe(false); | ||||
|                 expect(mockOverlayService.createOverlay).toHaveBeenCalledWith( | ||||
| @@ -188,8 +188,8 @@ define( | ||||
|                 }); | ||||
|  | ||||
|                 it("individual dialogs can be dismissed", function () { | ||||
|                     var secondDialogHandle, | ||||
|                         secondMockOverlay; | ||||
|                     var secondDialogHandle; | ||||
|                     var secondMockOverlay; | ||||
|  | ||||
|                     dialogHandle.dismiss(); | ||||
|  | ||||
|   | ||||
| @@ -28,15 +28,15 @@ define( | ||||
|     function (OverlayService) { | ||||
|  | ||||
|         describe("The overlay service", function () { | ||||
|             var mockDocument, | ||||
|                 mockCompile, | ||||
|                 mockRootScope, | ||||
|                 mockBody, | ||||
|                 mockTemplate, | ||||
|                 mockElement, | ||||
|                 mockScope, | ||||
|                 mockTimeout, | ||||
|                 overlayService; | ||||
|             var mockDocument; | ||||
|             var mockCompile; | ||||
|             var mockRootScope; | ||||
|             var mockBody; | ||||
|             var mockTemplate; | ||||
|             var mockElement; | ||||
|             var mockScope; | ||||
|             var mockTimeout; | ||||
|             var overlayService; | ||||
|  | ||||
|             beforeEach(function () { | ||||
|                 mockDocument = jasmine.createSpyObj("$document", ["find"]); | ||||
| @@ -48,7 +48,7 @@ define( | ||||
|                 mockScope = jasmine.createSpyObj("scope", ["$destroy"]); | ||||
|                 mockTimeout = function (callback) { | ||||
|                     callback(); | ||||
|                 }; | ||||
|                 } | ||||
|  | ||||
|                 mockDocument.find.and.returnValue(mockBody); | ||||
|                 mockCompile.and.returnValue(mockTemplate); | ||||
|   | ||||
| @@ -56,7 +56,6 @@ define( | ||||
|                     //navigate back to parent because nothing to show. | ||||
|                     return domainObject.getCapability("location").getOriginal().then(function (original) { | ||||
|                         parent = original.getCapability("context").getParent(); | ||||
|  | ||||
|                         return parent.getCapability("action").perform("navigate"); | ||||
|                     }); | ||||
|                 } | ||||
| @@ -79,10 +78,9 @@ define( | ||||
|          */ | ||||
|         CancelAction.appliesTo = function (context) { | ||||
|             var domainObject = (context || {}).domainObject; | ||||
|  | ||||
|             return domainObject !== undefined | ||||
|                 && domainObject.hasCapability('editor') | ||||
|                 && domainObject.getCapability('editor').isEditContextRoot(); | ||||
|             return domainObject !== undefined && | ||||
|                 domainObject.hasCapability('editor') && | ||||
|                 domainObject.getCapability('editor').isEditContextRoot(); | ||||
|         }; | ||||
|  | ||||
|         return CancelAction; | ||||
|   | ||||
| @@ -86,14 +86,14 @@ define( | ||||
|          *        will be performed; should contain a `domainObject` property | ||||
|          */ | ||||
|         EditAction.appliesTo = function (context) { | ||||
|             var domainObject = (context || {}).domainObject, | ||||
|                 type = domainObject && domainObject.getCapability('type'); | ||||
|             var domainObject = (context || {}).domainObject; | ||||
|             var type = domainObject && domainObject.getCapability('type'); | ||||
|  | ||||
|             // 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 type && type.hasFeature('creation') && | ||||
|                 domainObject.hasCapability('editor') && | ||||
|                 !domainObject.getCapability('editor').isEditContextRoot(); | ||||
|         }; | ||||
|  | ||||
|         return EditAction; | ||||
|   | ||||
| @@ -24,6 +24,7 @@ define( | ||||
|     [], | ||||
|     function () { | ||||
|  | ||||
|  | ||||
|         /** | ||||
|          * Add one domain object to another's composition. | ||||
|          * @constructor | ||||
| @@ -36,14 +37,13 @@ define( | ||||
|         } | ||||
|  | ||||
|         EditAndComposeAction.prototype.perform = function () { | ||||
|             var self = this, | ||||
|                 editAction = this.domainObject.getCapability('action').getActions("edit")[0]; | ||||
|             var self = this; | ||||
|             var editAction = this.domainObject.getCapability('action').getActions("edit")[0]; | ||||
|  | ||||
|             // Link these objects | ||||
|             function doLink() { | ||||
|                 var composition = self.domainObject | ||||
|                         && self.domainObject.getCapability('composition'); | ||||
|  | ||||
|                 var composition = self.domainObject && | ||||
|                         self.domainObject.getCapability('composition'); | ||||
|                 return composition && composition.add(self.selectedObject); | ||||
|             } | ||||
|  | ||||
|   | ||||
| @@ -46,9 +46,9 @@ define( | ||||
|         } | ||||
|  | ||||
|         PropertiesAction.prototype.perform = function () { | ||||
|             var type = this.domainObject.getCapability('type'), | ||||
|                 domainObject = this.domainObject, | ||||
|                 dialogService = this.dialogService; | ||||
|             var type = this.domainObject.getCapability('type'); | ||||
|             var domainObject = this.domainObject; | ||||
|             var dialogService = this.dialogService; | ||||
|  | ||||
|             // Update the domain object model based on user input | ||||
|             function updateModel(userInput, dialog) { | ||||
| @@ -82,9 +82,9 @@ define( | ||||
|          */ | ||||
|         PropertiesAction.appliesTo = function (context) { | ||||
|  | ||||
|             var domainObject = (context || {}).domainObject, | ||||
|                 type = domainObject && domainObject.getCapability('type'), | ||||
|                 creatable = type && type.hasFeature('creation'); | ||||
|             var domainObject = (context || {}).domainObject; | ||||
|             var type = domainObject && domainObject.getCapability('type'); | ||||
|             var creatable = type && type.hasFeature('creation'); | ||||
|  | ||||
|             if (domainObject && domainObject.model && domainObject.model.locked) { | ||||
|                 return false; | ||||
| @@ -99,3 +99,4 @@ define( | ||||
|  | ||||
| ); | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -51,7 +51,6 @@ define( | ||||
|                         // Property definition is same as form row definition | ||||
|                         var row = JSON.parse(JSON.stringify(property.getDefinition())); | ||||
|                         row.key = index; | ||||
|  | ||||
|                         return row; | ||||
|                     }).filter(function (row) { | ||||
|                         // Only show properties which are editable | ||||
|   | ||||
| @@ -49,9 +49,9 @@ define( | ||||
|          * @memberof platform/commonUI/edit.SaveAction# | ||||
|          */ | ||||
|         SaveAction.prototype.perform = function () { | ||||
|             var self = this, | ||||
|                 domainObject = this.domainObject, | ||||
|                 dialog = new SaveInProgressDialog(this.dialogService); | ||||
|             var self = this; | ||||
|             var domainObject = this.domainObject; | ||||
|             var dialog = new SaveInProgressDialog(this.dialogService); | ||||
|  | ||||
|             // Invoke any save behavior introduced by the editor capability; | ||||
|             // this is introduced by EditableDomainObject which is | ||||
| @@ -86,11 +86,10 @@ define( | ||||
|          */ | ||||
|         SaveAction.appliesTo = function (context) { | ||||
|             var domainObject = (context || {}).domainObject; | ||||
|  | ||||
|             return domainObject !== undefined | ||||
|                 && domainObject.hasCapability('editor') | ||||
|                 && domainObject.getCapability('editor').isEditContextRoot() | ||||
|                 && domainObject.getModel().persisted !== undefined; | ||||
|             return domainObject !== undefined && | ||||
|                 domainObject.hasCapability('editor') && | ||||
|                 domainObject.getCapability('editor').isEditContextRoot() && | ||||
|                 domainObject.getModel().persisted !== undefined; | ||||
|         }; | ||||
|  | ||||
|         return SaveAction; | ||||
|   | ||||
| @@ -50,8 +50,8 @@ define( | ||||
|          * @memberof platform/commonUI/edit.SaveAndStopEditingAction# | ||||
|          */ | ||||
|         SaveAndStopEditingAction.prototype.perform = function () { | ||||
|             var domainObject = this.domainObject, | ||||
|                 saveAction = new SaveAction(this.dialogService, this.notificationService, this.context); | ||||
|             var domainObject = this.domainObject; | ||||
|             var saveAction = new SaveAction(this.dialogService, this.notificationService, this.context); | ||||
|  | ||||
|             function closeEditor() { | ||||
|                 return domainObject.getCapability("editor").finish(); | ||||
|   | ||||
| @@ -20,6 +20,7 @@ | ||||
|  * at runtime from the About dialog for additional information. | ||||
|  *****************************************************************************/ | ||||
|  | ||||
|  | ||||
| define([ | ||||
|     '../creation/CreateWizard', | ||||
|     './SaveInProgressDialog' | ||||
| @@ -49,7 +50,6 @@ function ( | ||||
|         this.injectObjectService = function () { | ||||
|             this.objectService = $injector.get("objectService"); | ||||
|         }; | ||||
|  | ||||
|         this.dialogService = dialogService; | ||||
|         this.copyService = copyService; | ||||
|         this.notificationService = notificationService; | ||||
| @@ -75,10 +75,15 @@ function ( | ||||
|         if (!this.objectService) { | ||||
|             this.injectObjectService(); | ||||
|         } | ||||
|  | ||||
|         return this.objectService; | ||||
|     }; | ||||
|  | ||||
|     function resolveWith(object) { | ||||
|         return function () { | ||||
|             return object; | ||||
|         }; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|          * Save changes and conclude editing. | ||||
|          * | ||||
| @@ -94,10 +99,11 @@ function ( | ||||
|          * @private | ||||
|          */ | ||||
|     SaveAsAction.prototype.save = function () { | ||||
|         var self = this, | ||||
|             domainObject = this.domainObject, | ||||
|             dialog = new SaveInProgressDialog(this.dialogService), | ||||
|             toUndirty = []; | ||||
|         var self = this; | ||||
|         var domainObject = this.domainObject; | ||||
|         var copyService = this.copyService; | ||||
|         var dialog = new SaveInProgressDialog(this.dialogService); | ||||
|         var toUndirty = []; | ||||
|  | ||||
|         function doWizardSave(parent) { | ||||
|             var wizard = self.createWizard(parent); | ||||
| @@ -112,13 +118,11 @@ function ( | ||||
|  | ||||
|         function showBlockingDialog(object) { | ||||
|             dialog.show(); | ||||
|  | ||||
|             return object; | ||||
|         } | ||||
|  | ||||
|         function hideBlockingDialog(object) { | ||||
|             dialog.hide(); | ||||
|  | ||||
|             return object; | ||||
|         } | ||||
|  | ||||
| @@ -132,22 +136,18 @@ function ( | ||||
|             return fetchObject(object.getModel().location); | ||||
|         } | ||||
|  | ||||
|         function saveObject(parent) { | ||||
|             return self.openmct.editor.save().then(() => { | ||||
|                 // Force mutation for search indexing | ||||
|                 return parent; | ||||
|             }); | ||||
|         function allowClone(objectToClone) { | ||||
|             var allowed = | ||||
|                     (objectToClone.getId() === domainObject.getId()) || | ||||
|                         objectToClone.getCapability('location').isOriginal(); | ||||
|             if (allowed) { | ||||
|                 toUndirty.push(objectToClone); | ||||
|             } | ||||
|             return allowed; | ||||
|         } | ||||
|  | ||||
|         function addSavedObjectToParent(parent) { | ||||
|             return parent.getCapability("composition") | ||||
|                 .add(domainObject) | ||||
|                 .then(function (addedObject) { | ||||
|                     return parent.getCapability("persistence").persist() | ||||
|                         .then(function () { | ||||
|                             return addedObject; | ||||
|                         }); | ||||
|                 }); | ||||
|         function cloneIntoParent(parent) { | ||||
|             return copyService.perform(domainObject, parent, allowClone); | ||||
|         } | ||||
|  | ||||
|         function undirty(object) { | ||||
| @@ -156,22 +156,30 @@ function ( | ||||
|  | ||||
|         function undirtyOriginals(object) { | ||||
|             return Promise.all(toUndirty.map(undirty)) | ||||
|                 .then(() => { | ||||
|                     return object; | ||||
|                 }); | ||||
|                 .then(resolveWith(object)); | ||||
|         } | ||||
|  | ||||
|         function indexForSearch(addedObject) { | ||||
|             addedObject.useCapability('mutation', (model) => { | ||||
|         function saveAfterClone(clonedObject) { | ||||
|             return this.openmct.editor.save().then(() => { | ||||
|                 // Force mutation for search indexing | ||||
|                 return clonedObject; | ||||
|             }) | ||||
|         } | ||||
|  | ||||
|         function finishEditing(clonedObject) { | ||||
|             return fetchObject(clonedObject.getId()) | ||||
|         } | ||||
|  | ||||
|         function indexForSearch(savedObject) { | ||||
|             savedObject.useCapability('mutation', (model) => { | ||||
|                 return model; | ||||
|             }); | ||||
|  | ||||
|             return addedObject; | ||||
|             return savedObject; | ||||
|         } | ||||
|  | ||||
|         function onSuccess(object) { | ||||
|             self.notificationService.info("Save Succeeded"); | ||||
|  | ||||
|             return object; | ||||
|         } | ||||
|  | ||||
| @@ -180,7 +188,6 @@ function ( | ||||
|             if (reason !== "user canceled") { | ||||
|                 self.notificationService.error("Save Failed"); | ||||
|             } | ||||
|  | ||||
|             throw reason; | ||||
|         } | ||||
|  | ||||
| @@ -188,18 +195,17 @@ function ( | ||||
|             .then(doWizardSave) | ||||
|             .then(showBlockingDialog) | ||||
|             .then(getParent) | ||||
|             .then(saveObject) | ||||
|             .then(addSavedObjectToParent) | ||||
|             .then(cloneIntoParent) | ||||
|             .then(undirtyOriginals) | ||||
|             .then((addedObject) => { | ||||
|                 return fetchObject(addedObject.getId()); | ||||
|             }) | ||||
|             .then(saveAfterClone) | ||||
|             .then(finishEditing) | ||||
|             .then(indexForSearch) | ||||
|             .then(hideBlockingDialog) | ||||
|             .then(onSuccess) | ||||
|             .catch(onFailure); | ||||
|     }; | ||||
|  | ||||
|  | ||||
|     /** | ||||
|          * Check if this action is applicable in a given context. | ||||
|          * This will ensure that a domain object is present in the context, | ||||
| @@ -208,11 +214,10 @@ function ( | ||||
|          */ | ||||
|     SaveAsAction.appliesTo = function (context) { | ||||
|         var domainObject = (context || {}).domainObject; | ||||
|  | ||||
|         return domainObject !== undefined | ||||
|                 && domainObject.hasCapability('editor') | ||||
|                 && domainObject.getCapability('editor').isEditContextRoot() | ||||
|                 && domainObject.getModel().persisted === undefined; | ||||
|         return domainObject !== undefined && | ||||
|                 domainObject.hasCapability('editor') && | ||||
|                 domainObject.getCapability('editor').isEditContextRoot() && | ||||
|                 domainObject.getModel().persisted === undefined; | ||||
|     }; | ||||
|  | ||||
|     return SaveAsAction; | ||||
|   | ||||
| @@ -83,7 +83,6 @@ define( | ||||
|          */ | ||||
|         EditorCapability.prototype.save = function () { | ||||
|             console.warn('DEPRECATED: cannot save via edit capability, use openmct.editor instead.'); | ||||
|  | ||||
|             return Promise.resolve(); | ||||
|         }; | ||||
|  | ||||
| @@ -96,7 +95,6 @@ define( | ||||
|          */ | ||||
|         EditorCapability.prototype.finish = function () { | ||||
|             console.warn('DEPRECATED: cannot finish via edit capability, use openmct.editor instead.'); | ||||
|  | ||||
|             return Promise.resolve(); | ||||
|         }; | ||||
|  | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define( | ||||
|     ['./TransactionalPersistenceCapability'], | ||||
| @@ -48,17 +49,16 @@ define( | ||||
|          * transaction is in progress. | ||||
|          */ | ||||
|         TransactionCapabilityDecorator.prototype.getCapabilities = function () { | ||||
|             var self = this, | ||||
|                 capabilities = this.capabilityService.getCapabilities | ||||
|                     .apply(this.capabilityService, arguments), | ||||
|                 persistenceCapability = capabilities.persistence; | ||||
|             var self = this; | ||||
|             var capabilities = this.capabilityService.getCapabilities | ||||
|                 .apply(this.capabilityService, arguments); | ||||
|             var persistenceCapability = capabilities.persistence; | ||||
|  | ||||
|             capabilities.persistence = function (domainObject) { | ||||
|                 var original = | ||||
|                     (typeof persistenceCapability === 'function') | ||||
|                         ? persistenceCapability(domainObject) | ||||
|                         : persistenceCapability; | ||||
|  | ||||
|                     (typeof persistenceCapability === 'function') ? | ||||
|                         persistenceCapability(domainObject) : | ||||
|                         persistenceCapability; | ||||
|                 return new TransactionalPersistenceCapability( | ||||
|                     self.$q, | ||||
|                     self.transactionService, | ||||
| @@ -66,7 +66,6 @@ define( | ||||
|                     domainObject | ||||
|                 ); | ||||
|             }; | ||||
|  | ||||
|             return capabilities; | ||||
|         }; | ||||
|  | ||||
|   | ||||
| @@ -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*/ | ||||
|  | ||||
| define( | ||||
|     [], | ||||
| @@ -63,7 +64,6 @@ define( | ||||
|                     wrappedPersistence.persist.bind(wrappedPersistence), | ||||
|                     wrappedPersistence.refresh.bind(wrappedPersistence) | ||||
|                 ); | ||||
|  | ||||
|                 //Need to return a promise from this function | ||||
|                 return this.$q.when(true); | ||||
|             } else { | ||||
| @@ -74,7 +74,6 @@ define( | ||||
|         TransactionalPersistenceCapability.prototype.refresh = function () { | ||||
|             this.transactionManager | ||||
|                 .clearTransactionsFor(this.domainObject.getId()); | ||||
|  | ||||
|             return this.persistenceCapability.refresh(); | ||||
|         }; | ||||
|  | ||||
|   | ||||
| @@ -48,9 +48,9 @@ define( | ||||
|             // Maintain all "conclude-editing" and "save" actions in the | ||||
|             // present context. | ||||
|             function updateActions() { | ||||
|                 $scope.saveActions = $scope.action | ||||
|                     ? $scope.action.getActions(SAVE_ACTION_CONTEXT) | ||||
|                     : []; | ||||
|                 $scope.saveActions = $scope.action ? | ||||
|                     $scope.action.getActions(SAVE_ACTION_CONTEXT) : | ||||
|                     []; | ||||
|  | ||||
|                 $scope.saveActionsAsMenuOptions = $scope.saveActions.map(actionToMenuOption); | ||||
|  | ||||
| @@ -58,9 +58,9 @@ define( | ||||
|                     clickedAction.perform(); | ||||
|                 }; | ||||
|  | ||||
|                 $scope.otherEditActions = $scope.action | ||||
|                     ? $scope.action.getActions(OTHERS_ACTION_CONTEXT) | ||||
|                     : []; | ||||
|                 $scope.otherEditActions = $scope.action ? | ||||
|                     $scope.action.getActions(OTHERS_ACTION_CONTEXT) : | ||||
|                     []; | ||||
|  | ||||
|                 // Required because Angular does not allow 'bind' | ||||
|                 // in expressions. | ||||
|   | ||||
| @@ -29,12 +29,12 @@ define( | ||||
|     function () { | ||||
|  | ||||
|         function cancelEditing(domainObject) { | ||||
|             var navigatedObject = domainObject, | ||||
|                 editorCapability = navigatedObject | ||||
|                     && navigatedObject.getCapability("editor"); | ||||
|             var navigatedObject = domainObject; | ||||
|             var editorCapability = navigatedObject && | ||||
|                     navigatedObject.getCapability("editor"); | ||||
|  | ||||
|             return editorCapability | ||||
|                 && editorCapability.finish(); | ||||
|             return editorCapability && | ||||
|                 editorCapability.finish(); | ||||
|         } | ||||
|  | ||||
|         /** | ||||
|   | ||||
| @@ -34,12 +34,12 @@ define( | ||||
|  | ||||
|             // Update root object based on represented object | ||||
|             function updateRoot(domainObject) { | ||||
|                 var root = self.rootDomainObject, | ||||
|                     context = domainObject | ||||
|                         && domainObject.getCapability('context'), | ||||
|                     newRoot = context && context.getTrueRoot(), | ||||
|                     oldId = root && root.getId(), | ||||
|                     newId = newRoot && newRoot.getId(); | ||||
|                 var root = self.rootDomainObject; | ||||
|                 var context = domainObject && | ||||
|                         domainObject.getCapability('context'); | ||||
|                 var newRoot = context && context.getTrueRoot(); | ||||
|                 var oldId = root && root.getId(); | ||||
|                 var newId = newRoot && newRoot.getId(); | ||||
|  | ||||
|                 // Only update if this has actually changed, | ||||
|                 // to avoid excessive refreshing. | ||||
| @@ -51,7 +51,6 @@ define( | ||||
|             // Update root when represented object changes | ||||
|             $scope.$watch('domainObject', updateRoot); | ||||
|         } | ||||
|  | ||||
|         /** | ||||
|          * Get the root-level domain object, as reported by the | ||||
|          * represented domain object. | ||||
|   | ||||
| @@ -63,9 +63,9 @@ define( | ||||
|          * This will prompt for user input first. | ||||
|          */ | ||||
|         CreateAction.prototype.perform = function () { | ||||
|             var newModel = this.type.getInitialModel(), | ||||
|                 openmct = this.openmct, | ||||
|                 newObject; | ||||
|             var newModel = this.type.getInitialModel(); | ||||
|             var openmct = this.openmct; | ||||
|             var newObject; | ||||
|  | ||||
|             function onCancel() { | ||||
|                 openmct.editor.cancel(); | ||||
| @@ -78,13 +78,13 @@ define( | ||||
|             } | ||||
|  | ||||
|             function navigateAndEdit(object) { | ||||
|                 let objectPath = object.getCapability('context').getPath(), | ||||
|                     url = '#/browse/' + objectPath | ||||
|                         .slice(1) | ||||
|                         .map(function (o) { | ||||
|                             return o && openmct.objects.makeKeyString(o.getId()); | ||||
|                         }) | ||||
|                         .join('/'); | ||||
|                 let objectPath = object.getCapability('context').getPath(); | ||||
|                 let url = '#/browse/' + objectPath | ||||
|                     .slice(1) | ||||
|                     .map(function (o) { | ||||
|                         return o && openmct.objects.makeKeyString(o.getId()); | ||||
|                     }) | ||||
|                     .join('/'); | ||||
|  | ||||
|                 window.location.href = url; | ||||
|  | ||||
| @@ -104,6 +104,7 @@ define( | ||||
|             // We will disable this. | ||||
|         }; | ||||
|  | ||||
|  | ||||
|         /** | ||||
|          * Metadata associated with a Create action. | ||||
|          * @typedef {ActionMetadata} CreateActionMetadata | ||||
|   | ||||
| @@ -50,10 +50,10 @@ define( | ||||
|         } | ||||
|  | ||||
|         CreateActionProvider.prototype.getActions = function (actionContext) { | ||||
|             var context = actionContext || {}, | ||||
|                 key = context.key, | ||||
|                 destination = context.domainObject, | ||||
|                 self = this; | ||||
|             var context = actionContext || {}; | ||||
|             var key = context.key; | ||||
|             var destination = context.domainObject; | ||||
|             var self = this; | ||||
|  | ||||
|             // We only provide Create actions, and we need a | ||||
|             // domain object to serve as the container for the | ||||
|   | ||||
| @@ -38,9 +38,9 @@ define( | ||||
|         function CreateMenuController($scope) { | ||||
|             // Update the set of Create actions | ||||
|             function refreshActions() { | ||||
|                 $scope.createActions = $scope.action | ||||
|                     ? $scope.action.getActions('create') | ||||
|                     : []; | ||||
|                 $scope.createActions = $scope.action ? | ||||
|                     $scope.action.getActions('create') : | ||||
|                     []; | ||||
|             } | ||||
|  | ||||
|             // Listen for new instances of the represented object's | ||||
|   | ||||
| @@ -55,12 +55,11 @@ define( | ||||
|          *         show in the create dialog | ||||
|          */ | ||||
|         CreateWizard.prototype.getFormStructure = function (includeLocation) { | ||||
|             var sections = [], | ||||
|                 domainObject = this.domainObject, | ||||
|                 self = this; | ||||
|             var sections = []; | ||||
|             var domainObject = this.domainObject; | ||||
|  | ||||
|             function validateLocation(parent) { | ||||
|                 return parent && self.openmct.composition.checkPolicy(parent.useCapability('adapter'), domainObject.useCapability('adapter')); | ||||
|                 return parent && this.openmct.composition.checkPolicy(parent.useCapability('adapter'), domainObject.useCapability('adapter')); | ||||
|             } | ||||
|  | ||||
|             sections.push({ | ||||
| @@ -108,14 +107,13 @@ define( | ||||
|          * @returns {DomainObject} | ||||
|          */ | ||||
|         CreateWizard.prototype.populateObjectFromInput = function (formValue) { | ||||
|             var parent = this.getLocation(formValue), | ||||
|                 formModel = this.createModel(formValue); | ||||
|             var parent = this.getLocation(formValue); | ||||
|             var formModel = this.createModel(formValue); | ||||
|  | ||||
|             formModel.location = parent.getId(); | ||||
|             this.domainObject.useCapability("mutation", function () { | ||||
|                 return formModel; | ||||
|             }); | ||||
|  | ||||
|             return this.domainObject; | ||||
|         }; | ||||
|  | ||||
| @@ -128,10 +126,10 @@ define( | ||||
|          */ | ||||
|         CreateWizard.prototype.getInitialFormValue = function () { | ||||
|             // Start with initial values for properties | ||||
|             var model = this.model, | ||||
|                 formValue = this.properties.map(function (property) { | ||||
|                     return property.getValue(model); | ||||
|                 }); | ||||
|             var model = this.model; | ||||
|             var formValue = this.properties.map(function (property) { | ||||
|                 return property.getValue(model); | ||||
|             }); | ||||
|  | ||||
|             // Include the createParent | ||||
|             formValue.createParent = this.parent; | ||||
|   | ||||
| @@ -63,23 +63,22 @@ define( | ||||
|          *         object has been created | ||||
|          */ | ||||
|         CreationService.prototype.createObject = function (model, parent) { | ||||
|             var persistence = parent.getCapability("persistence"), | ||||
|                 newObject = parent.useCapability("instantiation", model), | ||||
|                 newObjectPersistence = newObject.getCapability("persistence"), | ||||
|                 self = this; | ||||
|             var persistence = parent.getCapability("persistence"); | ||||
|             var newObject = parent.useCapability("instantiation", model); | ||||
|             var newObjectPersistence = newObject.getCapability("persistence"); | ||||
|             var self = this; | ||||
|  | ||||
|             // Add the newly-created object's id to the parent's | ||||
|             // composition, so that it will subsequently appear | ||||
|             // as a child contained by that parent. | ||||
|             function addToComposition() { | ||||
|                 var compositionCapability = parent.getCapability('composition'), | ||||
|                     addResult = compositionCapability | ||||
|                         && compositionCapability.add(newObject); | ||||
|                 var compositionCapability = parent.getCapability('composition'); | ||||
|                 var addResult = compositionCapability && | ||||
|                         compositionCapability.add(newObject); | ||||
|  | ||||
|                 return self.$q.when(addResult).then(function (result) { | ||||
|                     if (!result) { | ||||
|                         self.$log.error("Could not modify " + parent.getId()); | ||||
|  | ||||
|                         return undefined; | ||||
|                     } | ||||
|  | ||||
| @@ -93,7 +92,6 @@ define( | ||||
|             // what space to create the new object's model in. | ||||
|             if (!persistence || !newObjectPersistence) { | ||||
|                 self.$log.warn(NON_PERSISTENT_WARNING); | ||||
|  | ||||
|                 return self.$q.reject(new Error(NON_PERSISTENT_WARNING)); | ||||
|             } | ||||
|  | ||||
| @@ -101,6 +99,8 @@ define( | ||||
|             return newObjectPersistence.persist().then(addToComposition); | ||||
|         }; | ||||
|  | ||||
|  | ||||
|  | ||||
|         return CreationService; | ||||
|     } | ||||
| ); | ||||
|   | ||||
| @@ -38,9 +38,9 @@ define( | ||||
|             // * treeModel: The model for the embedded tree representation, | ||||
|             //              used for bi-directional object selection. | ||||
|             function setLocatingObject(domainObject, priorObject) { | ||||
|                 var context = domainObject | ||||
|                     && domainObject.getCapability("context"), | ||||
|                     contextRoot = context && context.getRoot(); | ||||
|                 var context = domainObject && | ||||
|                     domainObject.getCapability("context"); | ||||
|                 var contextRoot = context && context.getRoot(); | ||||
|  | ||||
|                 if (contextRoot && contextRoot !== $scope.rootObject) { | ||||
|                     $scope.rootObject = undefined; | ||||
| @@ -65,12 +65,11 @@ define( | ||||
|                 $scope.ngModel[$scope.field] = domainObject; | ||||
|  | ||||
|                 // Restrict which locations can be selected | ||||
|                 if (domainObject | ||||
|                         && $scope.structure | ||||
|                             && $scope.structure.validate) { | ||||
|                 if (domainObject && | ||||
|                         $scope.structure && | ||||
|                             $scope.structure.validate) { | ||||
|                     if (!$scope.structure.validate(domainObject)) { | ||||
|                         setLocatingObject(priorObject, undefined); | ||||
|  | ||||
|                         return; | ||||
|                     } | ||||
|                 } | ||||
| @@ -79,7 +78,7 @@ define( | ||||
|                 if ($scope.ngModelController) { | ||||
|                     $scope.ngModelController.$setValidity( | ||||
|                         'composition', | ||||
|                         Boolean($scope.treeModel.selectedObject) | ||||
|                         !!$scope.treeModel.selectedObject | ||||
|                     ); | ||||
|                 } | ||||
|             } | ||||
|   | ||||
| @@ -45,7 +45,6 @@ define( | ||||
|             // because it may be saved elsewhere | ||||
|             if ((key === 'edit' && category === 'view-control') || key === 'properties') { | ||||
|                 let newStyleObject = objectUtils.toNewFormat(domainObject, domainObject.getId()); | ||||
|  | ||||
|                 return this.openmct.objects.isPersistable(newStyleObject); | ||||
|             } | ||||
|  | ||||
|   | ||||
| @@ -58,9 +58,9 @@ define( | ||||
|          * @param {String} message a message to log with the commit message. | ||||
|          */ | ||||
|         EditRepresenter.prototype.commit = function (message) { | ||||
|             var model = this.$scope.model, | ||||
|                 configuration = this.$scope.configuration, | ||||
|                 domainObject = this.domainObject; | ||||
|             var model = this.$scope.model; | ||||
|             var configuration = this.$scope.configuration; | ||||
|             var domainObject = this.domainObject; | ||||
|  | ||||
|             this.$log.debug([ | ||||
|                 "Committing ", | ||||
| @@ -74,7 +74,6 @@ define( | ||||
|                     model.configuration = model.configuration || {}; | ||||
|                     model.configuration[this.key] = configuration; | ||||
|                 } | ||||
|  | ||||
|                 domainObject.useCapability('mutation', function () { | ||||
|                     return model; | ||||
|                 }); | ||||
|   | ||||
| @@ -41,7 +41,6 @@ define(['./Transaction'], function (Transaction) { | ||||
|             Transaction.prototype.commit.bind(this), | ||||
|             Transaction.prototype.cancel.bind(this) | ||||
|         ); | ||||
|  | ||||
|         return Promise.resolve(true); | ||||
|     }; | ||||
|  | ||||
|   | ||||
| @@ -41,12 +41,8 @@ define([], function () { | ||||
|      *          pair of callbacks from the transaction | ||||
|      */ | ||||
|     Transaction.prototype.add = function (commit, cancel) { | ||||
|         var callback = { | ||||
|             commit: commit, | ||||
|             cancel: cancel | ||||
|         }; | ||||
|         var callback = { commit: commit, cancel: cancel }; | ||||
|         this.callbacks.push(callback); | ||||
|  | ||||
|         return function () { | ||||
|             this.callbacks = this.callbacks.filter(function (c) { | ||||
|                 return c !== callback; | ||||
| @@ -95,5 +91,6 @@ define([], function () { | ||||
|         }; | ||||
|     }); | ||||
|  | ||||
|  | ||||
|     return Transaction; | ||||
| }); | ||||
|   | ||||
| @@ -50,7 +50,7 @@ define([], function () { | ||||
|      * @returns {boolean} true if callbacks have been added | ||||
|      */ | ||||
|     TransactionManager.prototype.isScheduled = function (id) { | ||||
|         return Boolean(this.clearTransactionFns[id]); | ||||
|         return !!this.clearTransactionFns[id]; | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
| @@ -77,7 +77,6 @@ define([], function () { | ||||
|                 return promiseFn().then(nextFn); | ||||
|             }; | ||||
|         } | ||||
|  | ||||
|         /** | ||||
|          * Clear any existing persistence calls for object with given ID. This ensures only the most recent persistence | ||||
|          * call is executed. This should prevent stale objects being persisted and overwriting fresh ones. | ||||
|   | ||||
| @@ -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*/ | ||||
| define( | ||||
|     ['./Transaction', './NestedTransaction'], | ||||
|     function (Transaction, NestedTransaction) { | ||||
| @@ -47,9 +48,9 @@ define( | ||||
|          * #cancel} are called | ||||
|          */ | ||||
|         TransactionService.prototype.startTransaction = function () { | ||||
|             var transaction = this.isActive() | ||||
|                 ? new NestedTransaction(this.transactions[0]) | ||||
|                 : new Transaction(this.$log); | ||||
|             var transaction = this.isActive() ? | ||||
|                 new NestedTransaction(this.transactions[0]) : | ||||
|                 new Transaction(this.$log); | ||||
|  | ||||
|             this.transactions.push(transaction); | ||||
|         }; | ||||
| @@ -98,16 +99,13 @@ define( | ||||
|             if (!transaction) { | ||||
|                 return Promise.reject(); | ||||
|             } | ||||
|  | ||||
|             if (!this.isActive()) { | ||||
|                 return transaction.commit() | ||||
|                     .then(function (r) { | ||||
|                         this.cacheService.flush(); | ||||
|  | ||||
|                         return r; | ||||
|                     }.bind(this)); | ||||
|             } | ||||
|  | ||||
|             return transaction.commit(); | ||||
|         }; | ||||
|  | ||||
| @@ -121,7 +119,6 @@ define( | ||||
|          */ | ||||
|         TransactionService.prototype.cancel = function () { | ||||
|             var transaction = this.transactions.pop(); | ||||
|  | ||||
|             return transaction ? transaction.cancel() : Promise.reject(); | ||||
|         }; | ||||
|  | ||||
|   | ||||
| @@ -25,12 +25,12 @@ define( | ||||
|     function (CancelAction) { | ||||
|  | ||||
|         describe("The Cancel action", function () { | ||||
|             var mockDomainObject, | ||||
|                 mockParentObject, | ||||
|                 capabilities = {}, | ||||
|                 parentCapabilities = {}, | ||||
|                 actionContext, | ||||
|                 action; | ||||
|             var mockDomainObject; | ||||
|             var mockParentObject; | ||||
|             var capabilities = {}; | ||||
|             var parentCapabilities = {}; | ||||
|             var actionContext; | ||||
|             var action; | ||||
|  | ||||
|             function mockPromise(value) { | ||||
|                 return { | ||||
| @@ -102,7 +102,7 @@ define( | ||||
|                 }); | ||||
|  | ||||
|                 mockDomainObject.hasCapability.and.callFake(function (name) { | ||||
|                     return Boolean(capabilities[name]); | ||||
|                     return !!capabilities[name]; | ||||
|                 }); | ||||
|  | ||||
|                 capabilities.editor.finish.and.returnValue(mockPromise(true)); | ||||
| @@ -123,8 +123,8 @@ define( | ||||
|                 expect(CancelAction.appliesTo(actionContext)).toBeFalsy(); | ||||
|             }); | ||||
|  | ||||
|             it("invokes the editor capability's cancel functionality when" | ||||
|                 + " performed", function () { | ||||
|             it("invokes the editor capability's cancel functionality when" + | ||||
|                 " performed", function () { | ||||
|                 mockDomainObject.getModel.and.returnValue({persisted: 1}); | ||||
|                 //Return true from navigate action | ||||
|                 capabilities.action.perform.and.returnValue(mockPromise(true)); | ||||
|   | ||||
| @@ -25,15 +25,15 @@ define( | ||||
|     function (EditAction) { | ||||
|  | ||||
|         describe("The Edit action", function () { | ||||
|             var mockLocation, | ||||
|                 mockNavigationService, | ||||
|                 mockLog, | ||||
|                 mockDomainObject, | ||||
|                 mockType, | ||||
|                 mockEditor, | ||||
|                 actionContext, | ||||
|                 capabilities, | ||||
|                 action; | ||||
|             var mockLocation; | ||||
|             var mockNavigationService; | ||||
|             var mockLog; | ||||
|             var mockDomainObject; | ||||
|             var mockType; | ||||
|             var mockEditor; | ||||
|             var actionContext; | ||||
|             var capabilities; | ||||
|             var action; | ||||
|  | ||||
|             beforeEach(function () { | ||||
|                 mockLocation = jasmine.createSpyObj( | ||||
|   | ||||
| @@ -25,17 +25,17 @@ define( | ||||
|     function (EditAndComposeAction) { | ||||
|  | ||||
|         describe("The Link action", function () { | ||||
|             var mockDomainObject, | ||||
|                 mockParent, | ||||
|                 mockContext, | ||||
|                 mockComposition, | ||||
|                 mockActionCapability, | ||||
|                 mockEditAction, | ||||
|                 mockType, | ||||
|                 actionContext, | ||||
|                 model, | ||||
|                 capabilities, | ||||
|                 action; | ||||
|             var mockDomainObject; | ||||
|             var mockParent; | ||||
|             var mockContext; | ||||
|             var mockComposition; | ||||
|             var mockActionCapability; | ||||
|             var mockEditAction; | ||||
|             var mockType; | ||||
|             var actionContext; | ||||
|             var model; | ||||
|             var capabilities; | ||||
|             var action; | ||||
|  | ||||
|             function mockPromise(value) { | ||||
|                 return { | ||||
| @@ -93,6 +93,7 @@ define( | ||||
|                 action = new EditAndComposeAction(actionContext); | ||||
|             }); | ||||
|  | ||||
|  | ||||
|             it("adds to the parent's composition when performed", function () { | ||||
|                 action.perform(); | ||||
|                 expect(mockComposition.add) | ||||
| @@ -105,8 +106,8 @@ define( | ||||
|                 expect(mockEditAction.perform).toHaveBeenCalled(); | ||||
|             }); | ||||
|  | ||||
|             it("Does not enable edit mode for objects that do not have an" | ||||
|                 + " edit action", function () { | ||||
|             it("Does not enable edit mode for objects that do not have an" + | ||||
|                 " edit action", function () { | ||||
|                 mockActionCapability.getActions.and.returnValue([]); | ||||
|                 action.perform(); | ||||
|                 expect(mockEditAction.perform).not.toHaveBeenCalled(); | ||||
|   | ||||
| @@ -25,7 +25,13 @@ define( | ||||
|     function (PropertiesAction) { | ||||
|  | ||||
|         describe("Properties action", function () { | ||||
|             var capabilities, model, object, context, input, dialogService, action; | ||||
|             var capabilities; | ||||
|             var model; | ||||
|             var object; | ||||
|             var context; | ||||
|             var input; | ||||
|             var dialogService; | ||||
|             var action; | ||||
|  | ||||
|             function mockPromise(value) { | ||||
|                 return { | ||||
| @@ -64,10 +70,7 @@ define( | ||||
|                         return true; | ||||
|                     } | ||||
|                 }; | ||||
|                 context = { | ||||
|                     someKey: "some value", | ||||
|                     domainObject: object | ||||
|                 }; | ||||
|                 context = { someKey: "some value", domainObject: object }; | ||||
|                 dialogService = { | ||||
|                     getUserInput: function () { | ||||
|                         return mockPromise(input); | ||||
|   | ||||
| @@ -26,7 +26,10 @@ define( | ||||
|  | ||||
|         describe("Properties dialog", function () { | ||||
|  | ||||
|             var type, properties, model, dialog; | ||||
|             var type; | ||||
|             var properties; | ||||
|             var model; | ||||
|             var dialog; | ||||
|  | ||||
|             beforeEach(function () { | ||||
|                 type = { | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /***************************************************************************** | ||||
|  * Open MCT, Copyright (c) 2014-2020, United States Government | ||||
|  * Open MCT, Copyright (c) 2014-2018, United States Government | ||||
|  * as represented by the Administrator of the National Aeronautics and Space | ||||
|  * Administration. All rights reserved. | ||||
|  * | ||||
| @@ -19,20 +19,21 @@ | ||||
|  * this source code distribution or the Licensing information page available | ||||
|  * at runtime from the About dialog for additional information. | ||||
|  *****************************************************************************/ | ||||
| /*global describe,it,expect,beforeEach,jasmine*/ | ||||
|  | ||||
| define( | ||||
|     ["../../src/actions/SaveAction"], | ||||
|     function (SaveAction) { | ||||
|  | ||||
|         describe("The Save action", function () { | ||||
|             var mockDomainObject, | ||||
|                 mockEditorCapability, | ||||
|                 actionContext, | ||||
|                 mockDialogService, | ||||
|                 mockNotificationService, | ||||
|                 mockActionCapability, | ||||
|                 capabilities = {}, | ||||
|                 action; | ||||
|             var mockDomainObject; | ||||
|             var mockEditorCapability; | ||||
|             var actionContext; | ||||
|             var mockDialogService; | ||||
|             var mockNotificationService; | ||||
|             var mockActionCapability; | ||||
|             var capabilities = {}; | ||||
|             var action; | ||||
|  | ||||
|             function mockPromise(value) { | ||||
|                 return { | ||||
| @@ -137,7 +138,6 @@ define( | ||||
|                 it("notifies if saving succeeded", function () { | ||||
|                     var mockCallback = jasmine.createSpy("callback"); | ||||
|                     mockEditorCapability.save.and.returnValue(Promise.resolve()); | ||||
|  | ||||
|                     return action.perform().then(mockCallback).then(function () { | ||||
|                         expect(mockNotificationService.info).toHaveBeenCalled(); | ||||
|                         expect(mockNotificationService.error).not.toHaveBeenCalled(); | ||||
| @@ -147,7 +147,6 @@ define( | ||||
|                 it("notifies if saving failed", function () { | ||||
|                     var mockCallback = jasmine.createSpy("callback"); | ||||
|                     mockEditorCapability.save.and.returnValue(Promise.reject("some failure reason")); | ||||
|  | ||||
|                     return action.perform().then(mockCallback).then(function () { | ||||
|                         expect(mockNotificationService.error).toHaveBeenCalled(); | ||||
|                         expect(mockNotificationService.info).not.toHaveBeenCalled(); | ||||
|   | ||||
| @@ -19,6 +19,7 @@ | ||||
|  * this source code distribution or the Licensing information page available | ||||
|  * at runtime from the About dialog for additional information. | ||||
|  *****************************************************************************/ | ||||
| /*global describe,it,expect,beforeEach,jasmine*/ | ||||
|  | ||||
| define( | ||||
|     ["../../src/actions/SaveAndStopEditingAction"], | ||||
| @@ -31,14 +32,14 @@ define( | ||||
|             // depends on is not mocked, so we mock some | ||||
|             // of SaveAction's own dependencies to make | ||||
|             // it run. | ||||
|             var mockDomainObject, | ||||
|                 mockEditorCapability, | ||||
|                 actionContext, | ||||
|                 dialogService, | ||||
|                 notificationService, | ||||
|                 mockActionCapability, | ||||
|                 capabilities = {}, | ||||
|                 action; | ||||
|             var mockDomainObject; | ||||
|             var mockEditorCapability; | ||||
|             var actionContext; | ||||
|             var dialogService; | ||||
|             var notificationService; | ||||
|             var mockActionCapability; | ||||
|             var capabilities = {}; | ||||
|             var action; | ||||
|  | ||||
|             function mockPromise(value) { | ||||
|                 return { | ||||
| @@ -96,6 +97,7 @@ define( | ||||
|                 action = new SaveAndStopEditingAction(dialogService, notificationService, actionContext); | ||||
|             }); | ||||
|  | ||||
|  | ||||
|             it("only applies to domain object with an editor capability", function () { | ||||
|                 expect(SaveAndStopEditingAction.appliesTo(actionContext)).toBe(true); | ||||
|                 expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor"); | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /***************************************************************************** | ||||
|  * Open MCT, Copyright (c) 2014-2020, United States Government | ||||
|  * Open MCT, Copyright (c) 2014-2018, United States Government | ||||
|  * as represented by the Administrator of the National Aeronautics and Space | ||||
|  * Administration. All rights reserved. | ||||
|  * | ||||
| @@ -19,37 +19,38 @@ | ||||
|  * this source code distribution or the Licensing information page available | ||||
|  * at runtime from the About dialog for additional information. | ||||
|  *****************************************************************************/ | ||||
| /*global describe,it,expect,beforeEach,jasmine,spyOn*/ | ||||
|  | ||||
| define( | ||||
|     ["../../src/actions/SaveAsAction"], | ||||
|     function (SaveAsAction) { | ||||
|  | ||||
|         xdescribe("The Save As action", function () { | ||||
|             var mockDomainObject, | ||||
|                 mockClonedObject, | ||||
|                 mockEditorCapability, | ||||
|                 mockActionCapability, | ||||
|                 mockObjectService, | ||||
|                 mockDialogService, | ||||
|                 mockCopyService, | ||||
|                 mockNotificationService, | ||||
|                 mockParent, | ||||
|                 actionContext, | ||||
|                 capabilities = {}, | ||||
|                 action; | ||||
|             var mockDomainObject; | ||||
|             var mockClonedObject; | ||||
|             var mockEditorCapability; | ||||
|             var mockActionCapability; | ||||
|             var mockObjectService; | ||||
|             var mockDialogService; | ||||
|             var mockCopyService; | ||||
|             var mockNotificationService; | ||||
|             var mockParent; | ||||
|             var actionContext; | ||||
|             var capabilities = {}; | ||||
|             var action; | ||||
|  | ||||
|             function noop() {} | ||||
|  | ||||
|             function mockPromise(value) { | ||||
|                 return (value || {}).then ? value | ||||
|                     : { | ||||
|                 return (value || {}).then ? value : | ||||
|                     { | ||||
|                         then: function (callback) { | ||||
|                             return mockPromise(callback(value)); | ||||
|                         }, | ||||
|                         catch: function (callback) { | ||||
|                             return mockPromise(callback(value)); | ||||
|                         } | ||||
|                     }; | ||||
|                     }   ; | ||||
|             } | ||||
|  | ||||
|             beforeEach(function () { | ||||
| @@ -66,10 +67,7 @@ define( | ||||
|                 mockDomainObject.getCapability.and.callFake(function (capability) { | ||||
|                     return capabilities[capability]; | ||||
|                 }); | ||||
|                 mockDomainObject.getModel.and.returnValue({ | ||||
|                     location: 'a', | ||||
|                     persisted: undefined | ||||
|                 }); | ||||
|                 mockDomainObject.getModel.and.returnValue({location: 'a', persisted: undefined}); | ||||
|                 mockDomainObject.getId.and.returnValue(0); | ||||
|  | ||||
|                 mockClonedObject = jasmine.createSpyObj( | ||||
| @@ -170,8 +168,8 @@ define( | ||||
|                 expect(SaveAsAction.appliesTo(actionContext)).toBe(false); | ||||
|             }); | ||||
|  | ||||
|             it("only applies to domain object that has not already been" | ||||
|                 + " persisted", function () { | ||||
|             it("only applies to domain object that has not already been" + | ||||
|                 " persisted", function () { | ||||
|                 expect(SaveAsAction.appliesTo(actionContext)).toBe(true); | ||||
|                 expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor"); | ||||
|  | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user