mirror of
https://github.com/nasa/openmct.git
synced 2025-02-20 09:26:45 +00:00
ESLint one-var, no-var rules (#3239)
* fixed issues for eslint one-var and no-var rules Co-authored-by: Joshi <simplyrender@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
parent
4d560086dd
commit
c6ca912f2b
@ -120,6 +120,10 @@ module.exports = {
|
||||
"no-useless-computed-key": "error",
|
||||
// https://eslint.org/docs/rules/rest-spread-spacing
|
||||
"rest-spread-spacing": ["error"],
|
||||
// https://eslint.org/docs/rules/no-var
|
||||
"no-var": "error",
|
||||
// https://eslint.org/docs/rules/one-var
|
||||
"one-var": ["error", "never"],
|
||||
// https://eslint.org/docs/rules/default-case-last
|
||||
"default-case-last": "error",
|
||||
// https://eslint.org/docs/rules/default-param-last
|
||||
@ -248,7 +252,8 @@ module.exports = {
|
||||
}
|
||||
],
|
||||
"no-nested-ternary": "off",
|
||||
"no-var": "off"
|
||||
"no-var": "off",
|
||||
"one-var": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -32,6 +32,6 @@ if (document.currentScript) {
|
||||
|
||||
const MCT = require('./src/MCT');
|
||||
|
||||
var openmct = new MCT();
|
||||
const openmct = new MCT();
|
||||
|
||||
module.exports = openmct;
|
||||
|
@ -25,9 +25,9 @@ define(
|
||||
function (AboutController) {
|
||||
|
||||
describe("The About controller", function () {
|
||||
var testVersions,
|
||||
mockWindow,
|
||||
controller;
|
||||
let testVersions;
|
||||
let mockWindow;
|
||||
let controller;
|
||||
|
||||
beforeEach(function () {
|
||||
testVersions = [
|
||||
@ -56,7 +56,6 @@ define(
|
||||
controller.openLicenses();
|
||||
expect(mockWindow.open).toHaveBeenCalledWith("#/licenses");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -23,8 +23,8 @@
|
||||
define(['./BundleRegistry'], function (BundleRegistry) {
|
||||
|
||||
describe("BundleRegistry", function () {
|
||||
var testPath,
|
||||
bundleRegistry;
|
||||
let testPath;
|
||||
let bundleRegistry;
|
||||
|
||||
beforeEach(function () {
|
||||
testPath = 'some/bundle';
|
||||
@ -46,7 +46,7 @@ define(['./BundleRegistry'], function (BundleRegistry) {
|
||||
});
|
||||
|
||||
describe("when a bundle has been registered", function () {
|
||||
var testBundleDef;
|
||||
let testBundleDef;
|
||||
|
||||
beforeEach(function () {
|
||||
testBundleDef = { someKey: "some value" };
|
||||
@ -83,7 +83,6 @@ define(['./BundleRegistry'], function (BundleRegistry) {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -292,7 +292,7 @@ define([
|
||||
let capabilityService = this.$injector.get('capabilityService');
|
||||
|
||||
function instantiate(model, keyString) {
|
||||
var capabilities = capabilityService.getCapabilities(model, keyString);
|
||||
const capabilities = capabilityService.getCapabilities(model, keyString);
|
||||
model.id = keyString;
|
||||
|
||||
return new DomainObjectImpl(keyString, model, capabilities);
|
||||
@ -377,8 +377,8 @@ define([
|
||||
|
||||
// TODO: remove with legacy types.
|
||||
this.types.listKeys().forEach(function (typeKey) {
|
||||
var type = this.types.get(typeKey);
|
||||
var legacyDefinition = type.toLegacyDefinition();
|
||||
const type = this.types.get(typeKey);
|
||||
const legacyDefinition = type.toLegacyDefinition();
|
||||
legacyDefinition.key = typeKey;
|
||||
this.legacyExtension('types', legacyDefinition);
|
||||
}.bind(this));
|
||||
@ -405,7 +405,7 @@ define([
|
||||
this.$injector.get('objectService');
|
||||
|
||||
if (!isHeadlessMode) {
|
||||
var appLayout = new Vue({
|
||||
const appLayout = new Vue({
|
||||
components: {
|
||||
'Layout': Layout.default
|
||||
},
|
||||
|
@ -26,11 +26,11 @@ define([
|
||||
'utils/testing'
|
||||
], function (plugins, legacyRegistry, testUtils) {
|
||||
describe("MCT", function () {
|
||||
var openmct;
|
||||
var mockPlugin;
|
||||
var mockPlugin2;
|
||||
var mockListener;
|
||||
var oldBundles;
|
||||
let openmct;
|
||||
let mockPlugin;
|
||||
let mockPlugin2;
|
||||
let mockListener;
|
||||
let oldBundles;
|
||||
|
||||
beforeEach(function () {
|
||||
mockPlugin = jasmine.createSpy('plugin');
|
||||
@ -109,7 +109,7 @@ define([
|
||||
});
|
||||
|
||||
describe("setAssetPath", function () {
|
||||
var testAssetPath;
|
||||
let testAssetPath;
|
||||
|
||||
beforeEach(function () {
|
||||
openmct.legacyExtension = jasmine.createSpy('legacyExtension');
|
||||
|
@ -29,15 +29,15 @@ define([
|
||||
}
|
||||
|
||||
ActionDialogDecorator.prototype.getActions = function (context) {
|
||||
var mct = this.mct;
|
||||
const mct = this.mct;
|
||||
|
||||
return this.actionService.getActions(context).map(function (action) {
|
||||
if (action.dialogService) {
|
||||
var domainObject = objectUtils.toNewFormat(
|
||||
const domainObject = objectUtils.toNewFormat(
|
||||
context.domainObject.getModel(),
|
||||
objectUtils.parseKeyString(context.domainObject.getId())
|
||||
);
|
||||
var providers = mct.propertyEditors.get(domainObject);
|
||||
const providers = mct.propertyEditors.get(domainObject);
|
||||
|
||||
if (providers.length > 0) {
|
||||
action.dialogService = Object.create(action.dialogService);
|
||||
|
@ -43,7 +43,7 @@ define([
|
||||
model,
|
||||
id
|
||||
) {
|
||||
var capabilities = this.capabilityService.getCapabilities(model, id);
|
||||
const capabilities = this.capabilityService.getCapabilities(model, id);
|
||||
if (capabilities.mutation) {
|
||||
capabilities.mutation =
|
||||
synchronizeMutationCapability(capabilities.mutation);
|
||||
|
@ -46,7 +46,7 @@ define([
|
||||
}
|
||||
|
||||
function addChildToComposition(model) {
|
||||
var existingIndex = model.composition.indexOf(child.getId());
|
||||
const existingIndex = model.composition.indexOf(child.getId());
|
||||
if (existingIndex === -1) {
|
||||
model.composition.push(child.getId());
|
||||
}
|
||||
@ -71,16 +71,16 @@ define([
|
||||
this.getDependencies();
|
||||
}
|
||||
|
||||
var keyString = objectUtils.makeKeyString(child.identifier);
|
||||
var oldModel = objectUtils.toOldFormat(child);
|
||||
var newDO = this.instantiate(oldModel, keyString);
|
||||
const keyString = objectUtils.makeKeyString(child.identifier);
|
||||
const oldModel = objectUtils.toOldFormat(child);
|
||||
const newDO = this.instantiate(oldModel, keyString);
|
||||
|
||||
return new ContextualDomainObject(newDO, this.domainObject);
|
||||
|
||||
};
|
||||
|
||||
AlternateCompositionCapability.prototype.invoke = function () {
|
||||
var newFormatDO = objectUtils.toNewFormat(
|
||||
const newFormatDO = objectUtils.toNewFormat(
|
||||
this.domainObject.getModel(),
|
||||
this.domainObject.getId()
|
||||
);
|
||||
@ -89,7 +89,7 @@ define([
|
||||
this.getDependencies();
|
||||
}
|
||||
|
||||
var collection = this.openmct.composition.get(newFormatDO);
|
||||
const collection = this.openmct.composition.get(newFormatDO);
|
||||
|
||||
return collection.load()
|
||||
.then(function (children) {
|
||||
@ -104,5 +104,4 @@ define([
|
||||
};
|
||||
|
||||
return AlternateCompositionCapability;
|
||||
}
|
||||
);
|
||||
});
|
||||
|
@ -28,18 +28,18 @@ define([
|
||||
|
||||
function patchViewCapability(viewConstructor) {
|
||||
return function makeCapability(domainObject) {
|
||||
var capability = viewConstructor(domainObject);
|
||||
var oldInvoke = capability.invoke.bind(capability);
|
||||
const capability = viewConstructor(domainObject);
|
||||
const oldInvoke = capability.invoke.bind(capability);
|
||||
|
||||
/* eslint-disable you-dont-need-lodash-underscore/map */
|
||||
capability.invoke = function () {
|
||||
var availableViews = oldInvoke();
|
||||
var newDomainObject = capability
|
||||
const availableViews = oldInvoke();
|
||||
const newDomainObject = capability
|
||||
.domainObject
|
||||
.useCapability('adapter');
|
||||
|
||||
return _(availableViews).map(function (v, i) {
|
||||
var vd = {
|
||||
const vd = {
|
||||
view: v,
|
||||
priority: i + 100 // arbitrary to allow new views to
|
||||
// be defaults by returning priority less than 100.
|
||||
|
@ -32,8 +32,8 @@ define([
|
||||
function synchronizeMutationCapability(mutationConstructor) {
|
||||
|
||||
return function makeCapability(domainObject) {
|
||||
var capability = mutationConstructor(domainObject);
|
||||
var oldListen = capability.listen.bind(capability);
|
||||
const capability = mutationConstructor(domainObject);
|
||||
const oldListen = capability.listen.bind(capability);
|
||||
capability.listen = function (listener) {
|
||||
return oldListen(function (newModel) {
|
||||
capability.domainObject.model =
|
||||
|
@ -27,9 +27,9 @@ define([
|
||||
return {
|
||||
restrict: 'E',
|
||||
link: function (scope, element, attrs) {
|
||||
var provider = openmct.objectViews.getByProviderKey(attrs.mctProviderKey);
|
||||
var view = new provider.view(scope.domainObject.useCapability('adapter'));
|
||||
var domElement = element[0];
|
||||
const provider = openmct.objectViews.getByProviderKey(attrs.mctProviderKey);
|
||||
const view = new provider.view(scope.domainObject.useCapability('adapter'));
|
||||
const domElement = element[0];
|
||||
|
||||
view.show(domElement);
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
define([], function () {
|
||||
var LEGACY_INDICATOR_TEMPLATE =
|
||||
const LEGACY_INDICATOR_TEMPLATE =
|
||||
'<mct-include '
|
||||
+ ' ng-model="indicator" '
|
||||
+ ' class="h-indicator" '
|
||||
@ -36,8 +36,8 @@ define([], function () {
|
||||
|
||||
function addLegacyIndicators(legacyIndicators) {
|
||||
legacyIndicators.forEach(function (legacyIndicatorDef) {
|
||||
var legacyIndicator = initializeIfNeeded(legacyIndicatorDef);
|
||||
var legacyIndicatorElement = buildLegacyIndicator(legacyIndicator, legacyIndicatorDef.template);
|
||||
const legacyIndicator = initializeIfNeeded(legacyIndicatorDef);
|
||||
const legacyIndicatorElement = buildLegacyIndicator(legacyIndicator, legacyIndicatorDef.template);
|
||||
openmct.indicators.add({
|
||||
element: legacyIndicatorElement
|
||||
});
|
||||
@ -45,7 +45,7 @@ define([], function () {
|
||||
}
|
||||
|
||||
function initializeIfNeeded(LegacyIndicatorDef) {
|
||||
var legacyIndicator;
|
||||
let legacyIndicator;
|
||||
if (typeof LegacyIndicatorDef === 'function') {
|
||||
legacyIndicator = new LegacyIndicatorDef();
|
||||
} else {
|
||||
@ -56,9 +56,9 @@ define([], function () {
|
||||
}
|
||||
|
||||
function buildLegacyIndicator(legacyIndicator, template) {
|
||||
var $compile = openmct.$injector.get('$compile');
|
||||
var $rootScope = openmct.$injector.get('$rootScope');
|
||||
var scope = $rootScope.$new(true);
|
||||
const $compile = openmct.$injector.get('$compile');
|
||||
const $rootScope = openmct.$injector.get('$rootScope');
|
||||
const scope = $rootScope.$new(true);
|
||||
scope.indicator = legacyIndicator;
|
||||
scope.template = template || 'indicator';
|
||||
|
||||
|
@ -31,11 +31,11 @@ define(
|
||||
MCTIndicators,
|
||||
LegacyIndicatorsPlugin
|
||||
) {
|
||||
var openmct;
|
||||
var directive;
|
||||
var holderElement;
|
||||
var legacyExtensionFunction = MCT.prototype.legacyExtension;
|
||||
var legacyIndicatorsRunsFunction;
|
||||
let openmct;
|
||||
let directive;
|
||||
let holderElement;
|
||||
const legacyExtensionFunction = MCT.prototype.legacyExtension;
|
||||
let legacyIndicatorsRunsFunction;
|
||||
|
||||
xdescribe('The legacy indicators plugin', function () {
|
||||
beforeEach(function () {
|
||||
@ -63,10 +63,10 @@ define(
|
||||
}
|
||||
|
||||
function mockAngularComponents() {
|
||||
var mockInjector = jasmine.createSpyObj('$injector', ['get']);
|
||||
var mockCompile = jasmine.createSpy('$compile');
|
||||
var mockRootScope = jasmine.createSpyObj('rootScope', ['$new']);
|
||||
var mockScope = {};
|
||||
const mockInjector = jasmine.createSpyObj('$injector', ['get']);
|
||||
const mockCompile = jasmine.createSpy('$compile');
|
||||
const mockRootScope = jasmine.createSpyObj('rootScope', ['$new']);
|
||||
const mockScope = {};
|
||||
|
||||
mockRootScope.$new.and.returnValue(mockScope);
|
||||
mockInjector.get.and.callFake(function (service) {
|
||||
@ -85,7 +85,7 @@ define(
|
||||
}
|
||||
|
||||
it("Displays any legacy indicators ", function () {
|
||||
var legacyIndicators = [{}, {}, {}, {}];
|
||||
const legacyIndicators = [{}, {}, {}, {}];
|
||||
|
||||
legacyIndicatorsRunsFunction(legacyIndicators);
|
||||
renderIndicators();
|
||||
@ -95,8 +95,8 @@ define(
|
||||
});
|
||||
|
||||
it("If legacy indicator is defined as a constructor function, executes function ", function () {
|
||||
var mockConstructorFunction = jasmine.createSpy('mockIndicatorConstructor');
|
||||
var legacyIndicators = [{}, mockConstructorFunction];
|
||||
const mockConstructorFunction = jasmine.createSpy('mockIndicatorConstructor');
|
||||
const legacyIndicators = [{}, mockConstructorFunction];
|
||||
|
||||
mockConstructorFunction.and.returnValue({});
|
||||
legacyIndicatorsRunsFunction(legacyIndicators);
|
||||
|
@ -30,7 +30,7 @@ define([], function () {
|
||||
legacyObject
|
||||
) {
|
||||
if (Object.prototype.hasOwnProperty.call(view, 'provider')) {
|
||||
var domainObject = legacyObject.useCapability('adapter');
|
||||
const domainObject = legacyObject.useCapability('adapter');
|
||||
|
||||
return view.provider.canView(domainObject);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ define([
|
||||
LegacyTelemetryProvider.prototype.canProvideTelemetry;
|
||||
|
||||
function createDatum(domainObject, metadata, legacySeries, i) {
|
||||
var datum;
|
||||
let datum;
|
||||
|
||||
if (legacySeries.getDatum) {
|
||||
datum = legacySeries.getDatum(i);
|
||||
@ -77,9 +77,9 @@ define([
|
||||
}
|
||||
|
||||
function adaptSeries(domainObject, metadata, legacySeries) {
|
||||
var series = [];
|
||||
const series = [];
|
||||
|
||||
for (var i = 0; i < legacySeries.getPointCount(); i++) {
|
||||
for (let i = 0; i < legacySeries.getPointCount(); i++) {
|
||||
series.push(createDatum(domainObject, metadata, legacySeries, i));
|
||||
}
|
||||
|
||||
@ -104,9 +104,9 @@ define([
|
||||
* telemetry data.
|
||||
*/
|
||||
LegacyTelemetryProvider.prototype.request = function (domainObject, request) {
|
||||
var metadata = this.telemetryApi.getMetadata(domainObject);
|
||||
var oldObject = this.instantiate(utils.toOldFormat(domainObject), utils.makeKeyString(domainObject.identifier));
|
||||
var capability = oldObject.getCapability("telemetry");
|
||||
const metadata = this.telemetryApi.getMetadata(domainObject);
|
||||
const oldObject = this.instantiate(utils.toOldFormat(domainObject), utils.makeKeyString(domainObject.identifier));
|
||||
const capability = oldObject.getCapability("telemetry");
|
||||
|
||||
return capability.requestData(request).then(function (telemetrySeries) {
|
||||
return Promise.resolve(adaptSeries(domainObject, metadata, telemetrySeries));
|
||||
@ -130,9 +130,9 @@ define([
|
||||
* @returns {platform|telemetry.TelemetrySubscription|*}
|
||||
*/
|
||||
LegacyTelemetryProvider.prototype.subscribe = function (domainObject, callback, request) {
|
||||
var metadata = this.telemetryApi.getMetadata(domainObject);
|
||||
var oldObject = this.instantiate(utils.toOldFormat(domainObject), utils.makeKeyString(domainObject.identifier));
|
||||
var capability = oldObject.getCapability("telemetry");
|
||||
const metadata = this.telemetryApi.getMetadata(domainObject);
|
||||
const oldObject = this.instantiate(utils.toOldFormat(domainObject), utils.makeKeyString(domainObject.identifier));
|
||||
const capability = oldObject.getCapability("telemetry");
|
||||
|
||||
function callbackWrapper(series) {
|
||||
callback(createDatum(domainObject, metadata, series, series.getPointCount() - 1));
|
||||
@ -142,7 +142,7 @@ define([
|
||||
};
|
||||
|
||||
LegacyTelemetryProvider.prototype.supportsLimits = function (domainObject) {
|
||||
var oldObject = this.instantiate(
|
||||
const oldObject = this.instantiate(
|
||||
utils.toOldFormat(domainObject),
|
||||
utils.makeKeyString(domainObject.identifier)
|
||||
);
|
||||
@ -151,11 +151,11 @@ define([
|
||||
};
|
||||
|
||||
LegacyTelemetryProvider.prototype.getLimitEvaluator = function (domainObject) {
|
||||
var oldObject = this.instantiate(
|
||||
const oldObject = this.instantiate(
|
||||
utils.toOldFormat(domainObject),
|
||||
utils.makeKeyString(domainObject.identifier)
|
||||
);
|
||||
var limitEvaluator = oldObject.getCapability("limit");
|
||||
const limitEvaluator = oldObject.getCapability("limit");
|
||||
|
||||
return {
|
||||
evaluate: function (datum, property) {
|
||||
@ -166,7 +166,7 @@ define([
|
||||
|
||||
return function (openmct, instantiate) {
|
||||
// Legacy provider should always be the fallback.
|
||||
var provider = new LegacyTelemetryProvider(openmct, instantiate);
|
||||
const provider = new LegacyTelemetryProvider(openmct, instantiate);
|
||||
openmct.telemetry.legacyProvider = provider;
|
||||
openmct.telemetry.requestProviders.push(provider);
|
||||
openmct.telemetry.subscriptionProviders.push(provider);
|
||||
|
@ -35,9 +35,9 @@ define(
|
||||
) {
|
||||
return function (model, id) {
|
||||
id = id || identifierService.generate();
|
||||
var old_id = model.id;
|
||||
const old_id = model.id;
|
||||
model.id = id;
|
||||
var capabilities = capabilityService.getCapabilities(model, id);
|
||||
const capabilities = capabilityService.getCapabilities(model, id);
|
||||
model.id = old_id;
|
||||
cacheService.put(id, model);
|
||||
|
||||
|
@ -40,12 +40,12 @@ define([
|
||||
* @private
|
||||
*/
|
||||
ObjectServiceProvider.prototype.bridgeEventBuses = function () {
|
||||
var removeGeneralTopicListener;
|
||||
var handleLegacyMutation;
|
||||
let removeGeneralTopicListener;
|
||||
let handleLegacyMutation;
|
||||
|
||||
var handleMutation = function (newStyleObject) {
|
||||
var keyString = utils.makeKeyString(newStyleObject.identifier);
|
||||
var oldStyleObject = this.instantiate(utils.toOldFormat(newStyleObject), keyString);
|
||||
const handleMutation = function (newStyleObject) {
|
||||
const keyString = utils.makeKeyString(newStyleObject.identifier);
|
||||
const oldStyleObject = this.instantiate(utils.toOldFormat(newStyleObject), keyString);
|
||||
|
||||
// Don't trigger self
|
||||
removeGeneralTopicListener();
|
||||
@ -58,8 +58,8 @@ define([
|
||||
}.bind(this);
|
||||
|
||||
handleLegacyMutation = function (legacyObject) {
|
||||
var newStyleObject = utils.toNewFormat(legacyObject.getModel(), legacyObject.getId()),
|
||||
keystring = utils.makeKeyString(newStyleObject.identifier);
|
||||
const newStyleObject = utils.toNewFormat(legacyObject.getModel(), legacyObject.getId());
|
||||
const keystring = utils.makeKeyString(newStyleObject.identifier);
|
||||
|
||||
this.eventEmitter.emit(keystring + ":*", newStyleObject);
|
||||
this.eventEmitter.emit('mutation', newStyleObject);
|
||||
@ -128,11 +128,11 @@ define([
|
||||
};
|
||||
|
||||
ObjectServiceProvider.prototype.get = function (key) {
|
||||
var keyString = utils.makeKeyString(key);
|
||||
const keyString = utils.makeKeyString(key);
|
||||
|
||||
return this.objectService.getObjects([keyString])
|
||||
.then(function (results) {
|
||||
var model = results[keyString].getModel();
|
||||
let model = results[keyString].getModel();
|
||||
|
||||
return utils.toNewFormat(model, key);
|
||||
});
|
||||
@ -141,19 +141,20 @@ define([
|
||||
// Injects new object API as a decorator so that it hijacks all requests.
|
||||
// Object providers implemented on new API should just work, old API should just work, many things may break.
|
||||
function LegacyObjectAPIInterceptor(openmct, ROOTS, instantiate, topic, objectService) {
|
||||
var eventEmitter = openmct.objects.eventEmitter;
|
||||
const eventEmitter = openmct.objects.eventEmitter;
|
||||
|
||||
this.getObjects = function (keys) {
|
||||
var results = {},
|
||||
promises = keys.map(function (keyString) {
|
||||
var key = utils.parseKeyString(keyString);
|
||||
const results = {};
|
||||
|
||||
return openmct.objects.get(key)
|
||||
.then(function (object) {
|
||||
object = utils.toOldFormat(object);
|
||||
results[keyString] = instantiate(object, keyString);
|
||||
});
|
||||
});
|
||||
const promises = keys.map(function (keyString) {
|
||||
const key = utils.parseKeyString(keyString);
|
||||
|
||||
return openmct.objects.get(key)
|
||||
.then(function (object) {
|
||||
object = utils.toOldFormat(object);
|
||||
results[keyString] = instantiate(object, keyString);
|
||||
});
|
||||
});
|
||||
|
||||
return Promise.all(promises)
|
||||
.then(function () {
|
||||
|
@ -46,19 +46,20 @@ define([
|
||||
* models. If a model is requested twice, respond with a missing result.
|
||||
*/
|
||||
MissingModelCompatibilityDecorator.prototype.apiFetch = function (ids) {
|
||||
var results = {},
|
||||
promises = ids.map(function (id) {
|
||||
if (this.apiFetching[id]) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
const results = {};
|
||||
|
||||
this.apiFetching[id] = true;
|
||||
const promises = ids.map(function (id) {
|
||||
if (this.apiFetching[id]) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return this.api.objects.get(objectUtils.parseKeyString(id))
|
||||
.then(function (newDO) {
|
||||
results[id] = objectUtils.toOldFormat(newDO);
|
||||
});
|
||||
}, this);
|
||||
this.apiFetching[id] = true;
|
||||
|
||||
return this.api.objects.get(objectUtils.parseKeyString(id))
|
||||
.then(function (newDO) {
|
||||
results[id] = objectUtils.toOldFormat(newDO);
|
||||
});
|
||||
}, this);
|
||||
|
||||
return Promise.all(promises).then(function () {
|
||||
return results;
|
||||
@ -72,7 +73,7 @@ define([
|
||||
MissingModelCompatibilityDecorator.prototype.getModels = function (ids) {
|
||||
return this.modelService.getModels(ids)
|
||||
.then(function (models) {
|
||||
var missingIds = ids.filter(function (id) {
|
||||
const missingIds = ids.filter(function (id) {
|
||||
return !models[id];
|
||||
});
|
||||
|
||||
|
@ -70,7 +70,7 @@ define([
|
||||
* @memberof module:openmct.CompositionAPI#
|
||||
*/
|
||||
CompositionAPI.prototype.get = function (domainObject) {
|
||||
var provider = this.registry.find(p => {
|
||||
const provider = this.registry.find(p => {
|
||||
return p.appliesTo(domainObject);
|
||||
});
|
||||
|
||||
|
@ -7,10 +7,10 @@ define([
|
||||
) {
|
||||
|
||||
describe('The Composition API', function () {
|
||||
var publicAPI;
|
||||
var compositionAPI;
|
||||
var topicService;
|
||||
var mutationTopic;
|
||||
let publicAPI;
|
||||
let compositionAPI;
|
||||
let topicService;
|
||||
let mutationTopic;
|
||||
|
||||
beforeEach(function () {
|
||||
|
||||
@ -54,8 +54,8 @@ define([
|
||||
});
|
||||
|
||||
describe('default composition', function () {
|
||||
var domainObject;
|
||||
var composition;
|
||||
let domainObject;
|
||||
let composition;
|
||||
|
||||
beforeEach(function () {
|
||||
domainObject = {
|
||||
@ -88,7 +88,7 @@ define([
|
||||
});
|
||||
|
||||
it('loads composition from domain object', function () {
|
||||
var listener = jasmine.createSpy('addListener');
|
||||
const listener = jasmine.createSpy('addListener');
|
||||
composition.on('add', listener);
|
||||
|
||||
return composition.load().then(function () {
|
||||
@ -102,7 +102,7 @@ define([
|
||||
});
|
||||
});
|
||||
describe('supports reordering of composition', function () {
|
||||
var listener;
|
||||
let listener;
|
||||
beforeEach(function () {
|
||||
listener = jasmine.createSpy('reorderListener');
|
||||
composition.on('reorder', listener);
|
||||
@ -151,9 +151,9 @@ define([
|
||||
});
|
||||
|
||||
describe('static custom composition', function () {
|
||||
var customProvider;
|
||||
var domainObject;
|
||||
var composition;
|
||||
let customProvider;
|
||||
let domainObject;
|
||||
let composition;
|
||||
|
||||
beforeEach(function () {
|
||||
// A simple custom provider, returns the same composition for
|
||||
@ -185,12 +185,12 @@ define([
|
||||
});
|
||||
|
||||
it('supports listening and loading', function () {
|
||||
var addListener = jasmine.createSpy('addListener');
|
||||
const addListener = jasmine.createSpy('addListener');
|
||||
composition.on('add', addListener);
|
||||
|
||||
return composition.load().then(function (children) {
|
||||
var listenObject;
|
||||
var loadedObject = children[0];
|
||||
let listenObject;
|
||||
const loadedObject = children[0];
|
||||
|
||||
expect(addListener).toHaveBeenCalled();
|
||||
|
||||
@ -229,9 +229,9 @@ define([
|
||||
});
|
||||
|
||||
describe('dynamic custom composition', function () {
|
||||
var customProvider;
|
||||
var domainObject;
|
||||
var composition;
|
||||
let customProvider;
|
||||
let domainObject;
|
||||
let composition;
|
||||
|
||||
beforeEach(function () {
|
||||
// A dynamic provider, loads an empty composition and exposes
|
||||
@ -258,12 +258,12 @@ define([
|
||||
});
|
||||
|
||||
it('supports listening and loading', function () {
|
||||
var addListener = jasmine.createSpy('addListener');
|
||||
var removeListener = jasmine.createSpy('removeListener');
|
||||
var addPromise = new Promise(function (resolve) {
|
||||
const addListener = jasmine.createSpy('addListener');
|
||||
const removeListener = jasmine.createSpy('removeListener');
|
||||
const addPromise = new Promise(function (resolve) {
|
||||
addListener.and.callFake(resolve);
|
||||
});
|
||||
var removePromise = new Promise(function (resolve) {
|
||||
const removePromise = new Promise(function (resolve) {
|
||||
removeListener.and.callFake(resolve);
|
||||
});
|
||||
|
||||
@ -282,8 +282,8 @@ define([
|
||||
jasmine.any(Function),
|
||||
jasmine.any(CompositionCollection)
|
||||
);
|
||||
var add = customProvider.on.calls.all()[0].args[2];
|
||||
var remove = customProvider.on.calls.all()[1].args[2];
|
||||
const add = customProvider.on.calls.all()[0].args[2];
|
||||
const remove = customProvider.on.calls.all()[1].args[2];
|
||||
|
||||
return composition.load()
|
||||
.then(function () {
|
||||
|
@ -128,7 +128,7 @@ define([
|
||||
throw new Error('Event not supported by composition: ' + event);
|
||||
}
|
||||
|
||||
var index = this.listeners[event].findIndex(l => {
|
||||
const index = this.listeners[event].findIndex(l => {
|
||||
return l.callback === callback && l.context === context;
|
||||
});
|
||||
|
||||
|
@ -106,8 +106,8 @@ define([
|
||||
) {
|
||||
this.establishTopicListener();
|
||||
|
||||
var keyString = objectUtils.makeKeyString(domainObject.identifier);
|
||||
var objectListeners = this.listeningTo[keyString];
|
||||
const keyString = objectUtils.makeKeyString(domainObject.identifier);
|
||||
let objectListeners = this.listeningTo[keyString];
|
||||
|
||||
if (!objectListeners) {
|
||||
objectListeners = this.listeningTo[keyString] = {
|
||||
@ -140,10 +140,10 @@ define([
|
||||
callback,
|
||||
context
|
||||
) {
|
||||
var keyString = objectUtils.makeKeyString(domainObject.identifier);
|
||||
var objectListeners = this.listeningTo[keyString];
|
||||
const keyString = objectUtils.makeKeyString(domainObject.identifier);
|
||||
const objectListeners = this.listeningTo[keyString];
|
||||
|
||||
var index = objectListeners[event].findIndex(l => {
|
||||
const index = objectListeners[event].findIndex(l => {
|
||||
return l.callback === callback && l.context === context;
|
||||
});
|
||||
|
||||
@ -233,7 +233,7 @@ define([
|
||||
this.publicAPI.objects.mutate(domainObject, 'composition', newComposition);
|
||||
|
||||
let id = objectUtils.makeKeyString(domainObject.identifier);
|
||||
var listeners = this.listeningTo[id];
|
||||
const listeners = this.listeningTo[id];
|
||||
|
||||
if (!listeners) {
|
||||
return;
|
||||
@ -274,18 +274,18 @@ define([
|
||||
* @private
|
||||
*/
|
||||
DefaultCompositionProvider.prototype.onMutation = function (oldDomainObject) {
|
||||
var id = objectUtils.makeKeyString(oldDomainObject.identifier);
|
||||
var listeners = this.listeningTo[id];
|
||||
const id = objectUtils.makeKeyString(oldDomainObject.identifier);
|
||||
const listeners = this.listeningTo[id];
|
||||
|
||||
if (!listeners) {
|
||||
return;
|
||||
}
|
||||
|
||||
var oldComposition = listeners.composition.map(objectUtils.makeKeyString);
|
||||
var newComposition = oldDomainObject.composition.map(objectUtils.makeKeyString);
|
||||
const oldComposition = listeners.composition.map(objectUtils.makeKeyString);
|
||||
const newComposition = oldDomainObject.composition.map(objectUtils.makeKeyString);
|
||||
|
||||
var added = _.difference(newComposition, oldComposition).map(objectUtils.parseKeyString);
|
||||
var removed = _.difference(oldComposition, newComposition).map(objectUtils.parseKeyString);
|
||||
const added = _.difference(newComposition, oldComposition).map(objectUtils.parseKeyString);
|
||||
const removed = _.difference(oldComposition, newComposition).map(objectUtils.parseKeyString);
|
||||
|
||||
function notify(value) {
|
||||
return function (listener) {
|
||||
|
@ -30,9 +30,9 @@ define(
|
||||
MCTIndicators
|
||||
) {
|
||||
xdescribe("The Indicator API", function () {
|
||||
var openmct;
|
||||
var directive;
|
||||
var holderElement;
|
||||
let openmct;
|
||||
let directive;
|
||||
let holderElement;
|
||||
|
||||
beforeEach(function () {
|
||||
openmct = new MCT();
|
||||
@ -41,7 +41,7 @@ define(
|
||||
});
|
||||
|
||||
describe("The simple indicator", function () {
|
||||
var simpleIndicator;
|
||||
let simpleIndicator;
|
||||
|
||||
beforeEach(function () {
|
||||
simpleIndicator = openmct.indicators.simpleIndicator();
|
||||
@ -97,7 +97,7 @@ define(
|
||||
});
|
||||
|
||||
it("Supports registration of a completely custom indicator", function () {
|
||||
var customIndicator = document.createElement('div');
|
||||
const customIndicator = document.createElement('div');
|
||||
customIndicator.classList.add('customIndicator');
|
||||
customIndicator.textContent = 'A custom indicator';
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
define(['zepto', './res/indicator-template.html'],
|
||||
function ($, indicatorTemplate) {
|
||||
var DEFAULT_ICON_CLASS = 'icon-info';
|
||||
const DEFAULT_ICON_CLASS = 'icon-info';
|
||||
|
||||
function SimpleIndicator(openmct) {
|
||||
this.openmct = openmct;
|
||||
|
@ -27,7 +27,7 @@ define([
|
||||
utils,
|
||||
_
|
||||
) {
|
||||
var ANY_OBJECT_EVENT = "mutation";
|
||||
const ANY_OBJECT_EVENT = "mutation";
|
||||
|
||||
/**
|
||||
* The MutableObject wraps a DomainObject and provides getters and
|
||||
@ -43,7 +43,7 @@ define([
|
||||
}
|
||||
|
||||
function qualifiedEventName(object, eventName) {
|
||||
var keystring = utils.makeKeyString(object.identifier);
|
||||
const keystring = utils.makeKeyString(object.identifier);
|
||||
|
||||
return [keystring, eventName].join(':');
|
||||
}
|
||||
@ -64,8 +64,8 @@ define([
|
||||
* @memberof module:openmct.MutableObject#
|
||||
*/
|
||||
MutableObject.prototype.on = function (path, callback) {
|
||||
var fullPath = qualifiedEventName(this.object, path);
|
||||
var eventOff =
|
||||
const fullPath = qualifiedEventName(this.object, path);
|
||||
const eventOff =
|
||||
this.eventEmitter.off.bind(this.eventEmitter, fullPath, callback);
|
||||
|
||||
this.eventEmitter.on(fullPath, callback);
|
||||
@ -83,7 +83,7 @@ define([
|
||||
_.set(this.object, path, value);
|
||||
_.set(this.object, 'modified', Date.now());
|
||||
|
||||
var handleRecursiveMutation = function (newObject) {
|
||||
const handleRecursiveMutation = function (newObject) {
|
||||
this.object = newObject;
|
||||
}.bind(this);
|
||||
|
||||
|
@ -155,7 +155,7 @@ define([
|
||||
*/
|
||||
ObjectAPI.prototype.get = function (identifier) {
|
||||
identifier = utils.parseKeyString(identifier);
|
||||
var provider = this.getProvider(identifier);
|
||||
const provider = this.getProvider(identifier);
|
||||
|
||||
if (!provider) {
|
||||
throw new Error('No Provider Matched');
|
||||
@ -232,7 +232,7 @@ define([
|
||||
* @memberof module:openmct.ObjectAPI#
|
||||
*/
|
||||
ObjectAPI.prototype.mutate = function (domainObject, path, value) {
|
||||
var mutableObject =
|
||||
const mutableObject =
|
||||
new MutableObject(this.eventEmitter, domainObject);
|
||||
|
||||
return mutableObject.set(path, value);
|
||||
@ -248,7 +248,7 @@ define([
|
||||
* @memberof module:openmct.ObjectAPI#
|
||||
*/
|
||||
ObjectAPI.prototype.observe = function (domainObject, path, callback) {
|
||||
var mutableObject =
|
||||
const mutableObject =
|
||||
new MutableObject(this.eventEmitter, domainObject);
|
||||
mutableObject.on(path, callback);
|
||||
|
||||
|
@ -31,7 +31,7 @@ define([
|
||||
}
|
||||
|
||||
RootRegistry.prototype.getRoots = function () {
|
||||
var promises = this.providers.map(function (provider) {
|
||||
const promises = this.providers.map(function (provider) {
|
||||
return provider();
|
||||
});
|
||||
|
||||
|
@ -58,9 +58,9 @@ define([
|
||||
return keyString;
|
||||
}
|
||||
|
||||
var namespace = '',
|
||||
key = keyString;
|
||||
for (var i = 0; i < key.length; i++) {
|
||||
let namespace = '';
|
||||
let key = keyString;
|
||||
for (let i = 0; i < key.length; i++) {
|
||||
if (key[i] === "\\" && key[i + 1] === ":") {
|
||||
i++; // skip escape character.
|
||||
} else if (key[i] === ":") {
|
||||
|
@ -25,8 +25,8 @@ define([
|
||||
RootObjectProvider
|
||||
) {
|
||||
describe('RootObjectProvider', function () {
|
||||
var rootRegistry,
|
||||
rootObjectProvider;
|
||||
let rootRegistry;
|
||||
let rootObjectProvider;
|
||||
|
||||
beforeEach(function () {
|
||||
rootRegistry = jasmine.createSpyObj('rootRegistry', ['getRoots']);
|
||||
|
@ -25,10 +25,10 @@ define([
|
||||
RootRegistry
|
||||
) {
|
||||
describe('RootRegistry', function () {
|
||||
var idA,
|
||||
idB,
|
||||
idC,
|
||||
registry;
|
||||
let idA;
|
||||
let idB;
|
||||
let idC;
|
||||
let registry;
|
||||
|
||||
beforeEach(function () {
|
||||
idA = {
|
||||
|
@ -6,7 +6,7 @@ define([
|
||||
describe('objectUtils', function () {
|
||||
|
||||
describe('keyString util', function () {
|
||||
var EXPECTATIONS = {
|
||||
const EXPECTATIONS = {
|
||||
'ROOT': {
|
||||
namespace: '',
|
||||
key: 'ROOT'
|
||||
@ -40,20 +40,20 @@ define([
|
||||
});
|
||||
|
||||
it('parses and re-encodes "' + keyString + '"', function () {
|
||||
var identifier = objectUtils.parseKeyString(keyString);
|
||||
const identifier = objectUtils.parseKeyString(keyString);
|
||||
expect(objectUtils.makeKeyString(identifier))
|
||||
.toEqual(keyString);
|
||||
});
|
||||
|
||||
it('is idempotent for "' + keyString + '".', function () {
|
||||
var identifier = objectUtils.parseKeyString(keyString);
|
||||
var again = objectUtils.parseKeyString(identifier);
|
||||
const identifier = objectUtils.parseKeyString(keyString);
|
||||
let again = objectUtils.parseKeyString(identifier);
|
||||
expect(identifier).toEqual(again);
|
||||
again = objectUtils.parseKeyString(again);
|
||||
again = objectUtils.parseKeyString(again);
|
||||
expect(identifier).toEqual(again);
|
||||
|
||||
var againKeyString = objectUtils.makeKeyString(again);
|
||||
let againKeyString = objectUtils.makeKeyString(again);
|
||||
expect(againKeyString).toEqual(keyString);
|
||||
againKeyString = objectUtils.makeKeyString(againKeyString);
|
||||
againKeyString = objectUtils.makeKeyString(againKeyString);
|
||||
|
@ -2,7 +2,7 @@ import ProgressDialogComponent from './components/ProgressDialogComponent.vue';
|
||||
import Overlay from './Overlay';
|
||||
import Vue from 'vue';
|
||||
|
||||
var component;
|
||||
let component;
|
||||
|
||||
class ProgressDialog extends Overlay {
|
||||
constructor({progressPerc, progressText, iconClass, message, title, hint, timestamp, ...options}) {
|
||||
|
@ -52,7 +52,7 @@ define([
|
||||
* @private
|
||||
*/
|
||||
function valueMetadatasFromOldFormat(metadata) {
|
||||
var valueMetadatas = [];
|
||||
const valueMetadatas = [];
|
||||
|
||||
valueMetadatas.push({
|
||||
key: 'name',
|
||||
@ -60,7 +60,7 @@ define([
|
||||
});
|
||||
|
||||
metadata.domains.forEach(function (domain, index) {
|
||||
var valueMetadata = _.clone(domain);
|
||||
const valueMetadata = _.clone(domain);
|
||||
valueMetadata.hints = {
|
||||
domain: index + 1
|
||||
};
|
||||
@ -68,7 +68,7 @@ define([
|
||||
});
|
||||
|
||||
metadata.ranges.forEach(function (range, index) {
|
||||
var valueMetadata = _.clone(range);
|
||||
const valueMetadata = _.clone(range);
|
||||
valueMetadata.hints = {
|
||||
range: index,
|
||||
priority: index + metadata.domains.length + 1
|
||||
@ -100,9 +100,9 @@ define([
|
||||
* Returns telemetry metadata for a given domain object.
|
||||
*/
|
||||
DefaultMetadataProvider.prototype.getMetadata = function (domainObject) {
|
||||
var metadata = domainObject.telemetry || {};
|
||||
const metadata = domainObject.telemetry || {};
|
||||
if (this.typeHasTelemetry(domainObject)) {
|
||||
var typeMetadata = this.typeService.getType(domainObject.type).typeDef.telemetry;
|
||||
const typeMetadata = this.typeService.getType(domainObject.type).typeDef.telemetry;
|
||||
Object.assign(metadata, typeMetadata);
|
||||
if (!metadata.values) {
|
||||
metadata.values = valueMetadatasFromOldFormat(metadata);
|
||||
|
@ -205,7 +205,7 @@ define([
|
||||
* @private
|
||||
*/
|
||||
TelemetryAPI.prototype.findSubscriptionProvider = function () {
|
||||
var args = Array.prototype.slice.apply(arguments);
|
||||
const args = Array.prototype.slice.apply(arguments);
|
||||
function supportsDomainObject(provider) {
|
||||
return provider.supportsSubscribe.apply(provider, args);
|
||||
}
|
||||
@ -217,7 +217,7 @@ define([
|
||||
* @private
|
||||
*/
|
||||
TelemetryAPI.prototype.findRequestProvider = function (domainObject) {
|
||||
var args = Array.prototype.slice.apply(arguments);
|
||||
const args = Array.prototype.slice.apply(arguments);
|
||||
function supportsDomainObject(provider) {
|
||||
return provider.supportsRequest.apply(provider, args);
|
||||
}
|
||||
@ -282,7 +282,7 @@ define([
|
||||
}
|
||||
|
||||
this.standardizeRequestOptions(arguments[1]);
|
||||
var provider = this.findRequestProvider.apply(this, arguments);
|
||||
const provider = this.findRequestProvider.apply(this, arguments);
|
||||
if (!provider) {
|
||||
return Promise.reject('No provider found');
|
||||
}
|
||||
@ -310,14 +310,14 @@ define([
|
||||
* the subscription
|
||||
*/
|
||||
TelemetryAPI.prototype.subscribe = function (domainObject, callback, options) {
|
||||
var provider = this.findSubscriptionProvider(domainObject);
|
||||
const provider = this.findSubscriptionProvider(domainObject);
|
||||
|
||||
if (!this.subscribeCache) {
|
||||
this.subscribeCache = {};
|
||||
}
|
||||
|
||||
var keyString = objectUtils.makeKeyString(domainObject.identifier);
|
||||
var subscriber = this.subscribeCache[keyString];
|
||||
const keyString = objectUtils.makeKeyString(domainObject.identifier);
|
||||
let subscriber = this.subscribeCache[keyString];
|
||||
|
||||
if (!subscriber) {
|
||||
subscriber = this.subscribeCache[keyString] = {
|
||||
@ -357,12 +357,12 @@ define([
|
||||
*/
|
||||
TelemetryAPI.prototype.getMetadata = function (domainObject) {
|
||||
if (!this.metadataCache.has(domainObject)) {
|
||||
var metadataProvider = this.findMetadataProvider(domainObject);
|
||||
const metadataProvider = this.findMetadataProvider(domainObject);
|
||||
if (!metadataProvider) {
|
||||
return;
|
||||
}
|
||||
|
||||
var metadata = metadataProvider.getMetadata(domainObject);
|
||||
const metadata = metadataProvider.getMetadata(domainObject);
|
||||
|
||||
this.metadataCache.set(
|
||||
domainObject,
|
||||
@ -379,12 +379,12 @@ define([
|
||||
*
|
||||
*/
|
||||
TelemetryAPI.prototype.commonValuesForHints = function (metadatas, hints) {
|
||||
var options = metadatas.map(function (metadata) {
|
||||
var values = metadata.valuesForHints(hints);
|
||||
const options = metadatas.map(function (metadata) {
|
||||
const values = metadata.valuesForHints(hints);
|
||||
|
||||
return _.keyBy(values, 'key');
|
||||
}).reduce(function (a, b) {
|
||||
var results = {};
|
||||
const results = {};
|
||||
Object.keys(a).forEach(function (key) {
|
||||
if (Object.prototype.hasOwnProperty.call(b, key)) {
|
||||
results[key] = a[key];
|
||||
@ -393,7 +393,7 @@ define([
|
||||
|
||||
return results;
|
||||
});
|
||||
var sortKeys = hints.map(function (h) {
|
||||
const sortKeys = hints.map(function (h) {
|
||||
return 'hints.' + h;
|
||||
});
|
||||
|
||||
@ -428,7 +428,7 @@ define([
|
||||
*/
|
||||
TelemetryAPI.prototype.getFormatMap = function (metadata) {
|
||||
if (!this.formatMapCache.has(metadata)) {
|
||||
var formatMap = metadata.values().reduce(function (map, valueMetadata) {
|
||||
const formatMap = metadata.values().reduce(function (map, valueMetadata) {
|
||||
map[valueMetadata.key] = this.getValueFormatter(valueMetadata);
|
||||
|
||||
return map;
|
||||
@ -489,7 +489,7 @@ define([
|
||||
* @memberof module:openmct.TelemetryAPI~TelemetryProvider#
|
||||
*/
|
||||
TelemetryAPI.prototype.getLimitEvaluator = function (domainObject) {
|
||||
var provider = this.findLimitEvaluator(domainObject);
|
||||
const provider = this.findLimitEvaluator(domainObject);
|
||||
if (!provider) {
|
||||
return {
|
||||
evaluate: function () {}
|
||||
|
@ -26,9 +26,9 @@ define([
|
||||
TelemetryAPI
|
||||
) {
|
||||
xdescribe('Telemetry API', function () {
|
||||
var openmct;
|
||||
var telemetryAPI;
|
||||
var mockTypeService;
|
||||
let openmct;
|
||||
let telemetryAPI;
|
||||
let mockTypeService;
|
||||
|
||||
beforeEach(function () {
|
||||
openmct = {
|
||||
@ -54,8 +54,8 @@ define([
|
||||
});
|
||||
|
||||
describe('telemetry providers', function () {
|
||||
var telemetryProvider,
|
||||
domainObject;
|
||||
let telemetryProvider;
|
||||
let domainObject;
|
||||
|
||||
beforeEach(function () {
|
||||
telemetryProvider = jasmine.createSpyObj('telemetryProvider', [
|
||||
@ -74,10 +74,10 @@ define([
|
||||
});
|
||||
|
||||
it('provides consistent results without providers', function () {
|
||||
var unsubscribe = telemetryAPI.subscribe(domainObject);
|
||||
const unsubscribe = telemetryAPI.subscribe(domainObject);
|
||||
expect(unsubscribe).toEqual(jasmine.any(Function));
|
||||
|
||||
var response = telemetryAPI.request(domainObject);
|
||||
const response = telemetryAPI.request(domainObject);
|
||||
expect(response).toEqual(jasmine.any(Promise));
|
||||
});
|
||||
|
||||
@ -86,14 +86,14 @@ define([
|
||||
telemetryProvider.supportsRequest.and.returnValue(false);
|
||||
telemetryAPI.addProvider(telemetryProvider);
|
||||
|
||||
var callback = jasmine.createSpy('callback');
|
||||
var unsubscribe = telemetryAPI.subscribe(domainObject, callback);
|
||||
const callback = jasmine.createSpy('callback');
|
||||
const unsubscribe = telemetryAPI.subscribe(domainObject, callback);
|
||||
expect(telemetryProvider.supportsSubscribe)
|
||||
.toHaveBeenCalledWith(domainObject);
|
||||
expect(telemetryProvider.subscribe).not.toHaveBeenCalled();
|
||||
expect(unsubscribe).toEqual(jasmine.any(Function));
|
||||
|
||||
var response = telemetryAPI.request(domainObject);
|
||||
const response = telemetryAPI.request(domainObject);
|
||||
expect(telemetryProvider.supportsRequest)
|
||||
.toHaveBeenCalledWith(domainObject, jasmine.any(Object));
|
||||
expect(telemetryProvider.request).not.toHaveBeenCalled();
|
||||
@ -101,13 +101,13 @@ define([
|
||||
});
|
||||
|
||||
it('sends subscribe calls to matching providers', function () {
|
||||
var unsubFunc = jasmine.createSpy('unsubscribe');
|
||||
const unsubFunc = jasmine.createSpy('unsubscribe');
|
||||
telemetryProvider.subscribe.and.returnValue(unsubFunc);
|
||||
telemetryProvider.supportsSubscribe.and.returnValue(true);
|
||||
telemetryAPI.addProvider(telemetryProvider);
|
||||
|
||||
var callback = jasmine.createSpy('callback');
|
||||
var unsubscribe = telemetryAPI.subscribe(domainObject, callback);
|
||||
const callback = jasmine.createSpy('callback');
|
||||
const unsubscribe = telemetryAPI.subscribe(domainObject, callback);
|
||||
expect(telemetryProvider.supportsSubscribe.calls.count()).toBe(1);
|
||||
expect(telemetryProvider.supportsSubscribe)
|
||||
.toHaveBeenCalledWith(domainObject);
|
||||
@ -115,7 +115,7 @@ define([
|
||||
expect(telemetryProvider.subscribe)
|
||||
.toHaveBeenCalledWith(domainObject, jasmine.any(Function));
|
||||
|
||||
var notify = telemetryProvider.subscribe.calls.mostRecent().args[1];
|
||||
const notify = telemetryProvider.subscribe.calls.mostRecent().args[1];
|
||||
notify('someValue');
|
||||
expect(callback).toHaveBeenCalledWith('someValue');
|
||||
|
||||
@ -129,19 +129,19 @@ define([
|
||||
});
|
||||
|
||||
it('subscribes once per object', function () {
|
||||
var unsubFunc = jasmine.createSpy('unsubscribe');
|
||||
const unsubFunc = jasmine.createSpy('unsubscribe');
|
||||
telemetryProvider.subscribe.and.returnValue(unsubFunc);
|
||||
telemetryProvider.supportsSubscribe.and.returnValue(true);
|
||||
telemetryAPI.addProvider(telemetryProvider);
|
||||
|
||||
var callback = jasmine.createSpy('callback');
|
||||
var callbacktwo = jasmine.createSpy('callback two');
|
||||
var unsubscribe = telemetryAPI.subscribe(domainObject, callback);
|
||||
var unsubscribetwo = telemetryAPI.subscribe(domainObject, callbacktwo);
|
||||
const callback = jasmine.createSpy('callback');
|
||||
const callbacktwo = jasmine.createSpy('callback two');
|
||||
const unsubscribe = telemetryAPI.subscribe(domainObject, callback);
|
||||
const unsubscribetwo = telemetryAPI.subscribe(domainObject, callbacktwo);
|
||||
|
||||
expect(telemetryProvider.subscribe.calls.count()).toBe(1);
|
||||
|
||||
var notify = telemetryProvider.subscribe.calls.mostRecent().args[1];
|
||||
const notify = telemetryProvider.subscribe.calls.mostRecent().args[1];
|
||||
notify('someValue');
|
||||
expect(callback).toHaveBeenCalledWith('someValue');
|
||||
expect(callbacktwo).toHaveBeenCalledWith('someValue');
|
||||
@ -160,20 +160,20 @@ define([
|
||||
});
|
||||
|
||||
it('only deletes subscription cache when there are no more subscribers', function () {
|
||||
var unsubFunc = jasmine.createSpy('unsubscribe');
|
||||
const unsubFunc = jasmine.createSpy('unsubscribe');
|
||||
telemetryProvider.subscribe.and.returnValue(unsubFunc);
|
||||
telemetryProvider.supportsSubscribe.and.returnValue(true);
|
||||
telemetryAPI.addProvider(telemetryProvider);
|
||||
|
||||
var callback = jasmine.createSpy('callback');
|
||||
var callbacktwo = jasmine.createSpy('callback two');
|
||||
var callbackThree = jasmine.createSpy('callback three');
|
||||
var unsubscribe = telemetryAPI.subscribe(domainObject, callback);
|
||||
var unsubscribeTwo = telemetryAPI.subscribe(domainObject, callbacktwo);
|
||||
const callback = jasmine.createSpy('callback');
|
||||
const callbacktwo = jasmine.createSpy('callback two');
|
||||
const callbackThree = jasmine.createSpy('callback three');
|
||||
const unsubscribe = telemetryAPI.subscribe(domainObject, callback);
|
||||
const unsubscribeTwo = telemetryAPI.subscribe(domainObject, callbacktwo);
|
||||
|
||||
expect(telemetryProvider.subscribe.calls.count()).toBe(1);
|
||||
unsubscribe();
|
||||
var unsubscribeThree = telemetryAPI.subscribe(domainObject, callbackThree);
|
||||
const unsubscribeThree = telemetryAPI.subscribe(domainObject, callbackThree);
|
||||
// Regression test for where subscription cache was deleted on each unsubscribe, resulting in
|
||||
// superfluous additional subscriptions. If the subscription cache is being deleted on each unsubscribe,
|
||||
// then a subsequent subscribe will result in a new subscription at the provider.
|
||||
@ -183,13 +183,13 @@ define([
|
||||
});
|
||||
|
||||
it('does subscribe/unsubscribe', function () {
|
||||
var unsubFunc = jasmine.createSpy('unsubscribe');
|
||||
const unsubFunc = jasmine.createSpy('unsubscribe');
|
||||
telemetryProvider.subscribe.and.returnValue(unsubFunc);
|
||||
telemetryProvider.supportsSubscribe.and.returnValue(true);
|
||||
telemetryAPI.addProvider(telemetryProvider);
|
||||
|
||||
var callback = jasmine.createSpy('callback');
|
||||
var unsubscribe = telemetryAPI.subscribe(domainObject, callback);
|
||||
const callback = jasmine.createSpy('callback');
|
||||
let unsubscribe = telemetryAPI.subscribe(domainObject, callback);
|
||||
expect(telemetryProvider.subscribe.calls.count()).toBe(1);
|
||||
unsubscribe();
|
||||
|
||||
@ -199,11 +199,11 @@ define([
|
||||
});
|
||||
|
||||
it('subscribes for different object', function () {
|
||||
var unsubFuncs = [];
|
||||
var notifiers = [];
|
||||
const unsubFuncs = [];
|
||||
const notifiers = [];
|
||||
telemetryProvider.supportsSubscribe.and.returnValue(true);
|
||||
telemetryProvider.subscribe.and.callFake(function (obj, cb) {
|
||||
var unsubFunc = jasmine.createSpy('unsubscribe ' + unsubFuncs.length);
|
||||
const unsubFunc = jasmine.createSpy('unsubscribe ' + unsubFuncs.length);
|
||||
unsubFuncs.push(unsubFunc);
|
||||
notifiers.push(cb);
|
||||
|
||||
@ -211,14 +211,14 @@ define([
|
||||
});
|
||||
telemetryAPI.addProvider(telemetryProvider);
|
||||
|
||||
var otherDomainObject = JSON.parse(JSON.stringify(domainObject));
|
||||
const otherDomainObject = JSON.parse(JSON.stringify(domainObject));
|
||||
otherDomainObject.identifier.namespace = 'other';
|
||||
|
||||
var callback = jasmine.createSpy('callback');
|
||||
var callbacktwo = jasmine.createSpy('callback two');
|
||||
const callback = jasmine.createSpy('callback');
|
||||
const callbacktwo = jasmine.createSpy('callback two');
|
||||
|
||||
var unsubscribe = telemetryAPI.subscribe(domainObject, callback);
|
||||
var unsubscribetwo = telemetryAPI.subscribe(otherDomainObject, callbacktwo);
|
||||
const unsubscribe = telemetryAPI.subscribe(domainObject, callback);
|
||||
const unsubscribetwo = telemetryAPI.subscribe(otherDomainObject, callbacktwo);
|
||||
|
||||
expect(telemetryProvider.subscribe.calls.count()).toBe(2);
|
||||
|
||||
@ -239,12 +239,12 @@ define([
|
||||
});
|
||||
|
||||
it('sends requests to matching providers', function () {
|
||||
var telemPromise = Promise.resolve([]);
|
||||
const telemPromise = Promise.resolve([]);
|
||||
telemetryProvider.supportsRequest.and.returnValue(true);
|
||||
telemetryProvider.request.and.returnValue(telemPromise);
|
||||
telemetryAPI.addProvider(telemetryProvider);
|
||||
|
||||
var result = telemetryAPI.request(domainObject);
|
||||
const result = telemetryAPI.request(domainObject);
|
||||
expect(result).toBe(telemPromise);
|
||||
expect(telemetryProvider.supportsRequest).toHaveBeenCalledWith(
|
||||
domainObject,
|
||||
|
@ -121,7 +121,7 @@ define([
|
||||
return hints.every(hasHint, metadata);
|
||||
}
|
||||
|
||||
var matchingMetadata = this.valueMetadatas.filter(hasHints);
|
||||
const matchingMetadata = this.valueMetadatas.filter(hasHints);
|
||||
let iteratees = hints.map(hint => {
|
||||
return (metadata) => {
|
||||
return metadata.hints[hint];
|
||||
|
@ -30,7 +30,7 @@ define([
|
||||
|
||||
// TODO: needs reference to formatService;
|
||||
function TelemetryValueFormatter(valueMetadata, formatService) {
|
||||
var numberFormatter = {
|
||||
const numberFormatter = {
|
||||
parse: function (x) {
|
||||
return Number(x);
|
||||
},
|
||||
@ -82,8 +82,8 @@ define([
|
||||
|
||||
// Check for formatString support once instead of per format call.
|
||||
if (valueMetadata.formatString) {
|
||||
var baseFormat = this.formatter.format;
|
||||
var formatString = valueMetadata.formatString;
|
||||
const baseFormat = this.formatter.format;
|
||||
const formatString = valueMetadata.formatString;
|
||||
this.formatter.format = function (value) {
|
||||
return printj.sprintf(formatString, baseFormat.call(this, value));
|
||||
};
|
||||
|
@ -205,7 +205,7 @@ define(['EventEmitter'], function (EventEmitter) {
|
||||
*/
|
||||
TimeAPI.prototype.bounds = function (newBounds) {
|
||||
if (arguments.length > 0) {
|
||||
var validationResult = this.validateBounds(newBounds);
|
||||
const validationResult = this.validateBounds(newBounds);
|
||||
if (validationResult !== true) {
|
||||
throw new Error(validationResult);
|
||||
}
|
||||
@ -251,7 +251,7 @@ define(['EventEmitter'], function (EventEmitter) {
|
||||
);
|
||||
}
|
||||
|
||||
var timeSystem;
|
||||
let timeSystem;
|
||||
|
||||
if (timeSystemOrKey === undefined) {
|
||||
throw "Please provide a time system";
|
||||
@ -328,7 +328,7 @@ define(['EventEmitter'], function (EventEmitter) {
|
||||
* using current offsets.
|
||||
*/
|
||||
TimeAPI.prototype.tick = function (timestamp) {
|
||||
var newBounds = {
|
||||
const newBounds = {
|
||||
start: timestamp + this.offsets.start,
|
||||
end: timestamp + this.offsets.end
|
||||
};
|
||||
@ -357,7 +357,7 @@ define(['EventEmitter'], function (EventEmitter) {
|
||||
*/
|
||||
TimeAPI.prototype.clock = function (keyOrClock, offsets) {
|
||||
if (arguments.length === 2) {
|
||||
var clock;
|
||||
let clock;
|
||||
|
||||
if (typeof keyOrClock === 'string') {
|
||||
clock = this.clocks.get(keyOrClock);
|
||||
@ -371,7 +371,7 @@ define(['EventEmitter'], function (EventEmitter) {
|
||||
}
|
||||
}
|
||||
|
||||
var previousClock = this.activeClock;
|
||||
const previousClock = this.activeClock;
|
||||
if (previousClock !== undefined) {
|
||||
previousClock.off("tick", this.tick);
|
||||
}
|
||||
@ -422,15 +422,15 @@ define(['EventEmitter'], function (EventEmitter) {
|
||||
TimeAPI.prototype.clockOffsets = function (offsets) {
|
||||
if (arguments.length > 0) {
|
||||
|
||||
var validationResult = this.validateOffsets(offsets);
|
||||
const validationResult = this.validateOffsets(offsets);
|
||||
if (validationResult !== true) {
|
||||
throw new Error(validationResult);
|
||||
}
|
||||
|
||||
this.offsets = offsets;
|
||||
|
||||
var currentValue = this.activeClock.currentValue();
|
||||
var newBounds = {
|
||||
const currentValue = this.activeClock.currentValue();
|
||||
const newBounds = {
|
||||
start: currentValue + offsets.start,
|
||||
end: currentValue + offsets.end
|
||||
};
|
||||
|
@ -22,14 +22,14 @@
|
||||
|
||||
define(['./TimeAPI'], function (TimeAPI) {
|
||||
describe("The Time API", function () {
|
||||
var api,
|
||||
timeSystemKey,
|
||||
timeSystem,
|
||||
clockKey,
|
||||
clock,
|
||||
bounds,
|
||||
eventListener,
|
||||
toi;
|
||||
let api;
|
||||
let timeSystemKey;
|
||||
let timeSystem;
|
||||
let clockKey;
|
||||
let clock;
|
||||
let bounds;
|
||||
let eventListener;
|
||||
let toi;
|
||||
|
||||
beforeEach(function () {
|
||||
api = new TimeAPI();
|
||||
@ -162,7 +162,7 @@ define(['./TimeAPI'], function (TimeAPI) {
|
||||
});
|
||||
|
||||
it("Allows a registered tick source to be activated", function () {
|
||||
var mockTickSource = jasmine.createSpyObj("mockTickSource", [
|
||||
const mockTickSource = jasmine.createSpyObj("mockTickSource", [
|
||||
"on",
|
||||
"off",
|
||||
"currentValue"
|
||||
@ -171,9 +171,9 @@ define(['./TimeAPI'], function (TimeAPI) {
|
||||
});
|
||||
|
||||
describe(" when enabling a tick source", function () {
|
||||
var mockTickSource;
|
||||
var anotherMockTickSource;
|
||||
var mockOffsets = {
|
||||
let mockTickSource;
|
||||
let anotherMockTickSource;
|
||||
const mockOffsets = {
|
||||
start: 0,
|
||||
end: 1
|
||||
};
|
||||
@ -229,15 +229,15 @@ define(['./TimeAPI'], function (TimeAPI) {
|
||||
});
|
||||
|
||||
it("on tick, observes offsets, and indicates tick in bounds callback", function () {
|
||||
var mockTickSource = jasmine.createSpyObj("clock", [
|
||||
const mockTickSource = jasmine.createSpyObj("clock", [
|
||||
"on",
|
||||
"off",
|
||||
"currentValue"
|
||||
]);
|
||||
mockTickSource.currentValue.and.returnValue(100);
|
||||
var tickCallback;
|
||||
var boundsCallback = jasmine.createSpy("boundsCallback");
|
||||
var clockOffsets = {
|
||||
let tickCallback;
|
||||
const boundsCallback = jasmine.createSpy("boundsCallback");
|
||||
const clockOffsets = {
|
||||
start: -100,
|
||||
end: 100
|
||||
};
|
||||
|
@ -55,7 +55,7 @@ define(function () {
|
||||
* @private
|
||||
*/
|
||||
Type.prototype.toLegacyDefinition = function () {
|
||||
var def = {};
|
||||
const def = {};
|
||||
def.name = this.definition.name;
|
||||
def.cssClass = this.definition.cssClass;
|
||||
def.description = this.definition.description;
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
define(['./TypeRegistry', './Type'], function (TypeRegistry, Type) {
|
||||
describe('The Type API', function () {
|
||||
var typeRegistryInstance;
|
||||
let typeRegistryInstance;
|
||||
|
||||
beforeEach(function () {
|
||||
typeRegistryInstance = new TypeRegistry ();
|
||||
|
@ -125,8 +125,8 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
updateValues(datum) {
|
||||
let newTimestamp = this.getParsedTimestamp(datum),
|
||||
limit;
|
||||
let newTimestamp = this.getParsedTimestamp(datum);
|
||||
let limit;
|
||||
|
||||
if (this.shouldUpdate(newTimestamp)) {
|
||||
this.timestamp = newTimestamp;
|
||||
@ -140,9 +140,9 @@ export default {
|
||||
}
|
||||
},
|
||||
shouldUpdate(newTimestamp) {
|
||||
let newTimestampInBounds = this.inBounds(newTimestamp),
|
||||
noExistingTimestamp = this.timestamp === undefined,
|
||||
newTimestampIsLatest = newTimestamp > this.timestamp;
|
||||
let newTimestampInBounds = this.inBounds(newTimestamp);
|
||||
let noExistingTimestamp = this.timestamp === undefined;
|
||||
let newTimestampIsLatest = newTimestamp > this.timestamp;
|
||||
|
||||
return newTimestampInBounds
|
||||
&& (noExistingTimestamp || newTimestampIsLatest);
|
||||
|
@ -110,9 +110,9 @@ export default {
|
||||
this.$set(this.secondaryTelemetryObjects, primary.key, []);
|
||||
this.primaryTelemetryObjects.push(primary);
|
||||
|
||||
let composition = this.openmct.composition.get(primary.domainObject),
|
||||
addCallback = this.addSecondary(primary),
|
||||
removeCallback = this.removeSecondary(primary);
|
||||
let composition = this.openmct.composition.get(primary.domainObject);
|
||||
let addCallback = this.addSecondary(primary);
|
||||
let removeCallback = this.removeSecondary(primary);
|
||||
|
||||
composition.on('add', addCallback);
|
||||
composition.on('remove', removeCallback);
|
||||
@ -125,8 +125,8 @@ export default {
|
||||
});
|
||||
},
|
||||
removePrimary(identifier) {
|
||||
let index = this.primaryTelemetryObjects.findIndex(primary => this.openmct.objects.makeKeyString(identifier) === primary.key),
|
||||
primary = this.primaryTelemetryObjects[index];
|
||||
let index = this.primaryTelemetryObjects.findIndex(primary => this.openmct.objects.makeKeyString(identifier) === primary.key);
|
||||
let primary = this.primaryTelemetryObjects[index];
|
||||
|
||||
this.$delete(this.secondaryTelemetryObjects, primary.key);
|
||||
this.primaryTelemetryObjects.splice(index, 1);
|
||||
@ -151,8 +151,8 @@ export default {
|
||||
},
|
||||
removeSecondary(primary) {
|
||||
return (identifier) => {
|
||||
let array = this.secondaryTelemetryObjects[primary.key],
|
||||
index = array.findIndex(secondary => this.openmct.objects.makeKeyString(identifier) === secondary.key);
|
||||
let array = this.secondaryTelemetryObjects[primary.key];
|
||||
let index = array.findIndex(secondary => this.openmct.objects.makeKeyString(identifier) === secondary.key);
|
||||
|
||||
array.splice(index, 1);
|
||||
|
||||
|
@ -43,24 +43,24 @@ function utcTimeFormat(value) {
|
||||
describe("The LAD Table", () => {
|
||||
const ladTableKey = 'LadTable';
|
||||
|
||||
let openmct,
|
||||
ladPlugin,
|
||||
parent,
|
||||
child,
|
||||
telemetryCount = 3,
|
||||
timeFormat = 'utc',
|
||||
mockTelemetry = getMockTelemetry({
|
||||
count: telemetryCount,
|
||||
format: timeFormat
|
||||
}),
|
||||
mockObj = getMockObjects({
|
||||
objectKeyStrings: ['ladTable', 'telemetry'],
|
||||
format: timeFormat
|
||||
}),
|
||||
bounds = {
|
||||
start: 0,
|
||||
end: 4
|
||||
};
|
||||
let openmct;
|
||||
let ladPlugin;
|
||||
let parent;
|
||||
let child;
|
||||
let telemetryCount = 3;
|
||||
let timeFormat = 'utc';
|
||||
let mockTelemetry = getMockTelemetry({
|
||||
count: telemetryCount,
|
||||
format: timeFormat
|
||||
});
|
||||
let mockObj = getMockObjects({
|
||||
objectKeyStrings: ['ladTable', 'telemetry'],
|
||||
format: timeFormat
|
||||
});
|
||||
let bounds = {
|
||||
start: 0,
|
||||
end: 4
|
||||
};
|
||||
|
||||
// add telemetry object as composition in lad table
|
||||
mockObj.ladTable.composition.push(mockObj.telemetry.identifier);
|
||||
@ -98,10 +98,11 @@ describe("The LAD Table", () => {
|
||||
});
|
||||
|
||||
it("should provide a table view only for lad table objects", () => {
|
||||
let applicableViews = openmct.objectViews.get(mockObj.ladTable),
|
||||
ladTableView = applicableViews.find(
|
||||
(viewProvider) => viewProvider.key === ladTableKey
|
||||
);
|
||||
let applicableViews = openmct.objectViews.get(mockObj.ladTable);
|
||||
|
||||
let ladTableView = applicableViews.find(
|
||||
(viewProvider) => viewProvider.key === ladTableKey
|
||||
);
|
||||
|
||||
expect(applicableViews.length).toEqual(1);
|
||||
expect(ladTableView).toBeDefined();
|
||||
@ -129,38 +130,39 @@ describe("The LAD Table", () => {
|
||||
});
|
||||
|
||||
describe("table view", () => {
|
||||
let applicableViews,
|
||||
ladTableViewProvider,
|
||||
ladTableView,
|
||||
anotherTelemetryObj = getMockObjects({
|
||||
objectKeyStrings: ['telemetry'],
|
||||
overwrite: {
|
||||
telemetry: {
|
||||
name: "New Telemetry Object",
|
||||
identifier: {
|
||||
namespace: "",
|
||||
key: "another-telemetry-object"
|
||||
}
|
||||
let applicableViews;
|
||||
let ladTableViewProvider;
|
||||
let ladTableView;
|
||||
let anotherTelemetryObj = getMockObjects({
|
||||
objectKeyStrings: ['telemetry'],
|
||||
overwrite: {
|
||||
telemetry: {
|
||||
name: "New Telemetry Object",
|
||||
identifier: {
|
||||
namespace: "",
|
||||
key: "another-telemetry-object"
|
||||
}
|
||||
}
|
||||
}).telemetry;
|
||||
}
|
||||
}).telemetry;
|
||||
|
||||
// add another telemetry object as composition in lad table to test multi rows
|
||||
mockObj.ladTable.composition.push(anotherTelemetryObj.identifier);
|
||||
|
||||
beforeEach(async () => {
|
||||
let telemetryRequestResolve,
|
||||
telemetryObjectResolve,
|
||||
anotherTelemetryObjectResolve;
|
||||
let telemetryRequestResolve;
|
||||
let telemetryObjectResolve;
|
||||
let anotherTelemetryObjectResolve;
|
||||
let telemetryRequestPromise = new Promise((resolve) => {
|
||||
telemetryRequestResolve = resolve;
|
||||
}),
|
||||
telemetryObjectPromise = new Promise((resolve) => {
|
||||
telemetryObjectResolve = resolve;
|
||||
}),
|
||||
anotherTelemetryObjectPromise = new Promise((resolve) => {
|
||||
anotherTelemetryObjectResolve = resolve;
|
||||
});
|
||||
telemetryRequestResolve = resolve;
|
||||
});
|
||||
let telemetryObjectPromise = new Promise((resolve) => {
|
||||
telemetryObjectResolve = resolve;
|
||||
});
|
||||
let anotherTelemetryObjectPromise = new Promise((resolve) => {
|
||||
anotherTelemetryObjectResolve = resolve;
|
||||
});
|
||||
|
||||
openmct.telemetry.request.and.callFake(() => {
|
||||
telemetryRequestResolve(mockTelemetry);
|
||||
|
||||
@ -208,8 +210,9 @@ describe("The LAD Table", () => {
|
||||
});
|
||||
|
||||
it("should show the name provided for the the telemetry producing object", () => {
|
||||
const rowName = parent.querySelector(TABLE_BODY_FIRST_ROW_FIRST_DATA).innerText,
|
||||
expectedName = mockObj.telemetry.name;
|
||||
const rowName = parent.querySelector(TABLE_BODY_FIRST_ROW_FIRST_DATA).innerText;
|
||||
|
||||
const expectedName = mockObj.telemetry.name;
|
||||
expect(rowName).toBe(expectedName);
|
||||
});
|
||||
|
||||
@ -235,29 +238,34 @@ describe("The LAD Table", () => {
|
||||
describe("The LAD Table Set", () => {
|
||||
const ladTableSetKey = 'LadTableSet';
|
||||
|
||||
let openmct,
|
||||
ladPlugin,
|
||||
parent,
|
||||
child,
|
||||
telemetryCount = 3,
|
||||
timeFormat = 'utc',
|
||||
mockTelemetry = getMockTelemetry({
|
||||
count: telemetryCount,
|
||||
format: timeFormat
|
||||
}),
|
||||
mockObj = getMockObjects({
|
||||
objectKeyStrings: ['ladTable', 'ladTableSet', 'telemetry']
|
||||
}),
|
||||
bounds = {
|
||||
start: 0,
|
||||
end: 4
|
||||
};
|
||||
let openmct;
|
||||
let ladPlugin;
|
||||
let parent;
|
||||
let child;
|
||||
let telemetryCount = 3;
|
||||
let timeFormat = 'utc';
|
||||
|
||||
let mockTelemetry = getMockTelemetry({
|
||||
count: telemetryCount,
|
||||
format: timeFormat
|
||||
});
|
||||
|
||||
let mockObj = getMockObjects({
|
||||
objectKeyStrings: ['ladTable', 'ladTableSet', 'telemetry']
|
||||
});
|
||||
|
||||
let bounds = {
|
||||
start: 0,
|
||||
end: 4
|
||||
};
|
||||
|
||||
// add mock telemetry to lad table and lad table to lad table set (composition)
|
||||
mockObj.ladTable.composition.push(mockObj.telemetry.identifier);
|
||||
mockObj.ladTableSet.composition.push(mockObj.ladTable.identifier);
|
||||
|
||||
beforeEach((done) => {
|
||||
const appHolder = document.createElement('div');
|
||||
|
||||
appHolder.style.width = '640px';
|
||||
appHolder.style.height = '480px';
|
||||
|
||||
@ -288,10 +296,11 @@ describe("The LAD Table Set", () => {
|
||||
});
|
||||
|
||||
it("should provide a lad table set view only for lad table set objects", () => {
|
||||
let applicableViews = openmct.objectViews.get(mockObj.ladTableSet),
|
||||
ladTableSetView = applicableViews.find(
|
||||
(viewProvider) => viewProvider.key === ladTableSetKey
|
||||
);
|
||||
let applicableViews = openmct.objectViews.get(mockObj.ladTableSet);
|
||||
|
||||
let ladTableSetView = applicableViews.find(
|
||||
(viewProvider) => viewProvider.key === ladTableSetKey
|
||||
);
|
||||
|
||||
expect(applicableViews.length).toEqual(1);
|
||||
expect(ladTableSetView).toBeDefined();
|
||||
@ -319,44 +328,50 @@ describe("The LAD Table Set", () => {
|
||||
});
|
||||
|
||||
describe("table view", () => {
|
||||
let applicableViews,
|
||||
ladTableSetViewProvider,
|
||||
ladTableSetView,
|
||||
otherObj = getMockObjects({
|
||||
objectKeyStrings: ['ladTable'],
|
||||
overwrite: {
|
||||
ladTable: {
|
||||
name: "New LAD Table Object",
|
||||
identifier: {
|
||||
namespace: "",
|
||||
key: "another-lad-object"
|
||||
}
|
||||
let applicableViews;
|
||||
let ladTableSetViewProvider;
|
||||
let ladTableSetView;
|
||||
|
||||
let otherObj = getMockObjects({
|
||||
objectKeyStrings: ['ladTable'],
|
||||
overwrite: {
|
||||
ladTable: {
|
||||
name: "New LAD Table Object",
|
||||
identifier: {
|
||||
namespace: "",
|
||||
key: "another-lad-object"
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// add another lad table (with telemetry object) object to the lad table set for multi row test
|
||||
otherObj.ladTable.composition.push(mockObj.telemetry.identifier);
|
||||
mockObj.ladTableSet.composition.push(otherObj.ladTable.identifier);
|
||||
|
||||
beforeEach(async () => {
|
||||
let telemetryRequestResolve,
|
||||
ladObjectResolve,
|
||||
anotherLadObjectResolve;
|
||||
let telemetryRequestResolve;
|
||||
let ladObjectResolve;
|
||||
let anotherLadObjectResolve;
|
||||
|
||||
let telemetryRequestPromise = new Promise((resolve) => {
|
||||
telemetryRequestResolve = resolve;
|
||||
}),
|
||||
ladObjectPromise = new Promise((resolve) => {
|
||||
ladObjectResolve = resolve;
|
||||
}),
|
||||
anotherLadObjectPromise = new Promise((resolve) => {
|
||||
anotherLadObjectResolve = resolve;
|
||||
});
|
||||
telemetryRequestResolve = resolve;
|
||||
});
|
||||
|
||||
let ladObjectPromise = new Promise((resolve) => {
|
||||
ladObjectResolve = resolve;
|
||||
});
|
||||
|
||||
let anotherLadObjectPromise = new Promise((resolve) => {
|
||||
anotherLadObjectResolve = resolve;
|
||||
});
|
||||
|
||||
openmct.telemetry.request.and.callFake(() => {
|
||||
telemetryRequestResolve(mockTelemetry);
|
||||
|
||||
return telemetryRequestPromise;
|
||||
});
|
||||
|
||||
openmct.objects.get.and.callFake((obj) => {
|
||||
if (obj.key === 'lad-object') {
|
||||
ladObjectResolve(mockObj.ladObject);
|
||||
@ -389,6 +404,7 @@ describe("The LAD Table Set", () => {
|
||||
|
||||
it("should show one row per lad table object in the composition", () => {
|
||||
const rowCount = parent.querySelectorAll(LAD_SET_TABLE_HEADERS).length;
|
||||
|
||||
expect(rowCount).toBe(mockObj.ladTableSet.composition.length);
|
||||
pending();
|
||||
});
|
||||
|
@ -29,15 +29,15 @@ define(
|
||||
// CONNECTED: Everything nominal, expect to be able to read/write.
|
||||
// DISCONNECTED: HTTP failed; maybe misconfigured, disconnected.
|
||||
// PENDING: Still trying to connect, and haven't failed yet.
|
||||
var CONNECTED = {
|
||||
statusClass: "s-status-on"
|
||||
},
|
||||
PENDING = {
|
||||
statusClass: "s-status-warning-lo"
|
||||
},
|
||||
DISCONNECTED = {
|
||||
statusClass: "s-status-warning-hi"
|
||||
};
|
||||
const CONNECTED = {
|
||||
statusClass: "s-status-on"
|
||||
};
|
||||
const PENDING = {
|
||||
statusClass: "s-status-warning-lo"
|
||||
};
|
||||
const DISCONNECTED = {
|
||||
statusClass: "s-status-warning-hi"
|
||||
};
|
||||
function URLIndicator(options, simpleIndicator) {
|
||||
this.bindMethods();
|
||||
this.count = 0;
|
||||
|
@ -23,8 +23,8 @@ define(['./URLIndicator'],
|
||||
function URLIndicatorPlugin(URLIndicator) {
|
||||
return function (opts) {
|
||||
return function install(openmct) {
|
||||
var simpleIndicator = openmct.indicators.simpleIndicator();
|
||||
var urlIndicator = new URLIndicator(opts, simpleIndicator);
|
||||
const simpleIndicator = openmct.indicators.simpleIndicator();
|
||||
const urlIndicator = new URLIndicator(opts, simpleIndicator);
|
||||
|
||||
openmct.indicators.add(simpleIndicator);
|
||||
|
||||
|
@ -33,14 +33,14 @@ define(
|
||||
MCT,
|
||||
$
|
||||
) {
|
||||
var defaultAjaxFunction = $.ajax;
|
||||
const defaultAjaxFunction = $.ajax;
|
||||
|
||||
describe("The URLIndicator", function () {
|
||||
var openmct;
|
||||
var indicatorElement;
|
||||
var pluginOptions;
|
||||
var ajaxOptions;
|
||||
var urlIndicator; // eslint-disable-line
|
||||
let openmct;
|
||||
let indicatorElement;
|
||||
let pluginOptions;
|
||||
let ajaxOptions;
|
||||
let urlIndicator; // eslint-disable-line
|
||||
|
||||
beforeEach(function () {
|
||||
jasmine.clock().install();
|
||||
|
@ -58,8 +58,8 @@ define([
|
||||
* @private
|
||||
*/
|
||||
AutoflowTabularController.prototype.addRow = function (childObject) {
|
||||
var identifier = childObject.identifier;
|
||||
var id = [identifier.namespace, identifier.key].join(":");
|
||||
const identifier = childObject.identifier;
|
||||
const id = [identifier.namespace, identifier.key].join(":");
|
||||
|
||||
if (!this.rows[id]) {
|
||||
this.rows[id] = {
|
||||
@ -84,7 +84,7 @@ define([
|
||||
* @private
|
||||
*/
|
||||
AutoflowTabularController.prototype.removeRow = function (identifier) {
|
||||
var id = [identifier.namespace, identifier.key].join(":");
|
||||
const id = [identifier.namespace, identifier.key].join(":");
|
||||
|
||||
if (this.rows[id]) {
|
||||
this.data.items = this.data.items.filter(function (item) {
|
||||
|
@ -27,7 +27,7 @@ define([
|
||||
) {
|
||||
return function (options) {
|
||||
return function (openmct) {
|
||||
var views = (openmct.mainViews || openmct.objectViews);
|
||||
const views = (openmct.mainViews || openmct.objectViews);
|
||||
|
||||
views.addProvider({
|
||||
name: "Autoflow Tabular",
|
||||
|
@ -28,9 +28,9 @@ define([
|
||||
'./dom-observer'
|
||||
], function (AutoflowTabularPlugin, AutoflowTabularConstants, MCT, $, DOMObserver) {
|
||||
describe("AutoflowTabularPlugin", function () {
|
||||
var testType;
|
||||
var testObject;
|
||||
var mockmct;
|
||||
let testType;
|
||||
let testObject;
|
||||
let mockmct;
|
||||
|
||||
beforeEach(function () {
|
||||
testType = "some-type";
|
||||
@ -44,7 +44,7 @@ define([
|
||||
spyOn(mockmct.telemetry, 'request');
|
||||
spyOn(mockmct.telemetry, 'subscribe');
|
||||
|
||||
var plugin = new AutoflowTabularPlugin({ type: testType });
|
||||
const plugin = new AutoflowTabularPlugin({ type: testType });
|
||||
plugin(mockmct);
|
||||
});
|
||||
|
||||
@ -53,7 +53,7 @@ define([
|
||||
});
|
||||
|
||||
describe("installs a view provider which", function () {
|
||||
var provider;
|
||||
let provider;
|
||||
|
||||
beforeEach(function () {
|
||||
provider =
|
||||
@ -69,17 +69,17 @@ define([
|
||||
});
|
||||
|
||||
describe("provides a view which", function () {
|
||||
var testKeys;
|
||||
var testChildren;
|
||||
var testContainer;
|
||||
var testHistories;
|
||||
var mockComposition;
|
||||
var mockMetadata;
|
||||
var mockEvaluator;
|
||||
var mockUnsubscribes;
|
||||
var callbacks;
|
||||
var view;
|
||||
var domObserver;
|
||||
let testKeys;
|
||||
let testChildren;
|
||||
let testContainer;
|
||||
let testHistories;
|
||||
let mockComposition;
|
||||
let mockMetadata;
|
||||
let mockEvaluator;
|
||||
let mockUnsubscribes;
|
||||
let callbacks;
|
||||
let view;
|
||||
let domObserver;
|
||||
|
||||
function waitsForChange() {
|
||||
return new Promise(function (resolve) {
|
||||
@ -143,7 +143,7 @@ define([
|
||||
|
||||
mockmct.telemetry.getMetadata.and.returnValue(mockMetadata);
|
||||
mockmct.telemetry.getValueFormatter.and.callFake(function (metadatum) {
|
||||
var mockFormatter = jasmine.createSpyObj('formatter', ['format']);
|
||||
const mockFormatter = jasmine.createSpyObj('formatter', ['format']);
|
||||
mockFormatter.format.and.callFake(function (datum) {
|
||||
return datum[metadatum.hint];
|
||||
});
|
||||
@ -152,13 +152,13 @@ define([
|
||||
});
|
||||
mockmct.telemetry.limitEvaluator.and.returnValue(mockEvaluator);
|
||||
mockmct.telemetry.subscribe.and.callFake(function (obj, callback) {
|
||||
var key = obj.identifier.key;
|
||||
const key = obj.identifier.key;
|
||||
callbacks[key] = callback;
|
||||
|
||||
return mockUnsubscribes[key];
|
||||
});
|
||||
mockmct.telemetry.request.and.callFake(function (obj, request) {
|
||||
var key = obj.identifier.key;
|
||||
const key = obj.identifier.key;
|
||||
|
||||
return Promise.resolve([testHistories[key]]);
|
||||
});
|
||||
@ -182,7 +182,7 @@ define([
|
||||
|
||||
describe("when rows have been populated", function () {
|
||||
function rowsMatch() {
|
||||
var rows = $(testContainer).find(".l-autoflow-row").length;
|
||||
const rows = $(testContainer).find(".l-autoflow-row").length;
|
||||
|
||||
return rows === testChildren.length;
|
||||
}
|
||||
@ -192,7 +192,7 @@ define([
|
||||
});
|
||||
|
||||
it("adds rows on composition change", function () {
|
||||
var child = {
|
||||
const child = {
|
||||
identifier: {
|
||||
namespace: "test",
|
||||
key: "123"
|
||||
@ -206,7 +206,7 @@ define([
|
||||
});
|
||||
|
||||
it("removes rows on composition change", function () {
|
||||
var child = testChildren.pop();
|
||||
const child = testChildren.pop();
|
||||
emitEvent(mockComposition, 'remove', child.identifier);
|
||||
|
||||
return domObserver.when(rowsMatch);
|
||||
@ -224,8 +224,8 @@ define([
|
||||
});
|
||||
|
||||
it("provides a button to change column width", function () {
|
||||
var initialWidth = AutoflowTabularConstants.INITIAL_COLUMN_WIDTH;
|
||||
var nextWidth =
|
||||
const initialWidth = AutoflowTabularConstants.INITIAL_COLUMN_WIDTH;
|
||||
const nextWidth =
|
||||
initialWidth + AutoflowTabularConstants.COLUMN_WIDTH_STEP;
|
||||
|
||||
expect($(testContainer).find('.l-autoflow-col').css('width'))
|
||||
@ -234,7 +234,7 @@ define([
|
||||
$(testContainer).find('.change-column-width').click();
|
||||
|
||||
function widthHasChanged() {
|
||||
var width = $(testContainer).find('.l-autoflow-col').css('width');
|
||||
const width = $(testContainer).find('.l-autoflow-col').css('width');
|
||||
|
||||
return width !== initialWidth + 'px';
|
||||
}
|
||||
@ -259,15 +259,15 @@ define([
|
||||
|
||||
return domObserver.when(rowTextDefined).then(function () {
|
||||
testKeys.forEach(function (key, index) {
|
||||
var datum = testHistories[key];
|
||||
var $cell = $(testContainer).find(".l-autoflow-row").eq(index).find(".r");
|
||||
const datum = testHistories[key];
|
||||
const $cell = $(testContainer).find(".l-autoflow-row").eq(index).find(".r");
|
||||
expect($cell.text()).toEqual(String(datum.range));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("displays incoming telemetry", function () {
|
||||
var testData = testKeys.map(function (key, index) {
|
||||
const testData = testKeys.map(function (key, index) {
|
||||
return {
|
||||
key: key,
|
||||
range: index * 100,
|
||||
@ -281,14 +281,14 @@ define([
|
||||
|
||||
return waitsForChange().then(function () {
|
||||
testData.forEach(function (datum, index) {
|
||||
var $cell = $(testContainer).find(".l-autoflow-row").eq(index).find(".r");
|
||||
const $cell = $(testContainer).find(".l-autoflow-row").eq(index).find(".r");
|
||||
expect($cell.text()).toEqual(String(datum.range));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("updates classes for limit violations", function () {
|
||||
var testClass = "some-limit-violation";
|
||||
const testClass = "some-limit-violation";
|
||||
mockEvaluator.evaluate.and.returnValue({ cssClass: testClass });
|
||||
testKeys.forEach(function (key) {
|
||||
callbacks[key]({
|
||||
@ -299,24 +299,24 @@ define([
|
||||
|
||||
return waitsForChange().then(function () {
|
||||
testKeys.forEach(function (datum, index) {
|
||||
var $cell = $(testContainer).find(".l-autoflow-row").eq(index).find(".r");
|
||||
const $cell = $(testContainer).find(".l-autoflow-row").eq(index).find(".r");
|
||||
expect($cell.hasClass(testClass)).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("automatically flows to new columns", function () {
|
||||
var rowHeight = AutoflowTabularConstants.ROW_HEIGHT;
|
||||
var sliderHeight = AutoflowTabularConstants.SLIDER_HEIGHT;
|
||||
var count = testKeys.length;
|
||||
var $container = $(testContainer);
|
||||
var promiseChain = Promise.resolve();
|
||||
const rowHeight = AutoflowTabularConstants.ROW_HEIGHT;
|
||||
const sliderHeight = AutoflowTabularConstants.SLIDER_HEIGHT;
|
||||
const count = testKeys.length;
|
||||
const $container = $(testContainer);
|
||||
let promiseChain = Promise.resolve();
|
||||
|
||||
function columnsHaveAutoflowed() {
|
||||
var itemsHeight = $container.find('.l-autoflow-items').height();
|
||||
var availableHeight = itemsHeight - sliderHeight;
|
||||
var availableRows = Math.max(Math.floor(availableHeight / rowHeight), 1);
|
||||
var columns = Math.ceil(count / availableRows);
|
||||
const itemsHeight = $container.find('.l-autoflow-items').height();
|
||||
const availableHeight = itemsHeight - sliderHeight;
|
||||
const availableRows = Math.max(Math.floor(availableHeight / rowHeight), 1);
|
||||
const columns = Math.ceil(count / availableRows);
|
||||
|
||||
return $container.find('.l-autoflow-col').length === columns;
|
||||
}
|
||||
@ -338,7 +338,7 @@ define([
|
||||
return domObserver.when(columnsHaveAutoflowed);
|
||||
}
|
||||
|
||||
for (var height = 0; height < rowHeight * count * 2; height += rowHeight / 2) {
|
||||
for (let height = 0; height < rowHeight * count * 2; height += rowHeight / 2) {
|
||||
// eslint-disable-next-line no-invalid-this
|
||||
promiseChain = promiseChain.then(setHeight.bind(this, height));
|
||||
}
|
||||
@ -349,7 +349,7 @@ define([
|
||||
});
|
||||
|
||||
it("loads composition exactly once", function () {
|
||||
var testObj = testChildren.pop();
|
||||
const testObj = testChildren.pop();
|
||||
emitEvent(mockComposition, 'remove', testObj.identifier);
|
||||
testChildren.push(testObj);
|
||||
emitEvent(mockComposition, 'add', testObj);
|
||||
|
@ -54,7 +54,7 @@ define([], function () {
|
||||
* @private
|
||||
*/
|
||||
AutoflowTabularRowController.prototype.updateRowData = function (datum) {
|
||||
var violations = this.evaluator.evaluate(datum, this.ranges[0]);
|
||||
const violations = this.evaluator.evaluate(datum, this.ranges[0]);
|
||||
|
||||
this.initialized = true;
|
||||
this.data.classes = violations ? violations.cssClass : "";
|
||||
|
@ -31,17 +31,17 @@ define([
|
||||
VueView,
|
||||
autoflowTemplate
|
||||
) {
|
||||
var ROW_HEIGHT = AutoflowTabularConstants.ROW_HEIGHT;
|
||||
var SLIDER_HEIGHT = AutoflowTabularConstants.SLIDER_HEIGHT;
|
||||
var INITIAL_COLUMN_WIDTH = AutoflowTabularConstants.INITIAL_COLUMN_WIDTH;
|
||||
var MAX_COLUMN_WIDTH = AutoflowTabularConstants.MAX_COLUMN_WIDTH;
|
||||
var COLUMN_WIDTH_STEP = AutoflowTabularConstants.COLUMN_WIDTH_STEP;
|
||||
const ROW_HEIGHT = AutoflowTabularConstants.ROW_HEIGHT;
|
||||
const SLIDER_HEIGHT = AutoflowTabularConstants.SLIDER_HEIGHT;
|
||||
const INITIAL_COLUMN_WIDTH = AutoflowTabularConstants.INITIAL_COLUMN_WIDTH;
|
||||
const MAX_COLUMN_WIDTH = AutoflowTabularConstants.MAX_COLUMN_WIDTH;
|
||||
const COLUMN_WIDTH_STEP = AutoflowTabularConstants.COLUMN_WIDTH_STEP;
|
||||
|
||||
/**
|
||||
* Implements the Autoflow Tabular view of a domain object.
|
||||
*/
|
||||
function AutoflowTabularView(domainObject, openmct) {
|
||||
var data = {
|
||||
const data = {
|
||||
items: [],
|
||||
columns: [],
|
||||
width: INITIAL_COLUMN_WIDTH,
|
||||
@ -49,9 +49,9 @@ define([
|
||||
updated: "No updates",
|
||||
rowCount: 1
|
||||
};
|
||||
var controller =
|
||||
const controller =
|
||||
new AutoflowTabularController(domainObject, data, openmct);
|
||||
var interval;
|
||||
let interval;
|
||||
|
||||
VueView.call(this, {
|
||||
data: data,
|
||||
@ -62,9 +62,9 @@ define([
|
||||
? INITIAL_COLUMN_WIDTH : data.width;
|
||||
},
|
||||
reflow: function () {
|
||||
var column = [];
|
||||
var index = 0;
|
||||
var filteredItems =
|
||||
let column = [];
|
||||
let index = 0;
|
||||
const filteredItems =
|
||||
data.items.filter(function (item) {
|
||||
return item.name.toLowerCase()
|
||||
.indexOf(data.filter.toLowerCase()) !== -1;
|
||||
@ -104,11 +104,11 @@ define([
|
||||
mounted: function () {
|
||||
controller.activate();
|
||||
|
||||
var updateRowHeight = function () {
|
||||
var tabularArea = this.$refs.autoflowItems;
|
||||
var height = tabularArea ? tabularArea.clientHeight : 0;
|
||||
var available = height - SLIDER_HEIGHT;
|
||||
var rows = Math.max(1, Math.floor(available / ROW_HEIGHT));
|
||||
const updateRowHeight = function () {
|
||||
const tabularArea = this.$refs.autoflowItems;
|
||||
const height = tabularArea ? tabularArea.clientHeight : 0;
|
||||
const available = height - SLIDER_HEIGHT;
|
||||
const rows = Math.max(1, Math.floor(available / ROW_HEIGHT));
|
||||
data.rowCount = rows;
|
||||
}.bind(this);
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
define(['vue'], function (Vue) {
|
||||
function VueView(options) {
|
||||
var vm = new Vue(options);
|
||||
const vm = new Vue(options);
|
||||
this.show = function (container) {
|
||||
container.appendChild(vm.$mount().$el);
|
||||
};
|
||||
|
@ -33,12 +33,12 @@ define([], function () {
|
||||
resolve();
|
||||
} else {
|
||||
//Latch condition not true yet, create observer on DOM and test again on change.
|
||||
var config = {
|
||||
const config = {
|
||||
attributes: true,
|
||||
childList: true,
|
||||
subtree: true
|
||||
};
|
||||
var observer = new MutationObserver(function () {
|
||||
const observer = new MutationObserver(function () {
|
||||
if (latchFunction()) {
|
||||
resolve();
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ define([
|
||||
) {
|
||||
return function (buildInfo) {
|
||||
return function (openmct) {
|
||||
var aliases = { timestamp: "Built" };
|
||||
var descriptions = {
|
||||
const aliases = { timestamp: "Built" };
|
||||
const descriptions = {
|
||||
timestamp: "The date on which this version of Open MCT was built.",
|
||||
revision: "A unique revision identifier for the client sources.",
|
||||
branch: "The name of the branch that was used during the build."
|
||||
|
@ -24,8 +24,8 @@ define([
|
||||
'./plugin'
|
||||
], function (plugin) {
|
||||
describe("The buildInfo plugin", function () {
|
||||
var mockmct;
|
||||
var testInfo;
|
||||
let mockmct;
|
||||
let testInfo;
|
||||
|
||||
beforeEach(function () {
|
||||
mockmct = jasmine.createSpyObj('openmct', ['legacyExtension']);
|
||||
|
@ -37,17 +37,18 @@ define([
|
||||
return function install(openmct) {
|
||||
if (installIndicator) {
|
||||
let component = new Vue ({
|
||||
provide: {
|
||||
openmct
|
||||
},
|
||||
components: {
|
||||
GlobalClearIndicator: GlobaClearIndicator.default
|
||||
},
|
||||
template: '<GlobalClearIndicator></GlobalClearIndicator>'
|
||||
}),
|
||||
indicator = {
|
||||
element: component.$mount().$el
|
||||
};
|
||||
provide: {
|
||||
openmct
|
||||
},
|
||||
components: {
|
||||
GlobalClearIndicator: GlobaClearIndicator.default
|
||||
},
|
||||
template: '<GlobalClearIndicator></GlobalClearIndicator>'
|
||||
});
|
||||
|
||||
let indicator = {
|
||||
element: component.$mount().$el
|
||||
};
|
||||
|
||||
openmct.indicators.add(indicator);
|
||||
}
|
||||
|
@ -24,21 +24,23 @@ import ClearDataActionPlugin from '../plugin.js';
|
||||
import ClearDataAction from '../clearDataAction.js';
|
||||
|
||||
describe('When the Clear Data Plugin is installed,', function () {
|
||||
var mockObjectViews = jasmine.createSpyObj('objectViews', ['emit']),
|
||||
mockIndicatorProvider = jasmine.createSpyObj('indicators', ['add']),
|
||||
mockContextMenuProvider = jasmine.createSpyObj('contextMenu', ['registerAction']),
|
||||
openmct = {
|
||||
objectViews: mockObjectViews,
|
||||
indicators: mockIndicatorProvider,
|
||||
contextMenu: mockContextMenuProvider,
|
||||
install: function (plugin) {
|
||||
plugin(this);
|
||||
}
|
||||
},
|
||||
mockObjectPath = [
|
||||
{name: 'mockObject1'},
|
||||
{name: 'mockObject2'}
|
||||
];
|
||||
const mockObjectViews = jasmine.createSpyObj('objectViews', ['emit']);
|
||||
const mockIndicatorProvider = jasmine.createSpyObj('indicators', ['add']);
|
||||
const mockContextMenuProvider = jasmine.createSpyObj('contextMenu', ['registerAction']);
|
||||
|
||||
const openmct = {
|
||||
objectViews: mockObjectViews,
|
||||
indicators: mockIndicatorProvider,
|
||||
contextMenu: mockContextMenuProvider,
|
||||
install: function (plugin) {
|
||||
plugin(this);
|
||||
}
|
||||
};
|
||||
|
||||
const mockObjectPath = [
|
||||
{name: 'mockObject1'},
|
||||
{name: 'mockObject2'}
|
||||
];
|
||||
|
||||
it('Global Clear Indicator is installed', function () {
|
||||
openmct.install(ClearDataActionPlugin([]));
|
||||
|
@ -24,13 +24,13 @@ import Condition from "./Condition";
|
||||
import {TRIGGER} from "./utils/constants";
|
||||
import TelemetryCriterion from "./criterion/TelemetryCriterion";
|
||||
|
||||
let openmct = {},
|
||||
testConditionDefinition,
|
||||
testTelemetryObject,
|
||||
conditionObj,
|
||||
conditionManager,
|
||||
mockTelemetryReceived,
|
||||
mockTimeSystems;
|
||||
let openmct = {};
|
||||
let testConditionDefinition;
|
||||
let testTelemetryObject;
|
||||
let conditionObj;
|
||||
let conditionManager;
|
||||
let mockTelemetryReceived;
|
||||
let mockTimeSystems;
|
||||
|
||||
describe("The condition", function () {
|
||||
|
||||
|
@ -194,7 +194,7 @@ export default {
|
||||
}
|
||||
|
||||
if (new_index >= arr.length) {
|
||||
var k = new_index - arr.length;
|
||||
let k = new_index - arr.length;
|
||||
while ((k--) + 1) {
|
||||
arr.push(undefined);
|
||||
}
|
||||
|
@ -127,10 +127,10 @@ export default {
|
||||
this.searchService.query(this.searchValue).then(children => {
|
||||
this.filteredTreeItems = children.hits.map(child => {
|
||||
|
||||
let context = child.object.getCapability('context'),
|
||||
object = child.object.useCapability('adapter'),
|
||||
objectPath = [],
|
||||
navigateToParent;
|
||||
let context = child.object.getCapability('context');
|
||||
let object = child.object.useCapability('adapter');
|
||||
let objectPath = [];
|
||||
let navigateToParent;
|
||||
|
||||
if (context) {
|
||||
objectPath = context.getPath().slice(1)
|
||||
|
@ -23,12 +23,12 @@
|
||||
import TelemetryCriterion from "./TelemetryCriterion";
|
||||
import { getMockTelemetry } from "utils/testing";
|
||||
|
||||
let openmct = {},
|
||||
mockListener,
|
||||
testCriterionDefinition,
|
||||
testTelemetryObject,
|
||||
telemetryCriterion,
|
||||
mockTelemetry = getMockTelemetry();
|
||||
let openmct = {};
|
||||
let mockListener;
|
||||
let testCriterionDefinition;
|
||||
let testTelemetryObject;
|
||||
let telemetryCriterion;
|
||||
let mockTelemetry = getMockTelemetry();
|
||||
|
||||
describe("The telemetry criterion", function () {
|
||||
|
||||
|
@ -41,90 +41,92 @@ define(['lodash'], function (_) {
|
||||
},
|
||||
toolbar: function (selectedObjects) {
|
||||
const DIALOG_FORM = {
|
||||
'text': {
|
||||
name: "Text Element Properties",
|
||||
sections: [
|
||||
{
|
||||
rows: [
|
||||
{
|
||||
key: "text",
|
||||
control: "textfield",
|
||||
name: "Text",
|
||||
required: true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
'image': {
|
||||
name: "Image Properties",
|
||||
sections: [
|
||||
{
|
||||
rows: [
|
||||
{
|
||||
key: "url",
|
||||
control: "textfield",
|
||||
name: "Image URL",
|
||||
"cssClass": "l-input-lg",
|
||||
required: true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
VIEW_TYPES = {
|
||||
'telemetry-view': {
|
||||
value: 'telemetry-view',
|
||||
name: 'Alphanumeric',
|
||||
class: 'icon-alphanumeric'
|
||||
},
|
||||
'telemetry.plot.overlay': {
|
||||
value: 'telemetry.plot.overlay',
|
||||
name: 'Overlay Plot',
|
||||
class: "icon-plot-overlay"
|
||||
},
|
||||
'telemetry.plot.stacked': {
|
||||
value: "telemetry.plot.stacked",
|
||||
name: "Stacked Plot",
|
||||
class: "icon-plot-stacked"
|
||||
},
|
||||
'table': {
|
||||
value: 'table',
|
||||
name: 'Table',
|
||||
class: 'icon-tabular-realtime'
|
||||
}
|
||||
},
|
||||
APPLICABLE_VIEWS = {
|
||||
'telemetry-view': [
|
||||
VIEW_TYPES['telemetry.plot.overlay'],
|
||||
VIEW_TYPES['telemetry.plot.stacked'],
|
||||
VIEW_TYPES.table
|
||||
],
|
||||
'telemetry.plot.overlay': [
|
||||
VIEW_TYPES['telemetry.plot.stacked'],
|
||||
VIEW_TYPES.table,
|
||||
VIEW_TYPES['telemetry-view']
|
||||
],
|
||||
'telemetry.plot.stacked': [
|
||||
VIEW_TYPES['telemetry.plot.overlay'],
|
||||
VIEW_TYPES.table,
|
||||
VIEW_TYPES['telemetry-view']
|
||||
],
|
||||
'table': [
|
||||
VIEW_TYPES['telemetry.plot.overlay'],
|
||||
VIEW_TYPES['telemetry.plot.stacked'],
|
||||
VIEW_TYPES['telemetry-view']
|
||||
],
|
||||
'telemetry-view-multi': [
|
||||
VIEW_TYPES['telemetry.plot.overlay'],
|
||||
VIEW_TYPES['telemetry.plot.stacked'],
|
||||
VIEW_TYPES.table
|
||||
],
|
||||
'telemetry.plot.overlay-multi': [
|
||||
VIEW_TYPES['telemetry.plot.stacked']
|
||||
'text': {
|
||||
name: "Text Element Properties",
|
||||
sections: [
|
||||
{
|
||||
rows: [
|
||||
{
|
||||
key: "text",
|
||||
control: "textfield",
|
||||
name: "Text",
|
||||
required: true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
'image': {
|
||||
name: "Image Properties",
|
||||
sections: [
|
||||
{
|
||||
rows: [
|
||||
{
|
||||
key: "url",
|
||||
control: "textfield",
|
||||
name: "Image URL",
|
||||
"cssClass": "l-input-lg",
|
||||
required: true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
const VIEW_TYPES = {
|
||||
'telemetry-view': {
|
||||
value: 'telemetry-view',
|
||||
name: 'Alphanumeric',
|
||||
class: 'icon-alphanumeric'
|
||||
},
|
||||
'telemetry.plot.overlay': {
|
||||
value: 'telemetry.plot.overlay',
|
||||
name: 'Overlay Plot',
|
||||
class: "icon-plot-overlay"
|
||||
},
|
||||
'telemetry.plot.stacked': {
|
||||
value: "telemetry.plot.stacked",
|
||||
name: "Stacked Plot",
|
||||
class: "icon-plot-stacked"
|
||||
},
|
||||
'table': {
|
||||
value: 'table',
|
||||
name: 'Table',
|
||||
class: 'icon-tabular-realtime'
|
||||
}
|
||||
};
|
||||
|
||||
const APPLICABLE_VIEWS = {
|
||||
'telemetry-view': [
|
||||
VIEW_TYPES['telemetry.plot.overlay'],
|
||||
VIEW_TYPES['telemetry.plot.stacked'],
|
||||
VIEW_TYPES.table
|
||||
],
|
||||
'telemetry.plot.overlay': [
|
||||
VIEW_TYPES['telemetry.plot.stacked'],
|
||||
VIEW_TYPES.table,
|
||||
VIEW_TYPES['telemetry-view']
|
||||
],
|
||||
'telemetry.plot.stacked': [
|
||||
VIEW_TYPES['telemetry.plot.overlay'],
|
||||
VIEW_TYPES.table,
|
||||
VIEW_TYPES['telemetry-view']
|
||||
],
|
||||
'table': [
|
||||
VIEW_TYPES['telemetry.plot.overlay'],
|
||||
VIEW_TYPES['telemetry.plot.stacked'],
|
||||
VIEW_TYPES['telemetry-view']
|
||||
],
|
||||
'telemetry-view-multi': [
|
||||
VIEW_TYPES['telemetry.plot.overlay'],
|
||||
VIEW_TYPES['telemetry.plot.stacked'],
|
||||
VIEW_TYPES.table
|
||||
],
|
||||
'telemetry.plot.overlay-multi': [
|
||||
VIEW_TYPES['telemetry.plot.stacked']
|
||||
]
|
||||
};
|
||||
|
||||
function getUserInput(form) {
|
||||
return openmct.$injector.get('dialogService').getUserInput(form, {});
|
||||
@ -494,8 +496,8 @@ define(['lodash'], function (_) {
|
||||
}
|
||||
|
||||
function getPropertyFromPath(object, path) {
|
||||
let splitPath = path.split('.'),
|
||||
property = Object.assign({}, object);
|
||||
let splitPath = path.split('.');
|
||||
let property = Object.assign({}, object);
|
||||
|
||||
while (splitPath.length && property) {
|
||||
property = property[splitPath.shift()];
|
||||
@ -568,9 +570,9 @@ define(['lodash'], function (_) {
|
||||
|
||||
function getViewSwitcherMenu(selectedParent, selectionPath, selection) {
|
||||
if (selection.length === 1) {
|
||||
let displayLayoutContext = selectionPath[1].context,
|
||||
selectedItemContext = selectionPath[0].context,
|
||||
selectedItemType = selectedItemContext.item.type;
|
||||
let displayLayoutContext = selectionPath[1].context;
|
||||
let selectedItemContext = selectionPath[0].context;
|
||||
let selectedItemType = selectedItemContext.item.type;
|
||||
|
||||
if (selectedItemContext.layoutItem.type === 'telemetry-view') {
|
||||
selectedItemType = 'telemetry-view';
|
||||
|
@ -95,7 +95,7 @@ define(
|
||||
* original position, in pixels
|
||||
*/
|
||||
LayoutDrag.prototype.getAdjustedPositionAndDimensions = function (pixelDelta) {
|
||||
var gridDelta = toGridDelta(this.gridSize, pixelDelta);
|
||||
const gridDelta = toGridDelta(this.gridSize, pixelDelta);
|
||||
|
||||
return {
|
||||
position: max(add(
|
||||
@ -110,7 +110,7 @@ define(
|
||||
};
|
||||
|
||||
LayoutDrag.prototype.getAdjustedPosition = function (pixelDelta) {
|
||||
var gridDelta = toGridDelta(this.gridSize, pixelDelta);
|
||||
const gridDelta = toGridDelta(this.gridSize, pixelDelta);
|
||||
|
||||
return {
|
||||
position: max(add(
|
||||
|
@ -429,9 +429,9 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
let keyString = this.openmct.objects.makeKeyString(item.identifier),
|
||||
telemetryViewCount = this.telemetryViewMap[keyString],
|
||||
objectViewCount = this.objectViewMap[keyString];
|
||||
let keyString = this.openmct.objects.makeKeyString(item.identifier);
|
||||
let telemetryViewCount = this.telemetryViewMap[keyString];
|
||||
let objectViewCount = this.objectViewMap[keyString];
|
||||
|
||||
if (item.type === 'telemetry-view') {
|
||||
telemetryViewCount = --this.telemetryViewMap[keyString];
|
||||
@ -464,8 +464,8 @@ export default {
|
||||
this.layoutItems.forEach(this.trackItem);
|
||||
},
|
||||
isItemAlreadyTracked(child) {
|
||||
let found = false,
|
||||
keyString = this.openmct.objects.makeKeyString(child.identifier);
|
||||
let found = false;
|
||||
let keyString = this.openmct.objects.makeKeyString(child.identifier);
|
||||
|
||||
this.layoutItems.forEach(item => {
|
||||
if (item.identifier) {
|
||||
@ -603,13 +603,13 @@ export default {
|
||||
},
|
||||
createNewDomainObject(domainObject, composition, viewType, nameExtension, model) {
|
||||
let identifier = {
|
||||
key: uuid(),
|
||||
namespace: this.internalDomainObject.identifier.namespace
|
||||
},
|
||||
type = this.openmct.types.get(viewType),
|
||||
parentKeyString = this.openmct.objects.makeKeyString(this.internalDomainObject.identifier),
|
||||
objectName = nameExtension ? `${domainObject.name}-${nameExtension}` : domainObject.name,
|
||||
object = {};
|
||||
key: uuid(),
|
||||
namespace: this.internalDomainObject.identifier.namespace
|
||||
};
|
||||
let type = this.openmct.types.get(viewType);
|
||||
let parentKeyString = this.openmct.objects.makeKeyString(this.internalDomainObject.identifier);
|
||||
let objectName = nameExtension ? `${domainObject.name}-${nameExtension}` : domainObject.name;
|
||||
let object = {};
|
||||
|
||||
if (model) {
|
||||
object = _.cloneDeep(model);
|
||||
@ -649,8 +649,8 @@ export default {
|
||||
});
|
||||
|
||||
selectItemsArray.forEach((id) => {
|
||||
let refId = `layout-item-${id}`,
|
||||
component = this.$refs[refId] && this.$refs[refId][0];
|
||||
let refId = `layout-item-${id}`;
|
||||
let component = this.$refs[refId] && this.$refs[refId][0];
|
||||
|
||||
if (component) {
|
||||
component.immediatelySelect = event;
|
||||
@ -659,15 +659,15 @@ export default {
|
||||
});
|
||||
},
|
||||
duplicateItem(selectedItems) {
|
||||
let objectStyles = this.internalDomainObject.configuration.objectStyles || {},
|
||||
selectItemsArray = [],
|
||||
newDomainObjectsArray = [];
|
||||
let objectStyles = this.internalDomainObject.configuration.objectStyles || {};
|
||||
let selectItemsArray = [];
|
||||
let newDomainObjectsArray = [];
|
||||
|
||||
selectedItems.forEach(selectedItem => {
|
||||
let layoutItem = selectedItem[0].context.layoutItem,
|
||||
domainObject = selectedItem[0].context.item,
|
||||
layoutItemStyle = objectStyles[layoutItem.id],
|
||||
copy = _.cloneDeep(layoutItem);
|
||||
let layoutItem = selectedItem[0].context.layoutItem;
|
||||
let domainObject = selectedItem[0].context.item;
|
||||
let layoutItemStyle = objectStyles[layoutItem.id];
|
||||
let copy = _.cloneDeep(layoutItem);
|
||||
|
||||
copy.id = uuid();
|
||||
selectItemsArray.push(copy.id);
|
||||
@ -710,16 +710,16 @@ export default {
|
||||
},
|
||||
mergeMultipleTelemetryViews(selection, viewType) {
|
||||
let identifiers = selection.map(selectedItem => {
|
||||
return selectedItem[0].context.layoutItem.identifier;
|
||||
}),
|
||||
firstDomainObject = selection[0][0].context.item,
|
||||
firstLayoutItem = selection[0][0].context.layoutItem,
|
||||
position = [firstLayoutItem.x, firstLayoutItem.y],
|
||||
mockDomainObject = {
|
||||
name: 'Merged Telemetry Views',
|
||||
identifier: firstDomainObject.identifier
|
||||
},
|
||||
newDomainObject = this.createNewDomainObject(mockDomainObject, identifiers, viewType);
|
||||
return selectedItem[0].context.layoutItem.identifier;
|
||||
});
|
||||
let firstDomainObject = selection[0][0].context.item;
|
||||
let firstLayoutItem = selection[0][0].context.layoutItem;
|
||||
let position = [firstLayoutItem.x, firstLayoutItem.y];
|
||||
let mockDomainObject = {
|
||||
name: 'Merged Telemetry Views',
|
||||
identifier: firstDomainObject.identifier
|
||||
};
|
||||
let newDomainObject = this.createNewDomainObject(mockDomainObject, identifiers, viewType);
|
||||
|
||||
this.composition.add(newDomainObject);
|
||||
this.addItem('subobject-view', newDomainObject, position);
|
||||
@ -727,18 +727,18 @@ export default {
|
||||
this.initSelectIndex = this.layoutItems.length - 1;
|
||||
},
|
||||
mergeMultipleOverlayPlots(selection, viewType) {
|
||||
let overlayPlots = selection.map(selectedItem => selectedItem[0].context.item),
|
||||
overlayPlotIdentifiers = overlayPlots.map(overlayPlot => overlayPlot.identifier),
|
||||
firstOverlayPlot = overlayPlots[0],
|
||||
firstLayoutItem = selection[0][0].context.layoutItem,
|
||||
position = [firstLayoutItem.x, firstLayoutItem.y],
|
||||
mockDomainObject = {
|
||||
name: 'Merged Overlay Plots',
|
||||
identifier: firstOverlayPlot.identifier
|
||||
},
|
||||
newDomainObject = this.createNewDomainObject(mockDomainObject, overlayPlotIdentifiers, viewType),
|
||||
newDomainObjectKeyString = this.openmct.objects.makeKeyString(newDomainObject.identifier),
|
||||
internalDomainObjectKeyString = this.openmct.objects.makeKeyString(this.internalDomainObject.identifier);
|
||||
let overlayPlots = selection.map(selectedItem => selectedItem[0].context.item);
|
||||
let overlayPlotIdentifiers = overlayPlots.map(overlayPlot => overlayPlot.identifier);
|
||||
let firstOverlayPlot = overlayPlots[0];
|
||||
let firstLayoutItem = selection[0][0].context.layoutItem;
|
||||
let position = [firstLayoutItem.x, firstLayoutItem.y];
|
||||
let mockDomainObject = {
|
||||
name: 'Merged Overlay Plots',
|
||||
identifier: firstOverlayPlot.identifier
|
||||
};
|
||||
let newDomainObject = this.createNewDomainObject(mockDomainObject, overlayPlotIdentifiers, viewType);
|
||||
let newDomainObjectKeyString = this.openmct.objects.makeKeyString(newDomainObject.identifier);
|
||||
let internalDomainObjectKeyString = this.openmct.objects.makeKeyString(this.internalDomainObject.identifier);
|
||||
|
||||
this.composition.add(newDomainObject);
|
||||
this.addItem('subobject-view', newDomainObject, position);
|
||||
@ -762,10 +762,10 @@ export default {
|
||||
}
|
||||
},
|
||||
switchViewType(context, viewType, selection) {
|
||||
let domainObject = context.item,
|
||||
layoutItem = context.layoutItem,
|
||||
position = [layoutItem.x, layoutItem.y],
|
||||
layoutType = 'subobject-view';
|
||||
let domainObject = context.item;
|
||||
let layoutItem = context.layoutItem;
|
||||
let position = [layoutItem.x, layoutItem.y];
|
||||
let layoutType = 'subobject-view';
|
||||
|
||||
if (layoutItem.type === 'telemetry-view') {
|
||||
let newDomainObject = this.createNewDomainObject(domainObject, [domainObject.identifier], viewType);
|
||||
@ -776,8 +776,8 @@ export default {
|
||||
this.getTelemetryIdentifiers(domainObject).then((identifiers) => {
|
||||
if (viewType === 'telemetry-view') {
|
||||
identifiers.forEach((identifier, index) => {
|
||||
let positionX = position[0] + (index * DUPLICATE_OFFSET),
|
||||
positionY = position[1] + (index * DUPLICATE_OFFSET);
|
||||
let positionX = position[0] + (index * DUPLICATE_OFFSET);
|
||||
let positionY = position[1] + (index * DUPLICATE_OFFSET);
|
||||
|
||||
this.convertToTelemetryView(identifier, [positionX, positionY]);
|
||||
});
|
||||
|
@ -43,10 +43,10 @@
|
||||
import ObjectFrame from '../../../ui/components/ObjectFrame.vue';
|
||||
import LayoutFrame from './LayoutFrame.vue';
|
||||
|
||||
const MINIMUM_FRAME_SIZE = [320, 180],
|
||||
DEFAULT_DIMENSIONS = [10, 10],
|
||||
DEFAULT_POSITION = [1, 1],
|
||||
DEFAULT_HIDDEN_FRAME_TYPES = ['hyperlink', 'summary-widget', 'conditionWidget'];
|
||||
const MINIMUM_FRAME_SIZE = [320, 180];
|
||||
const DEFAULT_DIMENSIONS = [10, 10];
|
||||
const DEFAULT_POSITION = [1, 1];
|
||||
const DEFAULT_HIDDEN_FRAME_TYPES = ['hyperlink', 'summary-widget', 'conditionWidget'];
|
||||
|
||||
function getDefaultDimensions(gridSize) {
|
||||
return MINIMUM_FRAME_SIZE.map((min, index) => {
|
||||
|
@ -75,9 +75,9 @@ import LayoutFrame from './LayoutFrame.vue';
|
||||
import printj from 'printj';
|
||||
import conditionalStylesMixin from "../mixins/objectStyles-mixin";
|
||||
|
||||
const DEFAULT_TELEMETRY_DIMENSIONS = [10, 5],
|
||||
DEFAULT_POSITION = [1, 1],
|
||||
CONTEXT_MENU_ACTIONS = ['viewHistoricalData'];
|
||||
const DEFAULT_TELEMETRY_DIMENSIONS = [10, 5];
|
||||
const DEFAULT_POSITION = [1, 1];
|
||||
const CONTEXT_MENU_ACTIONS = ['viewHistoricalData'];
|
||||
|
||||
export default {
|
||||
makeDefinition(openmct, gridSize, domainObject, position) {
|
||||
@ -144,8 +144,9 @@ export default {
|
||||
return displayMode === 'all' || displayMode === 'value';
|
||||
},
|
||||
unit() {
|
||||
let value = this.item.value,
|
||||
unit = this.metadata.value(value).unit;
|
||||
let value = this.item.value;
|
||||
|
||||
let unit = this.metadata.value(value).unit;
|
||||
|
||||
return unit;
|
||||
},
|
||||
|
@ -147,16 +147,16 @@ export default {
|
||||
return true;
|
||||
}
|
||||
|
||||
let frameId = event.dataTransfer.getData('frameid'),
|
||||
containerIndex = Number(event.dataTransfer.getData('containerIndex'));
|
||||
let frameId = event.dataTransfer.getData('frameid');
|
||||
let containerIndex = Number(event.dataTransfer.getData('containerIndex'));
|
||||
|
||||
if (!frameId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (containerIndex === this.index) {
|
||||
let frame = this.container.frames.filter((f) => f.id === frameId)[0],
|
||||
framePos = this.container.frames.indexOf(frame);
|
||||
let frame = this.container.frames.filter((f) => f.id === frameId)[0];
|
||||
let framePos = this.container.frames.indexOf(frame);
|
||||
|
||||
if (index === -1) {
|
||||
return framePos !== 0;
|
||||
@ -190,15 +190,15 @@ export default {
|
||||
);
|
||||
},
|
||||
startFrameResizing(index) {
|
||||
let beforeFrame = this.frames[index],
|
||||
afterFrame = this.frames[index + 1];
|
||||
let beforeFrame = this.frames[index];
|
||||
let afterFrame = this.frames[index + 1];
|
||||
|
||||
this.maxMoveSize = beforeFrame.size + afterFrame.size;
|
||||
},
|
||||
frameResizing(index, delta, event) {
|
||||
let percentageMoved = Math.round(delta / this.getElSize() * 100),
|
||||
beforeFrame = this.frames[index],
|
||||
afterFrame = this.frames[index + 1];
|
||||
let percentageMoved = Math.round(delta / this.getElSize() * 100);
|
||||
let beforeFrame = this.frames[index];
|
||||
let afterFrame = this.frames[index + 1];
|
||||
|
||||
beforeFrame.size = this.getFrameSize(beforeFrame.size + percentageMoved);
|
||||
afterFrame.size = this.getFrameSize(afterFrame.size - percentageMoved);
|
||||
|
@ -196,8 +196,8 @@ export default {
|
||||
this.persist();
|
||||
},
|
||||
deleteContainer(containerId) {
|
||||
let container = this.containers.filter(c => c.id === containerId)[0],
|
||||
containerIndex = this.containers.indexOf(container);
|
||||
let container = this.containers.filter(c => c.id === containerId)[0];
|
||||
let containerIndex = this.containers.indexOf(container);
|
||||
|
||||
/*
|
||||
remove associated domainObjects from composition
|
||||
@ -273,9 +273,9 @@ export default {
|
||||
return false;
|
||||
}
|
||||
|
||||
let containerId = event.dataTransfer.getData('containerid'),
|
||||
container = this.containers.filter((c) => c.id === containerId)[0],
|
||||
containerPos = this.containers.indexOf(container);
|
||||
let containerId = event.dataTransfer.getData('containerid');
|
||||
let container = this.containers.filter((c) => c.id === containerId)[0];
|
||||
let containerPos = this.containers.indexOf(container);
|
||||
|
||||
if (index === -1) {
|
||||
return containerPos !== 0;
|
||||
@ -291,15 +291,15 @@ export default {
|
||||
}
|
||||
},
|
||||
startContainerResizing(index) {
|
||||
let beforeContainer = this.containers[index],
|
||||
afterContainer = this.containers[index + 1];
|
||||
let beforeContainer = this.containers[index];
|
||||
let afterContainer = this.containers[index + 1];
|
||||
|
||||
this.maxMoveSize = beforeContainer.size + afterContainer.size;
|
||||
},
|
||||
containerResizing(index, delta, event) {
|
||||
let percentageMoved = Math.round(delta / this.getElSize() * 100),
|
||||
beforeContainer = this.containers[index],
|
||||
afterContainer = this.containers[index + 1];
|
||||
let percentageMoved = Math.round(delta / this.getElSize() * 100);
|
||||
let beforeContainer = this.containers[index];
|
||||
let afterContainer = this.containers[index + 1];
|
||||
|
||||
beforeContainer.size = this.getContainerSize(beforeContainer.size + percentageMoved);
|
||||
afterContainer.size = this.getContainerSize(afterContainer.size - percentageMoved);
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
@ -127,8 +128,8 @@ export default {
|
||||
});
|
||||
},
|
||||
initDrag(event) {
|
||||
let type = this.openmct.types.get(this.domainObject.type),
|
||||
iconClass = type.definition ? type.definition.cssClass : 'icon-object-unknown';
|
||||
let type = this.openmct.types.get(this.domainObject.type);
|
||||
let iconClass = type.definition ? type.definition.cssClass : 'icon-object-unknown';
|
||||
|
||||
if (this.dragGhost) {
|
||||
let originalClassName = this.dragGhost.classList[0];
|
||||
|
@ -73,7 +73,9 @@ export default {
|
||||
mousemove(event) {
|
||||
event.preventDefault();
|
||||
|
||||
let elSize, mousePos, delta;
|
||||
let elSize;
|
||||
let mousePos;
|
||||
let delta;
|
||||
|
||||
if (this.orientation === 'horizontal') {
|
||||
elSize = this.$el.getBoundingClientRect().x;
|
||||
|
@ -33,16 +33,15 @@ function ToolbarProvider(openmct) {
|
||||
&& (context.type === 'flexible-layout' || context.type === 'container' || context.type === 'frame'));
|
||||
},
|
||||
toolbar: function (selection) {
|
||||
|
||||
let selectionPath = selection[0],
|
||||
primary = selectionPath[0],
|
||||
secondary = selectionPath[1],
|
||||
tertiary = selectionPath[2],
|
||||
deleteFrame,
|
||||
toggleContainer,
|
||||
deleteContainer,
|
||||
addContainer,
|
||||
toggleFrame;
|
||||
let selectionPath = selection[0];
|
||||
let primary = selectionPath[0];
|
||||
let secondary = selectionPath[1];
|
||||
let tertiary = selectionPath[2];
|
||||
let deleteFrame;
|
||||
let toggleContainer;
|
||||
let deleteContainer;
|
||||
let addContainer;
|
||||
let toggleFrame;
|
||||
|
||||
toggleContainer = {
|
||||
control: 'toggle-button',
|
||||
@ -155,8 +154,8 @@ function ToolbarProvider(openmct) {
|
||||
control: "button",
|
||||
domainObject: primary.context.item,
|
||||
method: function () {
|
||||
let removeContainer = secondary.context.deleteContainer,
|
||||
containerId = primary.context.containerId;
|
||||
let removeContainer = secondary.context.deleteContainer;
|
||||
let containerId = primary.context.containerId;
|
||||
|
||||
let prompt = openmct.overlays.dialog({
|
||||
iconClass: 'alert',
|
||||
|
@ -71,9 +71,9 @@ export default {
|
||||
mixins: [compositionLoader],
|
||||
inject: ['domainObject', 'openmct'],
|
||||
data() {
|
||||
let sortBy = 'model.name',
|
||||
ascending = true,
|
||||
persistedSortOrder = window.localStorage.getItem('openmct-listview-sort-order');
|
||||
let sortBy = 'model.name';
|
||||
let ascending = true;
|
||||
let persistedSortOrder = window.localStorage.getItem('openmct-listview-sort-order');
|
||||
|
||||
if (persistedSortOrder) {
|
||||
let parsed = JSON.parse(persistedSortOrder);
|
||||
|
@ -33,7 +33,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
add(child, index, anything) {
|
||||
var type = this.openmct.types.get(child.type) || unknownObjectType;
|
||||
const type = this.openmct.types.get(child.type) || unknownObjectType;
|
||||
this.items.push({
|
||||
model: child,
|
||||
type: type.definition,
|
||||
|
@ -25,14 +25,14 @@ define([
|
||||
], function (
|
||||
moment
|
||||
) {
|
||||
const DATE_FORMAT = "YYYY-MM-DD h:mm:ss.SSS a";
|
||||
|
||||
var DATE_FORMAT = "YYYY-MM-DD h:mm:ss.SSS a",
|
||||
DATE_FORMATS = [
|
||||
DATE_FORMAT,
|
||||
"YYYY-MM-DD h:mm:ss a",
|
||||
"YYYY-MM-DD h:mm a",
|
||||
"YYYY-MM-DD"
|
||||
];
|
||||
const DATE_FORMATS = [
|
||||
DATE_FORMAT,
|
||||
"YYYY-MM-DD h:mm:ss a",
|
||||
"YYYY-MM-DD h:mm a",
|
||||
"YYYY-MM-DD"
|
||||
];
|
||||
|
||||
/**
|
||||
* @typedef Scale
|
||||
|
@ -49,23 +49,25 @@ export default class NewFolderAction {
|
||||
};
|
||||
}
|
||||
invoke(objectPath) {
|
||||
let domainObject = objectPath[0],
|
||||
parentKeystring = this._openmct.objects.makeKeyString(domainObject.identifier),
|
||||
composition = this._openmct.composition.get(domainObject),
|
||||
dialogService = this._openmct.$injector.get('dialogService'),
|
||||
folderType = this._openmct.types.get('folder');
|
||||
let domainObject = objectPath[0];
|
||||
let parentKeystring = this._openmct.objects.makeKeyString(domainObject.identifier);
|
||||
let composition = this._openmct.composition.get(domainObject);
|
||||
let dialogService = this._openmct.$injector.get('dialogService');
|
||||
let folderType = this._openmct.types.get('folder');
|
||||
|
||||
dialogService.getUserInput(this._dialogForm, {name: 'Unnamed Folder'}).then((userInput) => {
|
||||
let name = userInput.name,
|
||||
identifier = {
|
||||
key: uuid(),
|
||||
namespace: domainObject.identifier.namespace
|
||||
},
|
||||
objectModel = {
|
||||
identifier,
|
||||
type: 'folder',
|
||||
location: parentKeystring
|
||||
};
|
||||
let name = userInput.name;
|
||||
|
||||
let identifier = {
|
||||
key: uuid(),
|
||||
namespace: domainObject.identifier.namespace
|
||||
};
|
||||
|
||||
let objectModel = {
|
||||
identifier,
|
||||
type: 'folder',
|
||||
location: parentKeystring
|
||||
};
|
||||
|
||||
folderType.definition.initialize(objectModel);
|
||||
objectModel.name = name || 'New Folder';
|
||||
|
@ -25,14 +25,14 @@ import {
|
||||
} from 'utils/testing';
|
||||
|
||||
describe("the plugin", () => {
|
||||
let openmct,
|
||||
compositionAPI,
|
||||
newFolderAction,
|
||||
mockObjectPath,
|
||||
mockDialogService,
|
||||
mockComposition,
|
||||
mockPromise,
|
||||
newFolderName = 'New Folder';
|
||||
let openmct;
|
||||
let compositionAPI;
|
||||
let newFolderAction;
|
||||
let mockObjectPath;
|
||||
let mockDialogService;
|
||||
let mockComposition;
|
||||
let mockPromise;
|
||||
let newFolderName = 'New Folder';
|
||||
|
||||
beforeEach((done) => {
|
||||
openmct = createOpenMct();
|
||||
|
@ -249,7 +249,7 @@ export default {
|
||||
selectTextInsideElement(element) {
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(element);
|
||||
var selection = window.getSelection();
|
||||
let selection = window.getSelection();
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
},
|
||||
|
@ -25,18 +25,19 @@ import NotificationIndicator from './components/NotificationIndicator.vue';
|
||||
export default function plugin() {
|
||||
return function install(openmct) {
|
||||
let component = new Vue ({
|
||||
provide: {
|
||||
openmct
|
||||
},
|
||||
components: {
|
||||
NotificationIndicator: NotificationIndicator
|
||||
},
|
||||
template: '<NotificationIndicator></NotificationIndicator>'
|
||||
}),
|
||||
indicator = {
|
||||
key: 'notifications-indicator',
|
||||
element: component.$mount().$el
|
||||
};
|
||||
provide: {
|
||||
openmct
|
||||
},
|
||||
components: {
|
||||
NotificationIndicator: NotificationIndicator
|
||||
},
|
||||
template: '<NotificationIndicator></NotificationIndicator>'
|
||||
});
|
||||
|
||||
let indicator = {
|
||||
key: 'notifications-indicator',
|
||||
element: component.$mount().$el
|
||||
};
|
||||
|
||||
openmct.indicators.add(indicator);
|
||||
};
|
||||
|
@ -28,12 +28,12 @@ import {
|
||||
} from 'utils/testing';
|
||||
|
||||
describe('the plugin', () => {
|
||||
let notificationIndicatorPlugin,
|
||||
openmct,
|
||||
indicatorObject,
|
||||
indicatorElement,
|
||||
parentElement,
|
||||
mockMessages = ['error', 'test', 'notifications'];
|
||||
let notificationIndicatorPlugin;
|
||||
let openmct;
|
||||
let indicatorObject;
|
||||
let indicatorElement;
|
||||
let parentElement;
|
||||
let mockMessages = ['error', 'test', 'notifications'];
|
||||
|
||||
beforeEach((done) => {
|
||||
openmct = createOpenMct();
|
||||
@ -73,5 +73,4 @@ describe('the plugin', () => {
|
||||
expect(notificationCountElement.innerText).toEqual(mockMessages.length.toString());
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -62,7 +62,7 @@ define([
|
||||
PlotTemplate
|
||||
) {
|
||||
|
||||
var installed = false;
|
||||
let installed = false;
|
||||
|
||||
function PlotPlugin() {
|
||||
return function install(openmct) {
|
||||
|
@ -35,7 +35,7 @@ define(
|
||||
}
|
||||
|
||||
PlotViewPolicy.prototype.hasNumericTelemetry = function (domainObject) {
|
||||
var adaptedObject = domainObject.useCapability('adapter');
|
||||
const adaptedObject = domainObject.useCapability('adapter');
|
||||
|
||||
if (!adaptedObject.telemetry) {
|
||||
return domainObject.hasCapability('delegation')
|
||||
@ -43,8 +43,8 @@ define(
|
||||
.doesDelegateCapability('telemetry');
|
||||
}
|
||||
|
||||
var metadata = this.openmct.telemetry.getMetadata(adaptedObject);
|
||||
var rangeValues = metadata.valuesForHints(['range']);
|
||||
const metadata = this.openmct.telemetry.getMetadata(adaptedObject);
|
||||
const rangeValues = metadata.valuesForHints(['range']);
|
||||
if (rangeValues.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -39,9 +39,8 @@ function (
|
||||
DrawLoader,
|
||||
eventHelpers
|
||||
) {
|
||||
|
||||
var MARKER_SIZE = 6.0,
|
||||
HIGHLIGHT_SIZE = MARKER_SIZE * 2.0;
|
||||
const MARKER_SIZE = 6.0;
|
||||
const HIGHLIGHT_SIZE = MARKER_SIZE * 2.0;
|
||||
|
||||
/**
|
||||
* Offsetter adjusts x and y values by a fixed amount,
|
||||
@ -94,14 +93,14 @@ function (
|
||||
return;
|
||||
}
|
||||
|
||||
var elements = this.seriesElements.get(series);
|
||||
const elements = this.seriesElements.get(series);
|
||||
elements.lines.forEach(function (line) {
|
||||
this.lines.splice(this.lines.indexOf(line), 1);
|
||||
line.destroy();
|
||||
}, this);
|
||||
elements.lines = [];
|
||||
|
||||
var newLine = this.lineForSeries(series);
|
||||
const newLine = this.lineForSeries(series);
|
||||
if (newLine) {
|
||||
elements.lines.push(newLine);
|
||||
this.lines.push(newLine);
|
||||
@ -113,7 +112,7 @@ function (
|
||||
return;
|
||||
}
|
||||
|
||||
var elements = this.seriesElements.get(series);
|
||||
const elements = this.seriesElements.get(series);
|
||||
if (elements.alarmSet) {
|
||||
elements.alarmSet.destroy();
|
||||
this.alarmSets.splice(this.alarmSets.indexOf(elements.alarmSet), 1);
|
||||
@ -130,14 +129,14 @@ function (
|
||||
return;
|
||||
}
|
||||
|
||||
var elements = this.seriesElements.get(series);
|
||||
const elements = this.seriesElements.get(series);
|
||||
elements.pointSets.forEach(function (pointSet) {
|
||||
this.pointSets.splice(this.pointSets.indexOf(pointSet), 1);
|
||||
pointSet.destroy();
|
||||
}, this);
|
||||
elements.pointSets = [];
|
||||
|
||||
var pointSet = this.pointSetForSeries(series);
|
||||
const pointSet = this.pointSetForSeries(series);
|
||||
if (pointSet) {
|
||||
elements.pointSets.push(pointSet);
|
||||
this.pointSets.push(pointSet);
|
||||
@ -177,7 +176,7 @@ function (
|
||||
return;
|
||||
}
|
||||
|
||||
var offsets = {
|
||||
const offsets = {
|
||||
x: series.getXVal(offsetPoint),
|
||||
y: series.getYVal(offsetPoint)
|
||||
};
|
||||
@ -212,10 +211,10 @@ function (
|
||||
DrawLoader.releaseDrawAPI(this.drawAPI);
|
||||
// Have to throw away the old canvas elements and replace with new
|
||||
// canvas elements in order to get new drawing contexts.
|
||||
var div = document.createElement('div');
|
||||
const div = document.createElement('div');
|
||||
div.innerHTML = this.TEMPLATE;
|
||||
var mainCanvas = div.querySelectorAll("canvas")[1];
|
||||
var overlayCanvas = div.querySelectorAll("canvas")[0];
|
||||
const mainCanvas = div.querySelectorAll("canvas")[1];
|
||||
const overlayCanvas = div.querySelectorAll("canvas")[0];
|
||||
this.canvas.parentNode.replaceChild(mainCanvas, this.canvas);
|
||||
this.canvas = mainCanvas;
|
||||
this.overlay.parentNode.replaceChild(overlayCanvas, this.overlay);
|
||||
@ -225,7 +224,7 @@ function (
|
||||
};
|
||||
|
||||
MCTChartController.prototype.removeChartElement = function (series) {
|
||||
var elements = this.seriesElements.get(series);
|
||||
const elements = this.seriesElements.get(series);
|
||||
|
||||
elements.lines.forEach(function (line) {
|
||||
this.lines.splice(this.lines.indexOf(line), 1);
|
||||
@ -282,18 +281,18 @@ function (
|
||||
};
|
||||
|
||||
MCTChartController.prototype.makeChartElement = function (series) {
|
||||
var elements = {
|
||||
const elements = {
|
||||
lines: [],
|
||||
pointSets: []
|
||||
};
|
||||
|
||||
var line = this.lineForSeries(series);
|
||||
const line = this.lineForSeries(series);
|
||||
if (line) {
|
||||
elements.lines.push(line);
|
||||
this.lines.push(line);
|
||||
}
|
||||
|
||||
var pointSet = this.pointSetForSeries(series);
|
||||
const pointSet = this.pointSetForSeries(series);
|
||||
if (pointSet) {
|
||||
elements.pointSets.push(pointSet);
|
||||
this.pointSets.push(pointSet);
|
||||
@ -338,21 +337,22 @@ function (
|
||||
};
|
||||
|
||||
MCTChartController.prototype.updateViewport = function () {
|
||||
var xRange = this.config.xAxis.get('displayRange'),
|
||||
yRange = this.config.yAxis.get('displayRange');
|
||||
const xRange = this.config.xAxis.get('displayRange');
|
||||
const yRange = this.config.yAxis.get('displayRange');
|
||||
|
||||
if (!xRange || !yRange) {
|
||||
return;
|
||||
}
|
||||
|
||||
var dimensions = [
|
||||
xRange.max - xRange.min,
|
||||
yRange.max - yRange.min
|
||||
],
|
||||
origin = [
|
||||
this.offset.x(xRange.min),
|
||||
this.offset.y(yRange.min)
|
||||
];
|
||||
const dimensions = [
|
||||
xRange.max - xRange.min,
|
||||
yRange.max - yRange.min
|
||||
];
|
||||
|
||||
const origin = [
|
||||
this.offset.x(xRange.min),
|
||||
this.offset.y(yRange.min)
|
||||
];
|
||||
|
||||
this.drawAPI.setDimensions(
|
||||
dimensions,
|
||||
@ -399,13 +399,14 @@ function (
|
||||
};
|
||||
|
||||
MCTChartController.prototype.drawHighlight = function (highlight) {
|
||||
var points = new Float32Array([
|
||||
this.offset.xVal(highlight.point, highlight.series),
|
||||
this.offset.yVal(highlight.point, highlight.series)
|
||||
]),
|
||||
color = highlight.series.get('color').asRGBAArray(),
|
||||
pointCount = 1,
|
||||
shape = highlight.series.get('markerShape');
|
||||
const points = new Float32Array([
|
||||
this.offset.xVal(highlight.point, highlight.series),
|
||||
this.offset.yVal(highlight.point, highlight.series)
|
||||
]);
|
||||
|
||||
const color = highlight.series.get('color').asRGBAArray();
|
||||
const pointCount = 1;
|
||||
const shape = highlight.series.get('markerShape');
|
||||
|
||||
this.drawAPI.drawPoints(points, color, pointCount, HIGHLIGHT_SIZE, shape);
|
||||
};
|
||||
|
@ -29,7 +29,7 @@ define([
|
||||
MCTChartController
|
||||
) {
|
||||
|
||||
var TEMPLATE = "<canvas style='position: absolute; background: none; width: 100%; height: 100%;'></canvas>";
|
||||
let TEMPLATE = "<canvas style='position: absolute; background: none; width: 100%; height: 100%;'></canvas>";
|
||||
TEMPLATE += TEMPLATE;
|
||||
|
||||
/**
|
||||
@ -43,8 +43,8 @@ define([
|
||||
template: TEMPLATE,
|
||||
link: function ($scope, $element, attrs, ctrl) {
|
||||
ctrl.TEMPLATE = TEMPLATE;
|
||||
var mainCanvas = $element.find("canvas")[1];
|
||||
var overlayCanvas = $element.find("canvas")[0];
|
||||
const mainCanvas = $element.find("canvas")[1];
|
||||
const overlayCanvas = $element.find("canvas")[0];
|
||||
|
||||
if (ctrl.initializeCanvas(mainCanvas, overlayCanvas)) {
|
||||
ctrl.draw();
|
||||
|
@ -26,7 +26,7 @@ define([
|
||||
MCTChartSeriesElement
|
||||
) {
|
||||
|
||||
var MCTChartLineLinear = MCTChartSeriesElement.extend({
|
||||
const MCTChartLineLinear = MCTChartSeriesElement.extend({
|
||||
addPoint: function (point, start, count) {
|
||||
this.buffer[start] = point.x;
|
||||
this.buffer[start + 1] = point.y;
|
||||
|
@ -26,7 +26,7 @@ define([
|
||||
MCTChartSeriesElement
|
||||
) {
|
||||
|
||||
var MCTChartLineStepAfter = MCTChartSeriesElement.extend({
|
||||
const MCTChartLineStepAfter = MCTChartSeriesElement.extend({
|
||||
removePoint: function (point, index, count) {
|
||||
if (index > 0 && index / 2 < this.count) {
|
||||
this.buffer[index + 1] = this.buffer[index - 1];
|
||||
|
@ -26,7 +26,7 @@ define([
|
||||
MCTChartSeriesElement
|
||||
) {
|
||||
|
||||
var MCTChartPointSet = MCTChartSeriesElement.extend({
|
||||
const MCTChartPointSet = MCTChartSeriesElement.extend({
|
||||
addPoint: function (point, start, count) {
|
||||
this.buffer[start] = point.x;
|
||||
this.buffer[start + 1] = point.y;
|
||||
|
@ -69,11 +69,11 @@ define([
|
||||
};
|
||||
|
||||
MCTChartSeriesElement.prototype.removeSegments = function (index, count) {
|
||||
var target = index,
|
||||
start = index + count,
|
||||
end = this.count * 2;
|
||||
const target = index;
|
||||
const start = index + count;
|
||||
const end = this.count * 2;
|
||||
this.buffer.copyWithin(target, start, end);
|
||||
for (var zero = end - count; zero < end; zero++) {
|
||||
for (let zero = end - count; zero < end; zero++) {
|
||||
this.buffer[zero] = 0;
|
||||
}
|
||||
};
|
||||
@ -83,8 +83,8 @@ define([
|
||||
};
|
||||
|
||||
MCTChartSeriesElement.prototype.remove = function (point, index, series) {
|
||||
var vertexCount = this.vertexCountForPointAtIndex(index);
|
||||
var removalPoint = this.startIndexForPointAtIndex(index);
|
||||
const vertexCount = this.vertexCountForPointAtIndex(index);
|
||||
const removalPoint = this.startIndexForPointAtIndex(index);
|
||||
|
||||
this.removeSegments(removalPoint, vertexCount);
|
||||
|
||||
@ -108,8 +108,8 @@ define([
|
||||
};
|
||||
|
||||
MCTChartSeriesElement.prototype.append = function (point, index, series) {
|
||||
var pointsRequired = this.vertexCountForPointAtIndex(index);
|
||||
var insertionPoint = this.startIndexForPointAtIndex(index);
|
||||
const pointsRequired = this.vertexCountForPointAtIndex(index);
|
||||
const insertionPoint = this.startIndexForPointAtIndex(index);
|
||||
this.growIfNeeded(pointsRequired);
|
||||
this.makeInsertionPoint(insertionPoint, pointsRequired);
|
||||
this.addPoint(
|
||||
@ -127,8 +127,8 @@ define([
|
||||
this.isTempBuffer = true;
|
||||
}
|
||||
|
||||
var target = insertionPoint + pointsRequired,
|
||||
start = insertionPoint;
|
||||
const target = insertionPoint + pointsRequired;
|
||||
let start = insertionPoint;
|
||||
for (; start < target; start++) {
|
||||
this.buffer.splice(start, 0, 0);
|
||||
}
|
||||
@ -146,8 +146,8 @@ define([
|
||||
};
|
||||
|
||||
MCTChartSeriesElement.prototype.growIfNeeded = function (pointsRequired) {
|
||||
var remainingPoints = this.buffer.length - this.count * 2;
|
||||
var temp;
|
||||
const remainingPoints = this.buffer.length - this.count * 2;
|
||||
let temp;
|
||||
|
||||
if (remainingPoints <= pointsRequired) {
|
||||
temp = new Float32Array(this.buffer.length + 20000);
|
||||
|
@ -93,7 +93,7 @@ define([
|
||||
|
||||
Collection.prototype.add = function (model) {
|
||||
model = this.modelFn(model);
|
||||
var index = this.models.length;
|
||||
const index = this.models.length;
|
||||
this.models.push(model);
|
||||
this.emit('add', model, index);
|
||||
};
|
||||
@ -109,7 +109,7 @@ define([
|
||||
};
|
||||
|
||||
Collection.prototype.remove = function (model) {
|
||||
var index = this.indexOf(model);
|
||||
const index = this.indexOf(model);
|
||||
|
||||
if (index === -1) {
|
||||
throw new Error('model not found in collection.');
|
||||
|
@ -28,7 +28,7 @@ define([
|
||||
/**
|
||||
* TODO: doc strings.
|
||||
*/
|
||||
var LegendModel = Model.extend({
|
||||
const LegendModel = Model.extend({
|
||||
listenToSeriesCollection: function (seriesCollection) {
|
||||
this.seriesCollection = seriesCollection;
|
||||
this.listenTo(this.seriesCollection, 'add', this.setHeight, this);
|
||||
@ -37,7 +37,7 @@ define([
|
||||
this.set('expanded', this.get('expandByDefault'));
|
||||
},
|
||||
setHeight: function () {
|
||||
var expanded = this.get('expanded');
|
||||
const expanded = this.get('expanded');
|
||||
if (this.get('position') !== 'top') {
|
||||
this.set('height', '0px');
|
||||
} else {
|
||||
|
@ -40,7 +40,7 @@ define([
|
||||
this.id = options.id;
|
||||
this.model = options.model;
|
||||
this.collection = options.collection;
|
||||
var defaults = this.defaults(options);
|
||||
const defaults = this.defaults(options);
|
||||
if (!this.model) {
|
||||
this.model = options.model = defaults;
|
||||
} else {
|
||||
@ -86,14 +86,14 @@ define([
|
||||
};
|
||||
|
||||
Model.prototype.set = function (attribute, value) {
|
||||
var oldValue = this.model[attribute];
|
||||
const oldValue = this.model[attribute];
|
||||
this.model[attribute] = value;
|
||||
this.emit('change', attribute, value, oldValue, this);
|
||||
this.emit('change:' + attribute, value, oldValue, this);
|
||||
};
|
||||
|
||||
Model.prototype.unset = function (attribute) {
|
||||
var oldValue = this.model[attribute];
|
||||
const oldValue = this.model[attribute];
|
||||
delete this.model[attribute];
|
||||
this.emit('change', attribute, undefined, oldValue, this);
|
||||
this.emit('change:' + attribute, undefined, oldValue, this);
|
||||
|
@ -44,7 +44,7 @@ define([
|
||||
* handle setting defaults and updating in response to various changes.
|
||||
*
|
||||
*/
|
||||
var PlotConfigurationModel = Model.extend({
|
||||
const PlotConfigurationModel = Model.extend({
|
||||
|
||||
/**
|
||||
* Initializes all sub models and then passes references to submodels
|
||||
@ -91,7 +91,7 @@ define([
|
||||
* Retrieve the persisted series config for a given identifier.
|
||||
*/
|
||||
getPersistedSeriesConfig: function (identifier) {
|
||||
var domainObject = this.get('domainObject');
|
||||
const domainObject = this.get('domainObject');
|
||||
if (!domainObject.configuration || !domainObject.configuration.series) {
|
||||
return;
|
||||
}
|
||||
@ -105,8 +105,8 @@ define([
|
||||
* Retrieve the persisted filters for a given identifier.
|
||||
*/
|
||||
getPersistedFilters: function (identifier) {
|
||||
var domainObject = this.get('domainObject'),
|
||||
keystring = this.openmct.objects.makeKeyString(identifier);
|
||||
const domainObject = this.get('domainObject');
|
||||
const keystring = this.openmct.objects.makeKeyString(identifier);
|
||||
|
||||
if (!domainObject.configuration || !domainObject.configuration.filters) {
|
||||
return;
|
||||
|
@ -70,7 +70,7 @@ define([
|
||||
* telemetry point.
|
||||
* `formats`: the Open MCT format map for this telemetry point.
|
||||
*/
|
||||
var PlotSeries = Model.extend({
|
||||
const PlotSeries = Model.extend({
|
||||
constructor: function (options) {
|
||||
this.metadata = options
|
||||
.openmct
|
||||
@ -97,7 +97,7 @@ define([
|
||||
* Set defaults for telemetry series.
|
||||
*/
|
||||
defaults: function (options) {
|
||||
var range = this.metadata.valuesForHints(['range'])[0];
|
||||
const range = this.metadata.valuesForHints(['range'])[0];
|
||||
|
||||
return {
|
||||
name: options.domainObject.name,
|
||||
@ -174,7 +174,7 @@ define([
|
||||
.telemetry
|
||||
.request(this.domainObject, options)
|
||||
.then(function (points) {
|
||||
var newPoints = _(this.data)
|
||||
const newPoints = _(this.data)
|
||||
.concat(points)
|
||||
.sortBy(this.getXVal)
|
||||
.uniq(true, point => [this.getXVal(point), this.getYVal(point)].join())
|
||||
@ -187,7 +187,7 @@ define([
|
||||
* Update x formatter on x change.
|
||||
*/
|
||||
onXKeyChange: function (xKey) {
|
||||
var format = this.formats[xKey];
|
||||
const format = this.formats[xKey];
|
||||
this.getXVal = format.parse.bind(format);
|
||||
},
|
||||
/**
|
||||
@ -199,7 +199,7 @@ define([
|
||||
return;
|
||||
}
|
||||
|
||||
var valueMetadata = this.metadata.value(newKey);
|
||||
const valueMetadata = this.metadata.value(newKey);
|
||||
if (!this.persistedConfig || !this.persistedConfig.interpolate) {
|
||||
if (valueMetadata.format === 'enum') {
|
||||
this.set('interpolate', 'stepAfter');
|
||||
@ -211,7 +211,7 @@ define([
|
||||
this.evaluate = function (datum) {
|
||||
return this.limitEvaluator.evaluate(datum, valueMetadata);
|
||||
}.bind(this);
|
||||
var format = this.formats[newKey];
|
||||
const format = this.formats[newKey];
|
||||
this.getYVal = format.parse.bind(format);
|
||||
},
|
||||
|
||||
@ -249,17 +249,17 @@ define([
|
||||
* Return the point closest to a given x value.
|
||||
*/
|
||||
nearestPoint: function (xValue) {
|
||||
var insertIndex = this.sortedIndex(xValue),
|
||||
lowPoint = this.data[insertIndex - 1],
|
||||
highPoint = this.data[insertIndex],
|
||||
indexVal = this.getXVal(xValue),
|
||||
lowDistance = lowPoint
|
||||
? indexVal - this.getXVal(lowPoint)
|
||||
: Number.POSITIVE_INFINITY,
|
||||
highDistance = highPoint
|
||||
? this.getXVal(highPoint) - indexVal
|
||||
: Number.POSITIVE_INFINITY,
|
||||
nearestPoint = highDistance < lowDistance ? highPoint : lowPoint;
|
||||
const insertIndex = this.sortedIndex(xValue);
|
||||
const lowPoint = this.data[insertIndex - 1];
|
||||
const highPoint = this.data[insertIndex];
|
||||
const indexVal = this.getXVal(xValue);
|
||||
const lowDistance = lowPoint
|
||||
? indexVal - this.getXVal(lowPoint)
|
||||
: Number.POSITIVE_INFINITY;
|
||||
const highDistance = highPoint
|
||||
? this.getXVal(highPoint) - indexVal
|
||||
: Number.POSITIVE_INFINITY;
|
||||
const nearestPoint = highDistance < lowDistance ? highPoint : lowPoint;
|
||||
|
||||
return nearestPoint;
|
||||
},
|
||||
@ -291,9 +291,9 @@ define([
|
||||
* @private
|
||||
*/
|
||||
updateStats: function (point) {
|
||||
var value = this.getYVal(point);
|
||||
var stats = this.get('stats');
|
||||
var changed = false;
|
||||
const value = this.getYVal(point);
|
||||
let stats = this.get('stats');
|
||||
let changed = false;
|
||||
if (!stats) {
|
||||
stats = {
|
||||
minValue: value,
|
||||
@ -338,9 +338,9 @@ define([
|
||||
* a point to the end without dupe checking.
|
||||
*/
|
||||
add: function (point, appendOnly) {
|
||||
var insertIndex = this.data.length,
|
||||
currentYVal = this.getYVal(point),
|
||||
lastYVal = this.getYVal(this.data[insertIndex - 1]);
|
||||
let insertIndex = this.data.length;
|
||||
const currentYVal = this.getYVal(point);
|
||||
const lastYVal = this.getYVal(this.data[insertIndex - 1]);
|
||||
|
||||
if (this.isValueInvalid(currentYVal) && this.isValueInvalid(lastYVal)) {
|
||||
console.warn('[Plot] Invalid Y Values detected');
|
||||
@ -378,7 +378,7 @@ define([
|
||||
* @private
|
||||
*/
|
||||
remove: function (point) {
|
||||
var index = this.data.indexOf(point);
|
||||
const index = this.data.indexOf(point);
|
||||
this.data.splice(index, 1);
|
||||
this.emit('remove', point, index, this);
|
||||
},
|
||||
@ -393,16 +393,16 @@ define([
|
||||
* @param {number} range.max maximum x value to keep.
|
||||
*/
|
||||
purgeRecordsOutsideRange: function (range) {
|
||||
var startIndex = this.sortedIndex(range.min);
|
||||
var endIndex = this.sortedIndex(range.max) + 1;
|
||||
var pointsToRemove = startIndex + (this.data.length - endIndex + 1);
|
||||
const startIndex = this.sortedIndex(range.min);
|
||||
const endIndex = this.sortedIndex(range.max) + 1;
|
||||
const pointsToRemove = startIndex + (this.data.length - endIndex + 1);
|
||||
if (pointsToRemove > 0) {
|
||||
if (pointsToRemove < 1000) {
|
||||
this.data.slice(0, startIndex).forEach(this.remove, this);
|
||||
this.data.slice(endIndex, this.data.length).forEach(this.remove, this);
|
||||
this.resetStats();
|
||||
} else {
|
||||
var newData = this.data.slice(startIndex, endIndex);
|
||||
const newData = this.data.slice(startIndex, endIndex);
|
||||
this.reset(newData);
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ define([
|
||||
_
|
||||
) {
|
||||
|
||||
var SeriesCollection = Collection.extend({
|
||||
const SeriesCollection = Collection.extend({
|
||||
modelClass: PlotSeries,
|
||||
initialize: function (options) {
|
||||
this.plot = options.plot;
|
||||
@ -43,7 +43,7 @@ define([
|
||||
this.listenTo(this, 'remove', this.onSeriesRemove, this);
|
||||
this.listenTo(this.plot, 'change:domainObject', this.trackPersistedConfig, this);
|
||||
|
||||
var domainObject = this.plot.get('domainObject');
|
||||
const domainObject = this.plot.get('domainObject');
|
||||
if (domainObject.telemetry) {
|
||||
this.addTelemetryObject(domainObject);
|
||||
} else {
|
||||
@ -52,22 +52,22 @@ define([
|
||||
},
|
||||
trackPersistedConfig: function (domainObject) {
|
||||
domainObject.configuration.series.forEach(function (seriesConfig) {
|
||||
var series = this.byIdentifier(seriesConfig.identifier);
|
||||
const series = this.byIdentifier(seriesConfig.identifier);
|
||||
if (series) {
|
||||
series.persistedConfig = seriesConfig;
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
watchTelemetryContainer: function (domainObject) {
|
||||
var composition = this.openmct.composition.get(domainObject);
|
||||
const composition = this.openmct.composition.get(domainObject);
|
||||
this.listenTo(composition, 'add', this.addTelemetryObject, this);
|
||||
this.listenTo(composition, 'remove', this.removeTelemetryObject, this);
|
||||
composition.load();
|
||||
},
|
||||
addTelemetryObject: function (domainObject, index) {
|
||||
var seriesConfig = this.plot.getPersistedSeriesConfig(domainObject.identifier);
|
||||
var filters = this.plot.getPersistedFilters(domainObject.identifier);
|
||||
var plotObject = this.plot.get('domainObject');
|
||||
let seriesConfig = this.plot.getPersistedSeriesConfig(domainObject.identifier);
|
||||
const filters = this.plot.getPersistedFilters(domainObject.identifier);
|
||||
const plotObject = this.plot.get('domainObject');
|
||||
|
||||
if (!seriesConfig) {
|
||||
seriesConfig = {
|
||||
@ -99,14 +99,14 @@ define([
|
||||
}));
|
||||
},
|
||||
removeTelemetryObject: function (identifier) {
|
||||
var plotObject = this.plot.get('domainObject');
|
||||
const plotObject = this.plot.get('domainObject');
|
||||
if (plotObject.type === 'telemetry.plot.overlay') {
|
||||
|
||||
var persistedIndex = plotObject.configuration.series.findIndex(s => {
|
||||
const persistedIndex = plotObject.configuration.series.findIndex(s => {
|
||||
return _.isEqual(identifier, s.identifier);
|
||||
});
|
||||
|
||||
var configIndex = this.models.findIndex(m => {
|
||||
const configIndex = this.models.findIndex(m => {
|
||||
return _.isEqual(m.domainObject.identifier, identifier);
|
||||
});
|
||||
|
||||
@ -122,8 +122,8 @@ define([
|
||||
// to defer mutation of our plot object, otherwise we might
|
||||
// mutate an outdated version of the plotObject.
|
||||
setTimeout(function () {
|
||||
var newPlotObject = this.plot.get('domainObject');
|
||||
var cSeries = newPlotObject.configuration.series.slice();
|
||||
const newPlotObject = this.plot.get('domainObject');
|
||||
const cSeries = newPlotObject.configuration.series.slice();
|
||||
cSeries.splice(persistedIndex, 1);
|
||||
this.openmct.objects.mutate(newPlotObject, 'configuration.series', cSeries);
|
||||
}.bind(this));
|
||||
@ -131,7 +131,7 @@ define([
|
||||
}
|
||||
},
|
||||
onSeriesAdd: function (series) {
|
||||
var seriesColor = series.get('color');
|
||||
let seriesColor = series.get('color');
|
||||
if (seriesColor) {
|
||||
if (!(seriesColor instanceof color.Color)) {
|
||||
seriesColor = color.Color.fromHexString(seriesColor);
|
||||
@ -152,7 +152,7 @@ define([
|
||||
},
|
||||
updateColorPalette: function (newColor, oldColor) {
|
||||
this.palette.remove(newColor);
|
||||
var seriesWithColor = this.filter(function (series) {
|
||||
const seriesWithColor = this.filter(function (series) {
|
||||
return series.get('color') === newColor;
|
||||
})[0];
|
||||
if (!seriesWithColor) {
|
||||
@ -161,7 +161,7 @@ define([
|
||||
},
|
||||
byIdentifier: function (identifier) {
|
||||
return this.filter(function (series) {
|
||||
var seriesIdentifier = series.get('identifier');
|
||||
const seriesIdentifier = series.get('identifier');
|
||||
|
||||
return seriesIdentifier.namespace === identifier.namespace
|
||||
&& seriesIdentifier.key === identifier.key;
|
||||
|
@ -28,7 +28,7 @@ define([
|
||||
/**
|
||||
* TODO: doc strings.
|
||||
*/
|
||||
var XAxisModel = Model.extend({
|
||||
const XAxisModel = Model.extend({
|
||||
initialize: function (options) {
|
||||
this.plot = options.plot;
|
||||
this.set('label', options.model.name || '');
|
||||
@ -51,10 +51,10 @@ define([
|
||||
this.listenTo(this, 'change:key', this.changeKey, this);
|
||||
},
|
||||
changeKey: function (newKey) {
|
||||
var series = this.plot.series.first();
|
||||
const series = this.plot.series.first();
|
||||
if (series) {
|
||||
var xMetadata = series.metadata.value(newKey);
|
||||
var xFormat = series.formats[newKey];
|
||||
const xMetadata = series.metadata.value(newKey);
|
||||
const xFormat = series.formats[newKey];
|
||||
this.set('label', xMetadata.name);
|
||||
this.set('format', xFormat.format.bind(xFormat));
|
||||
} else {
|
||||
@ -70,9 +70,9 @@ define([
|
||||
});
|
||||
},
|
||||
defaults: function (options) {
|
||||
var bounds = options.openmct.time.bounds();
|
||||
var timeSystem = options.openmct.time.timeSystem();
|
||||
var format = options.openmct.$injector.get('formatService')
|
||||
const bounds = options.openmct.time.bounds();
|
||||
const timeSystem = options.openmct.time.timeSystem();
|
||||
const format = options.openmct.$injector.get('formatService')
|
||||
.getFormat(timeSystem.timeFormat);
|
||||
|
||||
return {
|
||||
|
@ -48,7 +48,7 @@ define([
|
||||
* disabled.
|
||||
*
|
||||
*/
|
||||
var YAxisModel = Model.extend({
|
||||
const YAxisModel = Model.extend({
|
||||
initialize: function (options) {
|
||||
this.plot = options.plot;
|
||||
this.listenTo(this, 'change:stats', this.calculateAutoscaleExtents, this);
|
||||
@ -82,7 +82,7 @@ define([
|
||||
}
|
||||
},
|
||||
applyPadding: function (range) {
|
||||
var padding = Math.abs(range.max - range.min) * this.get('autoscalePadding');
|
||||
let padding = Math.abs(range.max - range.min) * this.get('autoscalePadding');
|
||||
if (padding === 0) {
|
||||
padding = 1;
|
||||
}
|
||||
@ -116,8 +116,8 @@ define([
|
||||
return;
|
||||
}
|
||||
|
||||
var stats = this.get('stats');
|
||||
var changed = false;
|
||||
const stats = this.get('stats');
|
||||
let changed = false;
|
||||
if (stats.min > seriesStats.minValue) {
|
||||
changed = true;
|
||||
stats.min = seriesStats.minValue;
|
||||
@ -171,9 +171,9 @@ define([
|
||||
* Update yAxis format, values, and label from known series.
|
||||
*/
|
||||
updateFromSeries: function (series) {
|
||||
var plotModel = this.plot.get('domainObject');
|
||||
var label = _.get(plotModel, 'configuration.yAxis.label');
|
||||
var sampleSeries = series.first();
|
||||
const plotModel = this.plot.get('domainObject');
|
||||
const label = _.get(plotModel, 'configuration.yAxis.label');
|
||||
const sampleSeries = series.first();
|
||||
if (!sampleSeries) {
|
||||
if (!label) {
|
||||
this.unset('label');
|
||||
@ -182,13 +182,13 @@ define([
|
||||
return;
|
||||
}
|
||||
|
||||
var yKey = sampleSeries.get('yKey');
|
||||
var yMetadata = sampleSeries.metadata.value(yKey);
|
||||
var yFormat = sampleSeries.formats[yKey];
|
||||
const yKey = sampleSeries.get('yKey');
|
||||
const yMetadata = sampleSeries.metadata.value(yKey);
|
||||
const yFormat = sampleSeries.formats[yKey];
|
||||
this.set('format', yFormat.format.bind(yFormat));
|
||||
this.set('values', yMetadata.values);
|
||||
if (!label) {
|
||||
var labelName = series.map(function (s) {
|
||||
const labelName = series.map(function (s) {
|
||||
return s.metadata.value(s.get('yKey')).name;
|
||||
}).reduce(function (a, b) {
|
||||
if (a === undefined) {
|
||||
@ -208,7 +208,7 @@ define([
|
||||
return;
|
||||
}
|
||||
|
||||
var labelUnits = series.map(function (s) {
|
||||
const labelUnits = series.map(function (s) {
|
||||
return s.metadata.value(s.get('yKey')).units;
|
||||
}).reduce(function (a, b) {
|
||||
if (a === undefined) {
|
||||
|
@ -42,7 +42,7 @@ define([
|
||||
return this.store[id];
|
||||
};
|
||||
|
||||
var STORE = new ConfigStore();
|
||||
const STORE = new ConfigStore();
|
||||
|
||||
return STORE;
|
||||
});
|
||||
|
@ -66,7 +66,7 @@ define([
|
||||
|
||||
// Set the color to be used for drawing operations
|
||||
Draw2D.prototype.setColor = function (color) {
|
||||
var mappedColor = color.map(function (c, i) {
|
||||
const mappedColor = color.map(function (c, i) {
|
||||
return i < 3 ? Math.floor(c * 255) : (c);
|
||||
}).join(',');
|
||||
this.c2d.strokeStyle = "rgba(" + mappedColor + ")";
|
||||
@ -85,7 +85,7 @@ define([
|
||||
};
|
||||
|
||||
Draw2D.prototype.drawLine = function (buf, color, points) {
|
||||
var i;
|
||||
let i;
|
||||
|
||||
this.setColor(color);
|
||||
|
||||
@ -108,10 +108,10 @@ define([
|
||||
};
|
||||
|
||||
Draw2D.prototype.drawSquare = function (min, max, color) {
|
||||
var x1 = this.x(min[0]),
|
||||
y1 = this.y(min[1]),
|
||||
w = this.x(max[0]) - x1,
|
||||
h = this.y(max[1]) - y1;
|
||||
const x1 = this.x(min[0]);
|
||||
const y1 = this.y(min[1]);
|
||||
const w = this.x(max[0]) - x1;
|
||||
const h = this.y(max[1]) - y1;
|
||||
|
||||
this.setColor(color);
|
||||
this.c2d.fillRect(x1, y1, w, h);
|
||||
@ -145,12 +145,12 @@ define([
|
||||
};
|
||||
|
||||
Draw2D.prototype.drawLimitPoints = function (points, color, pointSize) {
|
||||
var limitSize = pointSize * 2;
|
||||
var offset = limitSize / 2;
|
||||
const limitSize = pointSize * 2;
|
||||
const offset = limitSize / 2;
|
||||
|
||||
this.setColor(color);
|
||||
|
||||
for (var i = 0; i < points.length; i++) {
|
||||
for (let i = 0; i < points.length; i++) {
|
||||
this.drawLimitPoint(
|
||||
this.x(points[i].x) - offset,
|
||||
this.y(points[i].y) - offset,
|
||||
|
@ -27,7 +27,7 @@ define(
|
||||
],
|
||||
function (DrawWebGL, Draw2D) {
|
||||
|
||||
var CHARTS = [
|
||||
const CHARTS = [
|
||||
{
|
||||
MAX_INSTANCES: 16,
|
||||
API: DrawWebGL,
|
||||
@ -53,7 +53,7 @@ define(
|
||||
the draw API to.
|
||||
*/
|
||||
getDrawAPI: function (canvas, overlay) {
|
||||
var api;
|
||||
let api;
|
||||
|
||||
CHARTS.forEach(function (CHART_TYPE) {
|
||||
if (api) {
|
||||
@ -89,7 +89,7 @@ define(
|
||||
* Returns a fallback draw api.
|
||||
*/
|
||||
getFallbackDrawAPI: function (canvas, overlay) {
|
||||
var api = new CHARTS[1].API(canvas, overlay);
|
||||
const api = new CHARTS[1].API(canvas, overlay);
|
||||
CHARTS[1].ALLOCATIONS.push(api);
|
||||
|
||||
return api;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user