Compare commits

...

43 Commits

Author SHA1 Message Date
4e995c10da Merge branch 'master' into iso-date-format 2020-08-28 11:05:38 -07:00
b5cf157c40 cleaning up tests 2020-08-28 10:54:45 -07:00
ac082e9f58 removing openmct from tests as it is not required 2020-08-28 10:46:05 -07:00
9f7799b44f Couchdb object provider (#3245)
* Added legacy persistence service adapter
* Use new couch provider
* Added queuing of requests
Co-authored-by: Andrew Henry <akhenry@gmail.com>
2020-08-27 15:21:06 -07:00
cdf9c50b8a Merge branch 'master' into iso-date-format 2020-08-26 11:12:29 -07:00
ffb3b302c7 [MCT Tree] Testathon Fixes (#3324)
* WIP: testing backwards compatibility checks

* added new localstorage key for expanded tree node, delete old one if detected

* removing obsolete backwords compatibility code

* fixed going up the tree items not showing, going down the tree "ghost" image showing

* removing console log

* removed duplicate functionality
2020-08-25 14:15:28 -07:00
278f48f65c backwards compatible fix and switching between multi to single root children fix (#3319) 2020-08-24 15:00:11 -07:00
4801dc4f32 New tree refactor (#3098)
* revised new tree refactor, moved most of the logic to mct-tree instead of tree-item

* scrollTo set for sync, bug fixes, window resize handling

* removing console logs

* checking domainobject composition for length to verify children instead of composition object itself

* added scrollTo on load if in viewed objects directory

* loading, sync bug, search issues, opitmization

* initial PR review updates

* modified so search now uses the same container and virtual scroll

* eslint fix

* Adding new glyphs

- Multiple new glyphs cherrypicked from branch `add-new-glyphs-062320`;

* Styling for new-tree-refactor WIP

- WIP!
- New glyphs, markup changes in BrowseBar.vue;
- Refinements to tree items, WIP;
- TODO: move hard-coded CSS values into _constants, make
theme-compatible;

* Styling for new-tree-refactor WIP

- WIP!
- Added new `c-click-link` CSS class;
- Move tree sync button into tree pane area;
- Added named "controls" slot to pane.vue;
- _up and _down arrows now use visibility instead of opacity to prevent
accidental clicks;

* Styling for new-tree-refactor WIP

- WIP!
- Significant mods and simplification in pane.vue and assoc CSS for
expand/collapse functionality;
- Wait spinner when in tree: cleanups, simplification;

* More new glyphs, updated art

- New glyphs: icon-unlocked and icon-target;
- Updated art for icon-lock glyph;

* remove arrows for search results, hightlight "my items" correctly, added empty folder notic

* Styling for new-tree-refactor WIP

- WIP!
- Refinements to "empty" object element;
- Changed sync-tree icon glyph;

* Styling for new-tree-refactor WIP

- Nav up arrows now left-align properly;

* Styling for new-tree-refactor

- Significant consolidation and cleanups in mct-tree.scss;
- Normalize base and hover styles across new tree, legacy tree,
list-items (used in Notebook) and Folder List View;
- Class naming normalization, change `c-list-item__name-value` to
`c-list-item__name`;
- Add styling to override and remove `<a> outline: dotted` coming from
normalize-min;
- Removed too-broad `<a>` coloring in tables;

* Styling for new-tree-refactor

- Fix styles for Snow theme;
- Sync Maelstrom and Espresso themes;
- Remove too-broad `<a>` hover styling from global.scss;
- Disallow pointer-events on `is-navigated` object's label (click on
c-nav__down element still allowed);

* Styling for new-tree-refactor

- Normalizing status area expand/collapse iconography to match new
approach in panes;

* Adding new glyphs

- Added `icon-items-collapse` and `icon-items-expand`;

* Styling for new-tree-refactor

- Using new glyphs for items expand/collapse in Status area;

* dynamic item height for desktop and mobile views

* lint fixes

* updated addChild and removeChild functions as they were not working at all

* some PR comment updates!;

* Remove unneeded hard-coded CSS color property

* fixed issues when multiple root children exist, added plugin to change the name of the default root object

* removing "my other items" testing references

* linting fixes

* updating karma timeouts for testing purposes

* eslint fixes

* WIP: fixing linting issues

* updating for testing

* set root object provider to update root registry if called more than once

* tweaking tests so that it passes both locally and on the serve tests

* removing old css code preventing context clicks on active menu items

* fixing testing errors

* backwards compatible storage fix

Co-authored-by: charlesh88 <charlesh88@gmail.com>
Co-authored-by: Deep Tailor <deep.j.tailor@nasa.gov>
2020-08-24 13:47:56 -07:00
9e8f845fbe Fix plot axis separator line color and hash colors (#3314)
* Fixes for NIRVSS UI spectral plot view

- Fixes Y axis 2 vertical line color in spectral plot;

* Fixes for NIRVSS UI spectral plot view

- Fixes Y axis 2 vertical line color in spectral plot;
- Tweaks to themed plot hash line colors;
2020-08-21 15:22:26 -07:00
b4d1cdaae8 Fixes for NIRVSS UI spectral plot view (#3310)
- Fixed Plotly axis label title font sizing;
- Fixed Plotly axis vertical line color;
- Removed styling that caused `c-button` within
`h-local-controls--overlay-content` to be background on background
color;
2020-08-20 12:27:25 -07:00
f9d3af2724 Version 1.3.0 snapshot (#3307)
* Updating version to 1.2.4 for end of sprint.

* Update master to 1.3.0-SNAPSHOT sprint version
2020-08-18 12:19:49 -07:00
37debefadc Stop evaluation of conditions when one evaluates to true (#3276)
* Stop evaluation of conditions when one evaluates to true

* Fix broken test

* Fixes broken tests

* Addresses review comments - Rename getResult to updateResult

* Rename condition getResult to updateResult

* Renames condition getResult to updateResult
2020-08-14 10:09:35 -07:00
891fe0a36b Merge pull request #3154 from nasa/remove-action-tests
Remove action tests
2020-08-13 13:31:08 -07:00
4b6de59b03 Merge branch 'master' into remove-action-tests 2020-08-13 09:52:35 -07:00
6a5b902365 copyright stuff 2020-08-11 13:51:08 -07:00
270f07ebd5 Compare the enum value to the input, not the index of the enumeration (#3277) 2020-08-11 13:19:38 -07:00
52500f6097 lint fixes 2020-08-11 13:11:08 -07:00
2fa8a8d61d Merge branch 'master' into iso-date-format
Merg'n master
2020-08-11 13:07:10 -07:00
69a6cd20af linting 2020-08-11 13:01:54 -07:00
28eb268af1 Merge branch 'remove-action-tests' of https://github.com/nasa/openmct into remove-action-tests
More merg'n
2020-08-11 12:57:26 -07:00
045bb443cb Merge branch 'master' into remove-action-tests
Merg'n master
2020-08-11 12:57:02 -07:00
c6ca912f2b ESLint one-var, no-var rules (#3239)
* fixed issues for eslint one-var and no-var rules

Co-authored-by: Joshi <simplyrender@gmail.com>
Co-authored-by: Andrew Henry <akhenry@gmail.com>
2020-08-10 12:13:23 -07:00
78c7484d54 Merge branch 'master' into remove-action-tests 2020-08-10 11:57:06 -07:00
4d560086dd ESLint upgrade, implement additional rules (#3230)
* upgrade to ESLintv7, added overrides for rules violated
* removed overrides for spec files
* fixed no-prototype-builtins issues
* added rules for default-case-last, default-param-last, grouped-accessor-pairs, no-constructor-return, and added override for one violation

Co-authored-by: Andrew Henry <akhenry@gmail.com>
Co-authored-by: Shefali Joshi <simplyrender@gmail.com>
2020-08-10 11:23:35 -07:00
ef965ebdfd ESLint rules: array-callback-return, no-invalid-this, func-style (#3151)
* satisfied array-callback-return rule
* satisfying no-invalid-this rule
* fixed invalid-this issues
* changed isNotEqual to arrow function
* added rule func-style
* added return false to satisfy array-callback-return rule

Co-authored-by: Joel McKinnon <jmckinnon@apple.com>
Co-authored-by: Joshi <simplyrender@gmail.com>
Co-authored-by: Andrew Henry <akhenry@gmail.com>
2020-08-10 10:59:18 -07:00
0b4a843617 ESLint rules: rules requiring minor changes (#3139)
* implemented trivial code changes necessary batch of rules

Co-authored-by: Andrew Henry <akhenry@gmail.com>
2020-08-10 10:35:40 -07:00
7e7141a5a0 Fixes to enable testing again (#3275)
* Updated library versions
* Use Karma alternative spec loading
* Fixed memory leak in URLTimeSettingsSynchronizer
* Introduce mock DataTransfer object to fix issue with firefox headless
* make resetApplicationState return a promise
* Remove BeforeAll
* Do not throw an error if root returns no children
* Adding missing parameters to ES tests
* Fixed TransactionService bug
* bump test coverage up to 64%
2020-08-10 09:47:04 -07:00
b3fd6c9b85 Merge branch 'master' into iso-date-format 2020-08-03 14:34:38 -07:00
deb0511b43 Merge branch 'master' into remove-action-tests 2020-08-03 13:43:40 -07:00
2198a4780b Merge branch 'master' of https://github.com/nasa/openmct into remove-action-tests 2020-08-03 09:47:42 -07:00
9ebb013f22 Merge branch 'master' into remove-action-tests 2020-07-31 14:30:14 -07:00
7c1550ced7 Merge branch 'master' into remove-action-tests 2020-07-31 12:46:40 -07:00
fd3be63805 classic eslint fix 2020-07-28 13:58:31 -07:00
ad8ed419de removing old references in legacy code (accident) and adding tests for new formatter 2020-07-28 13:45:45 -07:00
8b4f07c2e0 added ISOTimeFormat plugin and format 2020-07-28 11:23:56 -07:00
9198effafe adding ISO Time Formatter to be used with openmct-yamcs 2020-07-27 10:32:22 -07:00
de6eceb98b parsing datum itself rather than specific key of datum, let telemetry api do the work 2020-07-24 11:37:41 -07:00
79c4dc9272 typo fix! and using object assign where appropriate 2020-07-13 14:42:01 -07:00
e1d0c22071 removing fdescribe 2020-07-06 15:27:38 -07:00
7dee6344b0 updating spec statements to be more broad 2020-07-06 14:14:57 -07:00
731ab89561 added some tests for remove action as well as another mock object "folder" 2020-07-06 14:05:32 -07:00
6bd0246db6 Merge branch 'master' into remove-action-tests
Merging master
2020-07-02 12:53:43 -07:00
99aa5c7b7b few more tests, not ready yet though 2020-07-02 10:14:14 -07:00
346 changed files with 4314 additions and 2572 deletions

View File

@ -11,12 +11,12 @@ jobs:
name: Update npm
command: 'sudo npm install -g npm@latest'
- restore_cache:
key: dependency-cache-13-{{ checksum "package.json" }}
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: Installing dependencies (npm install)
command: npm install
- save_cache:
key: dependency-cache-13-{{ checksum "package.json" }}
key: dependency-cache-{{ checksum "package.json" }}
paths:
- node_modules
- run:

View File

@ -120,6 +120,38 @@ 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",
@ -204,28 +236,24 @@ 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": ["*Spec.js"],
"files": LEGACY_FILES,
"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"
"no-var": "off",
"one-var": "off"
}
}
]

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2017, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/EventTelemetryProvider"

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2017, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define */
/**
* Module defining EventTelemetry.

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise*/
/**
* Module defining EventTelemetryProvider. Created by chacskaylo on 06/18/2015.

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([], function () {
'use strict';

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
'./ExportTelemetryAsCSVAction'

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/ExampleFormController"

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2017, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,window*/
define(
[],
@ -80,7 +79,7 @@ define(
control: "button",
csslass: "icon-save",
click: function () {
window.alert("Save");
console.log("Save");
}
},
{
@ -88,7 +87,7 @@ define(
csslass: "icon-x",
description: "Button B",
click: function () {
window.alert("Cancel");
console.log("Cancel");
}
},
{
@ -97,7 +96,7 @@ define(
description: "Button C",
disabled: true,
click: function () {
window.alert("Delete");
console.log("Delete");
}
}
]

View File

@ -117,7 +117,7 @@ define([
}
GeneratorMetadataProvider.prototype.supportsMetadata = function (domainObject) {
return METADATA_BY_TYPE.hasOwnProperty(domainObject.type);
return Object.prototype.hasOwnProperty.call(METADATA_BY_TYPE, domainObject.type);
};
GeneratorMetadataProvider.prototype.getMetadata = function (domainObject) {

View File

@ -62,15 +62,15 @@ define([
var workerRequest = {};
props.forEach(function (prop) {
if (domainObject.telemetry && domainObject.telemetry.hasOwnProperty(prop)) {
if (domainObject.telemetry && Object.prototype.hasOwnProperty.call(domainObject.telemetry, prop)) {
workerRequest[prop] = domainObject.telemetry[prop];
}
if (request && request.hasOwnProperty(prop)) {
if (request && Object.prototype.hasOwnProperty.call(request, prop)) {
workerRequest[prop] = request[prop];
}
if (!workerRequest.hasOwnProperty(prop)) {
if (!Object.prototype.hasOwnProperty.call(workerRequest, prop)) {
workerRequest[prop] = REQUEST_DEFAULTS[prop];
}

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([

View File

@ -72,6 +72,7 @@ define([
});
var messageId;
let self = this;
function callback(message) {
if (message.error) {
deferred.reject(message.error);
@ -79,7 +80,8 @@ define([
deferred.resolve(message.data);
}
delete this.callbacks[messageId];
delete self.callbacks[messageId];
}
messageId = this.dispatch('request', request, callback.bind(this));

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2017, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -20,8 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global self*/
(function () {
var FIFTEEN_MINUTES = 15 * 60 * 1000;

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./GeneratorProvider",

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/ExampleIdentityService"

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
function () {

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([], function () {
"use strict";

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/RemsTelemetryServerAdapter",

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
function () {

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define */
define (
['./RemsTelemetrySeries'],
function (RemsTelemetrySeries) {

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define */
define(
function () {
"use strict";

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
/*jslint es5: true */
define(

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/DialogLaunchController",

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,window*/
define(
[],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,window*/
define(
[],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/BrowserPersistenceProvider"

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
/**
* Stubbed implementation of a persistence provider,

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/ExamplePolicy"

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/WatchIndicator",

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/ScratchPersistenceProvider"

View File

@ -20,8 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,window*/
define(
[],
function () {

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],

3
indexTest.js Normal file
View File

@ -0,0 +1,3 @@
const testsContext = require.context('.', true, /\/(src|platform)\/.*Spec.js$/);
testsContext.keys().forEach(testsContext);

View File

@ -52,12 +52,16 @@ module.exports = (config) => {
basePath: '',
frameworks: ['jasmine'],
files: [
'platform/**/*Spec.js',
'src/**/*Spec.js'
'indexTest.js'
],
port: 9876,
reporters: reporters,
browsers: browsers,
client: {
jasmine: {
random: false
}
},
customLaunchers: {
ChromeDebugging: {
base: 'Chrome',
@ -82,20 +86,20 @@ module.exports = (config) => {
reports: ['html', 'lcovonly', 'text-summary'],
thresholds: {
global: {
lines: 62
lines: 64
}
}
},
preprocessors: {
'platform/**/*Spec.js': ['webpack', 'sourcemap'],
'src/**/*Spec.js': ['webpack', 'sourcemap']
'indexTest.js': ['webpack', 'sourcemap']
},
webpack: webpackConfig,
webpackMiddleware: {
stats: 'errors-only',
logLevel: 'warn'
},
concurrency: 1,
singleRun: true,
browserNoActivityTimeout: 90000
browserNoActivityTimeout: 400000
});
}
};

View File

@ -32,6 +32,6 @@ if (document.currentScript) {
const MCT = require('./src/MCT');
var openmct = new MCT();
const openmct = new MCT();
module.exports = openmct;

View File

@ -1,12 +1,12 @@
{
"name": "openmct",
"version": "1.0.0-snapshot",
"version": "1.3.0-SNAPSHOT",
"description": "The Open MCT core platform",
"dependencies": {},
"devDependencies": {
"angular": ">=1.8.0",
"angular-route": "1.4.14",
"babel-eslint": "8.2.6",
"babel-eslint": "10.0.3",
"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": "5.2.0",
"eslint": "7.0.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": "^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",
"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",
"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.1.1",
"minimist": "^1.2.5",
"moment": "2.25.3",
"moment-duration-format": "^2.2.2",
"moment-timezone": "0.5.28",
"node-bourbon": "^4.2.3",
"node-sass": "^4.9.2",
"node-sass": "^4.14.1",
"painterro": "^1.0.35",
"printj": "^1.2.1",
"raw-loader": "^0.5.1",

View File

@ -25,9 +25,9 @@ define(
function (AboutController) {
describe("The About controller", function () {
var testVersions,
mockWindow,
controller;
let testVersions;
let mockWindow;
let controller;
beforeEach(function () {
testVersions = [
@ -56,7 +56,6 @@ define(
controller.openLicenses();
expect(mockWindow.open).toHaveBeenCalledWith("#/licenses");
});
});
}

View File

@ -79,12 +79,6 @@ function (
return this.objectService;
};
function resolveWith(object) {
return function () {
return object;
};
}
/**
* Save changes and conclude editing.
*
@ -102,7 +96,6 @@ function (
SaveAsAction.prototype.save = function () {
var self = this,
domainObject = this.domainObject,
copyService = this.copyService,
dialog = new SaveInProgressDialog(this.dialogService),
toUndirty = [];
@ -139,19 +132,22 @@ function (
return fetchObject(object.getModel().location);
}
function allowClone(objectToClone) {
var allowed =
(objectToClone.getId() === domainObject.getId())
|| objectToClone.getCapability('location').isOriginal();
if (allowed) {
toUndirty.push(objectToClone);
}
return allowed;
function saveObject(parent) {
return self.openmct.editor.save().then(() => {
// Force mutation for search indexing
return parent;
});
}
function cloneIntoParent(parent) {
return copyService.perform(domainObject, parent, allowClone);
function addSavedObjectToParent(parent) {
return parent.getCapability("composition")
.add(domainObject)
.then(function (addedObject) {
return parent.getCapability("persistence").persist()
.then(function () {
return addedObject;
});
});
}
function undirty(object) {
@ -160,26 +156,17 @@ function (
function undirtyOriginals(object) {
return Promise.all(toUndirty.map(undirty))
.then(resolveWith(object));
.then(() => {
return object;
});
}
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) => {
function indexForSearch(addedObject) {
addedObject.useCapability('mutation', (model) => {
return model;
});
return savedObject;
return addedObject;
}
function onSuccess(object) {
@ -201,10 +188,12 @@ function (
.then(doWizardSave)
.then(showBlockingDialog)
.then(getParent)
.then(cloneIntoParent)
.then(saveObject)
.then(addSavedObjectToParent)
.then(undirtyOriginals)
.then(saveAfterClone)
.then(finishEditing)
.then((addedObject) => {
return fetchObject(addedObject.getId());
})
.then(indexForSearch)
.then(hideBlockingDialog)
.then(onSuccess)

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
['./TransactionalPersistenceCapability'],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],

View File

@ -56,10 +56,11 @@ define(
*/
CreateWizard.prototype.getFormStructure = function (includeLocation) {
var sections = [],
domainObject = this.domainObject;
domainObject = this.domainObject,
self = this;
function validateLocation(parent) {
return parent && this.openmct.composition.checkPolicy(parent.useCapability('adapter'), domainObject.useCapability('adapter'));
return parent && self.openmct.composition.checkPolicy(parent.useCapability('adapter'), domainObject.useCapability('adapter'));
}
sections.push({

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
['./Transaction', './NestedTransaction'],
function (Transaction, NestedTransaction) {

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* 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"],

View File

@ -19,7 +19,6 @@
* 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"],

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* 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"],

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,describe,it,expect,beforeEach,jasmine*/
define(
[

View File

@ -19,7 +19,6 @@
* 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/controllers/EditActionController"],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,describe,it,expect,beforeEach,jasmine*/
define(["../../src/services/NestedTransaction"], function (NestedTransaction) {
var TRANSACTION_METHODS = ['add', 'commit', 'cancel', 'size'];

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,describe,it,expect,beforeEach,jasmine*/
define(
["../../src/services/TransactionManager"],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,describe,it,expect,beforeEach,jasmine*/
define(
["../../src/services/TransactionService"],
@ -28,6 +27,7 @@ define(
describe("The Transaction Service", function () {
var mockQ,
mockLog,
mockCacheService,
transactionService;
function fastPromise(val) {
@ -40,9 +40,10 @@ define(
beforeEach(function () {
mockQ = jasmine.createSpyObj("$q", ["all"]);
mockCacheService = jasmine.createSpyObj("cacheService", ["flush"]);
mockQ.all.and.returnValue(fastPromise());
mockLog = jasmine.createSpyObj("$log", ["error"]);
transactionService = new TransactionService(mockQ, mockLog);
transactionService = new TransactionService(mockQ, mockLog, mockCacheService);
});
it("isActive returns true if a transaction is in progress", function () {
@ -85,17 +86,20 @@ define(
it("commit calls all queued commit functions", function () {
expect(transactionService.size()).toBe(3);
transactionService.commit();
onCommits.forEach(function (spy) {
expect(spy).toHaveBeenCalled();
return transactionService.commit().then(() => {
onCommits.forEach(function (spy) {
expect(spy).toHaveBeenCalled();
});
});
});
it("commit resets active state and clears queues", function () {
transactionService.commit();
expect(transactionService.isActive()).toBe(false);
expect(transactionService.size()).toBe(0);
expect(transactionService.size()).toBe(0);
return transactionService.commit().then(() => {
expect(transactionService.isActive()).toBe(false);
expect(transactionService.size()).toBe(0);
expect(transactionService.size()).toBe(0);
});
});
});

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,describe,it,expect,beforeEach,jasmine*/
define(
["../../src/services/Transaction"],

View File

@ -58,7 +58,8 @@ define(
var removeSelectable = openmct.selection.selectable(
element[0],
scope.$eval(attrs.mctSelectable),
attrs.hasOwnProperty('mctInitSelect') && scope.$eval(attrs.mctInitSelect) !== false
Object.prototype.hasOwnProperty.call(attrs, 'mctInitSelect')
&& scope.$eval(attrs.mctInitSelect) !== false
);
scope.$on("$destroy", function () {

View File

@ -76,7 +76,7 @@ define(
var search = this.$location.search(),
arr = [];
for (var key in search) {
if (search.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(search, key)) {
arr.push(key + '=' + search[key]);
}
}

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* global console*/
define([
'../../src/directives/MCTTree',

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global describe,beforeEach,jasmine,it,expect*/
define([
'../../src/ui/TreeView',

View File

@ -27,7 +27,7 @@ export default class NotificationService {
if (typeof message === 'string') {
return this.openmct.notifications.info(message);
} else {
if (message.hasOwnProperty('progress')) {
if (Object.prototype.hasOwnProperty.call(message, 'progress')) {
return this.openmct.notifications.progress(message.title, message.progress, message.progressText);
} else {
return this.openmct.notifications.info(message.title);

View File

@ -56,7 +56,7 @@ define([], function () {
* @returns {boolean} true if present; false if not
*/
ModelCacheService.prototype.has = function (id) {
return this.cache.hasOwnProperty(id);
return Object.prototype.hasOwnProperty.call(this.cache, id);
};
/**

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([], function () {

View File

@ -75,13 +75,13 @@ define(
function mergeObjects(a, b) {
var result = {};
Object.keys(a).forEach(function (k) {
result[k] = b.hasOwnProperty(k)
result[k] = Object.prototype.hasOwnProperty.call(b, k)
? mergeModels(a[k], b[k], (merger || {})[k])
: a[k];
});
Object.keys(b).forEach(function (k) {
// Copy any properties not already merged
if (!a.hasOwnProperty(k)) {
if (!Object.prototype.hasOwnProperty.call(a, k)) {
result[k] = b[k];
}
});

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global spyOn*/
define(
function () {

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -20,7 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global jasmine*/
define(
function () {
@ -110,7 +109,7 @@ define(
* @returns {*} capability object
*/
domainObject.getCapability.and.callFake(function (capability) {
if (config.capabilities.hasOwnProperty(capability)) {
if (Object.prototype.hasOwnProperty.call(config.capabilities, capability)) {
return config.capabilities[capability];
}
});
@ -124,7 +123,7 @@ define(
* @returns {boolean}
*/
domainObject.hasCapability.and.callFake(function (capability) {
return config.capabilities.hasOwnProperty(capability);
return Object.prototype.hasOwnProperty.call(config.capabilities, capability);
});
/**
@ -137,7 +136,7 @@ define(
* @returns {*} result whatever was returned by `invoke`.
*/
domainObject.useCapability.and.callFake(function (capability) {
if (config.capabilities.hasOwnProperty(capability)) {
if (Object.prototype.hasOwnProperty.call(config.capabilities, capability)) {
if (!config.capabilities[capability].invoke) {
throw new Error(
capability + ' missing invoke function.'

View File

@ -20,7 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global jasmine*/
define(
function () {
@ -60,7 +59,7 @@ define(
]
);
mockCopyService.perform.and.callFake(function () {
mockCopyService.perform.and.callFake(() => {
var performPromise,
callExtensions,
spy;
@ -79,7 +78,7 @@ define(
}
};
spy = this.perform;
spy = mockCopyService.perform;
Object.keys(callExtensions).forEach(function (key) {
spy.calls.mostRecent()[key] = callExtensions[key];

View File

@ -20,7 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global jasmine*/
define(
[
'../ControlledPromise'
@ -63,11 +62,11 @@ define(
]
);
mockLinkService.perform.and.callFake(function (object) {
mockLinkService.perform.and.callFake(object => {
var performPromise = new ControlledPromise();
this.perform.calls.mostRecent().promise = performPromise;
this.perform.calls.all()[this.perform.calls.count() - 1].promise =
mockLinkService.perform.calls.mostRecent().promise = performPromise;
mockLinkService.perform.calls.all()[mockLinkService.perform.calls.count() - 1].promise =
performPromise;
return performPromise.then(function (overrideObject) {

View File

@ -20,7 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global jasmine*/
define(
function () {
@ -60,7 +59,7 @@ define(
]
);
mockMoveService.perform.and.callFake(function () {
mockMoveService.perform.and.callFake(() => {
var performPromise,
callExtensions,
spy;
@ -79,7 +78,7 @@ define(
}
};
spy = this.perform;
spy = mockMoveService.perform;
Object.keys(callExtensions).forEach(function (key) {
spy.calls.mostRecent()[key] = callExtensions[key];

View File

@ -47,6 +47,7 @@ define(["zepto"], function ($) {
return new Promise(function (resolve, reject) {
input.trigger("click");
input.on('change', function (event) {
// eslint-disable-next-line no-invalid-this
file = this.files[0];
input.remove();
if (file) {

View File

@ -20,8 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global window*/
define([
'./Constants',
'./FrameworkInitializer',

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -20,8 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global window*/
/**
* Implements the framework layer, which handles the loading of bundles
* and the wiring-together of the extensions they expose.

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* eslint-disable no-invalid-this */
/**
* Module defining CustomRegistrars. Created by vwoeltje on 11/3/14.

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/actions/ExportAsJSONAction",

View File

@ -86,7 +86,7 @@ define(['lodash'], function (_) {
// Only export if object is creatable
if (this.isCreatable(child)) {
// Prevents infinite export of self-contained objs
if (!this.tree.hasOwnProperty(this.getId(child))) {
if (!Object.prototype.hasOwnProperty.call(this.tree, this.getId(child))) {
// If object is a link to something absent from
// tree, generate new id and treat as new object
if (this.isExternal(child, parent)) {

View File

@ -144,7 +144,7 @@ define(
setTimeout(resolve, 100);
}).then(function () {
expect(Object.keys(action.tree).length).toBe(1);
expect(action.tree.hasOwnProperty("parentId"))
expect(Object.prototype.hasOwnProperty.call(action.tree, "parentId"))
.toBeTruthy();
});
});
@ -184,9 +184,9 @@ define(
setTimeout(resolve, 100);
}).then(function () {
expect(Object.keys(action.tree).length).toBe(2);
expect(action.tree.hasOwnProperty("infiniteParentId"))
expect(Object.prototype.hasOwnProperty.call(action.tree, "infiniteParentId"))
.toBeTruthy();
expect(action.tree.hasOwnProperty("infiniteChildId"))
expect(Object.prototype.hasOwnProperty.call(action.tree, "infiniteChildId"))
.toBeTruthy();
});
});
@ -224,9 +224,9 @@ define(
setTimeout(resolve, 100);
}).then(function () {
expect(Object.keys(action.tree).length).toBe(2);
expect(action.tree.hasOwnProperty('parentId'))
expect(Object.prototype.hasOwnProperty.call(action.tree, "parentId"))
.toBeTruthy();
expect(action.tree.hasOwnProperty('brandNewId'))
expect(Object.prototype.hasOwnProperty.call(action.tree, "brandNewId"))
.toBeTruthy();
expect(action.tree.brandNewId.location).toBe('parentId');
});
@ -239,8 +239,8 @@ define(
setTimeout(resolve, 100);
}).then(function () {
expect(Object.keys(exportedTree).length).toBe(2);
expect(exportedTree.hasOwnProperty('openmct')).toBeTruthy();
expect(exportedTree.hasOwnProperty('rootId')).toBeTruthy();
expect(Object.prototype.hasOwnProperty.call(exportedTree, "openmct")).toBeTruthy();
expect(Object.prototype.hasOwnProperty.call(exportedTree, "rootId")).toBeTruthy();
});
});

View File

@ -46,25 +46,34 @@ define([
spyOn(provider, 'cleanTerm').and.returnValue('cleanedTerm');
spyOn(provider, 'fuzzyMatchUnquotedTerms').and.returnValue('fuzzy');
spyOn(provider, 'parseResponse').and.returnValue('parsedResponse');
$http.and.returnValue(Promise.resolve({}));
$http.and.returnValue(Promise.resolve({
data: {
hits: {
hits: []
}
}
}));
});
it('cleans terms and adds fuzzyness', function () {
provider.query('hello', 10);
expect(provider.cleanTerm).toHaveBeenCalledWith('hello');
expect(provider.fuzzyMatchUnquotedTerms)
.toHaveBeenCalledWith('cleanedTerm');
return provider.query('hello', 10)
.then(() => {
expect(provider.cleanTerm).toHaveBeenCalledWith('hello');
expect(provider.fuzzyMatchUnquotedTerms)
.toHaveBeenCalledWith('cleanedTerm');
});
});
it('calls through to $http', function () {
provider.query('hello', 10);
expect($http).toHaveBeenCalledWith({
method: 'GET',
params: {
q: 'fuzzy',
size: 10
},
url: 'http://localhost:9200/_search/'
return provider.query('hello', 10).then(() => {
expect($http).toHaveBeenCalledWith({
method: 'GET',
params: {
q: 'fuzzy',
size: 10
},
url: 'http://localhost:9200/_search/'
});
});
});

View File

@ -20,8 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global self*/
/**
* Module defining BareBonesSearchWorker. Created by deeptailor on 10/03/2019.
*/

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global setTimeout*/
/**
* Module defining GenericSearchProvider. Created by shale on 07/16/2015.

View File

@ -20,8 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global self*/
/**
* Module defining GenericSearchWorker. Created by shale on 07/21/2015.
*/

View File

@ -20,8 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global require*/
/**
* SearchSpec. Created by shale on 07/31/2015.
*/

View File

@ -27,7 +27,7 @@ define([
"../../src/services/SearchAggregator"
], function (SearchAggregator) {
describe("SearchAggregator", function () {
xdescribe("SearchAggregator", function () {
var $q,
objectService,
providers,
@ -91,18 +91,19 @@ define([
});
it('filters results with a function', function () {
var modelResults = {
hits: [
{model: {thing: 1}},
{model: {thing: 2}},
{model: {thing: 3}}
],
total: 3
},
filterFunc = function (model) {
return model.thing < 2;
},
filtered = aggregator.applyFilter(modelResults, filterFunc);
const modelResults = {
hits: [
{model: {thing: 1}},
{model: {thing: 2}},
{model: {thing: 3}}
],
total: 3
};
let filtered = aggregator.applyFilter(modelResults, filterFunc);
function filterFunc(model) {
return model.thing < 2;
}
expect(filtered.hits).toEqual([
{model: {thing: 1}}

View File

@ -33,14 +33,11 @@ define(
_
) {
var ZERO = function () {
return 0;
},
EMPTY_SERIES = {
getPointCount: ZERO,
getDomainValue: ZERO,
getRangeValue: ZERO
};
const EMPTY_SERIES = {
getPointCount: () => 0,
getDomainValue: () => 0,
getRangeValue: () => 0
};
/**
* Provides metadata about telemetry associated with a

View File

@ -28,7 +28,7 @@ define(function () {
}
BundleRegistry.prototype.register = function (path, definition) {
if (this.knownBundles.hasOwnProperty(path)) {
if (Object.prototype.hasOwnProperty.call(this.knownBundles, path)) {
throw new Error('Cannot register bundle with duplicate path', path);
}

View File

@ -23,8 +23,8 @@
define(['./BundleRegistry'], function (BundleRegistry) {
describe("BundleRegistry", function () {
var testPath,
bundleRegistry;
let testPath;
let bundleRegistry;
beforeEach(function () {
testPath = 'some/bundle';
@ -46,7 +46,7 @@ define(['./BundleRegistry'], function (BundleRegistry) {
});
describe("when a bundle has been registered", function () {
var testBundleDef;
let testBundleDef;
beforeEach(function () {
testBundleDef = { someKey: "some value" };
@ -83,7 +83,6 @@ define(['./BundleRegistry'], function (BundleRegistry) {
});
});
});
});
});

View File

@ -292,7 +292,7 @@ define([
let capabilityService = this.$injector.get('capabilityService');
function instantiate(model, keyString) {
var capabilities = capabilityService.getCapabilities(model, keyString);
const capabilities = capabilityService.getCapabilities(model, keyString);
model.id = keyString;
return new DomainObjectImpl(keyString, model, capabilities);
@ -377,8 +377,8 @@ define([
// TODO: remove with legacy types.
this.types.listKeys().forEach(function (typeKey) {
var type = this.types.get(typeKey);
var legacyDefinition = type.toLegacyDefinition();
const type = this.types.get(typeKey);
const legacyDefinition = type.toLegacyDefinition();
legacyDefinition.key = typeKey;
this.legacyExtension('types', legacyDefinition);
}.bind(this));
@ -405,7 +405,7 @@ define([
this.$injector.get('objectService');
if (!isHeadlessMode) {
var appLayout = new Vue({
const appLayout = new Vue({
components: {
'Layout': Layout.default
},
@ -444,6 +444,7 @@ define([
MCT.prototype.destroy = function () {
this.emit('destroy');
this.router.destroy();
};
MCT.prototype.plugins = plugins;

View File

@ -26,15 +26,11 @@ define([
'utils/testing'
], function (plugins, legacyRegistry, testUtils) {
describe("MCT", function () {
var openmct;
var mockPlugin;
var mockPlugin2;
var mockListener;
var oldBundles;
beforeAll(() => {
testUtils.resetApplicationState();
});
let openmct;
let mockPlugin;
let mockPlugin2;
let mockListener;
let oldBundles;
beforeEach(function () {
mockPlugin = jasmine.createSpy('plugin');
@ -56,7 +52,8 @@ define([
legacyRegistry.delete(bundle);
}
});
testUtils.resetApplicationState(openmct);
return testUtils.resetApplicationState(openmct);
});
it("exposes plugins", function () {
@ -112,7 +109,7 @@ define([
});
describe("setAssetPath", function () {
var testAssetPath;
let testAssetPath;
beforeEach(function () {
openmct.legacyExtension = jasmine.createSpy('legacyExtension');

View File

@ -29,15 +29,15 @@ define([
}
ActionDialogDecorator.prototype.getActions = function (context) {
var mct = this.mct;
const mct = this.mct;
return this.actionService.getActions(context).map(function (action) {
if (action.dialogService) {
var domainObject = objectUtils.toNewFormat(
const domainObject = objectUtils.toNewFormat(
context.domainObject.getModel(),
objectUtils.parseKeyString(context.domainObject.getId())
);
var providers = mct.propertyEditors.get(domainObject);
const providers = mct.propertyEditors.get(domainObject);
if (providers.length > 0) {
action.dialogService = Object.create(action.dialogService);

View File

@ -35,7 +35,8 @@ define([
'./services/LegacyObjectAPIInterceptor',
'./views/installLegacyViews',
'./policies/LegacyCompositionPolicyAdapter',
'./actions/LegacyActionAdapter'
'./actions/LegacyActionAdapter',
'./services/LegacyPersistenceAdapter'
], function (
ActionDialogDecorator,
AdapterCapability,
@ -51,7 +52,8 @@ define([
LegacyObjectAPIInterceptor,
installLegacyViews,
legacyCompositionPolicyAdapter,
LegacyActionAdapter
LegacyActionAdapter,
LegacyPersistenceAdapter
) {
return {
name: 'src/adapter',
@ -114,6 +116,15 @@ define([
"instantiate",
"topic"
]
},
{
provides: "persistenceService",
type: "provider",
priority: "fallback",
implementation: function legacyPersistenceProvider(openmct) {
return new LegacyPersistenceAdapter.default(openmct);
},
depends: ["openmct"]
}
],
policies: [

View File

@ -43,7 +43,7 @@ define([
model,
id
) {
var capabilities = this.capabilityService.getCapabilities(model, id);
const capabilities = this.capabilityService.getCapabilities(model, id);
if (capabilities.mutation) {
capabilities.mutation =
synchronizeMutationCapability(capabilities.mutation);

View File

@ -46,7 +46,7 @@ define([
}
function addChildToComposition(model) {
var existingIndex = model.composition.indexOf(child.getId());
const existingIndex = model.composition.indexOf(child.getId());
if (existingIndex === -1) {
model.composition.push(child.getId());
}
@ -71,16 +71,16 @@ define([
this.getDependencies();
}
var keyString = objectUtils.makeKeyString(child.identifier);
var oldModel = objectUtils.toOldFormat(child);
var newDO = this.instantiate(oldModel, keyString);
const keyString = objectUtils.makeKeyString(child.identifier);
const oldModel = objectUtils.toOldFormat(child);
const newDO = this.instantiate(oldModel, keyString);
return new ContextualDomainObject(newDO, this.domainObject);
};
AlternateCompositionCapability.prototype.invoke = function () {
var newFormatDO = objectUtils.toNewFormat(
const newFormatDO = objectUtils.toNewFormat(
this.domainObject.getModel(),
this.domainObject.getId()
);
@ -89,7 +89,7 @@ define([
this.getDependencies();
}
var collection = this.openmct.composition.get(newFormatDO);
const collection = this.openmct.composition.get(newFormatDO);
return collection.load()
.then(function (children) {
@ -104,5 +104,4 @@ define([
};
return AlternateCompositionCapability;
}
);
});

View File

@ -28,18 +28,18 @@ define([
function patchViewCapability(viewConstructor) {
return function makeCapability(domainObject) {
var capability = viewConstructor(domainObject);
var oldInvoke = capability.invoke.bind(capability);
const capability = viewConstructor(domainObject);
const oldInvoke = capability.invoke.bind(capability);
/* eslint-disable you-dont-need-lodash-underscore/map */
capability.invoke = function () {
var availableViews = oldInvoke();
var newDomainObject = capability
const availableViews = oldInvoke();
const newDomainObject = capability
.domainObject
.useCapability('adapter');
return _(availableViews).map(function (v, i) {
var vd = {
const vd = {
view: v,
priority: i + 100 // arbitrary to allow new views to
// be defaults by returning priority less than 100.

View File

@ -32,8 +32,8 @@ define([
function synchronizeMutationCapability(mutationConstructor) {
return function makeCapability(domainObject) {
var capability = mutationConstructor(domainObject);
var oldListen = capability.listen.bind(capability);
const capability = mutationConstructor(domainObject);
const oldListen = capability.listen.bind(capability);
capability.listen = function (listener) {
return oldListen(function (newModel) {
capability.domainObject.model =

View File

@ -27,9 +27,9 @@ define([
return {
restrict: 'E',
link: function (scope, element, attrs) {
var provider = openmct.objectViews.getByProviderKey(attrs.mctProviderKey);
var view = new provider.view(scope.domainObject.useCapability('adapter'));
var domElement = element[0];
const provider = openmct.objectViews.getByProviderKey(attrs.mctProviderKey);
const view = new provider.view(scope.domainObject.useCapability('adapter'));
const domElement = element[0];
view.show(domElement);

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([], function () {
var LEGACY_INDICATOR_TEMPLATE =
const LEGACY_INDICATOR_TEMPLATE =
'<mct-include '
+ ' ng-model="indicator" '
+ ' class="h-indicator" '
@ -36,8 +36,8 @@ define([], function () {
function addLegacyIndicators(legacyIndicators) {
legacyIndicators.forEach(function (legacyIndicatorDef) {
var legacyIndicator = initializeIfNeeded(legacyIndicatorDef);
var legacyIndicatorElement = buildLegacyIndicator(legacyIndicator, legacyIndicatorDef.template);
const legacyIndicator = initializeIfNeeded(legacyIndicatorDef);
const legacyIndicatorElement = buildLegacyIndicator(legacyIndicator, legacyIndicatorDef.template);
openmct.indicators.add({
element: legacyIndicatorElement
});
@ -45,7 +45,7 @@ define([], function () {
}
function initializeIfNeeded(LegacyIndicatorDef) {
var legacyIndicator;
let legacyIndicator;
if (typeof LegacyIndicatorDef === 'function') {
legacyIndicator = new LegacyIndicatorDef();
} else {
@ -56,9 +56,9 @@ define([], function () {
}
function buildLegacyIndicator(legacyIndicator, template) {
var $compile = openmct.$injector.get('$compile');
var $rootScope = openmct.$injector.get('$rootScope');
var scope = $rootScope.$new(true);
const $compile = openmct.$injector.get('$compile');
const $rootScope = openmct.$injector.get('$rootScope');
const scope = $rootScope.$new(true);
scope.indicator = legacyIndicator;
scope.template = template || 'indicator';

View File

@ -31,11 +31,11 @@ define(
MCTIndicators,
LegacyIndicatorsPlugin
) {
var openmct;
var directive;
var holderElement;
var legacyExtensionFunction = MCT.prototype.legacyExtension;
var legacyIndicatorsRunsFunction;
let openmct;
let directive;
let holderElement;
const legacyExtensionFunction = MCT.prototype.legacyExtension;
let legacyIndicatorsRunsFunction;
xdescribe('The legacy indicators plugin', function () {
beforeEach(function () {
@ -63,10 +63,10 @@ define(
}
function mockAngularComponents() {
var mockInjector = jasmine.createSpyObj('$injector', ['get']);
var mockCompile = jasmine.createSpy('$compile');
var mockRootScope = jasmine.createSpyObj('rootScope', ['$new']);
var mockScope = {};
const mockInjector = jasmine.createSpyObj('$injector', ['get']);
const mockCompile = jasmine.createSpy('$compile');
const mockRootScope = jasmine.createSpyObj('rootScope', ['$new']);
const mockScope = {};
mockRootScope.$new.and.returnValue(mockScope);
mockInjector.get.and.callFake(function (service) {
@ -85,7 +85,7 @@ define(
}
it("Displays any legacy indicators ", function () {
var legacyIndicators = [{}, {}, {}, {}];
const legacyIndicators = [{}, {}, {}, {}];
legacyIndicatorsRunsFunction(legacyIndicators);
renderIndicators();
@ -95,8 +95,8 @@ define(
});
it("If legacy indicator is defined as a constructor function, executes function ", function () {
var mockConstructorFunction = jasmine.createSpy('mockIndicatorConstructor');
var legacyIndicators = [{}, mockConstructorFunction];
const mockConstructorFunction = jasmine.createSpy('mockIndicatorConstructor');
const legacyIndicators = [{}, mockConstructorFunction];
mockConstructorFunction.and.returnValue({});
legacyIndicatorsRunsFunction(legacyIndicators);

View File

@ -29,8 +29,8 @@ define([], function () {
view,
legacyObject
) {
if (view.hasOwnProperty('provider')) {
var domainObject = legacyObject.useCapability('adapter');
if (Object.prototype.hasOwnProperty.call(view, 'provider')) {
const domainObject = legacyObject.useCapability('adapter');
return view.provider.canView(domainObject);
}

View File

@ -50,7 +50,7 @@ define([
LegacyTelemetryProvider.prototype.canProvideTelemetry;
function createDatum(domainObject, metadata, legacySeries, i) {
var datum;
let datum;
if (legacySeries.getDatum) {
datum = legacySeries.getDatum(i);
@ -77,9 +77,9 @@ define([
}
function adaptSeries(domainObject, metadata, legacySeries) {
var series = [];
const series = [];
for (var i = 0; i < legacySeries.getPointCount(); i++) {
for (let i = 0; i < legacySeries.getPointCount(); i++) {
series.push(createDatum(domainObject, metadata, legacySeries, i));
}
@ -104,9 +104,9 @@ define([
* telemetry data.
*/
LegacyTelemetryProvider.prototype.request = function (domainObject, request) {
var metadata = this.telemetryApi.getMetadata(domainObject);
var oldObject = this.instantiate(utils.toOldFormat(domainObject), utils.makeKeyString(domainObject.identifier));
var capability = oldObject.getCapability("telemetry");
const metadata = this.telemetryApi.getMetadata(domainObject);
const oldObject = this.instantiate(utils.toOldFormat(domainObject), utils.makeKeyString(domainObject.identifier));
const capability = oldObject.getCapability("telemetry");
return capability.requestData(request).then(function (telemetrySeries) {
return Promise.resolve(adaptSeries(domainObject, metadata, telemetrySeries));
@ -130,9 +130,9 @@ define([
* @returns {platform|telemetry.TelemetrySubscription|*}
*/
LegacyTelemetryProvider.prototype.subscribe = function (domainObject, callback, request) {
var metadata = this.telemetryApi.getMetadata(domainObject);
var oldObject = this.instantiate(utils.toOldFormat(domainObject), utils.makeKeyString(domainObject.identifier));
var capability = oldObject.getCapability("telemetry");
const metadata = this.telemetryApi.getMetadata(domainObject);
const oldObject = this.instantiate(utils.toOldFormat(domainObject), utils.makeKeyString(domainObject.identifier));
const capability = oldObject.getCapability("telemetry");
function callbackWrapper(series) {
callback(createDatum(domainObject, metadata, series, series.getPointCount() - 1));
@ -142,7 +142,7 @@ define([
};
LegacyTelemetryProvider.prototype.supportsLimits = function (domainObject) {
var oldObject = this.instantiate(
const oldObject = this.instantiate(
utils.toOldFormat(domainObject),
utils.makeKeyString(domainObject.identifier)
);
@ -151,11 +151,11 @@ define([
};
LegacyTelemetryProvider.prototype.getLimitEvaluator = function (domainObject) {
var oldObject = this.instantiate(
const oldObject = this.instantiate(
utils.toOldFormat(domainObject),
utils.makeKeyString(domainObject.identifier)
);
var limitEvaluator = oldObject.getCapability("limit");
const limitEvaluator = oldObject.getCapability("limit");
return {
evaluate: function (datum, property) {
@ -166,7 +166,7 @@ define([
return function (openmct, instantiate) {
// Legacy provider should always be the fallback.
var provider = new LegacyTelemetryProvider(openmct, instantiate);
const provider = new LegacyTelemetryProvider(openmct, instantiate);
openmct.telemetry.legacyProvider = provider;
openmct.telemetry.requestProviders.push(provider);
openmct.telemetry.subscriptionProviders.push(provider);

Some files were not shown because too many files have changed in this diff Show More