Compare commits
13 Commits
lodash-upg
...
tabs-lazyl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce54906934 | ||
|
|
aa4c6283de | ||
|
|
5a1a96b0f4 | ||
|
|
b8ebc70ee5 | ||
|
|
f3d136af69 | ||
|
|
218e73f595 | ||
|
|
c67253a97b | ||
|
|
2f58dfbfe7 | ||
|
|
166cb55945 | ||
|
|
83116257fc | ||
|
|
775f1048bc | ||
|
|
71a8b377bb | ||
|
|
c43d3fcfc9 |
23
.eslintrc.js
23
.eslintrc.js
@@ -8,12 +8,9 @@ module.exports = {
|
||||
"globals": {
|
||||
"_": "readonly"
|
||||
},
|
||||
"plugins": ["lodash"],
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:vue/recommended",
|
||||
"plugin:lodash/recommended",
|
||||
"plugin:you-dont-need-lodash-underscore/compatible"
|
||||
"plugin:vue/recommended"
|
||||
],
|
||||
"parser": "vue-eslint-parser",
|
||||
"parserOptions": {
|
||||
@@ -25,24 +22,6 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
"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-typecheck": "off",
|
||||
"lodash/prefer-constant": "off",
|
||||
"lodash/prefer-noop": "off",
|
||||
"lodash/prefer-matches": "off",
|
||||
"lodash/prefer-includes": "off",
|
||||
"lodash/prefer-startswith": "off",
|
||||
"lodash/prefer-get": "off",
|
||||
"lodash/prefer-is-nil": "off",
|
||||
"lodash/import-scope": "off",
|
||||
"no-bitwise": "error",
|
||||
"curly": "error",
|
||||
"eqeqeq": "error",
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
define([], function (
|
||||
define([
|
||||
'lodash'
|
||||
], function (
|
||||
_
|
||||
) {
|
||||
|
||||
@@ -97,7 +99,7 @@ define([], function (
|
||||
};
|
||||
|
||||
GeneratorMetadataProvider.prototype.getMetadata = function (domainObject) {
|
||||
return Object.assign(
|
||||
return _.extend(
|
||||
{},
|
||||
domainObject.telemetry,
|
||||
METADATA_BY_TYPE[domainObject.type]
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<template>
|
||||
<div class="example">{{ msg }}</div>
|
||||
<div class="example">{{ msg }}</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
msg: 'Hello world!'
|
||||
}
|
||||
data () {
|
||||
return {
|
||||
msg: 'Hello world!'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
12
package.json
12
package.json
@@ -23,9 +23,7 @@
|
||||
"d3-time": "1.0.x",
|
||||
"d3-time-format": "2.1.x",
|
||||
"eslint": "5.2.0",
|
||||
"eslint-plugin-lodash": "^6.0.0",
|
||||
"eslint-plugin-vue": "^6.0.0",
|
||||
"eslint-plugin-you-dont-need-lodash-underscore": "^6.10.0",
|
||||
"eventemitter3": "^1.2.0",
|
||||
"exports-loader": "^0.7.0",
|
||||
"express": "^4.13.1",
|
||||
@@ -49,14 +47,14 @@
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-webpack": "^3.0.0",
|
||||
"location-bar": "^3.0.1",
|
||||
"lodash": "^4.17.12",
|
||||
"lodash": "^3.10.1",
|
||||
"markdown-toc": "^0.11.7",
|
||||
"marked": "^0.3.5",
|
||||
"mini-css-extract-plugin": "^0.4.1",
|
||||
"minimist": "^1.1.1",
|
||||
"moment": "^2.11.1",
|
||||
"moment": "2.25.3",
|
||||
"moment-duration-format": "^2.2.2",
|
||||
"moment-timezone": "^0.5.21",
|
||||
"moment-timezone": "0.5.28",
|
||||
"node-bourbon": "^4.2.3",
|
||||
"node-sass": "^4.9.2",
|
||||
"painterro": "^0.2.65",
|
||||
@@ -78,8 +76,8 @@
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node app.js",
|
||||
"lint": "eslint platform example src --ext .js,.vue openmct.js",
|
||||
"lint:fix": "eslint platform example src --ext .js,.vue openmct.js --fix",
|
||||
"lint": "eslint platform example src/**/*.{js,vue} openmct.js",
|
||||
"lint:fix": "eslint platform example src/**/*.{js,vue} openmct.js --fix",
|
||||
"build:prod": "cross-env NODE_ENV=production webpack",
|
||||
"build:dev": "webpack",
|
||||
"build:watch": "webpack --watch",
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
['objectUtils'],
|
||||
['../../../../../src/api/objects/object-utils'],
|
||||
function (objectUtils) {
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* @namespace platform/containment
|
||||
*/
|
||||
define(
|
||||
['objectUtils'],
|
||||
['../../../src/api/objects/object-utils'],
|
||||
function (objectUtils) {
|
||||
|
||||
function PersistableCompositionPolicy(openmct) {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* Module defining ActionCapability. Created by vwoeltje on 11/10/14.
|
||||
*/
|
||||
define(
|
||||
[],
|
||||
['lodash'],
|
||||
function (_) {
|
||||
|
||||
/**
|
||||
@@ -81,7 +81,7 @@ define(
|
||||
baseContext = context || {};
|
||||
}
|
||||
|
||||
var actionContext = Object.assign({}, baseContext);
|
||||
var actionContext = _.extend({}, baseContext);
|
||||
actionContext.domainObject = this.domainObject;
|
||||
|
||||
return this.actionService.getActions(actionContext);
|
||||
|
||||
@@ -121,7 +121,7 @@ define(['lodash'], function (_) {
|
||||
*/
|
||||
ExportAsJSONAction.prototype.rewriteLink = function (child, parent) {
|
||||
this.externalIdentifiers.push(this.getId(child));
|
||||
var index = parent.composition.findIndex(function (id) {
|
||||
var index = _.findIndex(parent.composition, function (id) {
|
||||
return _.isEqual(child.identifier, id);
|
||||
});
|
||||
var copyOfChild = this.copyObject(child);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
define(['zepto', 'objectUtils'], function ($, objectUtils) {
|
||||
define(['zepto', '../../../../src/api/objects/object-utils.js'], function ($, objectUtils) {
|
||||
|
||||
/**
|
||||
* The ImportAsJSONAction is available from context menus and allows a user
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
* Module defining GenericSearchProvider. Created by shale on 07/16/2015.
|
||||
*/
|
||||
define([
|
||||
'objectUtils'
|
||||
'../../../../src/api/objects/object-utils',
|
||||
'lodash'
|
||||
], function (
|
||||
objectUtils,
|
||||
_
|
||||
@@ -190,7 +191,9 @@ define([
|
||||
}
|
||||
|
||||
var domainObject = objectUtils.toNewFormat(model, id);
|
||||
var composition = this.openmct.composition.registry.find(p => p.appliesTo(domainObject));
|
||||
var composition = _.find(this.openmct.composition.registry, function (p) {
|
||||
return p.appliesTo(domainObject);
|
||||
});
|
||||
|
||||
if (!composition) {
|
||||
return;
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
*/
|
||||
define(
|
||||
[
|
||||
'objectUtils',
|
||||
'arrayUtils'
|
||||
'../../../src/api/objects/object-utils',
|
||||
'lodash'
|
||||
],
|
||||
function (
|
||||
objectUtils,
|
||||
arrayUtils
|
||||
_
|
||||
) {
|
||||
|
||||
var ZERO = function () {
|
||||
@@ -235,7 +235,7 @@ define(
|
||||
var defaultRange = metadata.valuesForHints(['range'])[0];
|
||||
defaultRange = defaultRange ? defaultRange.key : undefined;
|
||||
|
||||
const sourceMap = arrayUtils.keyBy(metadata.values(), 'key');
|
||||
var sourceMap = _.indexBy(metadata.values(), 'key');
|
||||
|
||||
var isLegacyProvider = telemetryAPI.findRequestProvider(domainObject) ===
|
||||
telemetryAPI.legacyProvider;
|
||||
@@ -300,7 +300,7 @@ define(
|
||||
var defaultRange = metadata.valuesForHints(['range'])[0];
|
||||
defaultRange = defaultRange ? defaultRange.key : undefined;
|
||||
|
||||
const sourceMap = arrayUtils.keyBy(metadata.values(), 'key');
|
||||
var sourceMap = _.indexBy(metadata.values(), 'key');
|
||||
|
||||
var isLegacyProvider = telemetryAPI.findSubscriptionProvider(domainObject) ===
|
||||
telemetryAPI.legacyProvider;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'objectUtils'
|
||||
'../../api/objects/object-utils'
|
||||
], function (objectUtils) {
|
||||
function ActionDialogDecorator(mct, actionService) {
|
||||
this.mct = mct;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(['objectUtils'], function (objectUtils) {
|
||||
define(['../../api/objects/object-utils'], function (objectUtils) {
|
||||
function AdapterCapability(domainObject) {
|
||||
this.domainObject = domainObject;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* Module defining AlternateCompositionCapability. Created by vwoeltje on 11/7/14.
|
||||
*/
|
||||
define([
|
||||
'objectUtils',
|
||||
'../../api/objects/object-utils',
|
||||
'../../../platform/core/src/capabilities/ContextualDomainObject'
|
||||
], function (objectUtils, ContextualDomainObject) {
|
||||
function AlternateCompositionCapability($injector, domainObject) {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
define([
|
||||
'../capabilities/AlternateCompositionCapability',
|
||||
'objectUtils'
|
||||
'../../api/objects/object-utils'
|
||||
], function (
|
||||
AlternateCompositionCapability,
|
||||
objectUtils
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'objectUtils'
|
||||
'../../api/objects/object-utils'
|
||||
], function (
|
||||
objectUtils
|
||||
utils
|
||||
) {
|
||||
/**
|
||||
* @implements module:openmct.TelemetryAPI~TelemetryProvider
|
||||
@@ -41,8 +41,8 @@ define([
|
||||
* @see module:openmct.TelemetryAPI~TelemetryProvider#canProvideTelemetry
|
||||
*/
|
||||
LegacyTelemetryProvider.prototype.canProvideTelemetry = function (domainObject) {
|
||||
return this.instantiate(objectUtils.toOldFormat(domainObject),
|
||||
objectUtils.makeKeyString(domainObject.identifier)).hasCapability("telemetry");
|
||||
return this.instantiate(utils.toOldFormat(domainObject),
|
||||
utils.makeKeyString(domainObject.identifier)).hasCapability("telemetry");
|
||||
};
|
||||
|
||||
LegacyTelemetryProvider.prototype.supportsRequest =
|
||||
@@ -105,7 +105,7 @@ define([
|
||||
*/
|
||||
LegacyTelemetryProvider.prototype.request = function (domainObject, request) {
|
||||
var metadata = this.telemetryApi.getMetadata(domainObject);
|
||||
var oldObject = this.instantiate(objectUtils.toOldFormat(domainObject), objectUtils.makeKeyString(domainObject.identifier));
|
||||
var oldObject = this.instantiate(utils.toOldFormat(domainObject), utils.makeKeyString(domainObject.identifier));
|
||||
var capability = oldObject.getCapability("telemetry");
|
||||
|
||||
return capability.requestData(request).then(function (telemetrySeries) {
|
||||
@@ -131,7 +131,7 @@ define([
|
||||
*/
|
||||
LegacyTelemetryProvider.prototype.subscribe = function (domainObject, callback, request) {
|
||||
var metadata = this.telemetryApi.getMetadata(domainObject);
|
||||
var oldObject = this.instantiate(objectUtils.toOldFormat(domainObject), objectUtils.makeKeyString(domainObject.identifier));
|
||||
var oldObject = this.instantiate(utils.toOldFormat(domainObject), utils.makeKeyString(domainObject.identifier));
|
||||
var capability = oldObject.getCapability("telemetry");
|
||||
|
||||
function callbackWrapper(series) {
|
||||
@@ -142,16 +142,16 @@ define([
|
||||
|
||||
LegacyTelemetryProvider.prototype.supportsLimits = function (domainObject) {
|
||||
var oldObject = this.instantiate(
|
||||
objectUtils.toOldFormat(domainObject),
|
||||
objectUtils.makeKeyString(domainObject.identifier)
|
||||
utils.toOldFormat(domainObject),
|
||||
utils.makeKeyString(domainObject.identifier)
|
||||
);
|
||||
return oldObject.hasCapability("limit");
|
||||
};
|
||||
|
||||
LegacyTelemetryProvider.prototype.getLimitEvaluator = function (domainObject) {
|
||||
var oldObject = this.instantiate(
|
||||
objectUtils.toOldFormat(domainObject),
|
||||
objectUtils.makeKeyString(domainObject.identifier)
|
||||
utils.toOldFormat(domainObject),
|
||||
utils.makeKeyString(domainObject.identifier)
|
||||
);
|
||||
var limitEvaluator = oldObject.getCapability("limit");
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ define([
|
||||
};
|
||||
|
||||
TimeSettingsURLHandler.prototype.parseQueryParams = function () {
|
||||
var searchParams = _.pick(this.$location.search(), Object.values(SEARCH));
|
||||
var searchParams = _.pick(this.$location.search(), _.values(SEARCH));
|
||||
var parsedParams = {
|
||||
clock: searchParams[SEARCH.MODE],
|
||||
timeSystem: searchParams[SEARCH.TIME_SYSTEM]
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'objectUtils'
|
||||
'../../api/objects/object-utils'
|
||||
], function (
|
||||
objectUtils
|
||||
utils
|
||||
) {
|
||||
function ObjectServiceProvider(eventEmitter, objectService, instantiate, topic) {
|
||||
this.eventEmitter = eventEmitter;
|
||||
@@ -43,22 +43,22 @@ define([
|
||||
var handleLegacyMutation;
|
||||
|
||||
var handleMutation = function (newStyleObject) {
|
||||
var keyString = objectUtils.makeKeyString(newStyleObject.identifier);
|
||||
var oldStyleObject = this.instantiate(objectUtils.toOldFormat(newStyleObject), keyString);
|
||||
var keyString = utils.makeKeyString(newStyleObject.identifier);
|
||||
var oldStyleObject = this.instantiate(utils.toOldFormat(newStyleObject), keyString);
|
||||
|
||||
// Don't trigger self
|
||||
removeGeneralTopicListener();
|
||||
|
||||
oldStyleObject.getCapability('mutation').mutate(function () {
|
||||
return objectUtils.toOldFormat(newStyleObject);
|
||||
return utils.toOldFormat(newStyleObject);
|
||||
});
|
||||
|
||||
removeGeneralTopicListener = this.generalTopic.listen(handleLegacyMutation);
|
||||
}.bind(this);
|
||||
|
||||
handleLegacyMutation = function (legacyObject) {
|
||||
var newStyleObject = objectUtils.toNewFormat(legacyObject.getModel(), legacyObject.getId()),
|
||||
keystring = objectUtils.makeKeyString(newStyleObject.identifier);
|
||||
var newStyleObject = utils.toNewFormat(legacyObject.getModel(), legacyObject.getId()),
|
||||
keystring = utils.makeKeyString(newStyleObject.identifier);
|
||||
|
||||
this.eventEmitter.emit(keystring + ":*", newStyleObject);
|
||||
this.eventEmitter.emit('mutation', newStyleObject);
|
||||
@@ -74,7 +74,7 @@ define([
|
||||
return object.getCapability('persistence')
|
||||
.persist()
|
||||
.then(function () {
|
||||
return objectUtils.toNewFormat(object, key);
|
||||
return utils.toNewFormat(object, key);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -83,11 +83,11 @@ define([
|
||||
};
|
||||
|
||||
ObjectServiceProvider.prototype.get = function (key) {
|
||||
var keyString = objectUtils.makeKeyString(key);
|
||||
var keyString = utils.makeKeyString(key);
|
||||
return this.objectService.getObjects([keyString])
|
||||
.then(function (results) {
|
||||
var model = results[keyString].getModel();
|
||||
return objectUtils.toNewFormat(model, key);
|
||||
return utils.toNewFormat(model, key);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -99,10 +99,10 @@ define([
|
||||
this.getObjects = function (keys) {
|
||||
var results = {},
|
||||
promises = keys.map(function (keyString) {
|
||||
var key = objectUtils.parseKeyString(keyString);
|
||||
var key = utils.parseKeyString(keyString);
|
||||
return openmct.objects.get(key)
|
||||
.then(function (object) {
|
||||
object = objectUtils.toOldFormat(object);
|
||||
object = utils.toOldFormat(object);
|
||||
results[keyString] = instantiate(object, keyString);
|
||||
});
|
||||
});
|
||||
@@ -123,7 +123,7 @@ define([
|
||||
);
|
||||
|
||||
ROOTS.forEach(function (r) {
|
||||
openmct.objects.addRoot(objectUtils.parseKeyString(r.id));
|
||||
openmct.objects.addRoot(utils.parseKeyString(r.id));
|
||||
});
|
||||
|
||||
return this;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'objectUtils'
|
||||
'../../api/objects/object-utils'
|
||||
], function (
|
||||
objectUtils
|
||||
) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
define([
|
||||
'./LegacyViewProvider',
|
||||
'./TypeInspectorViewProvider',
|
||||
'objectUtils'
|
||||
'../../api/objects/object-utils'
|
||||
], function (
|
||||
LegacyViewProvider,
|
||||
TypeInspectorViewProvider,
|
||||
|
||||
@@ -21,10 +21,12 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
'EventEmitter',
|
||||
'./DefaultCompositionProvider',
|
||||
'./CompositionCollection'
|
||||
], function (
|
||||
_,
|
||||
EventEmitter,
|
||||
DefaultCompositionProvider,
|
||||
CompositionCollection
|
||||
@@ -68,7 +70,9 @@ define([
|
||||
* @memberof module:openmct.CompositionAPI#
|
||||
*/
|
||||
CompositionAPI.prototype.get = function (domainObject) {
|
||||
var provider = this.registry.find(p => p.appliesTo(domainObject));
|
||||
var provider = _.find(this.registry, function (p) {
|
||||
return p.appliesTo(domainObject);
|
||||
});
|
||||
|
||||
if (!provider) {
|
||||
return;
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define([], function (
|
||||
define([
|
||||
'lodash'
|
||||
], function (
|
||||
_
|
||||
) {
|
||||
/**
|
||||
@@ -120,7 +122,7 @@ define([], function (
|
||||
throw new Error('Event not supported by composition: ' + event);
|
||||
}
|
||||
|
||||
var index = this.listeners[event].findIndex(function (l) {
|
||||
var index = _.findIndex(this.listeners[event], function (l) {
|
||||
return l.callback === callback && l.context === context;
|
||||
});
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
'objectUtils'
|
||||
'../objects/object-utils'
|
||||
], function (
|
||||
_,
|
||||
objectUtils
|
||||
@@ -143,7 +143,7 @@ define([
|
||||
var keyString = objectUtils.makeKeyString(domainObject.identifier);
|
||||
var objectListeners = this.listeningTo[keyString];
|
||||
|
||||
var index = objectListeners[event].findIndex(function (l) {
|
||||
var index = _.findIndex(objectListeners[event], function (l) {
|
||||
return l.callback === callback && l.context === context;
|
||||
});
|
||||
|
||||
@@ -196,8 +196,8 @@ define([
|
||||
* @private
|
||||
*/
|
||||
DefaultCompositionProvider.prototype.includes = function (parent, childId) {
|
||||
return parent.composition.some(composee =>
|
||||
this.publicAPI.objects.areIdsEqual(composee, childId));
|
||||
return parent.composition.findIndex(composee =>
|
||||
this.publicAPI.objects.areIdsEqual(composee, childId)) !== -1;
|
||||
};
|
||||
|
||||
DefaultCompositionProvider.prototype.reorder = function (domainObject, oldIndex, newIndex) {
|
||||
|
||||
@@ -20,9 +20,11 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
define([
|
||||
'./SimpleIndicator'
|
||||
'./SimpleIndicator',
|
||||
'lodash'
|
||||
], function (
|
||||
SimpleIndicator
|
||||
SimpleIndicator,
|
||||
_
|
||||
) {
|
||||
function IndicatorAPI(openmct) {
|
||||
this.openmct = openmct;
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'objectUtils',
|
||||
'./object-utils.js',
|
||||
'lodash'
|
||||
], function (
|
||||
objectUtils,
|
||||
utils,
|
||||
_
|
||||
) {
|
||||
var ANY_OBJECT_EVENT = "mutation";
|
||||
@@ -43,7 +43,7 @@ define([
|
||||
}
|
||||
|
||||
function qualifiedEventName(object, eventName) {
|
||||
var keystring = objectUtils.makeKeyString(object.identifier);
|
||||
var keystring = utils.makeKeyString(object.identifier);
|
||||
|
||||
return [keystring, eventName].join(':');
|
||||
}
|
||||
|
||||
@@ -21,13 +21,15 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'objectUtils',
|
||||
'lodash',
|
||||
'./object-utils',
|
||||
'./MutableObject',
|
||||
'./RootRegistry',
|
||||
'./RootObjectProvider',
|
||||
'EventEmitter'
|
||||
], function (
|
||||
objectUtils,
|
||||
_,
|
||||
utils,
|
||||
MutableObject,
|
||||
RootRegistry,
|
||||
RootObjectProvider,
|
||||
@@ -141,7 +143,7 @@ define([
|
||||
* has been saved, or be rejected if it cannot be saved
|
||||
*/
|
||||
ObjectAPI.prototype.get = function (identifier) {
|
||||
identifier = objectUtils.parseKeyString(identifier);
|
||||
identifier = utils.parseKeyString(identifier);
|
||||
var provider = this.getProvider(identifier);
|
||||
|
||||
if (!provider) {
|
||||
@@ -210,7 +212,7 @@ define([
|
||||
* @returns {string} A string representation of the given identifier, including namespace and key
|
||||
*/
|
||||
ObjectAPI.prototype.makeKeyString = function (identifier) {
|
||||
return objectUtils.makeKeyString(identifier);
|
||||
return utils.makeKeyString(identifier);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -218,7 +220,7 @@ define([
|
||||
* @param {module:openmct.ObjectAPI~Identifier[]} identifiers
|
||||
*/
|
||||
ObjectAPI.prototype.areIdsEqual = function (...identifiers) {
|
||||
return identifiers.map(objectUtils.parseKeyString)
|
||||
return identifiers.map(utils.parseKeyString)
|
||||
.every(identifier => {
|
||||
return identifier === identifiers[0] ||
|
||||
(identifier.namespace === identifiers[0].namespace &&
|
||||
@@ -232,7 +234,7 @@ define([
|
||||
let location = domainObject.location;
|
||||
|
||||
if (location) {
|
||||
return this.getOriginalPath(objectUtils.parseKeyString(location), path);
|
||||
return this.getOriginalPath(utils.parseKeyString(location), path);
|
||||
} else {
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -21,11 +21,9 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
'arrayUtils'
|
||||
'lodash'
|
||||
], function (
|
||||
_,
|
||||
arrayUtils
|
||||
_
|
||||
) {
|
||||
|
||||
function RootRegistry() {
|
||||
@@ -37,7 +35,7 @@ define([
|
||||
return provider();
|
||||
});
|
||||
return Promise.all(promises)
|
||||
.then(arrayUtils.flatten);
|
||||
.then(_.flatten);
|
||||
};
|
||||
|
||||
function isKey(key) {
|
||||
@@ -45,7 +43,7 @@ define([
|
||||
}
|
||||
|
||||
RootRegistry.prototype.addRoot = function (key) {
|
||||
if (isKey(key) || (Array.isArray(key) && key.every(isKey))) {
|
||||
if (isKey(key) || (_.isArray(key) && _.every(key, isKey))) {
|
||||
this.providers.push(function () {
|
||||
return key;
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
define([
|
||||
'objectUtils'
|
||||
'../object-utils'
|
||||
], function (
|
||||
objectUtils
|
||||
) {
|
||||
|
||||
@@ -85,13 +85,9 @@ define([
|
||||
value: +e.value
|
||||
};
|
||||
}), 'e.value');
|
||||
valueMetadata.values = Object.entries(valueMetadata.enumerations)
|
||||
.reduce((accumulator, [key, {value}]) => {
|
||||
accumulator[key] = value;
|
||||
return accumulator
|
||||
}, []);
|
||||
valueMetadata.max = Math.max(...valueMetadata.values);
|
||||
valueMetadata.min = Math.min(...valueMetadata.values);
|
||||
valueMetadata.values = _.pluck(valueMetadata.enumerations, 'value');
|
||||
valueMetadata.max = _.max(valueMetadata.values);
|
||||
valueMetadata.min = _.min(valueMetadata.values);
|
||||
}
|
||||
|
||||
valueMetadatas.push(valueMetadata);
|
||||
@@ -107,7 +103,7 @@ define([
|
||||
var metadata = domainObject.telemetry || {};
|
||||
if (this.typeHasTelemetry(domainObject)) {
|
||||
var typeMetadata = this.typeService.getType(domainObject.type).typeDef.telemetry;
|
||||
Object.assign(metadata, typeMetadata);
|
||||
_.extend(metadata, typeMetadata);
|
||||
if (!metadata.values) {
|
||||
metadata.values = valueMetadatasFromOldFormat(metadata);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ define([
|
||||
'./TelemetryMetadataManager',
|
||||
'./TelemetryValueFormatter',
|
||||
'./DefaultMetadataProvider',
|
||||
'objectUtils',
|
||||
'../objects/object-utils',
|
||||
'lodash'
|
||||
], function (
|
||||
TelemetryMetadataManager,
|
||||
@@ -370,8 +370,7 @@ define([
|
||||
TelemetryAPI.prototype.commonValuesForHints = function (metadatas, hints) {
|
||||
var options = metadatas.map(function (metadata) {
|
||||
var values = metadata.valuesForHints(hints);
|
||||
const keyBy = (array, key) => (array || []).reduce((r, x) => ({ ...r, [key ? x[key] : x]: x }), {});
|
||||
return keyBy(values, 'key');
|
||||
return _.indexBy(values, 'key');
|
||||
}).reduce(function (a, b) {
|
||||
var results = {};
|
||||
Object.keys(a).forEach(function (key) {
|
||||
@@ -384,7 +383,7 @@ define([
|
||||
var sortKeys = hints.map(function (h) {
|
||||
return 'hints.' + h;
|
||||
});
|
||||
return _.sortBy(options, sortKeys);
|
||||
return _.sortByAll(options, sortKeys);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,13 +57,13 @@ define([
|
||||
|
||||
if (valueMetadata.format === 'enum') {
|
||||
if (!valueMetadata.values) {
|
||||
valueMetadata.enumerations.map(enumeration => enumeration.value);
|
||||
valueMetadata.values = _.pluck(valueMetadata.enumerations, 'value');
|
||||
}
|
||||
if (!valueMetadata.hasOwnProperty('max')) {
|
||||
valueMetadata.max = _.max(valueMetadata.values) + 1;
|
||||
}
|
||||
if (!valueMetadata.hasOwnProperty('min')) {
|
||||
valueMetadata.min = _.max(valueMetadata.values) + 1;
|
||||
valueMetadata.min = _.min(valueMetadata.values) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ define([
|
||||
return metadata.hints[hint];
|
||||
}
|
||||
});
|
||||
return _.sortBy(matchingMetadata, ...iteratees);
|
||||
return _.sortByAll(matchingMetadata, ...iteratees);
|
||||
};
|
||||
|
||||
TelemetryMetadataManager.prototype.getFilterableValues = function () {
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* 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;
|
||||
});
|
||||
@@ -1,131 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* 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();
|
||||
});
|
||||
});
|
||||
@@ -75,7 +75,7 @@ export default {
|
||||
this.items.push(item);
|
||||
},
|
||||
removeItem(identifier) {
|
||||
let index = this.items.findIndex(item => this.openmct.objects.makeKeyString(identifier) === item.key);
|
||||
let index = _.findIndex(this.items, (item) => this.openmct.objects.makeKeyString(identifier) === item.key);
|
||||
|
||||
this.items.splice(index, 1);
|
||||
},
|
||||
|
||||
@@ -102,7 +102,7 @@ export default {
|
||||
this.compositions.push({composition, addCallback, removeCallback});
|
||||
},
|
||||
removePrimary(identifier) {
|
||||
let index = this.primaryTelemetryObjects.findIndex(primary => this.openmct.objects.makeKeyString(identifier) === primary.key),
|
||||
let index = _.findIndex(this.primaryTelemetryObjects, (primary) => this.openmct.objects.makeKeyString(identifier) === primary.key),
|
||||
primary = this.primaryTelemetryObjects[index];
|
||||
|
||||
this.$set(this.secondaryTelemetryObjects, primary.key, undefined);
|
||||
@@ -130,7 +130,7 @@ export default {
|
||||
removeSecondary(primary) {
|
||||
return (identifier) => {
|
||||
let array = this.secondaryTelemetryObjects[primary.key],
|
||||
index = array.findIndex(secondary => this.openmct.objects.makeKeyString(identifier) === secondary.key);
|
||||
index = _.findIndex(array, (secondary) => this.openmct.objects.makeKeyString(identifier) === secondary.key);
|
||||
|
||||
array.splice(index, 1);
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ export default {
|
||||
this.$emit('telemetryUpdated', this.telemetryObjs);
|
||||
},
|
||||
removeTelemetryObject(identifier) {
|
||||
let index = this.telemetryObjs.findIndex(obj => {
|
||||
let index = _.findIndex(this.telemetryObjs, (obj) => {
|
||||
let objId = this.openmct.objects.makeKeyString(obj.identifier);
|
||||
let id = this.openmct.objects.makeKeyString(identifier);
|
||||
return objId === id;
|
||||
|
||||
@@ -105,8 +105,7 @@ import ConditionDescription from "@/plugins/condition/components/ConditionDescri
|
||||
import ConditionError from "@/plugins/condition/components/ConditionError.vue";
|
||||
import Vue from 'vue';
|
||||
import PreviewAction from "@/ui/preview/PreviewAction.js";
|
||||
import { getApplicableStylesForItem } from "@/plugins/condition/utils/styleUtils";
|
||||
import { isEmpty } from 'arrayUtils';
|
||||
import {getApplicableStylesForItem} from "@/plugins/condition/utils/styleUtils";
|
||||
|
||||
export default {
|
||||
name: 'ConditionalStylesView',
|
||||
@@ -274,7 +273,7 @@ export default {
|
||||
delete domainObjectStyles[this.itemId].conditionSetIdentifier;
|
||||
domainObjectStyles[this.itemId].styles = undefined;
|
||||
delete domainObjectStyles[this.itemId].styles;
|
||||
if (isEmpty(domainObjectStyles[this.itemId])) {
|
||||
if (_.isEmpty(domainObjectStyles[this.itemId])) {
|
||||
delete domainObjectStyles[this.itemId];
|
||||
}
|
||||
} else {
|
||||
@@ -283,7 +282,7 @@ export default {
|
||||
domainObjectStyles.styles = undefined;
|
||||
delete domainObjectStyles.styles;
|
||||
}
|
||||
if (isEmpty(domainObjectStyles)) {
|
||||
if (_.isEmpty(domainObjectStyles)) {
|
||||
domainObjectStyles = undefined;
|
||||
}
|
||||
|
||||
@@ -314,7 +313,7 @@ export default {
|
||||
delete domainObjectStyles[this.itemId];
|
||||
}
|
||||
});
|
||||
if (isEmpty(domainObjectStyles)) {
|
||||
if (_.isEmpty(domainObjectStyles)) {
|
||||
domainObjectStyles = undefined;
|
||||
}
|
||||
this.persist(domainObjectStyles);
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
import StyleEditor from "./StyleEditor.vue";
|
||||
import PreviewAction from "@/ui/preview/PreviewAction.js";
|
||||
import { getApplicableStylesForItem, getConsolidatedStyleValues, getConditionalStyleForItem } from "@/plugins/condition/utils/styleUtils";
|
||||
import { isEmpty } from 'arrayUtils';
|
||||
|
||||
export default {
|
||||
name: 'MultiSelectStylesView',
|
||||
@@ -179,7 +178,7 @@ export default {
|
||||
domainObjectStyles[itemId] = undefined;
|
||||
delete domainObjectStyles[this.itemId];
|
||||
|
||||
if (isEmpty(domainObjectStyles)) {
|
||||
if (_.isEmpty(domainObjectStyles)) {
|
||||
domainObjectStyles = undefined;
|
||||
}
|
||||
this.persist(this.domainObject, domainObjectStyles);
|
||||
@@ -240,7 +239,7 @@ export default {
|
||||
if (this.isStaticAndConditionalStyles) {
|
||||
this.removeConditionalStyles(domainObjectStyles, item.id);
|
||||
}
|
||||
if (isEmpty(itemStaticStyle)) {
|
||||
if (_.isEmpty(itemStaticStyle)) {
|
||||
itemStaticStyle = undefined;
|
||||
domainObjectStyles[item.id] = undefined;
|
||||
} else {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
import { createOpenMct } from "testUtils";
|
||||
import { createOpenMct } from "testTools";
|
||||
import ConditionPlugin from "./plugin";
|
||||
|
||||
let openmct = createOpenMct();
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
import _ from 'lodash';
|
||||
|
||||
const convertToNumbers = (input) => {
|
||||
let numberInputs = [];
|
||||
input.forEach(inputValue => numberInputs.push(Number(inputValue)));
|
||||
@@ -32,10 +34,6 @@ const convertToStrings = (input) => {
|
||||
return stringInputs;
|
||||
};
|
||||
|
||||
const joinValues = (values, length) => {
|
||||
return values.slice(0, length).join(', ');
|
||||
};
|
||||
|
||||
export const OPERATIONS = [
|
||||
{
|
||||
name: 'equalTo',
|
||||
@@ -46,7 +44,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['number'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' is ' + joinValues(values, 1);
|
||||
return ' is ' + values.join(', ');
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -58,7 +56,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['number'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' is not ' + joinValues(values, 1);
|
||||
return ' is not ' + values.join(', ');
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -70,7 +68,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['number'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' > ' + joinValues(values, 1);
|
||||
return ' > ' + values.join(', ');
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -82,7 +80,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['number'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' < ' + joinValues(values, 1);
|
||||
return ' < ' + values.join(', ');
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -94,7 +92,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['number'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' >= ' + joinValues(values, 1);
|
||||
return ' >= ' + values.join(', ');
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -106,7 +104,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['number'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' <= ' + joinValues(values, 1);
|
||||
return ' <= ' + values.join(', ');
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -148,7 +146,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['string'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' contains ' + joinValues(values, 1);
|
||||
return ' contains ' + values.join(', ');
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -160,7 +158,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['string'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' does not contain ' + joinValues(values, 1);
|
||||
return ' does not contain ' + values.join(', ');
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -172,7 +170,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['string'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' starts with ' + joinValues(values, 1);
|
||||
return ' starts with ' + values.join(', ');
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -184,7 +182,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['string'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' ends with ' + joinValues(values, 1);
|
||||
return ' ends with ' + values.join(', ');
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -196,7 +194,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['string'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' is exactly ' + joinValues(values, 1);
|
||||
return ' is exactly ' + values.join(', ');
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -233,7 +231,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['enum'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' is ' + joinValues(values, 1);
|
||||
return ' is ' + values.join(', ');
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -246,7 +244,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['enum'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' is not ' + joinValues(values, 1);
|
||||
return ' is not ' + values.join(', ');
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -255,7 +253,7 @@ export const OPERATIONS = [
|
||||
const lhsValue = input[0] !== undefined ? input[0].toString() : '';
|
||||
if (input[1]) {
|
||||
const values = input[1].split(',');
|
||||
return values.find((value) => lhsValue === value.toString().trim());
|
||||
return values.find((value) => lhsValue === _.trim(value.toString()));
|
||||
}
|
||||
return false;
|
||||
},
|
||||
@@ -272,7 +270,7 @@ export const OPERATIONS = [
|
||||
const lhsValue = input[0] !== undefined ? input[0].toString() : '';
|
||||
if (input[1]) {
|
||||
const values = input[1].split(',');
|
||||
const found = values.find((value) => lhsValue === value.toString().trim());
|
||||
const found = values.find((value) => lhsValue === _.trim(value.toString()));
|
||||
return !found;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
import { isEmpty } from 'arrayUtils';
|
||||
|
||||
const NONE_VALUE = '__no_value';
|
||||
|
||||
const styleProps = {
|
||||
@@ -156,7 +154,7 @@ export const getApplicableStylesForItem = (domainObject, item) => {
|
||||
};
|
||||
|
||||
export const getStylesWithoutNoneValue = (style) => {
|
||||
if (isEmpty(style) || !style) {
|
||||
if (_.isEmpty(style) || !style) {
|
||||
return;
|
||||
}
|
||||
let styleObj = {};
|
||||
|
||||
@@ -20,11 +20,7 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'arrayUtils'
|
||||
], function (
|
||||
arrayUtils
|
||||
) {
|
||||
define(['lodash'], function (_) {
|
||||
function DisplayLayoutToolbar(openmct) {
|
||||
return {
|
||||
name: "Display Layout Toolbar",
|
||||
@@ -563,7 +559,7 @@ define([
|
||||
});
|
||||
|
||||
let toolbarArray = Object.values(toolbar);
|
||||
return arrayUtils.flatten(toolbarArray.reduce((accumulator, group, index) => {
|
||||
return _.flatten(toolbarArray.reduce((accumulator, group, index) => {
|
||||
group = group.filter(control => control !== undefined);
|
||||
|
||||
if (group.length > 0) {
|
||||
|
||||
@@ -76,7 +76,6 @@ import TextView from './TextView.vue'
|
||||
import LineView from './LineView.vue'
|
||||
import ImageView from './ImageView.vue'
|
||||
import EditMarquee from './EditMarquee.vue'
|
||||
import _ from 'lodash';
|
||||
|
||||
const ITEM_TYPE_VIEW_MAP = {
|
||||
'subobject-view': SubobjectView,
|
||||
@@ -513,7 +512,7 @@ export default {
|
||||
}
|
||||
},
|
||||
updateTelemetryFormat(item, format) {
|
||||
let index = this.layoutItems.findIndex(item);
|
||||
let index = _.findIndex(this.layoutItems, item);
|
||||
item.format = format;
|
||||
this.mutate(`configuration.items[${index}]`, item);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
|
||||
<script>
|
||||
import LayoutDrag from './../LayoutDrag'
|
||||
import _ from 'lodash'
|
||||
|
||||
export default {
|
||||
inject: ['openmct'],
|
||||
|
||||
@@ -62,7 +62,6 @@
|
||||
<script>
|
||||
|
||||
import conditionalStylesMixin from "../mixins/objectStyles-mixin";
|
||||
import _ from 'lodash';
|
||||
|
||||
const START_HANDLE_QUADRANTS = {
|
||||
1: 'c-frame-edit__handle--sw',
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
import Layout from './components/DisplayLayout.vue'
|
||||
import Vue from 'vue'
|
||||
import objectUtils from 'objectUtils'
|
||||
import objectUtils from '../../api/objects/object-utils.js'
|
||||
import DisplayLayoutType from './DisplayLayoutType.js'
|
||||
import DisplayLayoutToolbar from './DisplayLayoutToolbar.js'
|
||||
import AlphaNumericFormatViewProvider from './AlphanumericFormatViewProvider.js'
|
||||
|
||||
@@ -62,7 +62,6 @@
|
||||
<script>
|
||||
import FilterField from './FilterField.vue';
|
||||
import ToggleSwitch from '../../../ui/components/ToggleSwitch.vue';
|
||||
import { isEmpty } from 'arrayUtils';
|
||||
|
||||
export default {
|
||||
inject: ['openmct'],
|
||||
@@ -103,7 +102,7 @@ export default {
|
||||
hasActiveFilters() {
|
||||
// Should be true when the user has entered any filter values.
|
||||
return Object.values(this.persistedFilters).some(comparator => {
|
||||
return (typeof(comparator) === 'object' && !isEmpty(comparator));
|
||||
return (typeof(comparator) === 'object' && !_.isEmpty(comparator));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
<script>
|
||||
import FilterObject from './FilterObject.vue';
|
||||
import GlobalFilters from './GlobalFilters.vue'
|
||||
import { isEmpty } from 'arrayUtils';
|
||||
import _ from 'lodash';
|
||||
|
||||
const FILTER_VIEW_TITLE = 'Filters applied';
|
||||
const FILTER_VIEW_TITLE_MIXED = 'Mixed filters applied';
|
||||
@@ -60,7 +58,7 @@ export default {
|
||||
// Should be true when the user has entered any filter values.
|
||||
return Object.values(this.persistedFilters).some(filters => {
|
||||
return Object.values(filters).some(comparator => {
|
||||
return (typeof(comparator) === 'object' && !isEmpty(comparator));
|
||||
return (typeof(comparator) === 'object' && !_.isEmpty(comparator));
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -64,7 +64,6 @@
|
||||
<script>
|
||||
import compositionLoader from './composition-loader';
|
||||
import ListItem from './ListItem.vue';
|
||||
import _ from 'lodash';
|
||||
|
||||
export default {
|
||||
components: {ListItem},
|
||||
|
||||
@@ -220,7 +220,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
const index = _.sortedIndexBy(this.imageHistory, datum, this.timeFormat.format.bind(this.timeFormat));
|
||||
const index = _.sortedIndex(this.imageHistory, datum, this.timeFormat.format.bind(this.timeFormat));
|
||||
this.imageHistory.splice(index, 0, datum);
|
||||
},
|
||||
updateValues(datum) {
|
||||
|
||||
@@ -111,7 +111,7 @@ import SearchResults from './search-results.vue';
|
||||
import Sidebar from './sidebar.vue';
|
||||
import { clearDefaultNotebook, getDefaultNotebook, setDefaultNotebook, setDefaultNotebookSection, setDefaultNotebookPage } from '../utils/notebook-storage';
|
||||
import { addNotebookEntry, createNewEmbed, getNotebookEntries } from '../utils/notebook-entries';
|
||||
import _ from 'lodash';
|
||||
import { throttle } from 'lodash';
|
||||
|
||||
const DEFAULT_CLASS = 'is-notebook-default';
|
||||
|
||||
@@ -175,7 +175,7 @@ export default {
|
||||
watch: {
|
||||
},
|
||||
beforeMount() {
|
||||
this.throttledSearchItem = _.throttle(this.searchItem, 500);
|
||||
this.throttledSearchItem = throttle(this.searchItem, 500);
|
||||
},
|
||||
mounted() {
|
||||
this.unlisten = this.openmct.objects.observe(this.internalDomainObject, '*', this.updateInternalDomainObject);
|
||||
|
||||
@@ -30,7 +30,8 @@ define([
|
||||
'./MCTChartPointSet',
|
||||
'./MCTChartAlarmPointSet',
|
||||
'../draw/DrawLoader',
|
||||
'../lib/eventHelpers'
|
||||
'../lib/eventHelpers',
|
||||
'lodash'
|
||||
],
|
||||
function (
|
||||
MCTChartLineLinear,
|
||||
@@ -38,7 +39,8 @@ function (
|
||||
MCTChartPointSet,
|
||||
MCTChartAlarmPointSet,
|
||||
DrawLoader,
|
||||
eventHelpers
|
||||
eventHelpers,
|
||||
_
|
||||
) {
|
||||
|
||||
var MARKER_SIZE = 6.0,
|
||||
@@ -150,7 +152,7 @@ function (
|
||||
MCTChartController.prototype.destroy = function () {
|
||||
this.isDestroyed = true;
|
||||
this.stopListening();
|
||||
this.lines.forEach(line => line.destroy());
|
||||
_.invoke(this.lines, 'destroy');
|
||||
DrawLoader.releaseDrawAPI(this.drawAPI);
|
||||
};
|
||||
|
||||
|
||||
@@ -22,11 +22,13 @@
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
'EventEmitter',
|
||||
'./Model',
|
||||
'../lib/extend',
|
||||
'../lib/eventHelpers'
|
||||
], function (
|
||||
_,
|
||||
EventEmitter,
|
||||
Model,
|
||||
extend,
|
||||
@@ -42,7 +44,7 @@ define([
|
||||
this.initialize(options);
|
||||
}
|
||||
|
||||
Object.assign(Collection.prototype, EventEmitter.prototype);
|
||||
_.extend(Collection.prototype, EventEmitter.prototype);
|
||||
eventHelpers.extend(Collection.prototype);
|
||||
|
||||
Collection.extend = extend;
|
||||
@@ -103,7 +105,12 @@ define([
|
||||
};
|
||||
|
||||
Collection.prototype.indexOf = function (model) {
|
||||
return this.models.findIndex(m => m === model);
|
||||
return _.findIndex(
|
||||
this.models,
|
||||
function (m) {
|
||||
return m === model;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
Collection.prototype.remove = function (model) {
|
||||
|
||||
@@ -49,7 +49,7 @@ define([
|
||||
this.initialize(options);
|
||||
}
|
||||
|
||||
Object.assign(Model.prototype, EventEmitter.prototype);
|
||||
_.extend(Model.prototype, EventEmitter.prototype);
|
||||
eventHelpers.extend(Model.prototype);
|
||||
|
||||
Model.extend = extend;
|
||||
|
||||
@@ -146,7 +146,7 @@ define([
|
||||
strategy = 'minmax';
|
||||
}
|
||||
|
||||
options = Object.assign({}, { size: 1000, strategy, filters: this.filters }, options || {});
|
||||
options = _.extend({}, { size: 1000, strategy, filters: this.filters }, options || {});
|
||||
|
||||
if (!this.unsubscribe) {
|
||||
this.unsubscribe = this.openmct
|
||||
@@ -270,7 +270,7 @@ define([
|
||||
* @private
|
||||
*/
|
||||
sortedIndex: function (point) {
|
||||
return _.sortedIndexBy(this.data, point, this.getXVal);
|
||||
return _.sortedIndex(this.data, point, this.getXVal);
|
||||
},
|
||||
/**
|
||||
* Update min/max stats for the series.
|
||||
|
||||
@@ -101,10 +101,13 @@ define([
|
||||
var plotObject = this.plot.get('domainObject');
|
||||
if (plotObject.type === 'telemetry.plot.overlay') {
|
||||
|
||||
var persistedIndex = plotObject.configuration.series.findIndex(s => _.isEqual(identifier, s.identifier));
|
||||
var persistedIndex = _.findIndex(plotObject.configuration.series, function (s) {
|
||||
return _.isEqual(identifier, s.identifier);
|
||||
});
|
||||
|
||||
|
||||
var configIndex = this.models.findIndex(m => _.isEqual(m.domainObject.identifier, identifier));
|
||||
var configIndex = _.findIndex(this.models, function (m) {
|
||||
return _.isEqual(m.domainObject.identifier, identifier);
|
||||
});
|
||||
|
||||
/*
|
||||
when cancelling out of edit mode, the config store and domain object are out of sync
|
||||
|
||||
@@ -22,9 +22,11 @@
|
||||
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
'EventEmitter',
|
||||
'../lib/eventHelpers'
|
||||
], function (
|
||||
_,
|
||||
EventEmitter,
|
||||
eventHelpers
|
||||
) {
|
||||
@@ -49,7 +51,7 @@ define([
|
||||
}
|
||||
}
|
||||
|
||||
Object.assign(Draw2D.prototype, EventEmitter.prototype);
|
||||
_.extend(Draw2D.prototype, EventEmitter.prototype);
|
||||
eventHelpers.extend(Draw2D.prototype);
|
||||
|
||||
// Convert from logical to physical x coordinates
|
||||
|
||||
@@ -22,9 +22,11 @@
|
||||
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
'EventEmitter',
|
||||
'../lib/eventHelpers'
|
||||
], function (
|
||||
_,
|
||||
EventEmitter,
|
||||
eventHelpers
|
||||
) {
|
||||
@@ -76,7 +78,7 @@ define([
|
||||
this.listenTo(this.canvas, "webglcontextlost", this.onContextLost, this);
|
||||
}
|
||||
|
||||
Object.assign(DrawWebGL.prototype, EventEmitter.prototype);
|
||||
_.extend(DrawWebGL.prototype, EventEmitter.prototype);
|
||||
eventHelpers.extend(DrawWebGL.prototype);
|
||||
|
||||
DrawWebGL.prototype.onContextLost = function (event) {
|
||||
|
||||
@@ -22,10 +22,14 @@
|
||||
|
||||
define([
|
||||
'../configuration/configStore',
|
||||
'../lib/eventHelpers'
|
||||
'../lib/eventHelpers',
|
||||
'../../../../api/objects/object-utils',
|
||||
'lodash'
|
||||
], function (
|
||||
configStore,
|
||||
eventHelpers
|
||||
eventHelpers,
|
||||
objectUtils,
|
||||
_
|
||||
) {
|
||||
|
||||
function PlotOptionsController($scope, openmct, $timeout) {
|
||||
|
||||
@@ -31,7 +31,9 @@ define([
|
||||
function dynamicPathForKey(key) {
|
||||
return function (object, model) {
|
||||
var modelIdentifier = model.get('identifier');
|
||||
var index = object.configuration.series.findIndex(s => _.isEqual(s.identifier, modelIdentifier));
|
||||
var index = _.findIndex(object.configuration.series, function (s) {
|
||||
return _.isEqual(s.identifier, modelIdentifier);
|
||||
});
|
||||
return 'configuration.series[' + index + '].' + key;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'./PlotModelFormController'
|
||||
'./PlotModelFormController',
|
||||
'lodash'
|
||||
], function (
|
||||
PlotModelFormController,
|
||||
_
|
||||
@@ -72,10 +73,10 @@ define([
|
||||
if (range.max === '' || range.max === null || typeof range.max === 'undefined') {
|
||||
return 'Must specify Maximum';
|
||||
}
|
||||
if (Number.isNaN(range.min)) {
|
||||
if (_.isNaN(Number(range.min))) {
|
||||
return 'Minimum must be a number.';
|
||||
}
|
||||
if (Number.isNaN(range.max)) {
|
||||
if (_.isNaN(Number(range.max))) {
|
||||
return 'Maximum must be a number.';
|
||||
}
|
||||
if (Number(range.min) > Number(range.max)) {
|
||||
|
||||
@@ -76,7 +76,7 @@ define([
|
||||
if (childObj) {
|
||||
var index = telemetryObjects.indexOf(childObj);
|
||||
telemetryObjects.splice(index, 1);
|
||||
$scope.$broadcast('plot:tickWidth', Math.max(...Object.values(tickWidthMap)));
|
||||
$scope.$broadcast('plot:tickWidth', _.max(tickWidthMap));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,6 @@ define([
|
||||
}
|
||||
tickWidthMap[plotId] = Math.max(width, tickWidthMap[plotId]);
|
||||
var newTickWidth = _.max(tickWidthMap);
|
||||
|
||||
if (newTickWidth !== tickWidth || width !== tickWidth) {
|
||||
tickWidth = newTickWidth;
|
||||
$scope.$broadcast('plot:tickWidth', tickWidth);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
define([
|
||||
'objectUtils'
|
||||
'../../api/objects/object-utils'
|
||||
], function (
|
||||
objectUtils
|
||||
) {
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
define ([
|
||||
'./ConditionEvaluator',
|
||||
'objectUtils',
|
||||
'arrayUtils',
|
||||
'../../../api/objects/object-utils',
|
||||
'EventEmitter',
|
||||
'zepto',
|
||||
'lodash'
|
||||
], function (
|
||||
ConditionEvaluator,
|
||||
objectUtils,
|
||||
arrayUtils,
|
||||
EventEmitter,
|
||||
$,
|
||||
_
|
||||
@@ -252,7 +250,7 @@ define ([
|
||||
delete this.subscriptions[objectId];
|
||||
this.eventEmitter.emit('remove', identifier);
|
||||
|
||||
if (arrayUtils.isEmpty(this.compositionObjs)) {
|
||||
if (_.isEmpty(this.compositionObjs)) {
|
||||
$('.w-summary-widget').addClass('s-status-no-data');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,7 +5,8 @@ define([
|
||||
'./TestDataManager',
|
||||
'./WidgetDnD',
|
||||
'./eventHelpers',
|
||||
'objectUtils',
|
||||
'../../../api/objects/object-utils',
|
||||
'lodash',
|
||||
'zepto'
|
||||
], function (
|
||||
widgetTemplate,
|
||||
@@ -15,6 +16,7 @@ define([
|
||||
WidgetDnD,
|
||||
eventHelpers,
|
||||
objectUtils,
|
||||
_,
|
||||
$
|
||||
) {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
define([
|
||||
'./Select',
|
||||
'objectUtils'
|
||||
'../../../../api/objects/object-utils'
|
||||
], function (
|
||||
Select,
|
||||
objectUtils
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
define([
|
||||
'./SummaryWidgetEvaluator',
|
||||
'objectUtils'
|
||||
'../../../../api/objects/object-utils'
|
||||
], function (
|
||||
SummaryWidgetEvaluator,
|
||||
objectUtils
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
define([
|
||||
'./SummaryWidgetRule',
|
||||
'../eventHelpers',
|
||||
'objectUtils',
|
||||
'../../../../api/objects/object-utils',
|
||||
'lodash'
|
||||
], function (
|
||||
SummaryWidgetRule,
|
||||
@@ -154,7 +154,7 @@ define([
|
||||
return _(this.baseState)
|
||||
.values()
|
||||
.map(_.clone)
|
||||
.keyBy('id')
|
||||
.indexBy('id')
|
||||
.value();
|
||||
}.bind(this));
|
||||
};
|
||||
@@ -182,7 +182,7 @@ define([
|
||||
* @private.
|
||||
*/
|
||||
SummaryWidgetEvaluator.prototype.updateObjectStateFromLAD = function (options, objectState) {
|
||||
options = Object.assign({}, options, {
|
||||
options = _.extend({}, options, {
|
||||
strategy: 'latest',
|
||||
size: 1
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
define([
|
||||
'../SummaryWidget',
|
||||
'./SummaryWidgetView',
|
||||
'objectUtils'
|
||||
'../../../../api/objects/object-utils'
|
||||
], function (
|
||||
SummaryWidgetEditView,
|
||||
SummaryWidgetView,
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<object-view
|
||||
v-if="internalDomainObject.keep_alive ? currentTab : isCurrent(tab)"
|
||||
class="c-tabs-view__object"
|
||||
:object="tab.domainObject"
|
||||
/>
|
||||
@@ -73,6 +74,7 @@ export default {
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
internalDomainObject: this.domainObject,
|
||||
currentTab: {},
|
||||
tabsList: [],
|
||||
setCurrentTab: true,
|
||||
@@ -88,6 +90,8 @@ export default {
|
||||
this.composition.load();
|
||||
}
|
||||
|
||||
this.unsubscribe = this.openmct.objects.observe(this.internalDomainObject, '*', this.updateInternalDomainObject);
|
||||
|
||||
document.addEventListener('dragstart', this.dragstart);
|
||||
document.addEventListener('dragend', this.dragend);
|
||||
},
|
||||
@@ -96,6 +100,8 @@ export default {
|
||||
this.composition.off('remove', this.removeItem);
|
||||
this.composition.off('reorder', this.onReorder);
|
||||
|
||||
this.unsubscribe();
|
||||
|
||||
document.removeEventListener('dragstart', this.dragstart);
|
||||
document.removeEventListener('dragend', this.dragend);
|
||||
},
|
||||
@@ -156,6 +162,9 @@ export default {
|
||||
},
|
||||
isCurrent(tab) {
|
||||
return _.isEqual(this.currentTab, tab)
|
||||
},
|
||||
updateInternalDomainObject(domainObject) {
|
||||
this.internalDomainObject = domainObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,27 @@ define([
|
||||
cssClass: 'icon-tabs-view',
|
||||
initialize(domainObject) {
|
||||
domainObject.composition = [];
|
||||
}
|
||||
domainObject.keep_alive = true;
|
||||
},
|
||||
form: [
|
||||
{
|
||||
"key": "keep_alive",
|
||||
"name": "Keep Tabs Alive",
|
||||
"control": "select",
|
||||
"options": [
|
||||
{
|
||||
'name': 'True',
|
||||
'value': true
|
||||
},
|
||||
{
|
||||
'name': 'False',
|
||||
'value': false
|
||||
}
|
||||
],
|
||||
"required": true,
|
||||
"cssClass": "l-input"
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
/*jshint latedef: nofunc */
|
||||
/*global console */
|
||||
define([
|
||||
'objectUtils',
|
||||
'../../../api/objects/object-utils',
|
||||
'./TelemetryAverager'
|
||||
], function (objectUtils, TelemetryAverager) {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'objectUtils',
|
||||
'../../api/objects/object-utils',
|
||||
'./components/table-configuration.vue',
|
||||
'./TelemetryTableConfiguration',
|
||||
'vue'
|
||||
|
||||
@@ -22,10 +22,8 @@
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
'EventEmitter',
|
||||
'arrayUtils'
|
||||
|
||||
], function (_, EventEmitter, arrayUtils) {
|
||||
'EventEmitter'
|
||||
], function (_, EventEmitter) {
|
||||
|
||||
class TelemetryTableConfiguration extends EventEmitter {
|
||||
constructor(domainObject, openmct) {
|
||||
@@ -101,8 +99,8 @@ define([
|
||||
}
|
||||
|
||||
hasColumnWithKey(columnKey) {
|
||||
return arrayUtils.flatten(Object.values(this.columns))
|
||||
.some(column => column.getKey() === columnKey);
|
||||
return _.flatten(Object.values(this.columns))
|
||||
.findIndex(column => column.getKey() === columnKey) !== -1;
|
||||
}
|
||||
|
||||
getColumns() {
|
||||
@@ -110,7 +108,7 @@ define([
|
||||
}
|
||||
|
||||
getAllHeaders() {
|
||||
let flattenedColumns = arrayUtils.flatten(Object.values(this.columns));
|
||||
let flattenedColumns = _.flatten(Object.values(this.columns));
|
||||
let headers = _.uniq(flattenedColumns, false, column => column.getKey())
|
||||
.reduce(fromColumnsToHeadersMap, {});
|
||||
|
||||
|
||||
@@ -22,9 +22,11 @@
|
||||
|
||||
define(
|
||||
[
|
||||
'lodash',
|
||||
'./SortedTableRowCollection'
|
||||
],
|
||||
function (
|
||||
_,
|
||||
SortedTableRowCollection
|
||||
) {
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ define(
|
||||
// same time stamp
|
||||
let potentialDupes = this.rows.slice(startIx, endIx + 1);
|
||||
// Search potential dupes for exact dupe
|
||||
isDuplicate = potentialDupes.some(_.isEqual.bind(undefined, row));
|
||||
isDuplicate = _.findIndex(potentialDupes, _.isEqual.bind(undefined, row)) > -1;
|
||||
}
|
||||
|
||||
if (!isDuplicate) {
|
||||
@@ -120,7 +120,7 @@ define(
|
||||
const firstValue = this.getValueForSortColumn(this.rows[0]);
|
||||
const lastValue = this.getValueForSortColumn(this.rows[this.rows.length - 1]);
|
||||
|
||||
lodashFunction = lodashFunction || _.sortedIndexBy;
|
||||
lodashFunction = lodashFunction || _.sortedIndex;
|
||||
|
||||
if (this.sortOptions.direction === 'asc') {
|
||||
if (testRowValue > lastValue) {
|
||||
@@ -201,7 +201,7 @@ define(
|
||||
sortBy(sortOptions) {
|
||||
if (arguments.length > 0) {
|
||||
this.sortOptions = sortOptions;
|
||||
this.rows = _.orderBy(this.rows, (row) => row.getParsedValue(sortOptions.key) , sortOptions.direction);
|
||||
this.rows = _.sortByOrder(this.rows, (row) => row.getParsedValue(sortOptions.key) , sortOptions.direction);
|
||||
this.emit('sort');
|
||||
}
|
||||
// Return duplicate to avoid direct modification of underlying object
|
||||
|
||||
@@ -17,9 +17,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import _ from 'lodash';
|
||||
import { flatten, isEmpty } from 'arrayUtils';
|
||||
|
||||
const FILTER_INDICATOR_LABEL = 'Filters:';
|
||||
const FILTER_INDICATOR_LABEL_MIXED = 'Mixed Filters:';
|
||||
const FILTER_INDICATOR_TITLE = 'Data filters are being applied to this view.';
|
||||
@@ -80,7 +77,7 @@ export default {
|
||||
}
|
||||
});
|
||||
|
||||
names = flatten(names);
|
||||
names = _.flatten(names);
|
||||
this.filterNames = names.length === 0 ? names : Array.from(new Set(names));
|
||||
});
|
||||
},
|
||||
@@ -89,7 +86,7 @@ export default {
|
||||
filters = _.omit(filters, [USE_GLOBAL]);
|
||||
|
||||
Object.keys(filters).forEach(key => {
|
||||
if (!isEmpty(filters[key])) {
|
||||
if (!_.isEmpty(filters[key])) {
|
||||
metadataValues.forEach(metadatum => {
|
||||
if (key === metadatum.key) {
|
||||
if (typeof metadatum.filters[0] === "object") {
|
||||
@@ -102,7 +99,7 @@ export default {
|
||||
}
|
||||
});
|
||||
|
||||
return flatten(filterNames);
|
||||
return _.flatten(filterNames);
|
||||
},
|
||||
getFilterLabels(filterObject, metadatum,) {
|
||||
let filterLabels = [];
|
||||
|
||||
@@ -260,8 +260,8 @@ import search from '../../../ui/components/search.vue';
|
||||
import TableColumnHeader from './table-column-header.vue';
|
||||
import TelemetryFilterIndicator from './TelemetryFilterIndicator.vue';
|
||||
import CSVExporter from '../../../exporters/CSVExporter.js';
|
||||
import ToggleSwitch from '../../../ui/components/ToggleSwitch.vue';
|
||||
import _ from 'lodash';
|
||||
import ToggleSwitch from '../../../ui/components/ToggleSwitch.vue';
|
||||
|
||||
const VISIBLE_ROW_COUNT = 100;
|
||||
const ROW_HEIGHT = 17;
|
||||
|
||||
@@ -24,7 +24,7 @@ import Vue from 'vue';
|
||||
import {
|
||||
createOpenMct,
|
||||
createMouseEvent
|
||||
} from 'testUtils';
|
||||
} from 'testTools';
|
||||
|
||||
let openmct;
|
||||
let tablePlugin;
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import _ from "lodash"
|
||||
import StyleRuleManager from "@/plugins/condition/StyleRuleManager";
|
||||
import {STYLE_CONSTANTS} from "@/plugins/condition/utils/constants";
|
||||
import _ from 'lodash';
|
||||
|
||||
export default {
|
||||
inject: ["openmct"],
|
||||
|
||||
@@ -47,12 +47,14 @@ import Location from './Location.vue';
|
||||
import Properties from './Properties.vue';
|
||||
import ObjectName from './ObjectName.vue';
|
||||
import InspectorViews from './InspectorViews.vue';
|
||||
import _ from "lodash";
|
||||
import StylesInspectorView from "./StylesInspectorView.vue";
|
||||
|
||||
export default {
|
||||
inject: ['openmct'],
|
||||
components: {
|
||||
StylesInspectorView,
|
||||
// StylesInspectorView,
|
||||
multipane,
|
||||
pane,
|
||||
Elements,
|
||||
@@ -126,7 +128,7 @@ export default {
|
||||
this.currentTabbedView = view;
|
||||
},
|
||||
isCurrent(view) {
|
||||
return JSON.stringify(this.currentTabbedView) === JSON.stringify(view)
|
||||
return _.isEqual(this.currentTabbedView, view)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,6 +198,8 @@ export default {
|
||||
updateName(event) {
|
||||
if (event.target.innerText !== this.domainObject.name && event.target.innerText.match(/\S/)) {
|
||||
this.openmct.objects.mutate(this.domainObject, 'name', event.target.innerText);
|
||||
} else {
|
||||
event.target.innerText = this.domainObject.name;
|
||||
}
|
||||
},
|
||||
updateNameOnEnterKeyPress(event) {
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
<script>
|
||||
import CreateAction from '../../../platform/commonUI/edit/src/creation/CreateAction';
|
||||
import objectUtils from 'objectUtils';
|
||||
import objectUtils from '../../api/objects/object-utils';
|
||||
|
||||
export default {
|
||||
inject: ['openmct'],
|
||||
|
||||
@@ -20,6 +20,7 @@ import toolbarMenu from './components/toolbar-menu.vue';
|
||||
import toolbarSelectMenu from './components/toolbar-select-menu.vue';
|
||||
import toolbarSeparator from './components/toolbar-separator.vue';
|
||||
import toolbarToggleButton from './components/toolbar-toggle-button.vue';
|
||||
|
||||
import _ from 'lodash';
|
||||
|
||||
export default {
|
||||
|
||||
@@ -42,9 +42,7 @@ const webpackConfig = {
|
||||
"printj": path.join(__dirname, "node_modules/printj/dist/printj.min.js"),
|
||||
"styles": path.join(__dirname, "src/styles"),
|
||||
"MCT": path.join(__dirname, "src/MCT"),
|
||||
"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")
|
||||
"testTools": path.join(__dirname, "src/testTools.js")
|
||||
}
|
||||
},
|
||||
devtool: devMode ? 'eval-source-map' : 'source-map',
|
||||
|
||||
Reference in New Issue
Block a user