mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 05:37:53 +00:00
Lodash upgrade and cleanup (#2990)
* Upgrades lodash * Replaces some usage of lodash with native functions. * Adds linting to catch cases where native functions could be used instead of lodash functions * Renamed testTools to testUtils Co-authored-by: Joshi <simplyrender@gmail.com> Co-authored-by: David Tsay <david.e.tsay@nasa.gov> Co-authored-by: David Tsay <3614296+davetsay@users.noreply.github.com> Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
parent
67bea86bc8
commit
43628ad9d6
@ -10,7 +10,8 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
"extends": [
|
"extends": [
|
||||||
"eslint:recommended",
|
"eslint:recommended",
|
||||||
"plugin:vue/recommended"
|
"plugin:vue/recommended",
|
||||||
|
"plugin:you-dont-need-lodash-underscore/compatible"
|
||||||
],
|
],
|
||||||
"parser": "vue-eslint-parser",
|
"parser": "vue-eslint-parser",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
@ -22,6 +23,9 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"you-dont-need-lodash-underscore/omit": "off",
|
||||||
|
"you-dont-need-lodash-underscore/throttle": "off",
|
||||||
|
"you-dont-need-lodash-underscore/flatten": "off",
|
||||||
"no-bitwise": "error",
|
"no-bitwise": "error",
|
||||||
"curly": "error",
|
"curly": "error",
|
||||||
"eqeqeq": "error",
|
"eqeqeq": "error",
|
||||||
|
@ -100,7 +100,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]
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
"d3-time-format": "2.1.x",
|
"d3-time-format": "2.1.x",
|
||||||
"eslint": "5.2.0",
|
"eslint": "5.2.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",
|
||||||
@ -48,7 +49,7 @@
|
|||||||
"karma-sourcemap-loader": "^0.3.7",
|
"karma-sourcemap-loader": "^0.3.7",
|
||||||
"karma-webpack": "^3.0.0",
|
"karma-webpack": "^3.0.0",
|
||||||
"location-bar": "^3.0.1",
|
"location-bar": "^3.0.1",
|
||||||
"lodash": "^3.10.1",
|
"lodash": "^4.17.12",
|
||||||
"markdown-toc": "^0.11.7",
|
"markdown-toc": "^0.11.7",
|
||||||
"marked": "^0.3.5",
|
"marked": "^0.3.5",
|
||||||
"mini-css-extract-plugin": "^0.4.1",
|
"mini-css-extract-plugin": "^0.4.1",
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
define(
|
define(
|
||||||
['../../../../../src/api/objects/object-utils'],
|
['objectUtils'],
|
||||||
function (objectUtils) {
|
function (objectUtils) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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) {
|
||||||
|
@ -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);
|
||||||
|
@ -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(id => {
|
||||||
return _.isEqual(child.identifier, id);
|
return _.isEqual(child.identifier, id);
|
||||||
});
|
});
|
||||||
var copyOfChild = this.copyObject(child);
|
var copyOfChild = this.copyObject(child);
|
||||||
|
@ -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
|
||||||
|
@ -25,7 +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'
|
'lodash'
|
||||||
], function (
|
], function (
|
||||||
objectUtils,
|
objectUtils,
|
||||||
@ -191,7 +191,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 => {
|
||||||
return p.appliesTo(domainObject);
|
return p.appliesTo(domainObject);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
define(
|
define(
|
||||||
[
|
[
|
||||||
'../../../src/api/objects/object-utils',
|
'objectUtils',
|
||||||
'lodash'
|
'lodash'
|
||||||
],
|
],
|
||||||
function (
|
function (
|
||||||
@ -235,7 +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;
|
||||||
|
|
||||||
var sourceMap = _.indexBy(metadata.values(), 'key');
|
var sourceMap = _.keyBy(metadata.values(), 'key');
|
||||||
|
|
||||||
var isLegacyProvider = telemetryAPI.findRequestProvider(domainObject) ===
|
var isLegacyProvider = telemetryAPI.findRequestProvider(domainObject) ===
|
||||||
telemetryAPI.legacyProvider;
|
telemetryAPI.legacyProvider;
|
||||||
@ -300,7 +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;
|
||||||
|
|
||||||
var sourceMap = _.indexBy(metadata.values(), 'key');
|
var sourceMap = _.keyBy(metadata.values(), 'key');
|
||||||
|
|
||||||
var isLegacyProvider = telemetryAPI.findSubscriptionProvider(domainObject) ===
|
var isLegacyProvider = telemetryAPI.findSubscriptionProvider(domainObject) ===
|
||||||
telemetryAPI.legacyProvider;
|
telemetryAPI.legacyProvider;
|
||||||
|
@ -28,7 +28,7 @@ define([
|
|||||||
'./api/api',
|
'./api/api',
|
||||||
'./api/overlays/OverlayAPI',
|
'./api/overlays/OverlayAPI',
|
||||||
'./selection/Selection',
|
'./selection/Selection',
|
||||||
'./api/objects/object-utils',
|
'objectUtils',
|
||||||
'./plugins/plugins',
|
'./plugins/plugins',
|
||||||
'./adapter/indicators/legacy-indicators-plugin',
|
'./adapter/indicators/legacy-indicators-plugin',
|
||||||
'./plugins/buildInfo/plugin',
|
'./plugins/buildInfo/plugin',
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
define([
|
define([
|
||||||
'./plugins/plugins',
|
'./plugins/plugins',
|
||||||
'legacyRegistry',
|
'legacyRegistry',
|
||||||
'testTools'
|
'testUtils'
|
||||||
], function (plugins, legacyRegistry, testTools) {
|
], function (plugins, legacyRegistry, testUtils) {
|
||||||
describe("MCT", function () {
|
describe("MCT", function () {
|
||||||
var openmct;
|
var openmct;
|
||||||
var mockPlugin;
|
var mockPlugin;
|
||||||
@ -38,7 +38,7 @@ define([
|
|||||||
mockListener = jasmine.createSpy('listener');
|
mockListener = jasmine.createSpy('listener');
|
||||||
oldBundles = legacyRegistry.list();
|
oldBundles = legacyRegistry.list();
|
||||||
|
|
||||||
openmct = testTools.createOpenMct();
|
openmct = testUtils.createOpenMct();
|
||||||
|
|
||||||
openmct.install(mockPlugin);
|
openmct.install(mockPlugin);
|
||||||
openmct.install(mockPlugin2);
|
openmct.install(mockPlugin2);
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
|
@ -31,6 +31,7 @@ define([
|
|||||||
var capability = viewConstructor(domainObject);
|
var capability = viewConstructor(domainObject);
|
||||||
var oldInvoke = capability.invoke.bind(capability);
|
var oldInvoke = capability.invoke.bind(capability);
|
||||||
|
|
||||||
|
/* eslint-disable you-dont-need-lodash-underscore/map */
|
||||||
capability.invoke = function () {
|
capability.invoke = function () {
|
||||||
var availableViews = oldInvoke();
|
var availableViews = oldInvoke();
|
||||||
var newDomainObject = capability
|
var newDomainObject = capability
|
||||||
@ -52,6 +53,8 @@ define([
|
|||||||
.map('view')
|
.map('view')
|
||||||
.value();
|
.value();
|
||||||
};
|
};
|
||||||
|
/* eslint-enable you-dont-need-lodash-underscore/map */
|
||||||
|
|
||||||
return capability;
|
return capability;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
define([
|
define([
|
||||||
'../capabilities/AlternateCompositionCapability',
|
'../capabilities/AlternateCompositionCapability',
|
||||||
'../../api/objects/object-utils'
|
'objectUtils'
|
||||||
], function (
|
], function (
|
||||||
AlternateCompositionCapability,
|
AlternateCompositionCapability,
|
||||||
objectUtils
|
objectUtils
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
define([
|
define([
|
||||||
'../../api/objects/object-utils'
|
'objectUtils'
|
||||||
], function (
|
], function (
|
||||||
utils
|
utils
|
||||||
) {
|
) {
|
||||||
|
@ -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]
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
define([
|
define([
|
||||||
'../../api/objects/object-utils'
|
'objectUtils'
|
||||||
], function (
|
], function (
|
||||||
utils
|
utils
|
||||||
) {
|
) {
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
define([
|
define([
|
||||||
'../../api/objects/object-utils'
|
'objectUtils'
|
||||||
], function (
|
], function (
|
||||||
objectUtils
|
objectUtils
|
||||||
) {
|
) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
define([
|
define([
|
||||||
'./LegacyViewProvider',
|
'./LegacyViewProvider',
|
||||||
'./TypeInspectorViewProvider',
|
'./TypeInspectorViewProvider',
|
||||||
'../../api/objects/object-utils'
|
'objectUtils'
|
||||||
], function (
|
], function (
|
||||||
LegacyViewProvider,
|
LegacyViewProvider,
|
||||||
TypeInspectorViewProvider,
|
TypeInspectorViewProvider,
|
||||||
|
@ -70,7 +70,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 => {
|
||||||
return p.appliesTo(domainObject);
|
return p.appliesTo(domainObject);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -122,7 +122,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(l => {
|
||||||
return l.callback === callback && l.context === context;
|
return l.callback === callback && l.context === context;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -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(l => {
|
||||||
return l.callback === callback && l.context === context;
|
return l.callback === callback && l.context === context;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -196,8 +196,8 @@ define([
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
DefaultCompositionProvider.prototype.includes = function (parent, childId) {
|
DefaultCompositionProvider.prototype.includes = function (parent, childId) {
|
||||||
return parent.composition.findIndex(composee =>
|
return parent.composition.some(composee =>
|
||||||
this.publicAPI.objects.areIdsEqual(composee, childId)) !== -1;
|
this.publicAPI.objects.areIdsEqual(composee, childId));
|
||||||
};
|
};
|
||||||
|
|
||||||
DefaultCompositionProvider.prototype.reorder = function (domainObject, oldIndex, newIndex) {
|
DefaultCompositionProvider.prototype.reorder = function (domainObject, oldIndex, newIndex) {
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
define([
|
define([
|
||||||
'./object-utils.js',
|
'objectUtils',
|
||||||
'lodash'
|
'lodash'
|
||||||
], function (
|
], function (
|
||||||
utils,
|
utils,
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
define([
|
define([
|
||||||
'lodash',
|
'lodash',
|
||||||
'./object-utils',
|
'objectUtils',
|
||||||
'./MutableObject',
|
'./MutableObject',
|
||||||
'./RootRegistry',
|
'./RootRegistry',
|
||||||
'./RootObjectProvider',
|
'./RootObjectProvider',
|
||||||
|
@ -43,7 +43,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;
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
define([
|
define([
|
||||||
'../object-utils'
|
'objectUtils'
|
||||||
], function (
|
], function (
|
||||||
objectUtils
|
objectUtils
|
||||||
) {
|
) {
|
||||||
|
@ -85,9 +85,9 @@ define([
|
|||||||
value: +e.value
|
value: +e.value
|
||||||
};
|
};
|
||||||
}), 'e.value');
|
}), 'e.value');
|
||||||
valueMetadata.values = _.pluck(valueMetadata.enumerations, 'value');
|
valueMetadata.values = valueMetadata.enumerations.map(e => e.value);
|
||||||
valueMetadata.max = _.max(valueMetadata.values);
|
valueMetadata.max = Math.max(valueMetadata.values);
|
||||||
valueMetadata.min = _.min(valueMetadata.values);
|
valueMetadata.min = Math.min(valueMetadata.values);
|
||||||
}
|
}
|
||||||
|
|
||||||
valueMetadatas.push(valueMetadata);
|
valueMetadatas.push(valueMetadata);
|
||||||
@ -103,7 +103,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);
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ define([
|
|||||||
'./TelemetryMetadataManager',
|
'./TelemetryMetadataManager',
|
||||||
'./TelemetryValueFormatter',
|
'./TelemetryValueFormatter',
|
||||||
'./DefaultMetadataProvider',
|
'./DefaultMetadataProvider',
|
||||||
'../objects/object-utils',
|
'objectUtils',
|
||||||
'lodash'
|
'lodash'
|
||||||
], function (
|
], function (
|
||||||
TelemetryMetadataManager,
|
TelemetryMetadataManager,
|
||||||
@ -370,7 +370,7 @@ 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 _.indexBy(values, 'key');
|
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) {
|
||||||
@ -383,7 +383,7 @@ define([
|
|||||||
var sortKeys = hints.map(function (h) {
|
var sortKeys = hints.map(function (h) {
|
||||||
return 'hints.' + h;
|
return 'hints.' + h;
|
||||||
});
|
});
|
||||||
return _.sortByAll(options, sortKeys);
|
return _.sortBy(options, sortKeys);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,13 +57,13 @@ define([
|
|||||||
|
|
||||||
if (valueMetadata.format === 'enum') {
|
if (valueMetadata.format === 'enum') {
|
||||||
if (!valueMetadata.values) {
|
if (!valueMetadata.values) {
|
||||||
valueMetadata.values = _.pluck(valueMetadata.enumerations, 'value');
|
valueMetadata.values = valueMetadata.enumerations.map(e => e.value);
|
||||||
}
|
}
|
||||||
if (!valueMetadata.hasOwnProperty('max')) {
|
if (!valueMetadata.hasOwnProperty('max')) {
|
||||||
valueMetadata.max = _.max(valueMetadata.values) + 1;
|
valueMetadata.max = Math.max(valueMetadata.values) + 1;
|
||||||
}
|
}
|
||||||
if (!valueMetadata.hasOwnProperty('min')) {
|
if (!valueMetadata.hasOwnProperty('min')) {
|
||||||
valueMetadata.min = _.min(valueMetadata.values) - 1;
|
valueMetadata.min = Math.min(valueMetadata.values) - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ define([
|
|||||||
return metadata.hints[hint];
|
return metadata.hints[hint];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return _.sortByAll(matchingMetadata, ...iteratees);
|
return _.sortBy(matchingMetadata, ...iteratees);
|
||||||
};
|
};
|
||||||
|
|
||||||
TelemetryMetadataManager.prototype.getFilterableValues = function () {
|
TelemetryMetadataManager.prototype.getFilterableValues = function () {
|
||||||
|
@ -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);
|
||||||
},
|
},
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
@ -200,7 +200,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;
|
||||||
|
@ -108,6 +108,7 @@ 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 'lodash/isEmpty';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ConditionalStylesView',
|
name: 'ConditionalStylesView',
|
||||||
@ -288,7 +289,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 {
|
||||||
@ -299,7 +300,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,7 +338,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);
|
||||||
|
@ -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 'lodash/isEmpty';
|
||||||
|
|
||||||
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 {
|
||||||
|
@ -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";
|
||||||
|
|
||||||
describe('the plugin', function () {
|
describe('the plugin', function () {
|
||||||
|
@ -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)));
|
||||||
@ -257,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;
|
||||||
},
|
},
|
||||||
@ -274,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;
|
||||||
|
@ -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 'lodash/isEmpty';
|
||||||
|
|
||||||
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 = {};
|
||||||
|
@ -68,7 +68,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import uuid from 'uuid';
|
import uuid from 'uuid';
|
||||||
|
|
||||||
import SubobjectView from './SubobjectView.vue'
|
import SubobjectView from './SubobjectView.vue'
|
||||||
import TelemetryView from './TelemetryView.vue'
|
import TelemetryView from './TelemetryView.vue'
|
||||||
import BoxView from './BoxView.vue'
|
import BoxView from './BoxView.vue'
|
||||||
@ -76,6 +75,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 +512,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);
|
||||||
}
|
}
|
||||||
|
@ -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'],
|
||||||
|
@ -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',
|
||||||
|
@ -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'
|
||||||
|
@ -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 'lodash/isEmpty';
|
||||||
|
|
||||||
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));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -27,7 +27,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import FilterObject from './FilterObject.vue';
|
import FilterObject from './FilterObject.vue';
|
||||||
import GlobalFilters from './GlobalFilters.vue'
|
import GlobalFilters from './GlobalFilters.vue';
|
||||||
|
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';
|
||||||
|
@ -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},
|
||||||
|
@ -220,7 +220,7 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const index = _.sortedIndex(this.imageHistory, datum, this.timeFormat.format.bind(this.timeFormat));
|
const index = _.sortedIndexBy(this.imageHistory, datum, this.timeFormat.format.bind(this.timeFormat));
|
||||||
this.imageHistory.splice(index, 0, datum);
|
this.imageHistory.splice(index, 0, datum);
|
||||||
},
|
},
|
||||||
updateValues(datum) {
|
updateValues(datum) {
|
||||||
|
@ -152,7 +152,7 @@ function (
|
|||||||
MCTChartController.prototype.destroy = function () {
|
MCTChartController.prototype.destroy = function () {
|
||||||
this.isDestroyed = true;
|
this.isDestroyed = true;
|
||||||
this.stopListening();
|
this.stopListening();
|
||||||
_.invoke(this.lines, 'destroy');
|
this.lines.forEach(line => line.destroy());
|
||||||
DrawLoader.releaseDrawAPI(this.drawAPI);
|
DrawLoader.releaseDrawAPI(this.drawAPI);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,7 +44,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 +105,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) {
|
||||||
|
@ -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;
|
||||||
|
@ -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
|
||||||
@ -160,6 +160,7 @@ define([
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* eslint-disable you-dont-need-lodash-underscore/concat */
|
||||||
return this.openmct
|
return this.openmct
|
||||||
.telemetry
|
.telemetry
|
||||||
.request(this.domainObject, options)
|
.request(this.domainObject, options)
|
||||||
@ -171,6 +172,7 @@ define([
|
|||||||
.value();
|
.value();
|
||||||
this.reset(newPoints);
|
this.reset(newPoints);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
/* eslint-enable you-dont-need-lodash-underscore/concat */
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Update x formatter on x change.
|
* Update x formatter on x change.
|
||||||
@ -270,7 +272,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.
|
||||||
|
@ -101,11 +101,11 @@ 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 => {
|
||||||
return _.isEqual(identifier, s.identifier);
|
return _.isEqual(identifier, s.identifier);
|
||||||
});
|
});
|
||||||
|
|
||||||
var configIndex = _.findIndex(this.models, function (m) {
|
var configIndex = this.models.findIndex(m => {
|
||||||
return _.isEqual(m.domainObject.identifier, identifier);
|
return _.isEqual(m.domainObject.identifier, identifier);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -51,7 +51,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
|
||||||
|
@ -78,7 +78,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) {
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
define([
|
define([
|
||||||
'../configuration/configStore',
|
'../configuration/configStore',
|
||||||
'../lib/eventHelpers',
|
'../lib/eventHelpers',
|
||||||
'../../../../api/objects/object-utils',
|
'objectUtils',
|
||||||
'lodash'
|
'lodash'
|
||||||
], function (
|
], function (
|
||||||
configStore,
|
configStore,
|
||||||
|
@ -31,7 +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 => {
|
||||||
return _.isEqual(s.identifier, modelIdentifier);
|
return _.isEqual(s.identifier, modelIdentifier);
|
||||||
});
|
});
|
||||||
return 'configuration.series[' + index + '].' + key;
|
return 'configuration.series[' + index + '].' + key;
|
||||||
|
@ -73,10 +73,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(Number(range.min))) {
|
||||||
return 'Minimum must be a number.';
|
return 'Minimum must be a number.';
|
||||||
}
|
}
|
||||||
if (_.isNaN(Number(range.max))) {
|
if (Number.isNaN(Number(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)) {
|
||||||
|
@ -76,7 +76,7 @@ define([
|
|||||||
if (childObj) {
|
if (childObj) {
|
||||||
var index = telemetryObjects.indexOf(childObj);
|
var index = telemetryObjects.indexOf(childObj);
|
||||||
telemetryObjects.splice(index, 1);
|
telemetryObjects.splice(index, 1);
|
||||||
$scope.$broadcast('plot:tickWidth', _.max(tickWidthMap));
|
$scope.$broadcast('plot:tickWidth', Math.max(...Object.values(tickWidthMap)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
define([
|
define([
|
||||||
'../../api/objects/object-utils'
|
'objectUtils'
|
||||||
], function (
|
], function (
|
||||||
objectUtils
|
objectUtils
|
||||||
) {
|
) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
define ([
|
define ([
|
||||||
'./ConditionEvaluator',
|
'./ConditionEvaluator',
|
||||||
'../../../api/objects/object-utils',
|
'objectUtils',
|
||||||
'EventEmitter',
|
'EventEmitter',
|
||||||
'zepto',
|
'zepto',
|
||||||
'lodash'
|
'lodash'
|
||||||
@ -9,7 +9,8 @@ define ([
|
|||||||
objectUtils,
|
objectUtils,
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
$,
|
$,
|
||||||
_
|
_,
|
||||||
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@ define([
|
|||||||
'./TestDataManager',
|
'./TestDataManager',
|
||||||
'./WidgetDnD',
|
'./WidgetDnD',
|
||||||
'./eventHelpers',
|
'./eventHelpers',
|
||||||
'../../../api/objects/object-utils',
|
'objectUtils',
|
||||||
'lodash',
|
'lodash',
|
||||||
'zepto'
|
'zepto'
|
||||||
], function (
|
], function (
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
define([
|
define([
|
||||||
'./Select',
|
'./Select',
|
||||||
'../../../../api/objects/object-utils'
|
'objectUtils'
|
||||||
], function (
|
], function (
|
||||||
Select,
|
Select,
|
||||||
objectUtils
|
objectUtils
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
define([
|
define([
|
||||||
'./SummaryWidgetEvaluator',
|
'./SummaryWidgetEvaluator',
|
||||||
'../../../../api/objects/object-utils'
|
'objectUtils'
|
||||||
], function (
|
], function (
|
||||||
SummaryWidgetEvaluator,
|
SummaryWidgetEvaluator,
|
||||||
objectUtils
|
objectUtils
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
define([
|
define([
|
||||||
'./SummaryWidgetRule',
|
'./SummaryWidgetRule',
|
||||||
'../eventHelpers',
|
'../eventHelpers',
|
||||||
'../../../../api/objects/object-utils',
|
'objectUtils',
|
||||||
'lodash'
|
'lodash'
|
||||||
], function (
|
], function (
|
||||||
SummaryWidgetRule,
|
SummaryWidgetRule,
|
||||||
@ -80,10 +80,12 @@ define([
|
|||||||
}
|
}
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
|
/* eslint-disable you-dont-need-lodash-underscore/map */
|
||||||
unsubscribes = _.map(
|
unsubscribes = _.map(
|
||||||
realtimeStates,
|
realtimeStates,
|
||||||
this.subscribeToObjectState.bind(this, updateCallback)
|
this.subscribeToObjectState.bind(this, updateCallback)
|
||||||
);
|
);
|
||||||
|
/* eslint-enable you-dont-need-lodash-underscore/map */
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
return function () {
|
return function () {
|
||||||
@ -151,11 +153,13 @@ define([
|
|||||||
SummaryWidgetEvaluator.prototype.getBaseStateClone = function () {
|
SummaryWidgetEvaluator.prototype.getBaseStateClone = function () {
|
||||||
return this.load()
|
return this.load()
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
/* eslint-disable you-dont-need-lodash-underscore/values */
|
||||||
return _(this.baseState)
|
return _(this.baseState)
|
||||||
.values()
|
.values()
|
||||||
.map(_.clone)
|
.map(_.clone)
|
||||||
.indexBy('id')
|
.keyBy('id')
|
||||||
.value();
|
.value();
|
||||||
|
/* eslint-enable you-dont-need-lodash-underscore/values */
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -182,7 +186,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
|
||||||
});
|
});
|
||||||
@ -255,10 +259,12 @@ define([
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* eslint-disable you-dont-need-lodash-underscore/map */
|
||||||
var latestTimestamp = _(state)
|
var latestTimestamp = _(state)
|
||||||
.map('timestamps')
|
.map('timestamps')
|
||||||
.sortBy(timestampKey)
|
.sortBy(timestampKey)
|
||||||
.last();
|
.last();
|
||||||
|
/* eslint-enable you-dont-need-lodash-underscore/map */
|
||||||
|
|
||||||
if (!latestTimestamp) {
|
if (!latestTimestamp) {
|
||||||
latestTimestamp = {};
|
latestTimestamp = {};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
define([
|
define([
|
||||||
'../SummaryWidget',
|
'../SummaryWidget',
|
||||||
'./SummaryWidgetView',
|
'./SummaryWidgetView',
|
||||||
'../../../../api/objects/object-utils'
|
'objectUtils'
|
||||||
], function (
|
], function (
|
||||||
SummaryWidgetEditView,
|
SummaryWidgetEditView,
|
||||||
SummaryWidgetView,
|
SummaryWidgetView,
|
||||||
|
@ -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) {
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
define([
|
define([
|
||||||
'../../api/objects/object-utils',
|
'objectUtils',
|
||||||
'./components/table-configuration.vue',
|
'./components/table-configuration.vue',
|
||||||
'./TelemetryTableConfiguration',
|
'./TelemetryTableConfiguration',
|
||||||
'vue'
|
'vue'
|
||||||
|
@ -100,7 +100,7 @@ define([
|
|||||||
|
|
||||||
hasColumnWithKey(columnKey) {
|
hasColumnWithKey(columnKey) {
|
||||||
return _.flatten(Object.values(this.columns))
|
return _.flatten(Object.values(this.columns))
|
||||||
.findIndex(column => column.getKey() === columnKey) !== -1;
|
.some(column => column.getKey() === columnKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
getColumns() {
|
getColumns() {
|
||||||
@ -109,9 +109,10 @@ define([
|
|||||||
|
|
||||||
getAllHeaders() {
|
getAllHeaders() {
|
||||||
let flattenedColumns = _.flatten(Object.values(this.columns));
|
let flattenedColumns = _.flatten(Object.values(this.columns));
|
||||||
|
/* eslint-disable you-dont-need-lodash-underscore/uniq */
|
||||||
let headers = _.uniq(flattenedColumns, false, column => column.getKey())
|
let headers = _.uniq(flattenedColumns, false, column => column.getKey())
|
||||||
.reduce(fromColumnsToHeadersMap, {});
|
.reduce(fromColumnsToHeadersMap, {});
|
||||||
|
/* eslint-enable you-dont-need-lodash-underscore/uniq */
|
||||||
function fromColumnsToHeadersMap(headersMap, column) {
|
function fromColumnsToHeadersMap(headersMap, column) {
|
||||||
headersMap[column.getKey()] = column.getTitle();
|
headersMap[column.getKey()] = column.getTitle();
|
||||||
return headersMap;
|
return headersMap;
|
||||||
|
@ -93,7 +93,7 @@ define(
|
|||||||
// same time stamp
|
// same time stamp
|
||||||
let potentialDupes = this.rows.slice(startIx, endIx + 1);
|
let potentialDupes = this.rows.slice(startIx, endIx + 1);
|
||||||
// Search potential dupes for exact dupe
|
// Search potential dupes for exact dupe
|
||||||
isDuplicate = _.findIndex(potentialDupes, _.isEqual.bind(undefined, row)) > -1;
|
isDuplicate = potentialDupes.some(_.isEqual.bind(undefined, row));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isDuplicate) {
|
if (!isDuplicate) {
|
||||||
@ -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) {
|
||||||
@ -201,7 +201,7 @@ define(
|
|||||||
sortBy(sortOptions) {
|
sortBy(sortOptions) {
|
||||||
if (arguments.length > 0) {
|
if (arguments.length > 0) {
|
||||||
this.sortOptions = sortOptions;
|
this.sortOptions = sortOptions;
|
||||||
this.rows = _.sortByOrder(this.rows, (row) => row.getParsedValue(sortOptions.key) , sortOptions.direction);
|
this.rows = _.orderBy(this.rows, (row) => row.getParsedValue(sortOptions.key) , sortOptions.direction);
|
||||||
this.emit('sort');
|
this.emit('sort');
|
||||||
}
|
}
|
||||||
// Return duplicate to avoid direct modification of underlying object
|
// Return duplicate to avoid direct modification of underlying object
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
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.';
|
||||||
|
@ -24,7 +24,7 @@ import Vue from 'vue';
|
|||||||
import {
|
import {
|
||||||
createOpenMct,
|
createOpenMct,
|
||||||
createMouseEvent
|
createMouseEvent
|
||||||
} from 'testTools';
|
} from 'testUtils';
|
||||||
|
|
||||||
describe("the plugin", () => {
|
describe("the plugin", () => {
|
||||||
let openmct;
|
let openmct;
|
||||||
|
@ -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'],
|
||||||
|
@ -42,7 +42,8 @@ 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/testUtils.js"),
|
||||||
|
"objectUtils": path.join(__dirname, "src/api/objects/object-utils.js")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
devtool: devMode ? 'eval-source-map' : 'source-map',
|
devtool: devMode ? 'eval-source-map' : 'source-map',
|
||||||
|
Loading…
Reference in New Issue
Block a user