Compare commits
44 Commits
plots-yaxi
...
lodash-upg
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1712f0579d | ||
|
|
5b7eaf6b04 | ||
|
|
396817b2d1 | ||
|
|
96eb6d6b74 | ||
|
|
ac69513e37 | ||
|
|
011fc94cb5 | ||
|
|
4446c5d075 | ||
|
|
cb5d47f66f | ||
|
|
ea90d02d66 | ||
|
|
95f73d8eb8 | ||
|
|
4297ffd270 | ||
|
|
5bf988a7f1 | ||
|
|
10da86183b | ||
|
|
ec5e3b929b | ||
|
|
8077ab43fe | ||
|
|
ccc0376352 | ||
|
|
2497b8df18 | ||
|
|
00c68a124e | ||
|
|
fe5fef8a3d | ||
|
|
3455ed5ac9 | ||
|
|
a37c686993 | ||
|
|
f12166097c | ||
|
|
d103a22fa0 | ||
|
|
eb5050b8ef | ||
|
|
eca22fef9e | ||
|
|
b66a599c69 | ||
|
|
835bcbcb5a | ||
|
|
04a60cfcbb | ||
|
|
8d723960f4 | ||
|
|
6d3cd2c699 | ||
|
|
87bf94fe0a | ||
|
|
af93823b6f | ||
|
|
9cb2fe3fb3 | ||
|
|
40c9546415 | ||
|
|
0622dbe78c | ||
|
|
5e8ac0f771 | ||
|
|
c5d31ce1cb | ||
|
|
2b96a8994c | ||
|
|
5efa7f69e4 | ||
|
|
33bb1c202e | ||
|
|
d73e9f6dae | ||
|
|
691742d8f0 | ||
|
|
ef4312e29a | ||
|
|
09cfe4f99a |
23
.eslintrc.js
23
.eslintrc.js
@@ -8,9 +8,12 @@ module.exports = {
|
||||
"globals": {
|
||||
"_": "readonly"
|
||||
},
|
||||
"plugins": ["lodash"],
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:vue/recommended"
|
||||
"plugin:vue/recommended",
|
||||
"plugin:lodash/recommended",
|
||||
"plugin:you-dont-need-lodash-underscore/compatible"
|
||||
],
|
||||
"parser": "vue-eslint-parser",
|
||||
"parserOptions": {
|
||||
@@ -22,6 +25,24 @@ 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,6 +1,4 @@
|
||||
define([
|
||||
'lodash'
|
||||
], function (
|
||||
define([], function (
|
||||
_
|
||||
) {
|
||||
|
||||
@@ -99,7 +97,7 @@ define([
|
||||
};
|
||||
|
||||
GeneratorMetadataProvider.prototype.getMetadata = function (domainObject) {
|
||||
return _.extend(
|
||||
return Object.assign(
|
||||
{},
|
||||
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>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
Open MCT, Copyright (c) 2014-2020, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
@@ -43,9 +43,9 @@
|
||||
openmct.legacyRegistry.enable.bind(openmct.legacyRegistry)
|
||||
);
|
||||
|
||||
openmct.install(openmct.plugins.LocalStorage());
|
||||
openmct.install(openmct.plugins.Espresso());
|
||||
openmct.install(openmct.plugins.MyItems());
|
||||
openmct.install(openmct.plugins.LocalStorage());
|
||||
openmct.install(openmct.plugins.Generator());
|
||||
openmct.install(openmct.plugins.ExampleImagery());
|
||||
openmct.install(openmct.plugins.UTCTimeSystem());
|
||||
|
||||
11
package.json
11
package.json
@@ -4,8 +4,7 @@
|
||||
"description": "The Open MCT core platform",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"acorn": "6.2.0",
|
||||
"angular": "1.4.14",
|
||||
"angular": "1.7.9",
|
||||
"angular-route": "1.4.14",
|
||||
"babel-eslint": "8.2.6",
|
||||
"comma-separated-values": "^3.6.4",
|
||||
@@ -24,7 +23,9 @@
|
||||
"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",
|
||||
@@ -48,7 +49,7 @@
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-webpack": "^3.0.0",
|
||||
"location-bar": "^3.0.1",
|
||||
"lodash": "^3.10.1",
|
||||
"lodash": "^4.17.12",
|
||||
"markdown-toc": "^0.11.7",
|
||||
"marked": "^0.3.5",
|
||||
"mini-css-extract-plugin": "^0.4.1",
|
||||
@@ -77,8 +78,8 @@
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node app.js",
|
||||
"lint": "eslint platform example src/**/*.{js,vue} openmct.js",
|
||||
"lint:fix": "eslint platform example src/**/*.{js,vue} openmct.js --fix",
|
||||
"lint": "eslint platform example src --ext .js,.vue openmct.js",
|
||||
"lint:fix": "eslint platform example src --ext .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(
|
||||
['../../../../../src/api/objects/object-utils'],
|
||||
['objectUtils'],
|
||||
function (objectUtils) {
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* @namespace platform/containment
|
||||
*/
|
||||
define(
|
||||
['../../../src/api/objects/object-utils'],
|
||||
['objectUtils'],
|
||||
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 = _.extend({}, baseContext);
|
||||
var actionContext = Object.assign({}, baseContext);
|
||||
actionContext.domainObject = this.domainObject;
|
||||
|
||||
return this.actionService.getActions(actionContext);
|
||||
|
||||
@@ -87,6 +87,11 @@ define([
|
||||
bootstrapper
|
||||
);
|
||||
|
||||
// Override of angular1.6 ! hashPrefix
|
||||
app.config(['$locationProvider', function ($locationProvider) {
|
||||
$locationProvider.hashPrefix('');
|
||||
}]);
|
||||
|
||||
// Apply logging levels; this must be done now, before the
|
||||
// first log statement.
|
||||
new LogLevel(logLevel).configure(app, $log);
|
||||
|
||||
@@ -121,7 +121,7 @@ define(['lodash'], function (_) {
|
||||
*/
|
||||
ExportAsJSONAction.prototype.rewriteLink = function (child, parent) {
|
||||
this.externalIdentifiers.push(this.getId(child));
|
||||
var index = _.findIndex(parent.composition, function (id) {
|
||||
var index = parent.composition.findIndex(function (id) {
|
||||
return _.isEqual(child.identifier, id);
|
||||
});
|
||||
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', '../../../../src/api/objects/object-utils.js'], function ($, objectUtils) {
|
||||
define(['zepto', 'objectUtils'], function ($, objectUtils) {
|
||||
|
||||
/**
|
||||
* The ImportAsJSONAction is available from context menus and allows a user
|
||||
|
||||
@@ -71,7 +71,7 @@ define([
|
||||
},
|
||||
{
|
||||
"key": "ELASTIC_PATH",
|
||||
"value": "mct/domain_object",
|
||||
"value": "mct/_doc",
|
||||
"priority": "fallback"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -32,9 +32,9 @@ define(
|
||||
// JSLint doesn't like underscore-prefixed properties,
|
||||
// so hide them here.
|
||||
var SRC = "_source",
|
||||
REV = "_version",
|
||||
ID = "_id",
|
||||
CONFLICT = 409;
|
||||
CONFLICT = 409,
|
||||
SEQ_NO = "_seq_no",
|
||||
PRIMARY_TERM = "_primary_term";
|
||||
|
||||
/**
|
||||
* The ElasticPersistenceProvider reads and writes JSON documents
|
||||
@@ -104,7 +104,8 @@ define(
|
||||
// Get a domain object model out of ElasticSearch's response
|
||||
ElasticPersistenceProvider.prototype.getModel = function (response) {
|
||||
if (response && response[SRC]) {
|
||||
this.revs[response[ID]] = response[REV];
|
||||
this.revs[response[SEQ_NO]] = response[SEQ_NO];
|
||||
this.revs[response[PRIMARY_TERM]] = response[PRIMARY_TERM];
|
||||
return response[SRC];
|
||||
} else {
|
||||
return undefined;
|
||||
@@ -116,7 +117,8 @@ define(
|
||||
// indicate that the request failed.
|
||||
ElasticPersistenceProvider.prototype.checkResponse = function (response, key) {
|
||||
if (response && !response.error) {
|
||||
this.revs[key] = response[REV];
|
||||
this.revs[SEQ_NO] = response[SEQ_NO];
|
||||
this.revs[PRIMARY_TERM] = response[PRIMARY_TERM];
|
||||
return response;
|
||||
} else {
|
||||
return this.handleError(response, key);
|
||||
@@ -147,7 +149,7 @@ define(
|
||||
function checkUpdate(response) {
|
||||
return self.checkResponse(response, key);
|
||||
}
|
||||
return this.put(key, value, { version: this.revs[key] })
|
||||
return this.put(key, value)
|
||||
.then(checkUpdate);
|
||||
};
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ define(
|
||||
it("allows object creation", function () {
|
||||
var model = { someKey: "some value" };
|
||||
mockHttp.and.returnValue(mockPromise({
|
||||
data: { "_id": "abc", "_version": 1 }
|
||||
data: { "_id": "abc", "_seq_no": 1, "_primary_term": 1 }
|
||||
}));
|
||||
provider.createObject("testSpace", "abc", model).then(capture);
|
||||
expect(mockHttp).toHaveBeenCalledWith({
|
||||
@@ -100,7 +100,7 @@ define(
|
||||
it("allows object models to be read back", function () {
|
||||
var model = { someKey: "some value" };
|
||||
mockHttp.and.returnValue(mockPromise({
|
||||
data: { "_id": "abc", "_version": 1, "_source": model }
|
||||
data: { "_id": "abc", "_seq_no": 1, "_primary_term": 1, "_source": model }
|
||||
}));
|
||||
provider.readObject("testSpace", "abc").then(capture);
|
||||
expect(mockHttp).toHaveBeenCalledWith({
|
||||
@@ -117,19 +117,19 @@ define(
|
||||
|
||||
// First do a read to populate rev tags...
|
||||
mockHttp.and.returnValue(mockPromise({
|
||||
data: { "_id": "abc", "_version": 42, "_source": {} }
|
||||
data: { "_id": "abc", "_source": {} }
|
||||
}));
|
||||
provider.readObject("testSpace", "abc");
|
||||
|
||||
// Now perform an update
|
||||
mockHttp.and.returnValue(mockPromise({
|
||||
data: { "_id": "abc", "_version": 43, "_source": {} }
|
||||
data: { "_id": "abc", "_seq_no": 1, "_source": {} }
|
||||
}));
|
||||
provider.updateObject("testSpace", "abc", model).then(capture);
|
||||
expect(mockHttp).toHaveBeenCalledWith({
|
||||
url: "/test/db/abc",
|
||||
method: "PUT",
|
||||
params: { version: 42 },
|
||||
params: undefined,
|
||||
data: model
|
||||
});
|
||||
expect(capture.calls.mostRecent().args[0]).toBeTruthy();
|
||||
@@ -138,13 +138,13 @@ define(
|
||||
it("allows object deletion", function () {
|
||||
// First do a read to populate rev tags...
|
||||
mockHttp.and.returnValue(mockPromise({
|
||||
data: { "_id": "abc", "_version": 42, "_source": {} }
|
||||
data: { "_id": "abc", "_source": {} }
|
||||
}));
|
||||
provider.readObject("testSpace", "abc");
|
||||
|
||||
// Now perform an update
|
||||
mockHttp.and.returnValue(mockPromise({
|
||||
data: { "_id": "abc", "_version": 42, "_source": {} }
|
||||
data: { "_id": "abc", "_source": {} }
|
||||
}));
|
||||
provider.deleteObject("testSpace", "abc", {}).then(capture);
|
||||
expect(mockHttp).toHaveBeenCalledWith({
|
||||
@@ -167,13 +167,13 @@ define(
|
||||
expect(capture).toHaveBeenCalledWith(undefined);
|
||||
});
|
||||
|
||||
it("handles rejection due to version", function () {
|
||||
it("handles rejection due to _seq_no", function () {
|
||||
var model = { someKey: "some value" },
|
||||
mockErrorCallback = jasmine.createSpy('error');
|
||||
|
||||
// First do a read to populate rev tags...
|
||||
mockHttp.and.returnValue(mockPromise({
|
||||
data: { "_id": "abc", "_version": 42, "_source": {} }
|
||||
data: { "_id": "abc", "_seq_no": 1, "_source": {} }
|
||||
}));
|
||||
provider.readObject("testSpace", "abc");
|
||||
|
||||
@@ -196,7 +196,7 @@ define(
|
||||
|
||||
// First do a read to populate rev tags...
|
||||
mockHttp.and.returnValue(mockPromise({
|
||||
data: { "_id": "abc", "_version": 42, "_source": {} }
|
||||
data: { "_id": "abc", "_seq_no": 1, "_source": {} }
|
||||
}));
|
||||
provider.readObject("testSpace", "abc");
|
||||
|
||||
|
||||
@@ -25,8 +25,7 @@
|
||||
* Module defining GenericSearchProvider. Created by shale on 07/16/2015.
|
||||
*/
|
||||
define([
|
||||
'../../../../src/api/objects/object-utils',
|
||||
'lodash'
|
||||
'objectUtils'
|
||||
], function (
|
||||
objectUtils,
|
||||
_
|
||||
@@ -191,9 +190,7 @@ define([
|
||||
}
|
||||
|
||||
var domainObject = objectUtils.toNewFormat(model, id);
|
||||
var composition = _.find(this.openmct.composition.registry, function (p) {
|
||||
return p.appliesTo(domainObject);
|
||||
});
|
||||
var composition = this.openmct.composition.registry.find(p => p.appliesTo(domainObject));
|
||||
|
||||
if (!composition) {
|
||||
return;
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
*/
|
||||
define(
|
||||
[
|
||||
'../../../src/api/objects/object-utils',
|
||||
'lodash'
|
||||
'objectUtils',
|
||||
'arrayUtils'
|
||||
],
|
||||
function (
|
||||
objectUtils,
|
||||
_
|
||||
arrayUtils
|
||||
) {
|
||||
|
||||
var ZERO = function () {
|
||||
@@ -235,7 +235,7 @@ define(
|
||||
var defaultRange = metadata.valuesForHints(['range'])[0];
|
||||
defaultRange = defaultRange ? defaultRange.key : undefined;
|
||||
|
||||
var sourceMap = _.indexBy(metadata.values(), 'key');
|
||||
const sourceMap = arrayUtils.keyBy(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;
|
||||
|
||||
var sourceMap = _.indexBy(metadata.values(), 'key');
|
||||
const sourceMap = arrayUtils.keyBy(metadata.values(), 'key');
|
||||
|
||||
var isLegacyProvider = telemetryAPI.findSubscriptionProvider(domainObject) ===
|
||||
telemetryAPI.legacyProvider;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'../../api/objects/object-utils'
|
||||
'objectUtils'
|
||||
], function (objectUtils) {
|
||||
function ActionDialogDecorator(mct, actionService) {
|
||||
this.mct = mct;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(['../../api/objects/object-utils'], function (objectUtils) {
|
||||
define(['objectUtils'], function (objectUtils) {
|
||||
function AdapterCapability(domainObject) {
|
||||
this.domainObject = domainObject;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* Module defining AlternateCompositionCapability. Created by vwoeltje on 11/7/14.
|
||||
*/
|
||||
define([
|
||||
'../../api/objects/object-utils',
|
||||
'objectUtils',
|
||||
'../../../platform/core/src/capabilities/ContextualDomainObject'
|
||||
], function (objectUtils, ContextualDomainObject) {
|
||||
function AlternateCompositionCapability($injector, domainObject) {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
define([
|
||||
'../capabilities/AlternateCompositionCapability',
|
||||
'../../api/objects/object-utils'
|
||||
'objectUtils'
|
||||
], function (
|
||||
AlternateCompositionCapability,
|
||||
objectUtils
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'../../api/objects/object-utils'
|
||||
'objectUtils'
|
||||
], function (
|
||||
utils
|
||||
objectUtils
|
||||
) {
|
||||
/**
|
||||
* @implements module:openmct.TelemetryAPI~TelemetryProvider
|
||||
@@ -41,8 +41,8 @@ define([
|
||||
* @see module:openmct.TelemetryAPI~TelemetryProvider#canProvideTelemetry
|
||||
*/
|
||||
LegacyTelemetryProvider.prototype.canProvideTelemetry = function (domainObject) {
|
||||
return this.instantiate(utils.toOldFormat(domainObject),
|
||||
utils.makeKeyString(domainObject.identifier)).hasCapability("telemetry");
|
||||
return this.instantiate(objectUtils.toOldFormat(domainObject),
|
||||
objectUtils.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(utils.toOldFormat(domainObject), utils.makeKeyString(domainObject.identifier));
|
||||
var oldObject = this.instantiate(objectUtils.toOldFormat(domainObject), objectUtils.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(utils.toOldFormat(domainObject), utils.makeKeyString(domainObject.identifier));
|
||||
var oldObject = this.instantiate(objectUtils.toOldFormat(domainObject), objectUtils.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(
|
||||
utils.toOldFormat(domainObject),
|
||||
utils.makeKeyString(domainObject.identifier)
|
||||
objectUtils.toOldFormat(domainObject),
|
||||
objectUtils.makeKeyString(domainObject.identifier)
|
||||
);
|
||||
return oldObject.hasCapability("limit");
|
||||
};
|
||||
|
||||
LegacyTelemetryProvider.prototype.getLimitEvaluator = function (domainObject) {
|
||||
var oldObject = this.instantiate(
|
||||
utils.toOldFormat(domainObject),
|
||||
utils.makeKeyString(domainObject.identifier)
|
||||
objectUtils.toOldFormat(domainObject),
|
||||
objectUtils.makeKeyString(domainObject.identifier)
|
||||
);
|
||||
var limitEvaluator = oldObject.getCapability("limit");
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ define([
|
||||
};
|
||||
|
||||
TimeSettingsURLHandler.prototype.parseQueryParams = function () {
|
||||
var searchParams = _.pick(this.$location.search(), _.values(SEARCH));
|
||||
var searchParams = _.pick(this.$location.search(), Object.values(SEARCH));
|
||||
var parsedParams = {
|
||||
clock: searchParams[SEARCH.MODE],
|
||||
timeSystem: searchParams[SEARCH.TIME_SYSTEM]
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'../../api/objects/object-utils'
|
||||
'objectUtils'
|
||||
], function (
|
||||
utils
|
||||
objectUtils
|
||||
) {
|
||||
function ObjectServiceProvider(eventEmitter, objectService, instantiate, topic) {
|
||||
this.eventEmitter = eventEmitter;
|
||||
@@ -43,22 +43,22 @@ define([
|
||||
var handleLegacyMutation;
|
||||
|
||||
var handleMutation = function (newStyleObject) {
|
||||
var keyString = utils.makeKeyString(newStyleObject.identifier);
|
||||
var oldStyleObject = this.instantiate(utils.toOldFormat(newStyleObject), keyString);
|
||||
var keyString = objectUtils.makeKeyString(newStyleObject.identifier);
|
||||
var oldStyleObject = this.instantiate(objectUtils.toOldFormat(newStyleObject), keyString);
|
||||
|
||||
// Don't trigger self
|
||||
removeGeneralTopicListener();
|
||||
|
||||
oldStyleObject.getCapability('mutation').mutate(function () {
|
||||
return utils.toOldFormat(newStyleObject);
|
||||
return objectUtils.toOldFormat(newStyleObject);
|
||||
});
|
||||
|
||||
removeGeneralTopicListener = this.generalTopic.listen(handleLegacyMutation);
|
||||
}.bind(this);
|
||||
|
||||
handleLegacyMutation = function (legacyObject) {
|
||||
var newStyleObject = utils.toNewFormat(legacyObject.getModel(), legacyObject.getId()),
|
||||
keystring = utils.makeKeyString(newStyleObject.identifier);
|
||||
var newStyleObject = objectUtils.toNewFormat(legacyObject.getModel(), legacyObject.getId()),
|
||||
keystring = objectUtils.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 utils.toNewFormat(object, key);
|
||||
return objectUtils.toNewFormat(object, key);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -83,11 +83,11 @@ define([
|
||||
};
|
||||
|
||||
ObjectServiceProvider.prototype.get = function (key) {
|
||||
var keyString = utils.makeKeyString(key);
|
||||
var keyString = objectUtils.makeKeyString(key);
|
||||
return this.objectService.getObjects([keyString])
|
||||
.then(function (results) {
|
||||
var model = results[keyString].getModel();
|
||||
return utils.toNewFormat(model, key);
|
||||
return objectUtils.toNewFormat(model, key);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -99,10 +99,10 @@ define([
|
||||
this.getObjects = function (keys) {
|
||||
var results = {},
|
||||
promises = keys.map(function (keyString) {
|
||||
var key = utils.parseKeyString(keyString);
|
||||
var key = objectUtils.parseKeyString(keyString);
|
||||
return openmct.objects.get(key)
|
||||
.then(function (object) {
|
||||
object = utils.toOldFormat(object);
|
||||
object = objectUtils.toOldFormat(object);
|
||||
results[keyString] = instantiate(object, keyString);
|
||||
});
|
||||
});
|
||||
@@ -123,7 +123,7 @@ define([
|
||||
);
|
||||
|
||||
ROOTS.forEach(function (r) {
|
||||
openmct.objects.addRoot(utils.parseKeyString(r.id));
|
||||
openmct.objects.addRoot(objectUtils.parseKeyString(r.id));
|
||||
});
|
||||
|
||||
return this;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'../../api/objects/object-utils'
|
||||
'objectUtils'
|
||||
], function (
|
||||
objectUtils
|
||||
) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
define([
|
||||
'./LegacyViewProvider',
|
||||
'./TypeInspectorViewProvider',
|
||||
'../../api/objects/object-utils'
|
||||
'objectUtils'
|
||||
], function (
|
||||
LegacyViewProvider,
|
||||
TypeInspectorViewProvider,
|
||||
|
||||
@@ -21,12 +21,10 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
'EventEmitter',
|
||||
'./DefaultCompositionProvider',
|
||||
'./CompositionCollection'
|
||||
], function (
|
||||
_,
|
||||
EventEmitter,
|
||||
DefaultCompositionProvider,
|
||||
CompositionCollection
|
||||
@@ -70,9 +68,7 @@ define([
|
||||
* @memberof module:openmct.CompositionAPI#
|
||||
*/
|
||||
CompositionAPI.prototype.get = function (domainObject) {
|
||||
var provider = _.find(this.registry, function (p) {
|
||||
return p.appliesTo(domainObject);
|
||||
});
|
||||
var provider = this.registry.find(p => p.appliesTo(domainObject));
|
||||
|
||||
if (!provider) {
|
||||
return;
|
||||
|
||||
@@ -20,9 +20,7 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'lodash'
|
||||
], function (
|
||||
define([], function (
|
||||
_
|
||||
) {
|
||||
/**
|
||||
@@ -122,7 +120,7 @@ define([
|
||||
throw new Error('Event not supported by composition: ' + event);
|
||||
}
|
||||
|
||||
var index = _.findIndex(this.listeners[event], function (l) {
|
||||
var index = this.listeners[event].findIndex(function (l) {
|
||||
return l.callback === callback && l.context === context;
|
||||
});
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
'../objects/object-utils'
|
||||
'objectUtils'
|
||||
], function (
|
||||
_,
|
||||
objectUtils
|
||||
@@ -143,7 +143,7 @@ define([
|
||||
var keyString = objectUtils.makeKeyString(domainObject.identifier);
|
||||
var objectListeners = this.listeningTo[keyString];
|
||||
|
||||
var index = _.findIndex(objectListeners[event], function (l) {
|
||||
var index = objectListeners[event].findIndex(function (l) {
|
||||
return l.callback === callback && l.context === context;
|
||||
});
|
||||
|
||||
@@ -196,8 +196,8 @@ define([
|
||||
* @private
|
||||
*/
|
||||
DefaultCompositionProvider.prototype.includes = function (parent, childId) {
|
||||
return parent.composition.findIndex(composee =>
|
||||
this.publicAPI.objects.areIdsEqual(composee, childId)) !== -1;
|
||||
return parent.composition.some(composee =>
|
||||
this.publicAPI.objects.areIdsEqual(composee, childId));
|
||||
};
|
||||
|
||||
DefaultCompositionProvider.prototype.reorder = function (domainObject, oldIndex, newIndex) {
|
||||
|
||||
@@ -20,11 +20,9 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
define([
|
||||
'./SimpleIndicator',
|
||||
'lodash'
|
||||
'./SimpleIndicator'
|
||||
], function (
|
||||
SimpleIndicator,
|
||||
_
|
||||
SimpleIndicator
|
||||
) {
|
||||
function IndicatorAPI(openmct) {
|
||||
this.openmct = openmct;
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'./object-utils.js',
|
||||
'objectUtils',
|
||||
'lodash'
|
||||
], function (
|
||||
utils,
|
||||
objectUtils,
|
||||
_
|
||||
) {
|
||||
var ANY_OBJECT_EVENT = "mutation";
|
||||
@@ -43,7 +43,7 @@ define([
|
||||
}
|
||||
|
||||
function qualifiedEventName(object, eventName) {
|
||||
var keystring = utils.makeKeyString(object.identifier);
|
||||
var keystring = objectUtils.makeKeyString(object.identifier);
|
||||
|
||||
return [keystring, eventName].join(':');
|
||||
}
|
||||
|
||||
@@ -21,15 +21,13 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
'./object-utils',
|
||||
'objectUtils',
|
||||
'./MutableObject',
|
||||
'./RootRegistry',
|
||||
'./RootObjectProvider',
|
||||
'EventEmitter'
|
||||
], function (
|
||||
_,
|
||||
utils,
|
||||
objectUtils,
|
||||
MutableObject,
|
||||
RootRegistry,
|
||||
RootObjectProvider,
|
||||
@@ -143,7 +141,7 @@ define([
|
||||
* has been saved, or be rejected if it cannot be saved
|
||||
*/
|
||||
ObjectAPI.prototype.get = function (identifier) {
|
||||
identifier = utils.parseKeyString(identifier);
|
||||
identifier = objectUtils.parseKeyString(identifier);
|
||||
var provider = this.getProvider(identifier);
|
||||
|
||||
if (!provider) {
|
||||
@@ -212,7 +210,7 @@ define([
|
||||
* @returns {string} A string representation of the given identifier, including namespace and key
|
||||
*/
|
||||
ObjectAPI.prototype.makeKeyString = function (identifier) {
|
||||
return utils.makeKeyString(identifier);
|
||||
return objectUtils.makeKeyString(identifier);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -220,7 +218,7 @@ define([
|
||||
* @param {module:openmct.ObjectAPI~Identifier[]} identifiers
|
||||
*/
|
||||
ObjectAPI.prototype.areIdsEqual = function (...identifiers) {
|
||||
return identifiers.map(utils.parseKeyString)
|
||||
return identifiers.map(objectUtils.parseKeyString)
|
||||
.every(identifier => {
|
||||
return identifier === identifiers[0] ||
|
||||
(identifier.namespace === identifiers[0].namespace &&
|
||||
@@ -234,7 +232,7 @@ define([
|
||||
let location = domainObject.location;
|
||||
|
||||
if (location) {
|
||||
return this.getOriginalPath(utils.parseKeyString(location), path);
|
||||
return this.getOriginalPath(objectUtils.parseKeyString(location), path);
|
||||
} else {
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'lodash'
|
||||
'lodash',
|
||||
'arrayUtils'
|
||||
], function (
|
||||
_
|
||||
_,
|
||||
arrayUtils
|
||||
) {
|
||||
|
||||
function RootRegistry() {
|
||||
@@ -35,7 +37,7 @@ define([
|
||||
return provider();
|
||||
});
|
||||
return Promise.all(promises)
|
||||
.then(_.flatten);
|
||||
.then(arrayUtils.flatten);
|
||||
};
|
||||
|
||||
function isKey(key) {
|
||||
@@ -43,7 +45,7 @@ define([
|
||||
}
|
||||
|
||||
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 () {
|
||||
return key;
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
define([
|
||||
'../object-utils'
|
||||
'objectUtils'
|
||||
], function (
|
||||
objectUtils
|
||||
) {
|
||||
|
||||
@@ -85,9 +85,13 @@ define([
|
||||
value: +e.value
|
||||
};
|
||||
}), 'e.value');
|
||||
valueMetadata.values = _.pluck(valueMetadata.enumerations, 'value');
|
||||
valueMetadata.max = _.max(valueMetadata.values);
|
||||
valueMetadata.min = _.min(valueMetadata.values);
|
||||
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);
|
||||
}
|
||||
|
||||
valueMetadatas.push(valueMetadata);
|
||||
@@ -103,7 +107,7 @@ define([
|
||||
var metadata = domainObject.telemetry || {};
|
||||
if (this.typeHasTelemetry(domainObject)) {
|
||||
var typeMetadata = this.typeService.getType(domainObject.type).typeDef.telemetry;
|
||||
_.extend(metadata, typeMetadata);
|
||||
Object.assign(metadata, typeMetadata);
|
||||
if (!metadata.values) {
|
||||
metadata.values = valueMetadatasFromOldFormat(metadata);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ define([
|
||||
'./TelemetryMetadataManager',
|
||||
'./TelemetryValueFormatter',
|
||||
'./DefaultMetadataProvider',
|
||||
'../objects/object-utils',
|
||||
'objectUtils',
|
||||
'lodash'
|
||||
], function (
|
||||
TelemetryMetadataManager,
|
||||
@@ -370,7 +370,8 @@ define([
|
||||
TelemetryAPI.prototype.commonValuesForHints = function (metadatas, hints) {
|
||||
var options = metadatas.map(function (metadata) {
|
||||
var values = metadata.valuesForHints(hints);
|
||||
return _.indexBy(values, 'key');
|
||||
const keyBy = (array, key) => (array || []).reduce((r, x) => ({ ...r, [key ? x[key] : x]: x }), {});
|
||||
return keyBy(values, 'key');
|
||||
}).reduce(function (a, b) {
|
||||
var results = {};
|
||||
Object.keys(a).forEach(function (key) {
|
||||
@@ -383,7 +384,7 @@ define([
|
||||
var sortKeys = hints.map(function (h) {
|
||||
return 'hints.' + h;
|
||||
});
|
||||
return _.sortByAll(options, sortKeys);
|
||||
return _.sortBy(options, sortKeys);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,13 +57,13 @@ define([
|
||||
|
||||
if (valueMetadata.format === 'enum') {
|
||||
if (!valueMetadata.values) {
|
||||
valueMetadata.values = _.pluck(valueMetadata.enumerations, 'value');
|
||||
valueMetadata.enumerations.map(enumeration => enumeration.value);
|
||||
}
|
||||
if (!valueMetadata.hasOwnProperty('max')) {
|
||||
valueMetadata.max = _.max(valueMetadata.values) + 1;
|
||||
}
|
||||
if (!valueMetadata.hasOwnProperty('min')) {
|
||||
valueMetadata.min = _.min(valueMetadata.values) - 1;
|
||||
valueMetadata.min = _.max(valueMetadata.values) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ define([
|
||||
return metadata.hints[hint];
|
||||
}
|
||||
});
|
||||
return _.sortByAll(matchingMetadata, ...iteratees);
|
||||
return _.sortBy(matchingMetadata, ...iteratees);
|
||||
};
|
||||
|
||||
TelemetryMetadataManager.prototype.getFilterableValues = function () {
|
||||
|
||||
46
src/api/utils/array-utils.js
Normal file
46
src/api/utils/array-utils.js
Normal file
@@ -0,0 +1,46 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2020, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/* Retired lodash methods */
|
||||
|
||||
// keyBy for array only
|
||||
export const keyBy = (array, key) => (array || []).reduce((acc, curr) => {
|
||||
return { ...acc, [curr[key]]: curr };
|
||||
}, {});
|
||||
|
||||
// flattens array a single level deep.
|
||||
export const flatten = array => array.reduce((acc, curr) => {
|
||||
return acc.concat(curr);
|
||||
}, []);
|
||||
|
||||
// recursively flatten deeper arrays
|
||||
export const flattenDeep = array => {
|
||||
return array.reduce((acc, curr) => {
|
||||
return Array.isArray(curr) ? acc.concat(flattenDeep(curr)) : acc.concat(curr);
|
||||
}, []);
|
||||
};
|
||||
|
||||
// checks if value is an empty object or collection - does not support evaluating a Set or a Map
|
||||
export const isEmpty = (obj => {
|
||||
return [Object, Array].includes((obj || {}).constructor)
|
||||
&& !Object.entries((obj || {})).length;
|
||||
});
|
||||
131
src/api/utils/array-utilsSpec.js
Normal file
131
src/api/utils/array-utilsSpec.js
Normal file
@@ -0,0 +1,131 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2020, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
import { keyBy, flatten, flattenDeep, isEmpty } from 'arrayUtils';
|
||||
const getArrayDepth = (obj => {
|
||||
if (Array.isArray(obj)) {
|
||||
return 1 + Math.max(...obj.map(t => getArrayDepth(t)));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
describe("The keyBy method", function () {
|
||||
|
||||
const input = [
|
||||
{
|
||||
"key":"name",
|
||||
"name":"Name",
|
||||
"source":"name",
|
||||
"hints":
|
||||
{
|
||||
"priority": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"key":"utc",
|
||||
"name":"Timestamp",
|
||||
"format":"utc",
|
||||
"hints":
|
||||
{
|
||||
"domain": 1,
|
||||
"priority": 1
|
||||
},
|
||||
"source":"utc"
|
||||
},
|
||||
{
|
||||
"key":"message",
|
||||
"name":"Message",
|
||||
"format":"string",
|
||||
"hints":
|
||||
{
|
||||
"range": 0,
|
||||
"priority": 2
|
||||
},
|
||||
"source":"message"
|
||||
}
|
||||
];
|
||||
|
||||
const output = keyBy(input, 'key');
|
||||
|
||||
it('returns an object', () => {
|
||||
expect(typeof output).toEqual('object');
|
||||
});
|
||||
|
||||
describe("returns an object", function () {
|
||||
|
||||
it('with the input key values as key names', () => {
|
||||
expect(Object.keys(output)).toEqual(input.map(obj => obj.key));
|
||||
});
|
||||
|
||||
it('with the input array objects as as properties of the name keys', () => {
|
||||
expect(Object.values(output)).toEqual(input);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
describe("The flatten method", function () {
|
||||
|
||||
it('returns a flat array', () => {
|
||||
expect(getArrayDepth(flatten([[1,2,3]]))).toEqual(1);
|
||||
});
|
||||
|
||||
it('fails to return a flat array when passed an array deeper than two levels', () => {
|
||||
expect(getArrayDepth(flatten([[[1,2,3]]]))).not.toEqual(1);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
describe("The flattenDeep method", function () {
|
||||
|
||||
it('returns a flat array when passed an array deeper than two levels', () => {
|
||||
expect(getArrayDepth(flattenDeep([[[1,[2,3]]]]))).toEqual(1);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
describe("The isEmpty method", function () {
|
||||
|
||||
it('returns true when passed an empty array', () => {
|
||||
expect(isEmpty([])).toBeTrue();
|
||||
});
|
||||
|
||||
it('returns false when passed a non-empty array', () => {
|
||||
expect(isEmpty([1,2,3])).not.toBeTrue();
|
||||
});
|
||||
|
||||
it('returns true when passed an empty object', () => {
|
||||
expect(isEmpty({})).toBeTrue();
|
||||
});
|
||||
|
||||
it('returns false when passed a non-empty object', () => {
|
||||
expect(isEmpty({1:1})).not.toBeTrue();
|
||||
});
|
||||
|
||||
it('returns false when passed a Set', () => {
|
||||
expect(isEmpty(new Set())).not.toBeTrue();
|
||||
});
|
||||
|
||||
it('returns false when passed a Map', () => {
|
||||
expect(isEmpty(new Map())).not.toBeTrue();
|
||||
});
|
||||
});
|
||||
@@ -75,7 +75,7 @@ export default {
|
||||
this.items.push(item);
|
||||
},
|
||||
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);
|
||||
},
|
||||
|
||||
@@ -102,7 +102,7 @@ export default {
|
||||
this.compositions.push({composition, addCallback, removeCallback});
|
||||
},
|
||||
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];
|
||||
|
||||
this.$set(this.secondaryTelemetryObjects, primary.key, undefined);
|
||||
@@ -130,7 +130,7 @@ export default {
|
||||
removeSecondary(primary) {
|
||||
return (identifier) => {
|
||||
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);
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ export default class ConditionClass extends EventEmitter {
|
||||
let latestTimestamp;
|
||||
let criteriaResults = {};
|
||||
const criteriaRequests = this.criteria
|
||||
.map(criterion => criterion.requestLAD({telemetryObjects: this.conditionManager.telemetryObjects}));
|
||||
.map(criterion => criterion.requestLAD(this.conditionManager.telemetryObjects));
|
||||
|
||||
return Promise.all(criteriaRequests)
|
||||
.then(results => {
|
||||
|
||||
@@ -55,7 +55,7 @@ export default class ConditionManager extends EventEmitter {
|
||||
this.telemetryObjects[id] = Object.assign({}, endpoint, {telemetryMetaData: this.openmct.telemetry.getMetadata(endpoint).valueMetadatas});
|
||||
this.subscriptions[id] = this.openmct.telemetry.subscribe(
|
||||
endpoint,
|
||||
this.telemetryReceived.bind(this, id)
|
||||
this.telemetryReceived.bind(this, endpoint)
|
||||
);
|
||||
this.updateConditionTelemetry();
|
||||
}
|
||||
@@ -258,9 +258,13 @@ export default class ConditionManager extends EventEmitter {
|
||||
this.openmct.time.timeSystem()
|
||||
);
|
||||
});
|
||||
const currentCondition = this.getCurrentConditionLAD(conditionResults);
|
||||
|
||||
return Object.assign(
|
||||
if (!Object.values(latestTimestamp).some(timeSystem => timeSystem)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const currentCondition = this.getCurrentConditionLAD(conditionResults);
|
||||
const currentOutput = Object.assign(
|
||||
{
|
||||
output: currentCondition.configuration.output,
|
||||
id: this.conditionSetDomainObject.identifier,
|
||||
@@ -268,11 +272,15 @@ export default class ConditionManager extends EventEmitter {
|
||||
},
|
||||
latestTimestamp
|
||||
);
|
||||
|
||||
return [currentOutput];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
isTelemetryUsed(id) {
|
||||
isTelemetryUsed(endpoint) {
|
||||
const id = this.openmct.objects.makeKeyString(endpoint.identifier);
|
||||
|
||||
for(const condition of this.conditionClassCollection) {
|
||||
if (condition.isTelemetryUsed(id)) {
|
||||
return true;
|
||||
@@ -282,12 +290,12 @@ export default class ConditionManager extends EventEmitter {
|
||||
return false;
|
||||
}
|
||||
|
||||
telemetryReceived(id, datum) {
|
||||
if (!this.isTelemetryUsed(id)) {
|
||||
telemetryReceived(endpoint, datum) {
|
||||
if (!this.isTelemetryUsed(endpoint)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const normalizedDatum = this.createNormalizedDatum(datum, id);
|
||||
const normalizedDatum = this.createNormalizedDatum(datum, endpoint);
|
||||
const timeSystemKey = this.openmct.time.timeSystem().key;
|
||||
let timestamp = {};
|
||||
timestamp[timeSystemKey] = normalizedDatum[timeSystemKey];
|
||||
@@ -321,8 +329,11 @@ export default class ConditionManager extends EventEmitter {
|
||||
return data;
|
||||
}
|
||||
|
||||
createNormalizedDatum(telemetryDatum, id) {
|
||||
const normalizedDatum = Object.values(this.telemetryObjects[id].telemetryMetaData).reduce((datum, metadatum) => {
|
||||
createNormalizedDatum(telemetryDatum, endpoint) {
|
||||
const id = this.openmct.objects.makeKeyString(endpoint.identifier);
|
||||
const metadata = this.openmct.telemetry.getMetadata(endpoint).valueMetadatas;
|
||||
|
||||
const normalizedDatum = Object.values(metadata).reduce((datum, metadatum) => {
|
||||
const testValue = this.getTestData(metadatum);
|
||||
const formatter = this.openmct.telemetry.getValueFormatter(metadatum);
|
||||
datum[metadatum.key] = testValue !== undefined ? formatter.parse(testValue) : formatter.parse(telemetryDatum[metadatum.source]);
|
||||
|
||||
@@ -54,13 +54,22 @@ export default class ConditionSetMetadataProvider {
|
||||
return {
|
||||
values: this.getDomains().concat([
|
||||
{
|
||||
name: 'Output',
|
||||
key: 'output',
|
||||
format: 'enum',
|
||||
key: "state",
|
||||
source: "output",
|
||||
name: "State",
|
||||
format: "enum",
|
||||
enumerations: enumerations,
|
||||
hints: {
|
||||
range: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "output",
|
||||
name: "Value",
|
||||
format: "string",
|
||||
hints: {
|
||||
range: 2
|
||||
}
|
||||
}
|
||||
])
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ export default class ConditionSetTelemetryProvider {
|
||||
|
||||
return conditionManager.requestLADConditionSetOutput()
|
||||
.then(latestOutput => {
|
||||
return latestOutput ? [latestOutput] : [];
|
||||
return latestOutput;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ export default {
|
||||
this.$emit('telemetryUpdated', this.telemetryObjs);
|
||||
},
|
||||
removeTelemetryObject(identifier) {
|
||||
let index = _.findIndex(this.telemetryObjs, (obj) => {
|
||||
let index = this.telemetryObjs.findIndex(obj => {
|
||||
let objId = this.openmct.objects.makeKeyString(obj.identifier);
|
||||
let id = this.openmct.objects.makeKeyString(identifier);
|
||||
return objId === id;
|
||||
|
||||
@@ -105,7 +105,8 @@ 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 { getApplicableStylesForItem } from "@/plugins/condition/utils/styleUtils";
|
||||
import { isEmpty } from 'arrayUtils';
|
||||
|
||||
export default {
|
||||
name: 'ConditionalStylesView',
|
||||
@@ -273,7 +274,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 {
|
||||
@@ -282,7 +283,7 @@ export default {
|
||||
domainObjectStyles.styles = undefined;
|
||||
delete domainObjectStyles.styles;
|
||||
}
|
||||
if (_.isEmpty(domainObjectStyles)) {
|
||||
if (isEmpty(domainObjectStyles)) {
|
||||
domainObjectStyles = undefined;
|
||||
}
|
||||
|
||||
@@ -313,7 +314,7 @@ export default {
|
||||
delete domainObjectStyles[this.itemId];
|
||||
}
|
||||
});
|
||||
if (_.isEmpty(domainObjectStyles)) {
|
||||
if (isEmpty(domainObjectStyles)) {
|
||||
domainObjectStyles = undefined;
|
||||
}
|
||||
this.persist(domainObjectStyles);
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
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',
|
||||
@@ -178,7 +179,7 @@ export default {
|
||||
domainObjectStyles[itemId] = undefined;
|
||||
delete domainObjectStyles[this.itemId];
|
||||
|
||||
if (_.isEmpty(domainObjectStyles)) {
|
||||
if (isEmpty(domainObjectStyles)) {
|
||||
domainObjectStyles = undefined;
|
||||
}
|
||||
this.persist(this.domainObject, domainObjectStyles);
|
||||
@@ -239,7 +240,7 @@ export default {
|
||||
if (this.isStaticAndConditionalStyles) {
|
||||
this.removeConditionalStyles(domainObjectStyles, item.id);
|
||||
}
|
||||
if (_.isEmpty(itemStaticStyle)) {
|
||||
if (isEmpty(itemStaticStyle)) {
|
||||
itemStaticStyle = undefined;
|
||||
domainObjectStyles[item.id] = undefined;
|
||||
} else {
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
import TelemetryCriterion from './TelemetryCriterion';
|
||||
import { evaluateResults } from "../utils/evaluator";
|
||||
import { getLatestTimestamp } from '../utils/time';
|
||||
|
||||
export default class AllTelemetryCriterion extends TelemetryCriterion {
|
||||
|
||||
@@ -107,40 +108,53 @@ export default class AllTelemetryCriterion extends TelemetryCriterion {
|
||||
this.result = evaluateResults(Object.values(this.telemetryDataCache), this.telemetry);
|
||||
}
|
||||
|
||||
requestLAD(options) {
|
||||
options = Object.assign({},
|
||||
options,
|
||||
{
|
||||
strategy: 'latest',
|
||||
size: 1
|
||||
}
|
||||
);
|
||||
requestLAD(telemetryObjects) {
|
||||
const options = {
|
||||
strategy: 'latest',
|
||||
size: 1
|
||||
};
|
||||
|
||||
if (!this.isValid()) {
|
||||
return this.formatData({}, options.telemetryObjects);
|
||||
return this.formatData({}, telemetryObjects);
|
||||
}
|
||||
|
||||
let keys = Object.keys(Object.assign({}, options.telemetryObjects));
|
||||
let keys = Object.keys(Object.assign({}, telemetryObjects));
|
||||
const telemetryRequests = keys
|
||||
.map(key => this.openmct.telemetry.request(
|
||||
options.telemetryObjects[key],
|
||||
telemetryObjects[key],
|
||||
options
|
||||
));
|
||||
|
||||
let telemetryDataCache = {};
|
||||
return Promise.all(telemetryRequests)
|
||||
.then(telemetryRequestsResults => {
|
||||
let latestDatum;
|
||||
let latestTimestamp;
|
||||
const timeSystems = this.openmct.time.getAllTimeSystems();
|
||||
const timeSystem = this.openmct.time.timeSystem();
|
||||
|
||||
telemetryRequestsResults.forEach((results, index) => {
|
||||
latestDatum = results.length ? results[results.length - 1] : {};
|
||||
if (index < telemetryRequestsResults.length-1) {
|
||||
if (latestDatum) {
|
||||
this.telemetryDataCache[latestDatum.id] = this.computeResult(latestDatum);
|
||||
}
|
||||
}
|
||||
const latestDatum = results.length ? results[results.length - 1] : {};
|
||||
const datumId = keys[index];
|
||||
const normalizedDatum = this.createNormalizedDatum(latestDatum, telemetryObjects[datumId]);
|
||||
|
||||
telemetryDataCache[datumId] = this.computeResult(normalizedDatum);
|
||||
|
||||
latestTimestamp = getLatestTimestamp(
|
||||
latestTimestamp,
|
||||
normalizedDatum,
|
||||
timeSystems,
|
||||
timeSystem
|
||||
);
|
||||
});
|
||||
|
||||
const datum = {
|
||||
result: evaluateResults(Object.values(telemetryDataCache), this.telemetry),
|
||||
...latestTimestamp
|
||||
};
|
||||
|
||||
return {
|
||||
id: this.id,
|
||||
data: this.formatData(latestDatum, options.telemetryObjects)
|
||||
data: datum
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -61,6 +61,21 @@ export default class TelemetryCriterion extends EventEmitter {
|
||||
this.telemetryObject = telemetryObjects[this.telemetryObjectIdAsString];
|
||||
}
|
||||
|
||||
createNormalizedDatum(telemetryDatum, endpoint) {
|
||||
const id = this.openmct.objects.makeKeyString(endpoint.identifier);
|
||||
const metadata = this.openmct.telemetry.getMetadata(endpoint).valueMetadatas;
|
||||
|
||||
const normalizedDatum = Object.values(metadata).reduce((datum, metadatum) => {
|
||||
const formatter = this.openmct.telemetry.getValueFormatter(metadatum);
|
||||
datum[metadatum.key] = formatter.parse(telemetryDatum[metadatum.source]);
|
||||
return datum;
|
||||
}, {});
|
||||
|
||||
normalizedDatum.id = id;
|
||||
|
||||
return normalizedDatum;
|
||||
}
|
||||
|
||||
formatData(data) {
|
||||
const datum = {
|
||||
result: this.computeResult(data)
|
||||
@@ -79,14 +94,11 @@ export default class TelemetryCriterion extends EventEmitter {
|
||||
this.result = this.computeResult(validatedData);
|
||||
}
|
||||
|
||||
requestLAD(options) {
|
||||
options = Object.assign({},
|
||||
options,
|
||||
{
|
||||
strategy: 'latest',
|
||||
size: 1
|
||||
}
|
||||
);
|
||||
requestLAD() {
|
||||
const options = {
|
||||
strategy: 'latest',
|
||||
size: 1
|
||||
};
|
||||
|
||||
if (!this.isValid()) {
|
||||
return {
|
||||
@@ -100,9 +112,11 @@ export default class TelemetryCriterion extends EventEmitter {
|
||||
options
|
||||
).then(results => {
|
||||
const latestDatum = results.length ? results[results.length - 1] : {};
|
||||
const normalizedDatum = this.createNormalizedDatum(latestDatum, this.telemetryObject);
|
||||
|
||||
return {
|
||||
id: this.id,
|
||||
data: this.formatData(latestDatum)
|
||||
data: this.formatData(normalizedDatum)
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
import { createOpenMct } from "testTools";
|
||||
import { createOpenMct } from "testUtils";
|
||||
import ConditionPlugin from "./plugin";
|
||||
|
||||
let openmct = createOpenMct();
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
import _ from 'lodash';
|
||||
|
||||
const convertToNumbers = (input) => {
|
||||
let numberInputs = [];
|
||||
input.forEach(inputValue => numberInputs.push(Number(inputValue)));
|
||||
@@ -34,6 +32,10 @@ const convertToStrings = (input) => {
|
||||
return stringInputs;
|
||||
};
|
||||
|
||||
const joinValues = (values, length) => {
|
||||
return values.slice(0, length).join(', ');
|
||||
};
|
||||
|
||||
export const OPERATIONS = [
|
||||
{
|
||||
name: 'equalTo',
|
||||
@@ -44,7 +46,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['number'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' is ' + values.join(', ');
|
||||
return ' is ' + joinValues(values, 1);
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -56,7 +58,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['number'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' is not ' + values.join(', ');
|
||||
return ' is not ' + joinValues(values, 1);
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -68,7 +70,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['number'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' > ' + values.join(', ');
|
||||
return ' > ' + joinValues(values, 1);
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -80,7 +82,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['number'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' < ' + values.join(', ');
|
||||
return ' < ' + joinValues(values, 1);
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -92,7 +94,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['number'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' >= ' + values.join(', ');
|
||||
return ' >= ' + joinValues(values, 1);
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -104,7 +106,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['number'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' <= ' + values.join(', ');
|
||||
return ' <= ' + joinValues(values, 1);
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -146,7 +148,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['string'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' contains ' + values.join(', ');
|
||||
return ' contains ' + joinValues(values, 1);
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -158,7 +160,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['string'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' does not contain ' + values.join(', ');
|
||||
return ' does not contain ' + joinValues(values, 1);
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -170,7 +172,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['string'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' starts with ' + values.join(', ');
|
||||
return ' starts with ' + joinValues(values, 1);
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -182,7 +184,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['string'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' ends with ' + values.join(', ');
|
||||
return ' ends with ' + joinValues(values, 1);
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -194,7 +196,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['string'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' is exactly ' + values.join(', ');
|
||||
return ' is exactly ' + joinValues(values, 1);
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -231,7 +233,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['enum'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' is ' + values.join(', ');
|
||||
return ' is ' + joinValues(values, 1);
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -244,7 +246,7 @@ export const OPERATIONS = [
|
||||
appliesTo: ['enum'],
|
||||
inputCount: 1,
|
||||
getDescription: function (values) {
|
||||
return ' is not ' + values.join(', ');
|
||||
return ' is not ' + joinValues(values, 1);
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -253,7 +255,7 @@ export const OPERATIONS = [
|
||||
const lhsValue = input[0] !== undefined ? input[0].toString() : '';
|
||||
if (input[1]) {
|
||||
const values = input[1].split(',');
|
||||
return values.find((value) => lhsValue === _.trim(value.toString()));
|
||||
return values.find((value) => lhsValue === value.toString().trim());
|
||||
}
|
||||
return false;
|
||||
},
|
||||
@@ -270,7 +272,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 === _.trim(value.toString()));
|
||||
const found = values.find((value) => lhsValue === value.toString().trim());
|
||||
return !found;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
* 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 = {
|
||||
@@ -154,7 +156,7 @@ export const getApplicableStylesForItem = (domainObject, item) => {
|
||||
};
|
||||
|
||||
export const getStylesWithoutNoneValue = (style) => {
|
||||
if (_.isEmpty(style) || !style) {
|
||||
if (isEmpty(style) || !style) {
|
||||
return;
|
||||
}
|
||||
let styleObj = {};
|
||||
|
||||
@@ -20,7 +20,11 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(['lodash'], function (_) {
|
||||
define([
|
||||
'arrayUtils'
|
||||
], function (
|
||||
arrayUtils
|
||||
) {
|
||||
function DisplayLayoutToolbar(openmct) {
|
||||
return {
|
||||
name: "Display Layout Toolbar",
|
||||
@@ -559,7 +563,7 @@ define(['lodash'], function (_) {
|
||||
});
|
||||
|
||||
let toolbarArray = Object.values(toolbar);
|
||||
return _.flatten(toolbarArray.reduce((accumulator, group, index) => {
|
||||
return arrayUtils.flatten(toolbarArray.reduce((accumulator, group, index) => {
|
||||
group = group.filter(control => control !== undefined);
|
||||
|
||||
if (group.length > 0) {
|
||||
|
||||
@@ -76,6 +76,7 @@ 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,
|
||||
@@ -512,7 +513,7 @@ export default {
|
||||
}
|
||||
},
|
||||
updateTelemetryFormat(item, format) {
|
||||
let index = _.findIndex(this.layoutItems, item);
|
||||
let index = this.layoutItems.findIndex(item);
|
||||
item.format = format;
|
||||
this.mutate(`configuration.items[${index}]`, item);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
<script>
|
||||
import LayoutDrag from './../LayoutDrag'
|
||||
import _ from 'lodash'
|
||||
|
||||
export default {
|
||||
inject: ['openmct'],
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
<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 '../../api/objects/object-utils.js'
|
||||
import objectUtils from 'objectUtils'
|
||||
import DisplayLayoutType from './DisplayLayoutType.js'
|
||||
import DisplayLayoutToolbar from './DisplayLayoutToolbar.js'
|
||||
import AlphaNumericFormatViewProvider from './AlphanumericFormatViewProvider.js'
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
<script>
|
||||
import FilterField from './FilterField.vue';
|
||||
import ToggleSwitch from '../../../ui/components/ToggleSwitch.vue';
|
||||
import { isEmpty } from 'arrayUtils';
|
||||
|
||||
export default {
|
||||
inject: ['openmct'],
|
||||
@@ -102,7 +103,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,6 +28,8 @@
|
||||
<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';
|
||||
@@ -58,7 +60,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,6 +64,7 @@
|
||||
<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 = _.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);
|
||||
},
|
||||
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 { throttle } from 'lodash';
|
||||
import _ 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,8 +30,7 @@ define([
|
||||
'./MCTChartPointSet',
|
||||
'./MCTChartAlarmPointSet',
|
||||
'../draw/DrawLoader',
|
||||
'../lib/eventHelpers',
|
||||
'lodash'
|
||||
'../lib/eventHelpers'
|
||||
],
|
||||
function (
|
||||
MCTChartLineLinear,
|
||||
@@ -39,8 +38,7 @@ function (
|
||||
MCTChartPointSet,
|
||||
MCTChartAlarmPointSet,
|
||||
DrawLoader,
|
||||
eventHelpers,
|
||||
_
|
||||
eventHelpers
|
||||
) {
|
||||
|
||||
var MARKER_SIZE = 6.0,
|
||||
@@ -54,27 +52,29 @@ function (
|
||||
* @constructor
|
||||
*/
|
||||
function MCTChartController($scope) {
|
||||
this.$scope = $scope;
|
||||
this.isDestroyed = false;
|
||||
this.lines = [];
|
||||
this.pointSets = [];
|
||||
this.alarmSets = [];
|
||||
this.offset = {};
|
||||
this.config = $scope.config;
|
||||
this.listenTo(this.$scope, '$destroy', this.destroy, this);
|
||||
this.draw = this.draw.bind(this);
|
||||
this.scheduleDraw = this.scheduleDraw.bind(this);
|
||||
this.seriesElements = new WeakMap();
|
||||
this.$onInit = () => {
|
||||
this.$scope = $scope;
|
||||
this.isDestroyed = false;
|
||||
this.lines = [];
|
||||
this.pointSets = [];
|
||||
this.alarmSets = [];
|
||||
this.offset = {};
|
||||
this.config = $scope.config;
|
||||
this.listenTo(this.$scope, '$destroy', this.destroy, this);
|
||||
this.draw = this.draw.bind(this);
|
||||
this.scheduleDraw = this.scheduleDraw.bind(this);
|
||||
this.seriesElements = new WeakMap();
|
||||
|
||||
this.listenTo(this.config.series, 'add', this.onSeriesAdd, this);
|
||||
this.listenTo(this.config.series, 'remove', this.onSeriesRemove, this);
|
||||
this.listenTo(this.config.yAxis, 'change:key', this.clearOffset, this);
|
||||
this.listenTo(this.config.xAxis, 'change:key', this.clearOffset, this);
|
||||
this.listenTo(this.config.yAxis, 'change', this.scheduleDraw);
|
||||
this.listenTo(this.config.xAxis, 'change', this.scheduleDraw);
|
||||
this.$scope.$watch('highlights', this.scheduleDraw);
|
||||
this.$scope.$watch('rectangles', this.scheduleDraw);
|
||||
this.config.series.forEach(this.onSeriesAdd, this);
|
||||
this.listenTo(this.config.series, 'add', this.onSeriesAdd, this);
|
||||
this.listenTo(this.config.series, 'remove', this.onSeriesRemove, this);
|
||||
this.listenTo(this.config.yAxis, 'change:key', this.clearOffset, this);
|
||||
this.listenTo(this.config.xAxis, 'change:key', this.clearOffset, this);
|
||||
this.listenTo(this.config.yAxis, 'change', this.scheduleDraw);
|
||||
this.listenTo(this.config.xAxis, 'change', this.scheduleDraw);
|
||||
this.$scope.$watch('highlights', this.scheduleDraw);
|
||||
this.$scope.$watch('rectangles', this.scheduleDraw);
|
||||
this.config.series.forEach(this.onSeriesAdd, this);
|
||||
}
|
||||
}
|
||||
|
||||
eventHelpers.extend(MCTChartController.prototype);
|
||||
@@ -150,7 +150,7 @@ function (
|
||||
MCTChartController.prototype.destroy = function () {
|
||||
this.isDestroyed = true;
|
||||
this.stopListening();
|
||||
_.invoke(this.lines, 'destroy');
|
||||
this.lines.forEach(line => line.destroy());
|
||||
DrawLoader.releaseDrawAPI(this.drawAPI);
|
||||
};
|
||||
|
||||
|
||||
@@ -22,13 +22,11 @@
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
'EventEmitter',
|
||||
'./Model',
|
||||
'../lib/extend',
|
||||
'../lib/eventHelpers'
|
||||
], function (
|
||||
_,
|
||||
EventEmitter,
|
||||
Model,
|
||||
extend,
|
||||
@@ -44,7 +42,7 @@ define([
|
||||
this.initialize(options);
|
||||
}
|
||||
|
||||
_.extend(Collection.prototype, EventEmitter.prototype);
|
||||
Object.assign(Collection.prototype, EventEmitter.prototype);
|
||||
eventHelpers.extend(Collection.prototype);
|
||||
|
||||
Collection.extend = extend;
|
||||
@@ -105,12 +103,7 @@ define([
|
||||
};
|
||||
|
||||
Collection.prototype.indexOf = function (model) {
|
||||
return _.findIndex(
|
||||
this.models,
|
||||
function (m) {
|
||||
return m === model;
|
||||
}
|
||||
);
|
||||
return this.models.findIndex(m => m === model);
|
||||
};
|
||||
|
||||
Collection.prototype.remove = function (model) {
|
||||
|
||||
@@ -49,7 +49,7 @@ define([
|
||||
this.initialize(options);
|
||||
}
|
||||
|
||||
_.extend(Model.prototype, EventEmitter.prototype);
|
||||
Object.assign(Model.prototype, EventEmitter.prototype);
|
||||
eventHelpers.extend(Model.prototype);
|
||||
|
||||
Model.extend = extend;
|
||||
|
||||
@@ -146,7 +146,7 @@ define([
|
||||
strategy = 'minmax';
|
||||
}
|
||||
|
||||
options = _.extend({}, { size: 1000, strategy, filters: this.filters }, options || {});
|
||||
options = Object.assign({}, { size: 1000, strategy, filters: this.filters }, options || {});
|
||||
|
||||
if (!this.unsubscribe) {
|
||||
this.unsubscribe = this.openmct
|
||||
@@ -270,7 +270,7 @@ define([
|
||||
* @private
|
||||
*/
|
||||
sortedIndex: function (point) {
|
||||
return _.sortedIndex(this.data, point, this.getXVal);
|
||||
return _.sortedIndexBy(this.data, point, this.getXVal);
|
||||
},
|
||||
/**
|
||||
* Update min/max stats for the series.
|
||||
|
||||
@@ -101,13 +101,10 @@ define([
|
||||
var plotObject = this.plot.get('domainObject');
|
||||
if (plotObject.type === 'telemetry.plot.overlay') {
|
||||
|
||||
var persistedIndex = _.findIndex(plotObject.configuration.series, function (s) {
|
||||
return _.isEqual(identifier, s.identifier);
|
||||
});
|
||||
var persistedIndex = plotObject.configuration.series.findIndex(s => _.isEqual(identifier, s.identifier));
|
||||
|
||||
var configIndex = _.findIndex(this.models, function (m) {
|
||||
return _.isEqual(m.domainObject.identifier, identifier);
|
||||
});
|
||||
|
||||
var configIndex = this.models.findIndex(m => _.isEqual(m.domainObject.identifier, identifier));
|
||||
|
||||
/*
|
||||
when cancelling out of edit mode, the config store and domain object are out of sync
|
||||
|
||||
@@ -22,11 +22,9 @@
|
||||
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
'EventEmitter',
|
||||
'../lib/eventHelpers'
|
||||
], function (
|
||||
_,
|
||||
EventEmitter,
|
||||
eventHelpers
|
||||
) {
|
||||
@@ -51,7 +49,7 @@ define([
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(Draw2D.prototype, EventEmitter.prototype);
|
||||
Object.assign(Draw2D.prototype, EventEmitter.prototype);
|
||||
eventHelpers.extend(Draw2D.prototype);
|
||||
|
||||
// Convert from logical to physical x coordinates
|
||||
|
||||
@@ -22,11 +22,9 @@
|
||||
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
'EventEmitter',
|
||||
'../lib/eventHelpers'
|
||||
], function (
|
||||
_,
|
||||
EventEmitter,
|
||||
eventHelpers
|
||||
) {
|
||||
@@ -78,7 +76,7 @@ define([
|
||||
this.listenTo(this.canvas, "webglcontextlost", this.onContextLost, this);
|
||||
}
|
||||
|
||||
_.extend(DrawWebGL.prototype, EventEmitter.prototype);
|
||||
Object.assign(DrawWebGL.prototype, EventEmitter.prototype);
|
||||
eventHelpers.extend(DrawWebGL.prototype);
|
||||
|
||||
DrawWebGL.prototype.onContextLost = function (event) {
|
||||
|
||||
@@ -22,14 +22,10 @@
|
||||
|
||||
define([
|
||||
'../configuration/configStore',
|
||||
'../lib/eventHelpers',
|
||||
'../../../../api/objects/object-utils',
|
||||
'lodash'
|
||||
'../lib/eventHelpers'
|
||||
], function (
|
||||
configStore,
|
||||
eventHelpers,
|
||||
objectUtils,
|
||||
_
|
||||
eventHelpers
|
||||
) {
|
||||
|
||||
function PlotOptionsController($scope, openmct, $timeout) {
|
||||
|
||||
@@ -31,9 +31,7 @@ define([
|
||||
function dynamicPathForKey(key) {
|
||||
return function (object, model) {
|
||||
var modelIdentifier = model.get('identifier');
|
||||
var index = _.findIndex(object.configuration.series, function (s) {
|
||||
return _.isEqual(s.identifier, modelIdentifier);
|
||||
});
|
||||
var index = object.configuration.series.findIndex(s => _.isEqual(s.identifier, modelIdentifier));
|
||||
return 'configuration.series[' + index + '].' + key;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'./PlotModelFormController',
|
||||
'lodash'
|
||||
'./PlotModelFormController'
|
||||
], function (
|
||||
PlotModelFormController,
|
||||
_
|
||||
@@ -73,10 +72,10 @@ define([
|
||||
if (range.max === '' || range.max === null || typeof range.max === 'undefined') {
|
||||
return 'Must specify Maximum';
|
||||
}
|
||||
if (_.isNaN(Number(range.min))) {
|
||||
if (Number.isNaN(range.min)) {
|
||||
return 'Minimum must be a number.';
|
||||
}
|
||||
if (_.isNaN(Number(range.max))) {
|
||||
if (Number.isNaN(range.max)) {
|
||||
return 'Maximum must be a number.';
|
||||
}
|
||||
if (Number(range.min) > Number(range.max)) {
|
||||
|
||||
@@ -34,25 +34,27 @@ define([
|
||||
* values near the cursor.
|
||||
*/
|
||||
function MCTPlotController($scope, $element, $window) {
|
||||
this.$scope = $scope;
|
||||
this.$scope.config = this.config;
|
||||
this.$scope.plot = this;
|
||||
this.$element = $element;
|
||||
this.$window = $window;
|
||||
this.$onInit = () => {
|
||||
this.$scope = $scope;
|
||||
this.$scope.config = this.config;
|
||||
this.$scope.plot = this;
|
||||
this.$element = $element;
|
||||
this.$window = $window;
|
||||
|
||||
this.xScale = new LinearScale(this.config.xAxis.get('displayRange'));
|
||||
this.yScale = new LinearScale(this.config.yAxis.get('displayRange'));
|
||||
this.xScale = new LinearScale(this.config.xAxis.get('displayRange'));
|
||||
this.yScale = new LinearScale(this.config.yAxis.get('displayRange'));
|
||||
|
||||
this.pan = undefined;
|
||||
this.marquee = undefined;
|
||||
this.pan = undefined;
|
||||
this.marquee = undefined;
|
||||
|
||||
this.chartElementBounds = undefined;
|
||||
this.tickUpdate = false;
|
||||
this.chartElementBounds = undefined;
|
||||
this.tickUpdate = false;
|
||||
|
||||
this.$scope.plotHistory = this.plotHistory = [];
|
||||
this.listenTo(this.$scope, 'plot:clearHistory', this.clear, this);
|
||||
this.$scope.plotHistory = this.plotHistory = [];
|
||||
this.listenTo(this.$scope, 'plot:clearHistory', this.clear, this);
|
||||
|
||||
this.initialize();
|
||||
this.initialize();
|
||||
}
|
||||
}
|
||||
|
||||
MCTPlotController.$inject = ['$scope', '$element', '$window'];
|
||||
|
||||
@@ -114,15 +114,17 @@ define([
|
||||
}
|
||||
|
||||
function MCTTicksController($scope, $element) {
|
||||
this.$scope = $scope;
|
||||
this.$element = $element;
|
||||
this.$onInit = () => {
|
||||
this.$scope = $scope;
|
||||
this.$element = $element;
|
||||
|
||||
this.tickCount = 4;
|
||||
this.tickUpdate = false;
|
||||
this.listenTo(this.axis, 'change:displayRange', this.updateTicks, this);
|
||||
this.listenTo(this.axis, 'change:format', this.updateTicks, this);
|
||||
this.listenTo(this.$scope, '$destroy', this.stopListening, this);
|
||||
this.updateTicks();
|
||||
this.tickCount = 4;
|
||||
this.tickUpdate = false;
|
||||
this.listenTo(this.axis, 'change:displayRange', this.updateTicks, this);
|
||||
this.listenTo(this.axis, 'change:format', this.updateTicks, this);
|
||||
this.listenTo(this.$scope, '$destroy', this.stopListening, this);
|
||||
this.updateTicks();
|
||||
}
|
||||
}
|
||||
|
||||
MCTTicksController.$inject = ['$scope', '$element'];
|
||||
|
||||
@@ -76,7 +76,7 @@ define([
|
||||
if (childObj) {
|
||||
var index = telemetryObjects.indexOf(childObj);
|
||||
telemetryObjects.splice(index, 1);
|
||||
$scope.$broadcast('plot:tickWidth', _.max(tickWidthMap));
|
||||
$scope.$broadcast('plot:tickWidth', Math.max(...Object.values(tickWidthMap)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,6 +131,7 @@ define([
|
||||
}
|
||||
tickWidthMap[plotId] = Math.max(width, tickWidthMap[plotId]);
|
||||
var newTickWidth = _.max(tickWidthMap);
|
||||
|
||||
if (newTickWidth !== tickWidth || width !== tickWidth) {
|
||||
tickWidth = newTickWidth;
|
||||
$scope.$broadcast('plot:tickWidth', tickWidth);
|
||||
|
||||
@@ -88,7 +88,8 @@ define([
|
||||
var bundleMap = {
|
||||
LocalStorage: 'platform/persistence/local',
|
||||
MyItems: 'platform/features/my-items',
|
||||
CouchDB: 'platform/persistence/couch'
|
||||
CouchDB: 'platform/persistence/couch',
|
||||
Elasticsearch: 'platform/persistence/elastic'
|
||||
};
|
||||
|
||||
var plugins = _.mapValues(bundleMap, function (bundleName, pluginName) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
define([
|
||||
'../../api/objects/object-utils'
|
||||
'objectUtils'
|
||||
], function (
|
||||
objectUtils
|
||||
) {
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
define ([
|
||||
'./ConditionEvaluator',
|
||||
'../../../api/objects/object-utils',
|
||||
'objectUtils',
|
||||
'arrayUtils',
|
||||
'EventEmitter',
|
||||
'zepto',
|
||||
'lodash'
|
||||
], function (
|
||||
ConditionEvaluator,
|
||||
objectUtils,
|
||||
arrayUtils,
|
||||
EventEmitter,
|
||||
$,
|
||||
_
|
||||
@@ -250,7 +252,7 @@ define ([
|
||||
delete this.subscriptions[objectId];
|
||||
this.eventEmitter.emit('remove', identifier);
|
||||
|
||||
if (_.isEmpty(this.compositionObjs)) {
|
||||
if (arrayUtils.isEmpty(this.compositionObjs)) {
|
||||
$('.w-summary-widget').addClass('s-status-no-data');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,8 +5,7 @@ define([
|
||||
'./TestDataManager',
|
||||
'./WidgetDnD',
|
||||
'./eventHelpers',
|
||||
'../../../api/objects/object-utils',
|
||||
'lodash',
|
||||
'objectUtils',
|
||||
'zepto'
|
||||
], function (
|
||||
widgetTemplate,
|
||||
@@ -16,7 +15,6 @@ define([
|
||||
WidgetDnD,
|
||||
eventHelpers,
|
||||
objectUtils,
|
||||
_,
|
||||
$
|
||||
) {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
define([
|
||||
'./Select',
|
||||
'../../../../api/objects/object-utils'
|
||||
'objectUtils'
|
||||
], function (
|
||||
Select,
|
||||
objectUtils
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
define([
|
||||
'./SummaryWidgetEvaluator',
|
||||
'../../../../api/objects/object-utils'
|
||||
'objectUtils'
|
||||
], function (
|
||||
SummaryWidgetEvaluator,
|
||||
objectUtils
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
define([
|
||||
'./SummaryWidgetRule',
|
||||
'../eventHelpers',
|
||||
'../../../../api/objects/object-utils',
|
||||
'objectUtils',
|
||||
'lodash'
|
||||
], function (
|
||||
SummaryWidgetRule,
|
||||
@@ -154,7 +154,7 @@ define([
|
||||
return _(this.baseState)
|
||||
.values()
|
||||
.map(_.clone)
|
||||
.indexBy('id')
|
||||
.keyBy('id')
|
||||
.value();
|
||||
}.bind(this));
|
||||
};
|
||||
@@ -182,7 +182,7 @@ define([
|
||||
* @private.
|
||||
*/
|
||||
SummaryWidgetEvaluator.prototype.updateObjectStateFromLAD = function (options, objectState) {
|
||||
options = _.extend({}, options, {
|
||||
options = Object.assign({}, options, {
|
||||
strategy: 'latest',
|
||||
size: 1
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
define([
|
||||
'../SummaryWidget',
|
||||
'./SummaryWidgetView',
|
||||
'../../../../api/objects/object-utils'
|
||||
'objectUtils'
|
||||
], function (
|
||||
SummaryWidgetEditView,
|
||||
SummaryWidgetView,
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
/*jshint latedef: nofunc */
|
||||
/*global console */
|
||||
define([
|
||||
'../../../api/objects/object-utils',
|
||||
'objectUtils',
|
||||
'./TelemetryAverager'
|
||||
], function (objectUtils, TelemetryAverager) {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'../../api/objects/object-utils',
|
||||
'objectUtils',
|
||||
'./components/table-configuration.vue',
|
||||
'./TelemetryTableConfiguration',
|
||||
'vue'
|
||||
|
||||
@@ -22,8 +22,10 @@
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
'EventEmitter'
|
||||
], function (_, EventEmitter) {
|
||||
'EventEmitter',
|
||||
'arrayUtils'
|
||||
|
||||
], function (_, EventEmitter, arrayUtils) {
|
||||
|
||||
class TelemetryTableConfiguration extends EventEmitter {
|
||||
constructor(domainObject, openmct) {
|
||||
@@ -99,8 +101,8 @@ define([
|
||||
}
|
||||
|
||||
hasColumnWithKey(columnKey) {
|
||||
return _.flatten(Object.values(this.columns))
|
||||
.findIndex(column => column.getKey() === columnKey) !== -1;
|
||||
return arrayUtils.flatten(Object.values(this.columns))
|
||||
.some(column => column.getKey() === columnKey);
|
||||
}
|
||||
|
||||
getColumns() {
|
||||
@@ -108,7 +110,7 @@ define([
|
||||
}
|
||||
|
||||
getAllHeaders() {
|
||||
let flattenedColumns = _.flatten(Object.values(this.columns));
|
||||
let flattenedColumns = arrayUtils.flatten(Object.values(this.columns));
|
||||
let headers = _.uniq(flattenedColumns, false, column => column.getKey())
|
||||
.reduce(fromColumnsToHeadersMap, {});
|
||||
|
||||
|
||||
@@ -22,11 +22,9 @@
|
||||
|
||||
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 = _.findIndex(potentialDupes, _.isEqual.bind(undefined, row)) > -1;
|
||||
isDuplicate = potentialDupes.some(_.isEqual.bind(undefined, row));
|
||||
}
|
||||
|
||||
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 || _.sortedIndex;
|
||||
lodashFunction = lodashFunction || _.sortedIndexBy;
|
||||
|
||||
if (this.sortOptions.direction === 'asc') {
|
||||
if (testRowValue > lastValue) {
|
||||
@@ -201,7 +201,7 @@ define(
|
||||
sortBy(sortOptions) {
|
||||
if (arguments.length > 0) {
|
||||
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');
|
||||
}
|
||||
// Return duplicate to avoid direct modification of underlying object
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
</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.';
|
||||
@@ -77,7 +80,7 @@ export default {
|
||||
}
|
||||
});
|
||||
|
||||
names = _.flatten(names);
|
||||
names = flatten(names);
|
||||
this.filterNames = names.length === 0 ? names : Array.from(new Set(names));
|
||||
});
|
||||
},
|
||||
@@ -86,7 +89,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") {
|
||||
@@ -99,7 +102,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 _ from 'lodash';
|
||||
import ToggleSwitch from '../../../ui/components/ToggleSwitch.vue';
|
||||
import _ from 'lodash';
|
||||
|
||||
const VISIBLE_ROW_COUNT = 100;
|
||||
const ROW_HEIGHT = 17;
|
||||
|
||||
@@ -24,7 +24,7 @@ import Vue from 'vue';
|
||||
import {
|
||||
createOpenMct,
|
||||
createMouseEvent
|
||||
} from 'testTools';
|
||||
} from 'testUtils';
|
||||
|
||||
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,14 +47,12 @@ 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,
|
||||
@@ -108,7 +106,7 @@ export default {
|
||||
let object = selection[0][0].context.item;
|
||||
if (object) {
|
||||
let type = this.openmct.types.get(object.type);
|
||||
this.showStyles = (this.excludeObjectTypes.indexOf(object.type) < 0) && type.definition.creatable;
|
||||
this.showStyles = this.isLayoutObject(selection[0], object.type) || this.isCreatableObject(object, type);
|
||||
}
|
||||
if (!this.currentTabbedView.key || (!this.showStyles && this.currentTabbedView.key === this.tabbedViews[1].key))
|
||||
{
|
||||
@@ -116,11 +114,19 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
isLayoutObject(selection, objectType) {
|
||||
//we allow conditionSets to be styled if they're part of a layout
|
||||
return selection.length > 1 &&
|
||||
((objectType === 'conditionSet') || (this.excludeObjectTypes.indexOf(objectType) < 0));
|
||||
},
|
||||
isCreatableObject(object, type) {
|
||||
return (this.excludeObjectTypes.indexOf(object.type) < 0) && type.definition.creatable;
|
||||
},
|
||||
updateCurrentTab(view) {
|
||||
this.currentTabbedView = view;
|
||||
},
|
||||
isCurrent(view) {
|
||||
return _.isEqual(this.currentTabbedView, view)
|
||||
return JSON.stringify(this.currentTabbedView) === JSON.stringify(view)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,8 +198,6 @@ 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 '../../api/objects/object-utils';
|
||||
import objectUtils from 'objectUtils';
|
||||
|
||||
export default {
|
||||
inject: ['openmct'],
|
||||
|
||||
@@ -20,7 +20,6 @@ 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,7 +42,9 @@ 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"),
|
||||
"testTools": path.join(__dirname, "src/testTools.js")
|
||||
"testUtils": path.join(__dirname, "src/test-utils.js"),
|
||||
"objectUtils": path.join(__dirname, "src/api/objects/object-utils.js"),
|
||||
"arrayUtils": path.join(__dirname, "src/api/utils/array-utils.js")
|
||||
}
|
||||
},
|
||||
devtool: devMode ? 'eval-source-map' : 'source-map',
|
||||
|
||||
Reference in New Issue
Block a user