Compare commits

...

38 Commits

Author SHA1 Message Date
Joel McKinnon
1712f0579d Merge branch 'master' into lodash-upgrade-test 2020-04-29 15:42:01 -07:00
Joel McKinnon
5b7eaf6b04 fixed bug in TelemetryMetadataManager.js .map() call and added test for flattenDeep() 2020-04-29 15:41:20 -07:00
David Tsay
396817b2d1 handle non-valid requests (#2984)
Co-authored-by: Deep Tailor <deep.j.tailor@nasa.gov>
2020-04-29 15:24:12 -07:00
David Tsay
96eb6d6b74 [Conditionals] evaluation fixes (#2981)
* change single output to state and value

* do not send telemetryObjects to telemetry api request cal

* normalize data on requests

Co-authored-by: Deep Tailor <deep.j.tailor@nasa.gov>
2020-04-29 14:56:07 -07:00
Joel McKinnon
ac69513e37 addressed review comments 2020-04-29 13:56:50 -07:00
Joel McKinnon
011fc94cb5 Merge branch 'master' of https://github.com/nasa/openmct into lodash-upgrade-test 2020-04-29 12:01:52 -07:00
Joel McKinnon
4446c5d075 added tests for array-utils 2020-04-29 12:01:40 -07:00
Shefali Joshi
cb5d47f66f Use only the values required for description (#2919)
Co-authored-by: Andrew Henry <akhenry@gmail.com>
2020-04-28 16:58:58 -07:00
Shefali Joshi
ea90d02d66 Show the Styles tab for non creatable layout objects including condition sets (#2975) 2020-04-28 13:10:29 -07:00
David Tsay
95f73d8eb8 [Conditionals] fix #2961 in master (#2969)
* use correct id for telemetry requests

* request and subscription data cache should be mutually exclusive

use latest timestamp for any/all requests

* do not add prop to datum

remove unnecessary if check

Co-authored-by: Deep Tailor <deep.j.tailor@nasa.gov>
2020-04-28 13:02:23 -07:00
Joel McKinnon
4297ffd270 renamed testTools.js to test-utils.js aliased as testUtils 2020-04-27 16:45:40 -07:00
Joel McKinnon
5bf988a7f1 added utils/array-utils.js, alias in webpack for arrayUtils, objectUtils 2020-04-27 16:35:06 -07:00
Joel McKinnon
10da86183b Merge branch 'eslint-script' of https://github.com/nasa/openmct into lodash-upgrade-test 2020-04-27 12:28:58 -07:00
Joel McKinnon
ec5e3b929b changed sortBy to orderBy 2020-04-27 12:18:38 -07:00
Joel McKinnon
8077ab43fe removed unneeded lodash import statements, changed _.extend to Object.assign 2020-04-27 11:44:35 -07:00
Joel McKinnon
ccc0376352 fixed lint errors 2020-04-24 15:22:53 -07:00
Joel McKinnon
2497b8df18 fixed flatten method 2020-04-24 15:15:51 -07:00
Joel McKinnon
00c68a124e Merge branch 'lodash-upgrade-test' of https://github.com/nasa/openmct into lodash-upgrade-test 2020-04-24 15:09:35 -07:00
Joel McKinnon
fe5fef8a3d fixed sortedBy methods, added missing import statements, changed several lodash methods to native 2020-04-24 15:08:54 -07:00
Joel McKinnon
3455ed5ac9 Merge branch 'master' of https://github.com/nasa/openmct into lodash-upgrade-test 2020-04-24 12:00:10 -07:00
Joel McKinnon
a37c686993 Merge pull request #2968 from nasa/revert-2885-lodash-upgrade-test
Revert "Lodash upgrade"
2020-04-24 11:55:44 -07:00
Deep Tailor
f12166097c Revert "Lodash upgrade (#2885)"
This reverts commit d103a22fa0.
2020-04-24 11:53:31 -07:00
Joel McKinnon
eb5050b8ef added you-dont-need-lodash linter 2020-04-22 16:23:04 -07:00
Joel McKinnon
eca22fef9e Merge branch 'master' into lodash-upgrade-test 2020-04-22 15:34:51 -07:00
Joel McKinnon
b66a599c69 Merge branch 'lodash-upgrade-test' of https://github.com/nasa/openmct into lodash-upgrade-test 2020-04-22 15:26:56 -07:00
Joel McKinnon
835bcbcb5a native implementations as requested 2020-04-22 15:26:08 -07:00
Joel McKinnon
9cb2fe3fb3 Merge branch 'master' into eslint-script 2020-04-21 11:14:10 -07:00
Joel McKinnon
40c9546415 Merge branch 'master' into lodash-upgrade-test 2020-04-21 10:51:15 -07:00
Joel McKinnon
0622dbe78c added lodash/prefer-is-nil linter restriction and reverted changes to PlotYAxisFormController 2020-04-09 13:02:14 -07:00
Joel McKinnon
5e8ac0f771 Merge branch 'master' into eslint-script 2020-04-09 12:33:46 -07:00
Joel McKinnon
c5d31ce1cb modified eslint script and fixed errors found 2020-04-09 12:17:45 -07:00
Joel McKinnon
2b96a8994c Merge branch 'lodash-upgrade-test' of https://github.com/nasa/openmct into lodash-upgrade-test 2020-04-09 11:54:52 -07:00
Joel McKinnon
5efa7f69e4 added lodash/prefer-get exclusion 2020-04-09 11:54:00 -07:00
Joel McKinnon
33bb1c202e Merge branch 'master' into lodash-upgrade-test 2020-04-09 11:49:39 -07:00
Joel McKinnon
d73e9f6dae fixed issues cuaght by circle-ci 2020-04-08 15:52:59 -07:00
Joel McKinnon
691742d8f0 working on circle-ci lint errors 2020-04-08 14:19:31 -07:00
Joel McKinnon
ef4312e29a completed changes to support upgrade to lodash v4.17.12 2020-04-07 16:21:49 -07:00
Joel McKinnon
09cfe4f99a upgraded lodash, changed method names 2020-04-07 12:02:49 -07:00
87 changed files with 481 additions and 251 deletions

View File

@@ -12,7 +12,8 @@ module.exports = {
"extends": [ "extends": [
"eslint:recommended", "eslint:recommended",
"plugin:vue/recommended", "plugin:vue/recommended",
"plugin:lodash/recommended" "plugin:lodash/recommended",
"plugin:you-dont-need-lodash-underscore/compatible"
], ],
"parser": "vue-eslint-parser", "parser": "vue-eslint-parser",
"parserOptions": { "parserOptions": {
@@ -24,6 +25,14 @@ module.exports = {
} }
}, },
"rules": { "rules": {
"you-dont-need-lodash-underscore/uniq": "off",
"you-dont-need-lodash-underscore/omit": "off",
"you-dont-need-lodash-underscore/concat": "off",
"you-dont-need-lodash-underscore/values": "off",
"you-dont-need-lodash-underscore/map": "off",
"you-dont-need-lodash-underscore/throttle": "off",
"lodash/prefer-immutable-method": "off",
"lodash/prefer-lodash-chain": "off",
"lodash/prefer-lodash-method": "off", "lodash/prefer-lodash-method": "off",
"lodash/prefer-lodash-typecheck": "off", "lodash/prefer-lodash-typecheck": "off",
"lodash/prefer-constant": "off", "lodash/prefer-constant": "off",

View File

@@ -1,6 +1,4 @@
define([ define([], function (
'lodash'
], function (
_ _
) { ) {
@@ -99,7 +97,7 @@ define([
}; };
GeneratorMetadataProvider.prototype.getMetadata = function (domainObject) { GeneratorMetadataProvider.prototype.getMetadata = function (domainObject) {
return _.extend( return Object.assign(
{}, {},
domainObject.telemetry, domainObject.telemetry,
METADATA_BY_TYPE[domainObject.type] METADATA_BY_TYPE[domainObject.type]

View File

@@ -1,10 +1,10 @@
<template> <template>
<div class="example">{{ msg }}</div> <div class="example">{{ msg }}</div>
</template> </template>
<script> <script>
export default { export default {
data () { data() {
return { return {
msg: 'Hello world!' msg: 'Hello world!'
} }

View File

@@ -25,6 +25,7 @@
"eslint": "5.2.0", "eslint": "5.2.0",
"eslint-plugin-lodash": "^6.0.0", "eslint-plugin-lodash": "^6.0.0",
"eslint-plugin-vue": "^6.0.0", "eslint-plugin-vue": "^6.0.0",
"eslint-plugin-you-dont-need-lodash-underscore": "^6.10.0",
"eventemitter3": "^1.2.0", "eventemitter3": "^1.2.0",
"exports-loader": "^0.7.0", "exports-loader": "^0.7.0",
"express": "^4.13.1", "express": "^4.13.1",
@@ -77,8 +78,8 @@
}, },
"scripts": { "scripts": {
"start": "node app.js", "start": "node app.js",
"lint": "eslint platform example src/**/*.{js,vue} openmct.js", "lint": "eslint platform example src --ext .js,.vue openmct.js",
"lint:fix": "eslint platform example src/**/*.{js,vue} openmct.js --fix", "lint:fix": "eslint platform example src --ext .js,.vue openmct.js --fix",
"build:prod": "cross-env NODE_ENV=production webpack", "build:prod": "cross-env NODE_ENV=production webpack",
"build:dev": "webpack", "build:dev": "webpack",
"build:watch": "webpack --watch", "build:watch": "webpack --watch",

View File

@@ -21,7 +21,7 @@
*****************************************************************************/ *****************************************************************************/
define( define(
['../../../../../src/api/objects/object-utils'], ['objectUtils'],
function (objectUtils) { function (objectUtils) {
/** /**

View File

@@ -26,7 +26,7 @@
* @namespace platform/containment * @namespace platform/containment
*/ */
define( define(
['../../../src/api/objects/object-utils'], ['objectUtils'],
function (objectUtils) { function (objectUtils) {
function PersistableCompositionPolicy(openmct) { function PersistableCompositionPolicy(openmct) {

View File

@@ -24,7 +24,7 @@
* Module defining ActionCapability. Created by vwoeltje on 11/10/14. * Module defining ActionCapability. Created by vwoeltje on 11/10/14.
*/ */
define( define(
['lodash'], [],
function (_) { function (_) {
/** /**
@@ -81,7 +81,7 @@ define(
baseContext = context || {}; baseContext = context || {};
} }
var actionContext = _.extend({}, baseContext); var actionContext = Object.assign({}, baseContext);
actionContext.domainObject = this.domainObject; actionContext.domainObject = this.domainObject;
return this.actionService.getActions(actionContext); return this.actionService.getActions(actionContext);

View File

@@ -121,7 +121,7 @@ define(['lodash'], function (_) {
*/ */
ExportAsJSONAction.prototype.rewriteLink = function (child, parent) { ExportAsJSONAction.prototype.rewriteLink = function (child, parent) {
this.externalIdentifiers.push(this.getId(child)); this.externalIdentifiers.push(this.getId(child));
var index = _.findIndex(parent.composition, function (id) { var index = parent.composition.findIndex(function (id) {
return _.isEqual(child.identifier, id); return _.isEqual(child.identifier, id);
}); });
var copyOfChild = this.copyObject(child); var copyOfChild = this.copyObject(child);

View File

@@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
define(['zepto', '../../../../src/api/objects/object-utils.js'], function ($, objectUtils) { define(['zepto', 'objectUtils'], function ($, objectUtils) {
/** /**
* The ImportAsJSONAction is available from context menus and allows a user * The ImportAsJSONAction is available from context menus and allows a user

View File

@@ -25,8 +25,7 @@
* Module defining GenericSearchProvider. Created by shale on 07/16/2015. * Module defining GenericSearchProvider. Created by shale on 07/16/2015.
*/ */
define([ define([
'../../../../src/api/objects/object-utils', 'objectUtils'
'lodash'
], function ( ], function (
objectUtils, objectUtils,
_ _
@@ -191,9 +190,7 @@ define([
} }
var domainObject = objectUtils.toNewFormat(model, id); var domainObject = objectUtils.toNewFormat(model, id);
var composition = _.find(this.openmct.composition.registry, function (p) { var composition = this.openmct.composition.registry.find(p => p.appliesTo(domainObject));
return p.appliesTo(domainObject);
});
if (!composition) { if (!composition) {
return; return;

View File

@@ -25,11 +25,12 @@
*/ */
define( define(
[ [
'../../../src/api/objects/object-utils' 'objectUtils',
'arrayUtils'
], ],
function ( function (
objectUtils, objectUtils,
_ arrayUtils
) { ) {
var ZERO = function () { var ZERO = function () {
@@ -234,8 +235,7 @@ define(
var defaultRange = metadata.valuesForHints(['range'])[0]; var defaultRange = metadata.valuesForHints(['range'])[0];
defaultRange = defaultRange ? defaultRange.key : undefined; defaultRange = defaultRange ? defaultRange.key : undefined;
const keyBy = (array, k) => (array || []).reduce((r, x) => ({ ...r, [k ? x[k] : x]: x }), {}); const sourceMap = arrayUtils.keyBy(metadata.values(), 'key');
var sourceMap = keyBy(metadata.values(), 'key');
var isLegacyProvider = telemetryAPI.findRequestProvider(domainObject) === var isLegacyProvider = telemetryAPI.findRequestProvider(domainObject) ===
telemetryAPI.legacyProvider; telemetryAPI.legacyProvider;
@@ -300,8 +300,7 @@ define(
var defaultRange = metadata.valuesForHints(['range'])[0]; var defaultRange = metadata.valuesForHints(['range'])[0];
defaultRange = defaultRange ? defaultRange.key : undefined; defaultRange = defaultRange ? defaultRange.key : undefined;
const keyBy = (array, k) => (array || []).reduce((r, x) => ({ ...r, [k ? x[k] : x]: x }), {}); const sourceMap = arrayUtils.keyBy(metadata.values(), 'key');
var sourceMap = keyBy(metadata.values(), 'key');
var isLegacyProvider = telemetryAPI.findSubscriptionProvider(domainObject) === var isLegacyProvider = telemetryAPI.findSubscriptionProvider(domainObject) ===
telemetryAPI.legacyProvider; telemetryAPI.legacyProvider;

View File

@@ -21,7 +21,7 @@
*****************************************************************************/ *****************************************************************************/
define([ define([
'../../api/objects/object-utils' 'objectUtils'
], function (objectUtils) { ], function (objectUtils) {
function ActionDialogDecorator(mct, actionService) { function ActionDialogDecorator(mct, actionService) {
this.mct = mct; this.mct = mct;

View File

@@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
define(['../../api/objects/object-utils'], function (objectUtils) { define(['objectUtils'], function (objectUtils) {
function AdapterCapability(domainObject) { function AdapterCapability(domainObject) {
this.domainObject = domainObject; this.domainObject = domainObject;
} }

View File

@@ -24,7 +24,7 @@
* Module defining AlternateCompositionCapability. Created by vwoeltje on 11/7/14. * Module defining AlternateCompositionCapability. Created by vwoeltje on 11/7/14.
*/ */
define([ define([
'../../api/objects/object-utils', 'objectUtils',
'../../../platform/core/src/capabilities/ContextualDomainObject' '../../../platform/core/src/capabilities/ContextualDomainObject'
], function (objectUtils, ContextualDomainObject) { ], function (objectUtils, ContextualDomainObject) {
function AlternateCompositionCapability($injector, domainObject) { function AlternateCompositionCapability($injector, domainObject) {

View File

@@ -22,7 +22,7 @@
define([ define([
'../capabilities/AlternateCompositionCapability', '../capabilities/AlternateCompositionCapability',
'../../api/objects/object-utils' 'objectUtils'
], function ( ], function (
AlternateCompositionCapability, AlternateCompositionCapability,
objectUtils objectUtils

View File

@@ -21,9 +21,9 @@
*****************************************************************************/ *****************************************************************************/
define([ define([
'../../api/objects/object-utils' 'objectUtils'
], function ( ], function (
utils objectUtils
) { ) {
/** /**
* @implements module:openmct.TelemetryAPI~TelemetryProvider * @implements module:openmct.TelemetryAPI~TelemetryProvider
@@ -41,8 +41,8 @@ define([
* @see module:openmct.TelemetryAPI~TelemetryProvider#canProvideTelemetry * @see module:openmct.TelemetryAPI~TelemetryProvider#canProvideTelemetry
*/ */
LegacyTelemetryProvider.prototype.canProvideTelemetry = function (domainObject) { LegacyTelemetryProvider.prototype.canProvideTelemetry = function (domainObject) {
return this.instantiate(utils.toOldFormat(domainObject), return this.instantiate(objectUtils.toOldFormat(domainObject),
utils.makeKeyString(domainObject.identifier)).hasCapability("telemetry"); objectUtils.makeKeyString(domainObject.identifier)).hasCapability("telemetry");
}; };
LegacyTelemetryProvider.prototype.supportsRequest = LegacyTelemetryProvider.prototype.supportsRequest =
@@ -105,7 +105,7 @@ define([
*/ */
LegacyTelemetryProvider.prototype.request = function (domainObject, request) { LegacyTelemetryProvider.prototype.request = function (domainObject, request) {
var metadata = this.telemetryApi.getMetadata(domainObject); var metadata = this.telemetryApi.getMetadata(domainObject);
var oldObject = this.instantiate(utils.toOldFormat(domainObject), utils.makeKeyString(domainObject.identifier)); var oldObject = this.instantiate(objectUtils.toOldFormat(domainObject), objectUtils.makeKeyString(domainObject.identifier));
var capability = oldObject.getCapability("telemetry"); var capability = oldObject.getCapability("telemetry");
return capability.requestData(request).then(function (telemetrySeries) { return capability.requestData(request).then(function (telemetrySeries) {
@@ -131,7 +131,7 @@ define([
*/ */
LegacyTelemetryProvider.prototype.subscribe = function (domainObject, callback, request) { LegacyTelemetryProvider.prototype.subscribe = function (domainObject, callback, request) {
var metadata = this.telemetryApi.getMetadata(domainObject); var metadata = this.telemetryApi.getMetadata(domainObject);
var oldObject = this.instantiate(utils.toOldFormat(domainObject), utils.makeKeyString(domainObject.identifier)); var oldObject = this.instantiate(objectUtils.toOldFormat(domainObject), objectUtils.makeKeyString(domainObject.identifier));
var capability = oldObject.getCapability("telemetry"); var capability = oldObject.getCapability("telemetry");
function callbackWrapper(series) { function callbackWrapper(series) {
@@ -142,16 +142,16 @@ define([
LegacyTelemetryProvider.prototype.supportsLimits = function (domainObject) { LegacyTelemetryProvider.prototype.supportsLimits = function (domainObject) {
var oldObject = this.instantiate( var oldObject = this.instantiate(
utils.toOldFormat(domainObject), objectUtils.toOldFormat(domainObject),
utils.makeKeyString(domainObject.identifier) objectUtils.makeKeyString(domainObject.identifier)
); );
return oldObject.hasCapability("limit"); return oldObject.hasCapability("limit");
}; };
LegacyTelemetryProvider.prototype.getLimitEvaluator = function (domainObject) { LegacyTelemetryProvider.prototype.getLimitEvaluator = function (domainObject) {
var oldObject = this.instantiate( var oldObject = this.instantiate(
utils.toOldFormat(domainObject), objectUtils.toOldFormat(domainObject),
utils.makeKeyString(domainObject.identifier) objectUtils.makeKeyString(domainObject.identifier)
); );
var limitEvaluator = oldObject.getCapability("limit"); var limitEvaluator = oldObject.getCapability("limit");

View File

@@ -78,7 +78,7 @@ define([
}; };
TimeSettingsURLHandler.prototype.parseQueryParams = function () { TimeSettingsURLHandler.prototype.parseQueryParams = function () {
var searchParams = _.pick(this.$location.search(), _.values(SEARCH)); var searchParams = _.pick(this.$location.search(), Object.values(SEARCH));
var parsedParams = { var parsedParams = {
clock: searchParams[SEARCH.MODE], clock: searchParams[SEARCH.MODE],
timeSystem: searchParams[SEARCH.TIME_SYSTEM] timeSystem: searchParams[SEARCH.TIME_SYSTEM]

View File

@@ -21,9 +21,9 @@
*****************************************************************************/ *****************************************************************************/
define([ define([
'../../api/objects/object-utils' 'objectUtils'
], function ( ], function (
utils objectUtils
) { ) {
function ObjectServiceProvider(eventEmitter, objectService, instantiate, topic) { function ObjectServiceProvider(eventEmitter, objectService, instantiate, topic) {
this.eventEmitter = eventEmitter; this.eventEmitter = eventEmitter;
@@ -43,22 +43,22 @@ define([
var handleLegacyMutation; var handleLegacyMutation;
var handleMutation = function (newStyleObject) { var handleMutation = function (newStyleObject) {
var keyString = utils.makeKeyString(newStyleObject.identifier); var keyString = objectUtils.makeKeyString(newStyleObject.identifier);
var oldStyleObject = this.instantiate(utils.toOldFormat(newStyleObject), keyString); var oldStyleObject = this.instantiate(objectUtils.toOldFormat(newStyleObject), keyString);
// Don't trigger self // Don't trigger self
removeGeneralTopicListener(); removeGeneralTopicListener();
oldStyleObject.getCapability('mutation').mutate(function () { oldStyleObject.getCapability('mutation').mutate(function () {
return utils.toOldFormat(newStyleObject); return objectUtils.toOldFormat(newStyleObject);
}); });
removeGeneralTopicListener = this.generalTopic.listen(handleLegacyMutation); removeGeneralTopicListener = this.generalTopic.listen(handleLegacyMutation);
}.bind(this); }.bind(this);
handleLegacyMutation = function (legacyObject) { handleLegacyMutation = function (legacyObject) {
var newStyleObject = utils.toNewFormat(legacyObject.getModel(), legacyObject.getId()), var newStyleObject = objectUtils.toNewFormat(legacyObject.getModel(), legacyObject.getId()),
keystring = utils.makeKeyString(newStyleObject.identifier); keystring = objectUtils.makeKeyString(newStyleObject.identifier);
this.eventEmitter.emit(keystring + ":*", newStyleObject); this.eventEmitter.emit(keystring + ":*", newStyleObject);
this.eventEmitter.emit('mutation', newStyleObject); this.eventEmitter.emit('mutation', newStyleObject);
@@ -74,7 +74,7 @@ define([
return object.getCapability('persistence') return object.getCapability('persistence')
.persist() .persist()
.then(function () { .then(function () {
return utils.toNewFormat(object, key); return objectUtils.toNewFormat(object, key);
}); });
}; };
@@ -83,11 +83,11 @@ define([
}; };
ObjectServiceProvider.prototype.get = function (key) { ObjectServiceProvider.prototype.get = function (key) {
var keyString = utils.makeKeyString(key); var keyString = objectUtils.makeKeyString(key);
return this.objectService.getObjects([keyString]) return this.objectService.getObjects([keyString])
.then(function (results) { .then(function (results) {
var model = results[keyString].getModel(); var model = results[keyString].getModel();
return utils.toNewFormat(model, key); return objectUtils.toNewFormat(model, key);
}); });
}; };
@@ -99,10 +99,10 @@ define([
this.getObjects = function (keys) { this.getObjects = function (keys) {
var results = {}, var results = {},
promises = keys.map(function (keyString) { promises = keys.map(function (keyString) {
var key = utils.parseKeyString(keyString); var key = objectUtils.parseKeyString(keyString);
return openmct.objects.get(key) return openmct.objects.get(key)
.then(function (object) { .then(function (object) {
object = utils.toOldFormat(object); object = objectUtils.toOldFormat(object);
results[keyString] = instantiate(object, keyString); results[keyString] = instantiate(object, keyString);
}); });
}); });
@@ -123,7 +123,7 @@ define([
); );
ROOTS.forEach(function (r) { ROOTS.forEach(function (r) {
openmct.objects.addRoot(utils.parseKeyString(r.id)); openmct.objects.addRoot(objectUtils.parseKeyString(r.id));
}); });
return this; return this;

View File

@@ -21,7 +21,7 @@
*****************************************************************************/ *****************************************************************************/
define([ define([
'../../api/objects/object-utils' 'objectUtils'
], function ( ], function (
objectUtils objectUtils
) { ) {

View File

@@ -1,7 +1,7 @@
define([ define([
'./LegacyViewProvider', './LegacyViewProvider',
'./TypeInspectorViewProvider', './TypeInspectorViewProvider',
'../../api/objects/object-utils' 'objectUtils'
], function ( ], function (
LegacyViewProvider, LegacyViewProvider,
TypeInspectorViewProvider, TypeInspectorViewProvider,

View File

@@ -21,12 +21,10 @@
*****************************************************************************/ *****************************************************************************/
define([ define([
'lodash',
'EventEmitter', 'EventEmitter',
'./DefaultCompositionProvider', './DefaultCompositionProvider',
'./CompositionCollection' './CompositionCollection'
], function ( ], function (
_,
EventEmitter, EventEmitter,
DefaultCompositionProvider, DefaultCompositionProvider,
CompositionCollection CompositionCollection
@@ -70,9 +68,7 @@ define([
* @memberof module:openmct.CompositionAPI# * @memberof module:openmct.CompositionAPI#
*/ */
CompositionAPI.prototype.get = function (domainObject) { CompositionAPI.prototype.get = function (domainObject) {
var provider = _.find(this.registry, function (p) { var provider = this.registry.find(p => p.appliesTo(domainObject));
return p.appliesTo(domainObject);
});
if (!provider) { if (!provider) {
return; return;

View File

@@ -20,9 +20,7 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
define([ define([], function (
'lodash'
], function (
_ _
) { ) {
/** /**
@@ -122,7 +120,7 @@ define([
throw new Error('Event not supported by composition: ' + event); throw new Error('Event not supported by composition: ' + event);
} }
var index = _.findIndex(this.listeners[event], function (l) { var index = this.listeners[event].findIndex(function (l) {
return l.callback === callback && l.context === context; return l.callback === callback && l.context === context;
}); });

View File

@@ -22,7 +22,7 @@
define([ define([
'lodash', 'lodash',
'../objects/object-utils' 'objectUtils'
], function ( ], function (
_, _,
objectUtils objectUtils
@@ -143,7 +143,7 @@ define([
var keyString = objectUtils.makeKeyString(domainObject.identifier); var keyString = objectUtils.makeKeyString(domainObject.identifier);
var objectListeners = this.listeningTo[keyString]; var objectListeners = this.listeningTo[keyString];
var index = _.findIndex(objectListeners[event], function (l) { var index = objectListeners[event].findIndex(function (l) {
return l.callback === callback && l.context === context; return l.callback === callback && l.context === context;
}); });

View File

@@ -20,11 +20,9 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
define([ define([
'./SimpleIndicator', './SimpleIndicator'
'lodash'
], function ( ], function (
SimpleIndicator, SimpleIndicator
_
) { ) {
function IndicatorAPI(openmct) { function IndicatorAPI(openmct) {
this.openmct = openmct; this.openmct = openmct;

View File

@@ -21,10 +21,10 @@
*****************************************************************************/ *****************************************************************************/
define([ define([
'./object-utils.js', 'objectUtils',
'lodash' 'lodash'
], function ( ], function (
utils, objectUtils,
_ _
) { ) {
var ANY_OBJECT_EVENT = "mutation"; var ANY_OBJECT_EVENT = "mutation";
@@ -43,7 +43,7 @@ define([
} }
function qualifiedEventName(object, eventName) { function qualifiedEventName(object, eventName) {
var keystring = utils.makeKeyString(object.identifier); var keystring = objectUtils.makeKeyString(object.identifier);
return [keystring, eventName].join(':'); return [keystring, eventName].join(':');
} }

View File

@@ -21,15 +21,13 @@
*****************************************************************************/ *****************************************************************************/
define([ define([
'lodash', 'objectUtils',
'./object-utils',
'./MutableObject', './MutableObject',
'./RootRegistry', './RootRegistry',
'./RootObjectProvider', './RootObjectProvider',
'EventEmitter' 'EventEmitter'
], function ( ], function (
_, objectUtils,
utils,
MutableObject, MutableObject,
RootRegistry, RootRegistry,
RootObjectProvider, RootObjectProvider,
@@ -143,7 +141,7 @@ define([
* has been saved, or be rejected if it cannot be saved * has been saved, or be rejected if it cannot be saved
*/ */
ObjectAPI.prototype.get = function (identifier) { ObjectAPI.prototype.get = function (identifier) {
identifier = utils.parseKeyString(identifier); identifier = objectUtils.parseKeyString(identifier);
var provider = this.getProvider(identifier); var provider = this.getProvider(identifier);
if (!provider) { if (!provider) {
@@ -212,7 +210,7 @@ define([
* @returns {string} A string representation of the given identifier, including namespace and key * @returns {string} A string representation of the given identifier, including namespace and key
*/ */
ObjectAPI.prototype.makeKeyString = function (identifier) { ObjectAPI.prototype.makeKeyString = function (identifier) {
return utils.makeKeyString(identifier); return objectUtils.makeKeyString(identifier);
}; };
/** /**
@@ -220,7 +218,7 @@ define([
* @param {module:openmct.ObjectAPI~Identifier[]} identifiers * @param {module:openmct.ObjectAPI~Identifier[]} identifiers
*/ */
ObjectAPI.prototype.areIdsEqual = function (...identifiers) { ObjectAPI.prototype.areIdsEqual = function (...identifiers) {
return identifiers.map(utils.parseKeyString) return identifiers.map(objectUtils.parseKeyString)
.every(identifier => { .every(identifier => {
return identifier === identifiers[0] || return identifier === identifiers[0] ||
(identifier.namespace === identifiers[0].namespace && (identifier.namespace === identifiers[0].namespace &&
@@ -234,7 +232,7 @@ define([
let location = domainObject.location; let location = domainObject.location;
if (location) { if (location) {
return this.getOriginalPath(utils.parseKeyString(location), path); return this.getOriginalPath(objectUtils.parseKeyString(location), path);
} else { } else {
return path; return path;
} }

View File

@@ -21,9 +21,11 @@
*****************************************************************************/ *****************************************************************************/
define([ define([
'lodash' 'lodash',
'arrayUtils'
], function ( ], function (
_ _,
arrayUtils
) { ) {
function RootRegistry() { function RootRegistry() {
@@ -35,7 +37,7 @@ define([
return provider(); return provider();
}); });
return Promise.all(promises) return Promise.all(promises)
.then(_.flatten); .then(arrayUtils.flatten);
}; };
function isKey(key) { function isKey(key) {
@@ -43,7 +45,7 @@ define([
} }
RootRegistry.prototype.addRoot = function (key) { RootRegistry.prototype.addRoot = function (key) {
if (isKey(key) || (_.isArray(key) && _.every(key, isKey))) { if (isKey(key) || (Array.isArray(key) && key.every(isKey))) {
this.providers.push(function () { this.providers.push(function () {
return key; return key;
}); });

View File

@@ -1,5 +1,5 @@
define([ define([
'../object-utils' 'objectUtils'
], function ( ], function (
objectUtils objectUtils
) { ) {

View File

@@ -85,7 +85,11 @@ define([
value: +e.value value: +e.value
}; };
}), 'e.value'); }), 'e.value');
valueMetadata.values = Object.entries(valueMetadata.enumerations).reduce((a, [key, {value}]) => {a [key] = value; return a}, []); valueMetadata.values = Object.entries(valueMetadata.enumerations)
.reduce((accumulator, [key, {value}]) => {
accumulator[key] = value;
return accumulator
}, []);
valueMetadata.max = Math.max(...valueMetadata.values); valueMetadata.max = Math.max(...valueMetadata.values);
valueMetadata.min = Math.min(...valueMetadata.values); valueMetadata.min = Math.min(...valueMetadata.values);
} }
@@ -103,7 +107,7 @@ define([
var metadata = domainObject.telemetry || {}; var metadata = domainObject.telemetry || {};
if (this.typeHasTelemetry(domainObject)) { if (this.typeHasTelemetry(domainObject)) {
var typeMetadata = this.typeService.getType(domainObject.type).typeDef.telemetry; var typeMetadata = this.typeService.getType(domainObject.type).typeDef.telemetry;
_.extend(metadata, typeMetadata); Object.assign(metadata, typeMetadata);
if (!metadata.values) { if (!metadata.values) {
metadata.values = valueMetadatasFromOldFormat(metadata); metadata.values = valueMetadatasFromOldFormat(metadata);
} }

View File

@@ -24,7 +24,7 @@ define([
'./TelemetryMetadataManager', './TelemetryMetadataManager',
'./TelemetryValueFormatter', './TelemetryValueFormatter',
'./DefaultMetadataProvider', './DefaultMetadataProvider',
'../objects/object-utils', 'objectUtils',
'lodash' 'lodash'
], function ( ], function (
TelemetryMetadataManager, TelemetryMetadataManager,
@@ -370,7 +370,8 @@ define([
TelemetryAPI.prototype.commonValuesForHints = function (metadatas, hints) { TelemetryAPI.prototype.commonValuesForHints = function (metadatas, hints) {
var options = metadatas.map(function (metadata) { var options = metadatas.map(function (metadata) {
var values = metadata.valuesForHints(hints); var values = metadata.valuesForHints(hints);
return _.keyBy(values, 'key'); const keyBy = (array, key) => (array || []).reduce((r, x) => ({ ...r, [key ? x[key] : x]: x }), {});
return keyBy(values, 'key');
}).reduce(function (a, b) { }).reduce(function (a, b) {
var results = {}; var results = {};
Object.keys(a).forEach(function (key) { Object.keys(a).forEach(function (key) {

View File

@@ -57,13 +57,13 @@ define([
if (valueMetadata.format === 'enum') { if (valueMetadata.format === 'enum') {
if (!valueMetadata.values) { if (!valueMetadata.values) {
valueMetadata.values = Object.entries(valueMetadata.enumerations).reduce((a, [key, {value}]) => {a [key] = value; return a}, []); valueMetadata.enumerations.map(enumeration => enumeration.value);
} }
if (!valueMetadata.hasOwnProperty('max')) { if (!valueMetadata.hasOwnProperty('max')) {
valueMetadata.max = Math.max(...valueMetadata.values) + 1; valueMetadata.max = _.max(valueMetadata.values) + 1;
} }
if (!valueMetadata.hasOwnProperty('min')) { if (!valueMetadata.hasOwnProperty('min')) {
valueMetadata.min = Math.min(...valueMetadata.values) - 1; valueMetadata.min = _.max(valueMetadata.values) + 1;
} }
} }

View File

@@ -0,0 +1,46 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* Retired lodash methods */
// keyBy for array only
export const keyBy = (array, key) => (array || []).reduce((acc, curr) => {
return { ...acc, [curr[key]]: curr };
}, {});
// flattens array a single level deep.
export const flatten = array => array.reduce((acc, curr) => {
return acc.concat(curr);
}, []);
// recursively flatten deeper arrays
export const flattenDeep = array => {
return array.reduce((acc, curr) => {
return Array.isArray(curr) ? acc.concat(flattenDeep(curr)) : acc.concat(curr);
}, []);
};
// checks if value is an empty object or collection - does not support evaluating a Set or a Map
export const isEmpty = (obj => {
return [Object, Array].includes((obj || {}).constructor)
&& !Object.entries((obj || {})).length;
});

View File

@@ -0,0 +1,131 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
import { keyBy, flatten, flattenDeep, isEmpty } from 'arrayUtils';
const getArrayDepth = (obj => {
if (Array.isArray(obj)) {
return 1 + Math.max(...obj.map(t => getArrayDepth(t)));
} else {
return 0;
}
});
describe("The keyBy method", function () {
const input = [
{
"key":"name",
"name":"Name",
"source":"name",
"hints":
{
"priority": 0
}
},
{
"key":"utc",
"name":"Timestamp",
"format":"utc",
"hints":
{
"domain": 1,
"priority": 1
},
"source":"utc"
},
{
"key":"message",
"name":"Message",
"format":"string",
"hints":
{
"range": 0,
"priority": 2
},
"source":"message"
}
];
const output = keyBy(input, 'key');
it('returns an object', () => {
expect(typeof output).toEqual('object');
});
describe("returns an object", function () {
it('with the input key values as key names', () => {
expect(Object.keys(output)).toEqual(input.map(obj => obj.key));
});
it('with the input array objects as as properties of the name keys', () => {
expect(Object.values(output)).toEqual(input);
});
});
});
describe("The flatten method", function () {
it('returns a flat array', () => {
expect(getArrayDepth(flatten([[1,2,3]]))).toEqual(1);
});
it('fails to return a flat array when passed an array deeper than two levels', () => {
expect(getArrayDepth(flatten([[[1,2,3]]]))).not.toEqual(1);
});
});
describe("The flattenDeep method", function () {
it('returns a flat array when passed an array deeper than two levels', () => {
expect(getArrayDepth(flattenDeep([[[1,[2,3]]]]))).toEqual(1);
});
});
describe("The isEmpty method", function () {
it('returns true when passed an empty array', () => {
expect(isEmpty([])).toBeTrue();
});
it('returns false when passed a non-empty array', () => {
expect(isEmpty([1,2,3])).not.toBeTrue();
});
it('returns true when passed an empty object', () => {
expect(isEmpty({})).toBeTrue();
});
it('returns false when passed a non-empty object', () => {
expect(isEmpty({1:1})).not.toBeTrue();
});
it('returns false when passed a Set', () => {
expect(isEmpty(new Set())).not.toBeTrue();
});
it('returns false when passed a Map', () => {
expect(isEmpty(new Map())).not.toBeTrue();
});
});

View File

@@ -75,7 +75,7 @@ export default {
this.items.push(item); this.items.push(item);
}, },
removeItem(identifier) { removeItem(identifier) {
let index = _.findIndex(this.items, (item) => this.openmct.objects.makeKeyString(identifier) === item.key); let index = this.items.findIndex(item => this.openmct.objects.makeKeyString(identifier) === item.key);
this.items.splice(index, 1); this.items.splice(index, 1);
}, },

View File

@@ -102,7 +102,7 @@ export default {
this.compositions.push({composition, addCallback, removeCallback}); this.compositions.push({composition, addCallback, removeCallback});
}, },
removePrimary(identifier) { removePrimary(identifier) {
let index = _.findIndex(this.primaryTelemetryObjects, (primary) => this.openmct.objects.makeKeyString(identifier) === primary.key), let index = this.primaryTelemetryObjects.findIndex(primary => this.openmct.objects.makeKeyString(identifier) === primary.key),
primary = this.primaryTelemetryObjects[index]; primary = this.primaryTelemetryObjects[index];
this.$set(this.secondaryTelemetryObjects, primary.key, undefined); this.$set(this.secondaryTelemetryObjects, primary.key, undefined);
@@ -130,7 +130,7 @@ export default {
removeSecondary(primary) { removeSecondary(primary) {
return (identifier) => { return (identifier) => {
let array = this.secondaryTelemetryObjects[primary.key], let array = this.secondaryTelemetryObjects[primary.key],
index = _.findIndex(array, (secondary) => this.openmct.objects.makeKeyString(identifier) === secondary.key); index = array.findIndex(secondary => this.openmct.objects.makeKeyString(identifier) === secondary.key);
array.splice(index, 1); array.splice(index, 1);

View File

@@ -204,7 +204,7 @@ export default class ConditionClass extends EventEmitter {
let latestTimestamp; let latestTimestamp;
let criteriaResults = {}; let criteriaResults = {};
const criteriaRequests = this.criteria const criteriaRequests = this.criteria
.map(criterion => criterion.requestLAD({telemetryObjects: this.conditionManager.telemetryObjects})); .map(criterion => criterion.requestLAD(this.conditionManager.telemetryObjects));
return Promise.all(criteriaRequests) return Promise.all(criteriaRequests)
.then(results => { .then(results => {

View File

@@ -55,7 +55,7 @@ export default class ConditionManager extends EventEmitter {
this.telemetryObjects[id] = Object.assign({}, endpoint, {telemetryMetaData: this.openmct.telemetry.getMetadata(endpoint).valueMetadatas}); this.telemetryObjects[id] = Object.assign({}, endpoint, {telemetryMetaData: this.openmct.telemetry.getMetadata(endpoint).valueMetadatas});
this.subscriptions[id] = this.openmct.telemetry.subscribe( this.subscriptions[id] = this.openmct.telemetry.subscribe(
endpoint, endpoint,
this.telemetryReceived.bind(this, id) this.telemetryReceived.bind(this, endpoint)
); );
this.updateConditionTelemetry(); this.updateConditionTelemetry();
} }
@@ -258,9 +258,13 @@ export default class ConditionManager extends EventEmitter {
this.openmct.time.timeSystem() this.openmct.time.timeSystem()
); );
}); });
const currentCondition = this.getCurrentConditionLAD(conditionResults);
return Object.assign( if (!Object.values(latestTimestamp).some(timeSystem => timeSystem)) {
return [];
}
const currentCondition = this.getCurrentConditionLAD(conditionResults);
const currentOutput = Object.assign(
{ {
output: currentCondition.configuration.output, output: currentCondition.configuration.output,
id: this.conditionSetDomainObject.identifier, id: this.conditionSetDomainObject.identifier,
@@ -268,11 +272,15 @@ export default class ConditionManager extends EventEmitter {
}, },
latestTimestamp latestTimestamp
); );
return [currentOutput];
}); });
}); });
} }
isTelemetryUsed(id) { isTelemetryUsed(endpoint) {
const id = this.openmct.objects.makeKeyString(endpoint.identifier);
for(const condition of this.conditionClassCollection) { for(const condition of this.conditionClassCollection) {
if (condition.isTelemetryUsed(id)) { if (condition.isTelemetryUsed(id)) {
return true; return true;
@@ -282,12 +290,12 @@ export default class ConditionManager extends EventEmitter {
return false; return false;
} }
telemetryReceived(id, datum) { telemetryReceived(endpoint, datum) {
if (!this.isTelemetryUsed(id)) { if (!this.isTelemetryUsed(endpoint)) {
return; return;
} }
const normalizedDatum = this.createNormalizedDatum(datum, id); const normalizedDatum = this.createNormalizedDatum(datum, endpoint);
const timeSystemKey = this.openmct.time.timeSystem().key; const timeSystemKey = this.openmct.time.timeSystem().key;
let timestamp = {}; let timestamp = {};
timestamp[timeSystemKey] = normalizedDatum[timeSystemKey]; timestamp[timeSystemKey] = normalizedDatum[timeSystemKey];
@@ -321,8 +329,11 @@ export default class ConditionManager extends EventEmitter {
return data; return data;
} }
createNormalizedDatum(telemetryDatum, id) { createNormalizedDatum(telemetryDatum, endpoint) {
const normalizedDatum = Object.values(this.telemetryObjects[id].telemetryMetaData).reduce((datum, metadatum) => { const id = this.openmct.objects.makeKeyString(endpoint.identifier);
const metadata = this.openmct.telemetry.getMetadata(endpoint).valueMetadatas;
const normalizedDatum = Object.values(metadata).reduce((datum, metadatum) => {
const testValue = this.getTestData(metadatum); const testValue = this.getTestData(metadatum);
const formatter = this.openmct.telemetry.getValueFormatter(metadatum); const formatter = this.openmct.telemetry.getValueFormatter(metadatum);
datum[metadatum.key] = testValue !== undefined ? formatter.parse(testValue) : formatter.parse(telemetryDatum[metadatum.source]); datum[metadatum.key] = testValue !== undefined ? formatter.parse(testValue) : formatter.parse(telemetryDatum[metadatum.source]);

View File

@@ -54,13 +54,22 @@ export default class ConditionSetMetadataProvider {
return { return {
values: this.getDomains().concat([ values: this.getDomains().concat([
{ {
name: 'Output', key: "state",
key: 'output', source: "output",
format: 'enum', name: "State",
format: "enum",
enumerations: enumerations, enumerations: enumerations,
hints: { hints: {
range: 1 range: 1
} }
},
{
key: "output",
name: "Value",
format: "string",
hints: {
range: 2
}
} }
]) ])
}; };

View File

@@ -45,7 +45,7 @@ export default class ConditionSetTelemetryProvider {
return conditionManager.requestLADConditionSetOutput() return conditionManager.requestLADConditionSetOutput()
.then(latestOutput => { .then(latestOutput => {
return latestOutput ? [latestOutput] : []; return latestOutput;
}); });
} }

View File

@@ -197,7 +197,7 @@ export default {
this.$emit('telemetryUpdated', this.telemetryObjs); this.$emit('telemetryUpdated', this.telemetryObjs);
}, },
removeTelemetryObject(identifier) { removeTelemetryObject(identifier) {
let index = _.findIndex(this.telemetryObjs, (obj) => { let index = this.telemetryObjs.findIndex(obj => {
let objId = this.openmct.objects.makeKeyString(obj.identifier); let objId = this.openmct.objects.makeKeyString(obj.identifier);
let id = this.openmct.objects.makeKeyString(identifier); let id = this.openmct.objects.makeKeyString(identifier);
return objId === id; return objId === id;

View File

@@ -105,7 +105,8 @@ import ConditionDescription from "@/plugins/condition/components/ConditionDescri
import ConditionError from "@/plugins/condition/components/ConditionError.vue"; import ConditionError from "@/plugins/condition/components/ConditionError.vue";
import Vue from 'vue'; import Vue from 'vue';
import PreviewAction from "@/ui/preview/PreviewAction.js"; import PreviewAction from "@/ui/preview/PreviewAction.js";
import {getApplicableStylesForItem} from "@/plugins/condition/utils/styleUtils"; import { getApplicableStylesForItem } from "@/plugins/condition/utils/styleUtils";
import { isEmpty } from 'arrayUtils';
export default { export default {
name: 'ConditionalStylesView', name: 'ConditionalStylesView',
@@ -273,7 +274,7 @@ export default {
delete domainObjectStyles[this.itemId].conditionSetIdentifier; delete domainObjectStyles[this.itemId].conditionSetIdentifier;
domainObjectStyles[this.itemId].styles = undefined; domainObjectStyles[this.itemId].styles = undefined;
delete domainObjectStyles[this.itemId].styles; delete domainObjectStyles[this.itemId].styles;
if (_.isEmpty(domainObjectStyles[this.itemId])) { if (isEmpty(domainObjectStyles[this.itemId])) {
delete domainObjectStyles[this.itemId]; delete domainObjectStyles[this.itemId];
} }
} else { } else {
@@ -282,7 +283,7 @@ export default {
domainObjectStyles.styles = undefined; domainObjectStyles.styles = undefined;
delete domainObjectStyles.styles; delete domainObjectStyles.styles;
} }
if (_.isEmpty(domainObjectStyles)) { if (isEmpty(domainObjectStyles)) {
domainObjectStyles = undefined; domainObjectStyles = undefined;
} }
@@ -313,7 +314,7 @@ export default {
delete domainObjectStyles[this.itemId]; delete domainObjectStyles[this.itemId];
} }
}); });
if (_.isEmpty(domainObjectStyles)) { if (isEmpty(domainObjectStyles)) {
domainObjectStyles = undefined; domainObjectStyles = undefined;
} }
this.persist(domainObjectStyles); this.persist(domainObjectStyles);

View File

@@ -50,6 +50,7 @@
import StyleEditor from "./StyleEditor.vue"; import StyleEditor from "./StyleEditor.vue";
import PreviewAction from "@/ui/preview/PreviewAction.js"; import PreviewAction from "@/ui/preview/PreviewAction.js";
import { getApplicableStylesForItem, getConsolidatedStyleValues, getConditionalStyleForItem } from "@/plugins/condition/utils/styleUtils"; import { getApplicableStylesForItem, getConsolidatedStyleValues, getConditionalStyleForItem } from "@/plugins/condition/utils/styleUtils";
import { isEmpty } from 'arrayUtils';
export default { export default {
name: 'MultiSelectStylesView', name: 'MultiSelectStylesView',
@@ -178,7 +179,7 @@ export default {
domainObjectStyles[itemId] = undefined; domainObjectStyles[itemId] = undefined;
delete domainObjectStyles[this.itemId]; delete domainObjectStyles[this.itemId];
if (_.isEmpty(domainObjectStyles)) { if (isEmpty(domainObjectStyles)) {
domainObjectStyles = undefined; domainObjectStyles = undefined;
} }
this.persist(this.domainObject, domainObjectStyles); this.persist(this.domainObject, domainObjectStyles);
@@ -239,7 +240,7 @@ export default {
if (this.isStaticAndConditionalStyles) { if (this.isStaticAndConditionalStyles) {
this.removeConditionalStyles(domainObjectStyles, item.id); this.removeConditionalStyles(domainObjectStyles, item.id);
} }
if (_.isEmpty(itemStaticStyle)) { if (isEmpty(itemStaticStyle)) {
itemStaticStyle = undefined; itemStaticStyle = undefined;
domainObjectStyles[item.id] = undefined; domainObjectStyles[item.id] = undefined;
} else { } else {

View File

@@ -22,6 +22,7 @@
import TelemetryCriterion from './TelemetryCriterion'; import TelemetryCriterion from './TelemetryCriterion';
import { evaluateResults } from "../utils/evaluator"; import { evaluateResults } from "../utils/evaluator";
import { getLatestTimestamp } from '../utils/time';
export default class AllTelemetryCriterion extends TelemetryCriterion { export default class AllTelemetryCriterion extends TelemetryCriterion {
@@ -107,40 +108,53 @@ export default class AllTelemetryCriterion extends TelemetryCriterion {
this.result = evaluateResults(Object.values(this.telemetryDataCache), this.telemetry); this.result = evaluateResults(Object.values(this.telemetryDataCache), this.telemetry);
} }
requestLAD(options) { requestLAD(telemetryObjects) {
options = Object.assign({}, const options = {
options,
{
strategy: 'latest', strategy: 'latest',
size: 1 size: 1
} };
);
if (!this.isValid()) { if (!this.isValid()) {
return this.formatData({}, options.telemetryObjects); return this.formatData({}, telemetryObjects);
} }
let keys = Object.keys(Object.assign({}, options.telemetryObjects)); let keys = Object.keys(Object.assign({}, telemetryObjects));
const telemetryRequests = keys const telemetryRequests = keys
.map(key => this.openmct.telemetry.request( .map(key => this.openmct.telemetry.request(
options.telemetryObjects[key], telemetryObjects[key],
options options
)); ));
let telemetryDataCache = {};
return Promise.all(telemetryRequests) return Promise.all(telemetryRequests)
.then(telemetryRequestsResults => { .then(telemetryRequestsResults => {
let latestDatum; let latestTimestamp;
const timeSystems = this.openmct.time.getAllTimeSystems();
const timeSystem = this.openmct.time.timeSystem();
telemetryRequestsResults.forEach((results, index) => { telemetryRequestsResults.forEach((results, index) => {
latestDatum = results.length ? results[results.length - 1] : {}; const latestDatum = results.length ? results[results.length - 1] : {};
if (index < telemetryRequestsResults.length-1) { const datumId = keys[index];
if (latestDatum) { const normalizedDatum = this.createNormalizedDatum(latestDatum, telemetryObjects[datumId]);
this.telemetryDataCache[latestDatum.id] = this.computeResult(latestDatum);
} telemetryDataCache[datumId] = this.computeResult(normalizedDatum);
}
latestTimestamp = getLatestTimestamp(
latestTimestamp,
normalizedDatum,
timeSystems,
timeSystem
);
}); });
const datum = {
result: evaluateResults(Object.values(telemetryDataCache), this.telemetry),
...latestTimestamp
};
return { return {
id: this.id, id: this.id,
data: this.formatData(latestDatum, options.telemetryObjects) data: datum
}; };
}); });
} }

View File

@@ -61,6 +61,21 @@ export default class TelemetryCriterion extends EventEmitter {
this.telemetryObject = telemetryObjects[this.telemetryObjectIdAsString]; this.telemetryObject = telemetryObjects[this.telemetryObjectIdAsString];
} }
createNormalizedDatum(telemetryDatum, endpoint) {
const id = this.openmct.objects.makeKeyString(endpoint.identifier);
const metadata = this.openmct.telemetry.getMetadata(endpoint).valueMetadatas;
const normalizedDatum = Object.values(metadata).reduce((datum, metadatum) => {
const formatter = this.openmct.telemetry.getValueFormatter(metadatum);
datum[metadatum.key] = formatter.parse(telemetryDatum[metadatum.source]);
return datum;
}, {});
normalizedDatum.id = id;
return normalizedDatum;
}
formatData(data) { formatData(data) {
const datum = { const datum = {
result: this.computeResult(data) result: this.computeResult(data)
@@ -79,14 +94,11 @@ export default class TelemetryCriterion extends EventEmitter {
this.result = this.computeResult(validatedData); this.result = this.computeResult(validatedData);
} }
requestLAD(options) { requestLAD() {
options = Object.assign({}, const options = {
options,
{
strategy: 'latest', strategy: 'latest',
size: 1 size: 1
} };
);
if (!this.isValid()) { if (!this.isValid()) {
return { return {
@@ -100,9 +112,11 @@ export default class TelemetryCriterion extends EventEmitter {
options options
).then(results => { ).then(results => {
const latestDatum = results.length ? results[results.length - 1] : {}; const latestDatum = results.length ? results[results.length - 1] : {};
const normalizedDatum = this.createNormalizedDatum(latestDatum, this.telemetryObject);
return { return {
id: this.id, id: this.id,
data: this.formatData(latestDatum) data: this.formatData(normalizedDatum)
}; };
}); });
} }

View File

@@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
import { createOpenMct } from "testTools"; import { createOpenMct } from "testUtils";
import ConditionPlugin from "./plugin"; import ConditionPlugin from "./plugin";
let openmct = createOpenMct(); let openmct = createOpenMct();

View File

@@ -20,8 +20,6 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
import _ from 'lodash';
const convertToNumbers = (input) => { const convertToNumbers = (input) => {
let numberInputs = []; let numberInputs = [];
input.forEach(inputValue => numberInputs.push(Number(inputValue))); input.forEach(inputValue => numberInputs.push(Number(inputValue)));
@@ -34,6 +32,10 @@ const convertToStrings = (input) => {
return stringInputs; return stringInputs;
}; };
const joinValues = (values, length) => {
return values.slice(0, length).join(', ');
};
export const OPERATIONS = [ export const OPERATIONS = [
{ {
name: 'equalTo', name: 'equalTo',
@@ -44,7 +46,7 @@ export const OPERATIONS = [
appliesTo: ['number'], appliesTo: ['number'],
inputCount: 1, inputCount: 1,
getDescription: function (values) { getDescription: function (values) {
return ' is ' + values.join(', '); return ' is ' + joinValues(values, 1);
} }
}, },
{ {
@@ -56,7 +58,7 @@ export const OPERATIONS = [
appliesTo: ['number'], appliesTo: ['number'],
inputCount: 1, inputCount: 1,
getDescription: function (values) { getDescription: function (values) {
return ' is not ' + values.join(', '); return ' is not ' + joinValues(values, 1);
} }
}, },
{ {
@@ -68,7 +70,7 @@ export const OPERATIONS = [
appliesTo: ['number'], appliesTo: ['number'],
inputCount: 1, inputCount: 1,
getDescription: function (values) { getDescription: function (values) {
return ' > ' + values.join(', '); return ' > ' + joinValues(values, 1);
} }
}, },
{ {
@@ -80,7 +82,7 @@ export const OPERATIONS = [
appliesTo: ['number'], appliesTo: ['number'],
inputCount: 1, inputCount: 1,
getDescription: function (values) { getDescription: function (values) {
return ' < ' + values.join(', '); return ' < ' + joinValues(values, 1);
} }
}, },
{ {
@@ -92,7 +94,7 @@ export const OPERATIONS = [
appliesTo: ['number'], appliesTo: ['number'],
inputCount: 1, inputCount: 1,
getDescription: function (values) { getDescription: function (values) {
return ' >= ' + values.join(', '); return ' >= ' + joinValues(values, 1);
} }
}, },
{ {
@@ -104,7 +106,7 @@ export const OPERATIONS = [
appliesTo: ['number'], appliesTo: ['number'],
inputCount: 1, inputCount: 1,
getDescription: function (values) { getDescription: function (values) {
return ' <= ' + values.join(', '); return ' <= ' + joinValues(values, 1);
} }
}, },
{ {
@@ -146,7 +148,7 @@ export const OPERATIONS = [
appliesTo: ['string'], appliesTo: ['string'],
inputCount: 1, inputCount: 1,
getDescription: function (values) { getDescription: function (values) {
return ' contains ' + values.join(', '); return ' contains ' + joinValues(values, 1);
} }
}, },
{ {
@@ -158,7 +160,7 @@ export const OPERATIONS = [
appliesTo: ['string'], appliesTo: ['string'],
inputCount: 1, inputCount: 1,
getDescription: function (values) { getDescription: function (values) {
return ' does not contain ' + values.join(', '); return ' does not contain ' + joinValues(values, 1);
} }
}, },
{ {
@@ -170,7 +172,7 @@ export const OPERATIONS = [
appliesTo: ['string'], appliesTo: ['string'],
inputCount: 1, inputCount: 1,
getDescription: function (values) { getDescription: function (values) {
return ' starts with ' + values.join(', '); return ' starts with ' + joinValues(values, 1);
} }
}, },
{ {
@@ -182,7 +184,7 @@ export const OPERATIONS = [
appliesTo: ['string'], appliesTo: ['string'],
inputCount: 1, inputCount: 1,
getDescription: function (values) { getDescription: function (values) {
return ' ends with ' + values.join(', '); return ' ends with ' + joinValues(values, 1);
} }
}, },
{ {
@@ -194,7 +196,7 @@ export const OPERATIONS = [
appliesTo: ['string'], appliesTo: ['string'],
inputCount: 1, inputCount: 1,
getDescription: function (values) { getDescription: function (values) {
return ' is exactly ' + values.join(', '); return ' is exactly ' + joinValues(values, 1);
} }
}, },
{ {
@@ -231,7 +233,7 @@ export const OPERATIONS = [
appliesTo: ['enum'], appliesTo: ['enum'],
inputCount: 1, inputCount: 1,
getDescription: function (values) { getDescription: function (values) {
return ' is ' + values.join(', '); return ' is ' + joinValues(values, 1);
} }
}, },
{ {
@@ -244,7 +246,7 @@ export const OPERATIONS = [
appliesTo: ['enum'], appliesTo: ['enum'],
inputCount: 1, inputCount: 1,
getDescription: function (values) { getDescription: function (values) {
return ' is not ' + values.join(', '); return ' is not ' + joinValues(values, 1);
} }
}, },
{ {
@@ -253,7 +255,7 @@ export const OPERATIONS = [
const lhsValue = input[0] !== undefined ? input[0].toString() : ''; const lhsValue = input[0] !== undefined ? input[0].toString() : '';
if (input[1]) { if (input[1]) {
const values = input[1].split(','); const values = input[1].split(',');
return values.find((value) => lhsValue === _.trim(value.toString())); return values.find((value) => lhsValue === value.toString().trim());
} }
return false; return false;
}, },
@@ -270,7 +272,7 @@ export const OPERATIONS = [
const lhsValue = input[0] !== undefined ? input[0].toString() : ''; const lhsValue = input[0] !== undefined ? input[0].toString() : '';
if (input[1]) { if (input[1]) {
const values = input[1].split(','); const values = input[1].split(',');
const found = values.find((value) => lhsValue === _.trim(value.toString())); const found = values.find((value) => lhsValue === value.toString().trim());
return !found; return !found;
} }
return false; return false;

View File

@@ -19,6 +19,8 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
import { isEmpty } from 'arrayUtils';
const NONE_VALUE = '__no_value'; const NONE_VALUE = '__no_value';
const styleProps = { const styleProps = {
@@ -154,7 +156,7 @@ export const getApplicableStylesForItem = (domainObject, item) => {
}; };
export const getStylesWithoutNoneValue = (style) => { export const getStylesWithoutNoneValue = (style) => {
if (_.isEmpty(style) || !style) { if (isEmpty(style) || !style) {
return; return;
} }
let styleObj = {}; let styleObj = {};

View File

@@ -20,7 +20,11 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
define(['lodash'], function (_) { define([
'arrayUtils'
], function (
arrayUtils
) {
function DisplayLayoutToolbar(openmct) { function DisplayLayoutToolbar(openmct) {
return { return {
name: "Display Layout Toolbar", name: "Display Layout Toolbar",
@@ -559,7 +563,7 @@ define(['lodash'], function (_) {
}); });
let toolbarArray = Object.values(toolbar); let toolbarArray = Object.values(toolbar);
return _.flatten(toolbarArray.reduce((accumulator, group, index) => { return arrayUtils.flatten(toolbarArray.reduce((accumulator, group, index) => {
group = group.filter(control => control !== undefined); group = group.filter(control => control !== undefined);
if (group.length > 0) { if (group.length > 0) {

View File

@@ -76,6 +76,7 @@ import TextView from './TextView.vue'
import LineView from './LineView.vue' import LineView from './LineView.vue'
import ImageView from './ImageView.vue' import ImageView from './ImageView.vue'
import EditMarquee from './EditMarquee.vue' import EditMarquee from './EditMarquee.vue'
import _ from 'lodash';
const ITEM_TYPE_VIEW_MAP = { const ITEM_TYPE_VIEW_MAP = {
'subobject-view': SubobjectView, 'subobject-view': SubobjectView,
@@ -512,7 +513,7 @@ export default {
} }
}, },
updateTelemetryFormat(item, format) { updateTelemetryFormat(item, format) {
let index = _.findIndex(this.layoutItems, item); let index = this.layoutItems.findIndex(item);
item.format = format; item.format = format;
this.mutate(`configuration.items[${index}]`, item); this.mutate(`configuration.items[${index}]`, item);
} }

View File

@@ -40,6 +40,7 @@
<script> <script>
import LayoutDrag from './../LayoutDrag' import LayoutDrag from './../LayoutDrag'
import _ from 'lodash'
export default { export default {
inject: ['openmct'], inject: ['openmct'],

View File

@@ -62,6 +62,7 @@
<script> <script>
import conditionalStylesMixin from "../mixins/objectStyles-mixin"; import conditionalStylesMixin from "../mixins/objectStyles-mixin";
import _ from 'lodash';
const START_HANDLE_QUADRANTS = { const START_HANDLE_QUADRANTS = {
1: 'c-frame-edit__handle--sw', 1: 'c-frame-edit__handle--sw',

View File

@@ -22,7 +22,7 @@
import Layout from './components/DisplayLayout.vue' import Layout from './components/DisplayLayout.vue'
import Vue from 'vue' import Vue from 'vue'
import objectUtils from '../../api/objects/object-utils.js' import objectUtils from 'objectUtils'
import DisplayLayoutType from './DisplayLayoutType.js' import DisplayLayoutType from './DisplayLayoutType.js'
import DisplayLayoutToolbar from './DisplayLayoutToolbar.js' import DisplayLayoutToolbar from './DisplayLayoutToolbar.js'
import AlphaNumericFormatViewProvider from './AlphanumericFormatViewProvider.js' import AlphaNumericFormatViewProvider from './AlphanumericFormatViewProvider.js'

View File

@@ -62,6 +62,7 @@
<script> <script>
import FilterField from './FilterField.vue'; import FilterField from './FilterField.vue';
import ToggleSwitch from '../../../ui/components/ToggleSwitch.vue'; import ToggleSwitch from '../../../ui/components/ToggleSwitch.vue';
import { isEmpty } from 'arrayUtils';
export default { export default {
inject: ['openmct'], inject: ['openmct'],
@@ -102,7 +103,7 @@ export default {
hasActiveFilters() { hasActiveFilters() {
// Should be true when the user has entered any filter values. // Should be true when the user has entered any filter values.
return Object.values(this.persistedFilters).some(comparator => { return Object.values(this.persistedFilters).some(comparator => {
return (typeof(comparator) === 'object' && !_.isEmpty(comparator)); return (typeof(comparator) === 'object' && !isEmpty(comparator));
}); });
} }
}, },

View File

@@ -28,6 +28,8 @@
<script> <script>
import FilterObject from './FilterObject.vue'; import FilterObject from './FilterObject.vue';
import GlobalFilters from './GlobalFilters.vue' import GlobalFilters from './GlobalFilters.vue'
import { isEmpty } from 'arrayUtils';
import _ from 'lodash';
const FILTER_VIEW_TITLE = 'Filters applied'; const FILTER_VIEW_TITLE = 'Filters applied';
const FILTER_VIEW_TITLE_MIXED = 'Mixed filters applied'; const FILTER_VIEW_TITLE_MIXED = 'Mixed filters applied';
@@ -58,7 +60,7 @@ export default {
// Should be true when the user has entered any filter values. // Should be true when the user has entered any filter values.
return Object.values(this.persistedFilters).some(filters => { return Object.values(this.persistedFilters).some(filters => {
return Object.values(filters).some(comparator => { return Object.values(filters).some(comparator => {
return (typeof(comparator) === 'object' && !_.isEmpty(comparator)); return (typeof(comparator) === 'object' && !isEmpty(comparator));
}); });
}); });
}, },

View File

@@ -64,6 +64,7 @@
<script> <script>
import compositionLoader from './composition-loader'; import compositionLoader from './composition-loader';
import ListItem from './ListItem.vue'; import ListItem from './ListItem.vue';
import _ from 'lodash';
export default { export default {
components: {ListItem}, components: {ListItem},

View File

@@ -111,7 +111,7 @@ import SearchResults from './search-results.vue';
import Sidebar from './sidebar.vue'; import Sidebar from './sidebar.vue';
import { clearDefaultNotebook, getDefaultNotebook, setDefaultNotebook, setDefaultNotebookSection, setDefaultNotebookPage } from '../utils/notebook-storage'; import { clearDefaultNotebook, getDefaultNotebook, setDefaultNotebook, setDefaultNotebookSection, setDefaultNotebookPage } from '../utils/notebook-storage';
import { addNotebookEntry, createNewEmbed, getNotebookEntries } from '../utils/notebook-entries'; import { addNotebookEntry, createNewEmbed, getNotebookEntries } from '../utils/notebook-entries';
import { throttle } from 'lodash'; import _ from 'lodash';
const DEFAULT_CLASS = 'is-notebook-default'; const DEFAULT_CLASS = 'is-notebook-default';
@@ -175,7 +175,7 @@ export default {
watch: { watch: {
}, },
beforeMount() { beforeMount() {
this.throttledSearchItem = throttle(this.searchItem, 500); this.throttledSearchItem = _.throttle(this.searchItem, 500);
}, },
mounted() { mounted() {
this.unlisten = this.openmct.objects.observe(this.internalDomainObject, '*', this.updateInternalDomainObject); this.unlisten = this.openmct.objects.observe(this.internalDomainObject, '*', this.updateInternalDomainObject);

View File

@@ -30,8 +30,7 @@ define([
'./MCTChartPointSet', './MCTChartPointSet',
'./MCTChartAlarmPointSet', './MCTChartAlarmPointSet',
'../draw/DrawLoader', '../draw/DrawLoader',
'../lib/eventHelpers', '../lib/eventHelpers'
'lodash'
], ],
function ( function (
MCTChartLineLinear, MCTChartLineLinear,
@@ -39,8 +38,7 @@ function (
MCTChartPointSet, MCTChartPointSet,
MCTChartAlarmPointSet, MCTChartAlarmPointSet,
DrawLoader, DrawLoader,
eventHelpers, eventHelpers
_
) { ) {
var MARKER_SIZE = 6.0, var MARKER_SIZE = 6.0,
@@ -152,7 +150,7 @@ function (
MCTChartController.prototype.destroy = function () { MCTChartController.prototype.destroy = function () {
this.isDestroyed = true; this.isDestroyed = true;
this.stopListening(); this.stopListening();
this.lines.map(line => line.destroy()); this.lines.forEach(line => line.destroy());
DrawLoader.releaseDrawAPI(this.drawAPI); DrawLoader.releaseDrawAPI(this.drawAPI);
}; };

View File

@@ -22,13 +22,11 @@
/*global define*/ /*global define*/
define([ define([
'lodash',
'EventEmitter', 'EventEmitter',
'./Model', './Model',
'../lib/extend', '../lib/extend',
'../lib/eventHelpers' '../lib/eventHelpers'
], function ( ], function (
_,
EventEmitter, EventEmitter,
Model, Model,
extend, extend,
@@ -44,7 +42,7 @@ define([
this.initialize(options); this.initialize(options);
} }
_.extend(Collection.prototype, EventEmitter.prototype); Object.assign(Collection.prototype, EventEmitter.prototype);
eventHelpers.extend(Collection.prototype); eventHelpers.extend(Collection.prototype);
Collection.extend = extend; Collection.extend = extend;
@@ -105,12 +103,7 @@ define([
}; };
Collection.prototype.indexOf = function (model) { Collection.prototype.indexOf = function (model) {
return _.findIndex( return this.models.findIndex(m => m === model);
this.models,
function (m) {
return m === model;
}
);
}; };
Collection.prototype.remove = function (model) { Collection.prototype.remove = function (model) {

View File

@@ -49,7 +49,7 @@ define([
this.initialize(options); this.initialize(options);
} }
_.extend(Model.prototype, EventEmitter.prototype); Object.assign(Model.prototype, EventEmitter.prototype);
eventHelpers.extend(Model.prototype); eventHelpers.extend(Model.prototype);
Model.extend = extend; Model.extend = extend;

View File

@@ -146,7 +146,7 @@ define([
strategy = 'minmax'; strategy = 'minmax';
} }
options = _.extend({}, { size: 1000, strategy, filters: this.filters }, options || {}); options = Object.assign({}, { size: 1000, strategy, filters: this.filters }, options || {});
if (!this.unsubscribe) { if (!this.unsubscribe) {
this.unsubscribe = this.openmct this.unsubscribe = this.openmct
@@ -270,7 +270,7 @@ define([
* @private * @private
*/ */
sortedIndex: function (point) { sortedIndex: function (point) {
return _.sortedIndex(this.data, point, this.getXVal); return _.sortedIndexBy(this.data, point, this.getXVal);
}, },
/** /**
* Update min/max stats for the series. * Update min/max stats for the series.

View File

@@ -101,13 +101,10 @@ define([
var plotObject = this.plot.get('domainObject'); var plotObject = this.plot.get('domainObject');
if (plotObject.type === 'telemetry.plot.overlay') { if (plotObject.type === 'telemetry.plot.overlay') {
var persistedIndex = _.findIndex(plotObject.configuration.series, function (s) { var persistedIndex = plotObject.configuration.series.findIndex(s => _.isEqual(identifier, s.identifier));
return _.isEqual(identifier, s.identifier);
});
var configIndex = _.findIndex(this.models, function (m) {
return _.isEqual(m.domainObject.identifier, identifier); var configIndex = this.models.findIndex(m => _.isEqual(m.domainObject.identifier, identifier));
});
/* /*
when cancelling out of edit mode, the config store and domain object are out of sync when cancelling out of edit mode, the config store and domain object are out of sync

View File

@@ -22,11 +22,9 @@
define([ define([
'lodash',
'EventEmitter', 'EventEmitter',
'../lib/eventHelpers' '../lib/eventHelpers'
], function ( ], function (
_,
EventEmitter, EventEmitter,
eventHelpers eventHelpers
) { ) {
@@ -51,7 +49,7 @@ define([
} }
} }
_.extend(Draw2D.prototype, EventEmitter.prototype); Object.assign(Draw2D.prototype, EventEmitter.prototype);
eventHelpers.extend(Draw2D.prototype); eventHelpers.extend(Draw2D.prototype);
// Convert from logical to physical x coordinates // Convert from logical to physical x coordinates

View File

@@ -22,11 +22,9 @@
define([ define([
'lodash',
'EventEmitter', 'EventEmitter',
'../lib/eventHelpers' '../lib/eventHelpers'
], function ( ], function (
_,
EventEmitter, EventEmitter,
eventHelpers eventHelpers
) { ) {
@@ -78,7 +76,7 @@ define([
this.listenTo(this.canvas, "webglcontextlost", this.onContextLost, this); this.listenTo(this.canvas, "webglcontextlost", this.onContextLost, this);
} }
_.extend(DrawWebGL.prototype, EventEmitter.prototype); Object.assign(DrawWebGL.prototype, EventEmitter.prototype);
eventHelpers.extend(DrawWebGL.prototype); eventHelpers.extend(DrawWebGL.prototype);
DrawWebGL.prototype.onContextLost = function (event) { DrawWebGL.prototype.onContextLost = function (event) {

View File

@@ -22,14 +22,10 @@
define([ define([
'../configuration/configStore', '../configuration/configStore',
'../lib/eventHelpers', '../lib/eventHelpers'
'../../../../api/objects/object-utils',
'lodash'
], function ( ], function (
configStore, configStore,
eventHelpers, eventHelpers
objectUtils,
_
) { ) {
function PlotOptionsController($scope, openmct, $timeout) { function PlotOptionsController($scope, openmct, $timeout) {

View File

@@ -31,9 +31,7 @@ define([
function dynamicPathForKey(key) { function dynamicPathForKey(key) {
return function (object, model) { return function (object, model) {
var modelIdentifier = model.get('identifier'); var modelIdentifier = model.get('identifier');
var index = _.findIndex(object.configuration.series, function (s) { var index = object.configuration.series.findIndex(s => _.isEqual(s.identifier, modelIdentifier));
return _.isEqual(s.identifier, modelIdentifier);
});
return 'configuration.series[' + index + '].' + key; return 'configuration.series[' + index + '].' + key;
}; };
} }

View File

@@ -21,8 +21,7 @@
*****************************************************************************/ *****************************************************************************/
define([ define([
'./PlotModelFormController', './PlotModelFormController'
'lodash'
], function ( ], function (
PlotModelFormController, PlotModelFormController,
_ _
@@ -73,10 +72,10 @@ define([
if (range.max === '' || range.max === null || typeof range.max === 'undefined') { if (range.max === '' || range.max === null || typeof range.max === 'undefined') {
return 'Must specify Maximum'; return 'Must specify Maximum';
} }
if (_.isNaN(Number(range.min))) { if (Number.isNaN(range.min)) {
return 'Minimum must be a number.'; return 'Minimum must be a number.';
} }
if (_.isNaN(Number(range.max))) { if (Number.isNaN(range.max)) {
return 'Maximum must be a number.'; return 'Maximum must be a number.';
} }
if (Number(range.min) > Number(range.max)) { if (Number(range.min) > Number(range.max)) {

View File

@@ -1,5 +1,5 @@
define([ define([
'../../api/objects/object-utils' 'objectUtils'
], function ( ], function (
objectUtils objectUtils
) { ) {

View File

@@ -1,12 +1,14 @@
define ([ define ([
'./ConditionEvaluator', './ConditionEvaluator',
'../../../api/objects/object-utils', 'objectUtils',
'arrayUtils',
'EventEmitter', 'EventEmitter',
'zepto', 'zepto',
'lodash' 'lodash'
], function ( ], function (
ConditionEvaluator, ConditionEvaluator,
objectUtils, objectUtils,
arrayUtils,
EventEmitter, EventEmitter,
$, $,
_ _
@@ -250,7 +252,7 @@ define ([
delete this.subscriptions[objectId]; delete this.subscriptions[objectId];
this.eventEmitter.emit('remove', identifier); this.eventEmitter.emit('remove', identifier);
if (_.isEmpty(this.compositionObjs)) { if (arrayUtils.isEmpty(this.compositionObjs)) {
$('.w-summary-widget').addClass('s-status-no-data'); $('.w-summary-widget').addClass('s-status-no-data');
} }
}; };

View File

@@ -5,8 +5,7 @@ define([
'./TestDataManager', './TestDataManager',
'./WidgetDnD', './WidgetDnD',
'./eventHelpers', './eventHelpers',
'../../../api/objects/object-utils', 'objectUtils',
'lodash',
'zepto' 'zepto'
], function ( ], function (
widgetTemplate, widgetTemplate,
@@ -16,7 +15,6 @@ define([
WidgetDnD, WidgetDnD,
eventHelpers, eventHelpers,
objectUtils, objectUtils,
_,
$ $
) { ) {

View File

@@ -1,6 +1,6 @@
define([ define([
'./Select', './Select',
'../../../../api/objects/object-utils' 'objectUtils'
], function ( ], function (
Select, Select,
objectUtils objectUtils

View File

@@ -22,7 +22,7 @@
define([ define([
'./SummaryWidgetEvaluator', './SummaryWidgetEvaluator',
'../../../../api/objects/object-utils' 'objectUtils'
], function ( ], function (
SummaryWidgetEvaluator, SummaryWidgetEvaluator,
objectUtils objectUtils

View File

@@ -23,7 +23,7 @@
define([ define([
'./SummaryWidgetRule', './SummaryWidgetRule',
'../eventHelpers', '../eventHelpers',
'../../../../api/objects/object-utils', 'objectUtils',
'lodash' 'lodash'
], function ( ], function (
SummaryWidgetRule, SummaryWidgetRule,
@@ -182,7 +182,7 @@ define([
* @private. * @private.
*/ */
SummaryWidgetEvaluator.prototype.updateObjectStateFromLAD = function (options, objectState) { SummaryWidgetEvaluator.prototype.updateObjectStateFromLAD = function (options, objectState) {
options = _.extend({}, options, { options = Object.assign({}, options, {
strategy: 'latest', strategy: 'latest',
size: 1 size: 1
}); });

View File

@@ -1,7 +1,7 @@
define([ define([
'../SummaryWidget', '../SummaryWidget',
'./SummaryWidgetView', './SummaryWidgetView',
'../../../../api/objects/object-utils' 'objectUtils'
], function ( ], function (
SummaryWidgetEditView, SummaryWidgetEditView,
SummaryWidgetView, SummaryWidgetView,

View File

@@ -22,7 +22,7 @@
/*jshint latedef: nofunc */ /*jshint latedef: nofunc */
/*global console */ /*global console */
define([ define([
'../../../api/objects/object-utils', 'objectUtils',
'./TelemetryAverager' './TelemetryAverager'
], function (objectUtils, TelemetryAverager) { ], function (objectUtils, TelemetryAverager) {

View File

@@ -21,7 +21,7 @@
*****************************************************************************/ *****************************************************************************/
define([ define([
'../../api/objects/object-utils', 'objectUtils',
'./components/table-configuration.vue', './components/table-configuration.vue',
'./TelemetryTableConfiguration', './TelemetryTableConfiguration',
'vue' 'vue'

View File

@@ -22,8 +22,10 @@
define([ define([
'lodash', 'lodash',
'EventEmitter' 'EventEmitter',
], function (_, EventEmitter) { 'arrayUtils'
], function (_, EventEmitter, arrayUtils) {
class TelemetryTableConfiguration extends EventEmitter { class TelemetryTableConfiguration extends EventEmitter {
constructor(domainObject, openmct) { constructor(domainObject, openmct) {
@@ -99,7 +101,7 @@ define([
} }
hasColumnWithKey(columnKey) { hasColumnWithKey(columnKey) {
return _.flatten(Object.values(this.columns)) return arrayUtils.flatten(Object.values(this.columns))
.some(column => column.getKey() === columnKey); .some(column => column.getKey() === columnKey);
} }
@@ -108,7 +110,7 @@ define([
} }
getAllHeaders() { getAllHeaders() {
let flattenedColumns = _.flatten(Object.values(this.columns)); let flattenedColumns = arrayUtils.flatten(Object.values(this.columns));
let headers = _.uniq(flattenedColumns, false, column => column.getKey()) let headers = _.uniq(flattenedColumns, false, column => column.getKey())
.reduce(fromColumnsToHeadersMap, {}); .reduce(fromColumnsToHeadersMap, {});

View File

@@ -22,11 +22,9 @@
define( define(
[ [
'lodash',
'./SortedTableRowCollection' './SortedTableRowCollection'
], ],
function ( function (
_,
SortedTableRowCollection SortedTableRowCollection
) { ) {

View File

@@ -120,7 +120,7 @@ define(
const firstValue = this.getValueForSortColumn(this.rows[0]); const firstValue = this.getValueForSortColumn(this.rows[0]);
const lastValue = this.getValueForSortColumn(this.rows[this.rows.length - 1]); const lastValue = this.getValueForSortColumn(this.rows[this.rows.length - 1]);
lodashFunction = lodashFunction || _.sortedIndex; lodashFunction = lodashFunction || _.sortedIndexBy;
if (this.sortOptions.direction === 'asc') { if (this.sortOptions.direction === 'asc') {
if (testRowValue > lastValue) { if (testRowValue > lastValue) {

View File

@@ -17,6 +17,9 @@
</template> </template>
<script> <script>
import _ from 'lodash';
import { flatten, isEmpty } from 'arrayUtils';
const FILTER_INDICATOR_LABEL = 'Filters:'; const FILTER_INDICATOR_LABEL = 'Filters:';
const FILTER_INDICATOR_LABEL_MIXED = 'Mixed Filters:'; const FILTER_INDICATOR_LABEL_MIXED = 'Mixed Filters:';
const FILTER_INDICATOR_TITLE = 'Data filters are being applied to this view.'; const FILTER_INDICATOR_TITLE = 'Data filters are being applied to this view.';
@@ -77,7 +80,7 @@ export default {
} }
}); });
names = _.flatten(names); names = flatten(names);
this.filterNames = names.length === 0 ? names : Array.from(new Set(names)); this.filterNames = names.length === 0 ? names : Array.from(new Set(names));
}); });
}, },
@@ -86,7 +89,7 @@ export default {
filters = _.omit(filters, [USE_GLOBAL]); filters = _.omit(filters, [USE_GLOBAL]);
Object.keys(filters).forEach(key => { Object.keys(filters).forEach(key => {
if (!_.isEmpty(filters[key])) { if (!isEmpty(filters[key])) {
metadataValues.forEach(metadatum => { metadataValues.forEach(metadatum => {
if (key === metadatum.key) { if (key === metadatum.key) {
if (typeof metadatum.filters[0] === "object") { if (typeof metadatum.filters[0] === "object") {
@@ -99,7 +102,7 @@ export default {
} }
}); });
return _.flatten(filterNames); return flatten(filterNames);
}, },
getFilterLabels(filterObject, metadatum,) { getFilterLabels(filterObject, metadatum,) {
let filterLabels = []; let filterLabels = [];

View File

@@ -260,8 +260,8 @@ import search from '../../../ui/components/search.vue';
import TableColumnHeader from './table-column-header.vue'; import TableColumnHeader from './table-column-header.vue';
import TelemetryFilterIndicator from './TelemetryFilterIndicator.vue'; import TelemetryFilterIndicator from './TelemetryFilterIndicator.vue';
import CSVExporter from '../../../exporters/CSVExporter.js'; import CSVExporter from '../../../exporters/CSVExporter.js';
import _ from 'lodash';
import ToggleSwitch from '../../../ui/components/ToggleSwitch.vue'; import ToggleSwitch from '../../../ui/components/ToggleSwitch.vue';
import _ from 'lodash';
const VISIBLE_ROW_COUNT = 100; const VISIBLE_ROW_COUNT = 100;
const ROW_HEIGHT = 17; const ROW_HEIGHT = 17;

View File

@@ -24,7 +24,7 @@ import Vue from 'vue';
import { import {
createOpenMct, createOpenMct,
createMouseEvent createMouseEvent
} from 'testTools'; } from 'testUtils';
let openmct; let openmct;
let tablePlugin; let tablePlugin;

View File

@@ -3,9 +3,9 @@
</template> </template>
<script> <script>
import _ from "lodash"
import StyleRuleManager from "@/plugins/condition/StyleRuleManager"; import StyleRuleManager from "@/plugins/condition/StyleRuleManager";
import {STYLE_CONSTANTS} from "@/plugins/condition/utils/constants"; import {STYLE_CONSTANTS} from "@/plugins/condition/utils/constants";
import _ from 'lodash';
export default { export default {
inject: ["openmct"], inject: ["openmct"],

View File

@@ -47,14 +47,12 @@ import Location from './Location.vue';
import Properties from './Properties.vue'; import Properties from './Properties.vue';
import ObjectName from './ObjectName.vue'; import ObjectName from './ObjectName.vue';
import InspectorViews from './InspectorViews.vue'; import InspectorViews from './InspectorViews.vue';
import _ from "lodash";
import StylesInspectorView from "./StylesInspectorView.vue"; import StylesInspectorView from "./StylesInspectorView.vue";
export default { export default {
inject: ['openmct'], inject: ['openmct'],
components: { components: {
StylesInspectorView, StylesInspectorView,
// StylesInspectorView,
multipane, multipane,
pane, pane,
Elements, Elements,
@@ -108,7 +106,7 @@ export default {
let object = selection[0][0].context.item; let object = selection[0][0].context.item;
if (object) { if (object) {
let type = this.openmct.types.get(object.type); let type = this.openmct.types.get(object.type);
this.showStyles = (this.excludeObjectTypes.indexOf(object.type) < 0) && type.definition.creatable; this.showStyles = this.isLayoutObject(selection[0], object.type) || this.isCreatableObject(object, type);
} }
if (!this.currentTabbedView.key || (!this.showStyles && this.currentTabbedView.key === this.tabbedViews[1].key)) if (!this.currentTabbedView.key || (!this.showStyles && this.currentTabbedView.key === this.tabbedViews[1].key))
{ {
@@ -116,11 +114,19 @@ export default {
} }
} }
}, },
isLayoutObject(selection, objectType) {
//we allow conditionSets to be styled if they're part of a layout
return selection.length > 1 &&
((objectType === 'conditionSet') || (this.excludeObjectTypes.indexOf(objectType) < 0));
},
isCreatableObject(object, type) {
return (this.excludeObjectTypes.indexOf(object.type) < 0) && type.definition.creatable;
},
updateCurrentTab(view) { updateCurrentTab(view) {
this.currentTabbedView = view; this.currentTabbedView = view;
}, },
isCurrent(view) { isCurrent(view) {
return _.isEqual(this.currentTabbedView, view) return JSON.stringify(this.currentTabbedView) === JSON.stringify(view)
} }
} }
} }

View File

@@ -39,7 +39,7 @@
<script> <script>
import CreateAction from '../../../platform/commonUI/edit/src/creation/CreateAction'; import CreateAction from '../../../platform/commonUI/edit/src/creation/CreateAction';
import objectUtils from '../../api/objects/object-utils'; import objectUtils from 'objectUtils';
export default { export default {
inject: ['openmct'], inject: ['openmct'],

View File

@@ -20,7 +20,6 @@ import toolbarMenu from './components/toolbar-menu.vue';
import toolbarSelectMenu from './components/toolbar-select-menu.vue'; import toolbarSelectMenu from './components/toolbar-select-menu.vue';
import toolbarSeparator from './components/toolbar-separator.vue'; import toolbarSeparator from './components/toolbar-separator.vue';
import toolbarToggleButton from './components/toolbar-toggle-button.vue'; import toolbarToggleButton from './components/toolbar-toggle-button.vue';
import _ from 'lodash'; import _ from 'lodash';
export default { export default {

View File

@@ -42,7 +42,9 @@ const webpackConfig = {
"printj": path.join(__dirname, "node_modules/printj/dist/printj.min.js"), "printj": path.join(__dirname, "node_modules/printj/dist/printj.min.js"),
"styles": path.join(__dirname, "src/styles"), "styles": path.join(__dirname, "src/styles"),
"MCT": path.join(__dirname, "src/MCT"), "MCT": path.join(__dirname, "src/MCT"),
"testTools": path.join(__dirname, "src/testTools.js") "testUtils": path.join(__dirname, "src/test-utils.js"),
"objectUtils": path.join(__dirname, "src/api/objects/object-utils.js"),
"arrayUtils": path.join(__dirname, "src/api/utils/array-utils.js")
} }
}, },
devtool: devMode ? 'eval-source-map' : 'source-map', devtool: devMode ? 'eval-source-map' : 'source-map',