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