Experimental unit tests for the Telemetry Table component (#2533)

* Initial commit of telemetry table spec
* Added example directory to linter paths. Fixed outstanding linting issues
This commit is contained in:
Andrew Henry 2019-11-27 16:04:52 -08:00 committed by GitHub
parent 72e382c46a
commit c51fd21847
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
73 changed files with 3963 additions and 3757 deletions

View File

@ -22,15 +22,15 @@
/*global define*/
define([
"./src/EventTelemetryProvider",
'legacyRegistry'
"./src/EventTelemetryProvider"
], function (
EventTelemetryProvider,
legacyRegistry
EventTelemetryProvider
) {
"use strict";
legacyRegistry.register("example/eventGenerator", {
return {
name:"example/eventGenerator",
definition: {
"name": "Event Message Generator",
"description": "For development use. Creates sample event message data that mimics a live data stream.",
"extensions": {
@ -76,5 +76,6 @@ define([
}
]
}
});
}
};
});

View File

@ -34,11 +34,9 @@ define(
* @constructor
*/
function EventTelemetryProvider($q, $timeout) {
var
subscriptions = [],
var subscriptions = [],
genInterval = 1000,
generating = false,
id = Math.random() * 100000;
generating = false;
//
function matchesSource(request) {
@ -47,7 +45,6 @@ define(
// Used internally; this will be repacked by doPackage
function generateData(request) {
//console.log("generateData " + (Date.now() - startTime).toString());
return {
key: request.key,
telemetry: new EventTelemetry(request, genInterval)

View File

@ -58,15 +58,15 @@ define([], function () {
row,
i;
function copyDomainsToRow(row, index) {
function copyDomainsToRow(telemetryRow, index) {
domains.forEach(function (domain) {
row[domain.name] = series.getDomainValue(index, domain.key);
telemetryRow[domain.name] = series.getDomainValue(index, domain.key);
});
}
function copyRangesToRow(row, index) {
function copyRangesToRow(telemetryRow, index) {
ranges.forEach(function (range) {
row[range.name] = series.getRangeValue(index, range.key);
telemetryRow[range.name] = series.getRangeValue(index, range.key);
});
}

View File

@ -22,12 +22,13 @@
/*global define*/
define([
'legacyRegistry',
'./ExportTelemetryAsCSVAction'
], function (legacyRegistry, ExportTelemetryAsCSVAction) {
], function (ExportTelemetryAsCSVAction) {
"use strict";
legacyRegistry.register("example/export", {
return {
name:"example/export",
definition: {
"name": "Example of using CSV Export",
"extensions": {
"actions": [
@ -37,9 +38,10 @@ define([
"implementation": ExportTelemetryAsCSVAction,
"category": "contextual",
"cssClass": "icon-download",
"depends": [ "exportService" ]
"depends": ["exportService"]
}
]
}
});
}
};
});

View File

@ -22,15 +22,15 @@
/*global define*/
define([
"./src/ExampleFormController",
'legacyRegistry'
"./src/ExampleFormController"
], function (
ExampleFormController,
legacyRegistry
ExampleFormController
) {
"use strict";
legacyRegistry.register("example/forms", {
return {
name:"example/forms",
definition: {
"name": "Declarative Forms example",
"sources": "src",
"extensions": {
@ -49,5 +49,6 @@ define([
}
]
}
});
}
};
});

View File

@ -52,7 +52,7 @@ define([
'period',
'offset',
'dataRateInHz',
'phase',
'phase'
];
request = request || {};

View File

@ -89,7 +89,7 @@ define([
WorkerInterface.prototype.subscribe = function (request, cb) {
function callback(message) {
cb(message.data);
};
}
var messageId = this.dispatch('subscribe', request, callback);

View File

@ -84,10 +84,10 @@
function onRequest(message) {
var request = message.data;
if (request.end == undefined) {
if (request.end === undefined) {
request.end = Date.now();
}
if (request.start == undefined){
if (request.start === undefined) {
request.start = request.end - FIFTEEN_MINUTES;
}

View File

@ -33,7 +33,7 @@ define([
GeneratorMetadataProvider
) {
return function(openmct){
return function (openmct) {
openmct.types.addType("example.state-generator", {
name: "State Generator",

View File

@ -22,15 +22,15 @@
/*global define*/
define([
"./src/ExampleIdentityService",
'legacyRegistry'
"./src/ExampleIdentityService"
], function (
ExampleIdentityService,
legacyRegistry
ExampleIdentityService
) {
"use strict";
legacyRegistry.register("example/identity", {
return {
name:"example/identity",
definition: {
"extensions": {
"components": [
{
@ -44,5 +44,6 @@ define([
}
]
}
});
}
};
});

View File

@ -22,7 +22,7 @@
define([
], function(
], function (
) {
function ImageryPlugin() {
@ -65,7 +65,7 @@ define([
callback(pointForTimestamp(Date.now(), domainObject.name));
}, 5000);
return function (interval) {
return function () {
clearInterval(interval);
};
}

View File

@ -21,16 +21,12 @@
*****************************************************************************/
/*global define*/
define([
'legacyRegistry'
], function (
legacyRegistry
) {
define([], function () {
"use strict";
legacyRegistry.register("example/mobile", {
return {
name:"example/mobile",
definition: {
"name": "Mobile",
"description": "Allows elements with pertinence to mobile usage and development",
"extensions": {
@ -41,5 +37,6 @@ define([
}
]
}
});
}
};
});

View File

@ -24,17 +24,16 @@
define([
"./src/RemsTelemetryServerAdapter",
"./src/RemsTelemetryModelProvider",
"./src/RemsTelemetryProvider",
'legacyRegistry',
"module"
"./src/RemsTelemetryProvider"
], function (
RemsTelemetryServerAdapter,
RemsTelemetryModelProvider,
RemsTelemetryProvider,
legacyRegistry
RemsTelemetryProvider
) {
"use strict";
legacyRegistry.register("example/msl", {
return {
name:"example/msl",
definition: {
"name" : "Mars Science Laboratory Data Adapter",
"extensions" : {
"types": [
@ -110,6 +109,7 @@ define([
}
]
}
});
}
};
});

View File

@ -22,7 +22,7 @@
/*global define*/
define(
function (){
function () {
"use strict";
var PREFIX = "msl_tlm:",
@ -32,20 +32,20 @@ define(
string: "string"
};
function RemsTelemetryModelProvider(adapter){
function RemsTelemetryModelProvider(adapter) {
function isRelevant(id) {
return id.indexOf(PREFIX) === 0;
}
function makeId(element){
function makeId(element) {
return PREFIX + element.identifier;
}
function buildTaxonomy(dictionary){
function buildTaxonomy(dictionary) {
var models = {};
function addMeasurement(measurement, parent){
function addMeasurement(measurement, parent) {
var format = FORMAT_MAPPINGS[measurement.type];
models[makeId(measurement)] = {
type: "msl.measurement",
@ -73,12 +73,12 @@ define(
location: spacecraftId,
composition: measurements.map(makeId)
};
measurements.forEach(function(measurement) {
measurements.forEach(function (measurement) {
addMeasurement(measurement, instrumentId);
});
}
(dictionary.instruments || []).forEach(function(instrument) {
(dictionary.instruments || []).forEach(function (instrument) {
addInstrument(instrument, "msl:curiosity");
});
return models;

View File

@ -72,10 +72,10 @@ define (
* This data source does not support real-time subscriptions
*/
RemsTelemetryProvider.prototype.subscribe = function (callback, requests) {
return function() {};
return function () {};
};
RemsTelemetryProvider.prototype.unsubscribe = function (callback, requests) {
return function() {};
return function () {};
};
return RemsTelemetryProvider;

View File

@ -54,7 +54,7 @@ define(
* @returns {number} A count of the number of data values available in
* this series
*/
RemsTelemetrySeries.prototype.getPointCount = function() {
RemsTelemetrySeries.prototype.getPointCount = function () {
return this.data.length;
};
/**
@ -64,7 +64,7 @@ define(
* @param index
* @returns {number} the time value in ms since 1 January 1970
*/
RemsTelemetrySeries.prototype.getDomainValue = function(index) {
RemsTelemetrySeries.prototype.getDomainValue = function (index) {
return this.data[index].date;
};
@ -75,7 +75,7 @@ define(
* value of.
* @returns {number} A floating point number
*/
RemsTelemetrySeries.prototype.getRangeValue = function(index) {
RemsTelemetrySeries.prototype.getRangeValue = function (index) {
return this.data[index].value;
};

View File

@ -68,18 +68,18 @@ define(
* given request ID.
* @private
*/
RemsTelemetryServerAdapter.prototype.requestHistory = function(request) {
RemsTelemetryServerAdapter.prototype.requestHistory = function (request) {
var self = this,
id = request.key;
var dataTransforms = this.dataTransforms;
function processResponse(response){
function processResponse(response) {
var data = [];
/*
* History data is organised by Sol. Iterate over sols...
*/
response.data.soles.forEach(function(solData){
response.data.soles.forEach(function (solData) {
/*
* Check that valid data exists
*/
@ -106,13 +106,13 @@ define(
//Filter results to match request parameters
function filterResults(results) {
return results.filter(function(result){
return results.filter(function (result) {
return result.date >= (request.start || Number.MIN_VALUE) &&
result.date <= (request.end || Number.MAX_VALUE);
});
}
function packageAndResolve(results){
function packageAndResolve(results) {
return {id: id, values: results};
}
@ -132,7 +132,7 @@ define(
* @param id The telemetry data point key to be queried.
* @returns {Promise | Array<RemsTelemetryValue>} that resolves with an Array of {@link RemsTelemetryValue} objects for the request data key.
*/
RemsTelemetryServerAdapter.prototype.history = function(request) {
RemsTelemetryServerAdapter.prototype.history = function (request) {
return this.requestHistory(request);
};

View File

@ -27,20 +27,20 @@ define([
"./src/DialogLaunchIndicator",
"./src/NotificationLaunchIndicator",
"./res/dialog-launch.html",
"./res/notification-launch.html",
'legacyRegistry'
"./res/notification-launch.html"
], function (
DialogLaunchController,
NotificationLaunchController,
DialogLaunchIndicator,
NotificationLaunchIndicator,
DialogLaunch,
NotificationLaunch,
legacyRegistry
NotificationLaunch
) {
"use strict";
legacyRegistry.register("example/notifications", {
return {
name:"example/notifications",
definition: {
"extensions": {
"templates": [
{
@ -86,5 +86,6 @@ define([
}
]
}
});
}
};
});

View File

@ -22,15 +22,15 @@
/*global define*/
define([
"./src/BrowserPersistenceProvider",
'legacyRegistry'
"./src/BrowserPersistenceProvider"
], function (
BrowserPersistenceProvider,
legacyRegistry
BrowserPersistenceProvider
) {
"use strict";
legacyRegistry.register("example/persistence", {
return {
name:"example/persistence",
definition: {
"extensions": {
"components": [
{
@ -50,5 +50,6 @@ define([
}
]
}
});
}
};
});

View File

@ -22,15 +22,15 @@
/*global define*/
define([
"./src/ExamplePolicy",
'legacyRegistry'
"./src/ExamplePolicy"
], function (
ExamplePolicy,
legacyRegistry
ExamplePolicy
) {
"use strict";
legacyRegistry.register("example/policy", {
return {
name:"example/policy",
definition: {
"name": "Example Policy",
"description": "Provides an example of using policies to prohibit actions.",
"extensions": {
@ -41,5 +41,6 @@ define([
}
]
}
});
}
};
});

View File

@ -23,16 +23,16 @@
define([
"./src/WatchIndicator",
"./src/DigestIndicator",
'legacyRegistry'
"./src/DigestIndicator"
], function (
WatchIndicator,
DigestIndicator,
legacyRegistry
DigestIndicator
) {
"use strict";
legacyRegistry.register("example/profiling", {
return {
name:"example/profiling",
definition: {
"extensions": {
"indicators": [
{
@ -51,5 +51,6 @@ define([
}
]
}
});
}
};
});

View File

@ -22,15 +22,15 @@
/*global define*/
define([
"./src/ScratchPersistenceProvider",
'legacyRegistry'
"./src/ScratchPersistenceProvider"
], function (
ScratchPersistenceProvider,
legacyRegistry
ScratchPersistenceProvider
) {
"use strict";
legacyRegistry.register("example/scratchpad", {
return {
name:"example/scratchpad",
definition: {
"extensions": {
"roots": [
{
@ -59,5 +59,6 @@ define([
}
]
}
});
}
};
});

View File

@ -1,10 +1,8 @@
import Vue from 'Vue';
import HelloWorld from './HelloWorld.vue';
function SimpleVuePlugin () {
function SimpleVuePlugin() {
return function install(openmct) {
var views = (openmct.mainViews || openmct.objectViews);
openmct.types.addType('hello-world', {
name: 'Hello World',
description: 'An introduction object',

View File

@ -8,8 +8,7 @@ define([
"./res/templates/glyphs.html",
"./res/templates/controls.html",
"./res/templates/input.html",
"./res/templates/menus.html",
'legacyRegistry'
"./res/templates/menus.html"
], function (
ExampleStyleGuideModelProvider,
MCTExample,
@ -20,10 +19,11 @@ define([
glyphsTemplate,
controlsTemplate,
inputTemplate,
menusTemplate,
legacyRegistry
menusTemplate
) {
legacyRegistry.register("example/styleguide", {
return {
name:"example/styleguide",
definition: {
"name": "Open MCT Style Guide",
"description": "Examples and documentation illustrating UI styles in use in Open MCT.",
"extensions":
@ -103,5 +103,6 @@ define([
}
]
}
});
}
};
});

View File

@ -30,14 +30,14 @@ define(
var pages = {};
// Add pages
pages['intro'] = { name: "Introduction", type: "styleguide.intro", location: "styleguide:home" };
pages['standards'] = { name: "Standards", type: "styleguide.standards", location: "styleguide:home" };
pages['colors'] = { name: "Colors", type: "styleguide.colors", location: "styleguide:home" };
pages['glyphs'] = { name: "Glyphs", type: "styleguide.glyphs", location: "styleguide:home" };
pages['status'] = { name: "Status Indication", type: "styleguide.status", location: "styleguide:home" };
pages['controls'] = { name: "Controls", type: "styleguide.controls", location: "styleguide:ui-elements" };
pages['input'] = { name: "Text Inputs", type: "styleguide.input", location: "styleguide:ui-elements" };
pages['menus'] = { name: "Menus", type: "styleguide.menus", location: "styleguide:ui-elements" };
pages.intro = { name: "Introduction", type: "styleguide.intro", location: "styleguide:home" };
pages.standards = { name: "Standards", type: "styleguide.standards", location: "styleguide:home" };
pages.colors = { name: "Colors", type: "styleguide.colors", location: "styleguide:home" };
pages.glyphs = { name: "Glyphs", type: "styleguide.glyphs", location: "styleguide:home" };
pages.status = { name: "Status Indication", type: "styleguide.status", location: "styleguide:home" };
pages.controls = { name: "Controls", type: "styleguide.controls", location: "styleguide:ui-elements" };
pages.input = { name: "Text Inputs", type: "styleguide.input", location: "styleguide:ui-elements" };
pages.menus = { name: "Menus", type: "styleguide.menus", location: "styleguide:ui-elements" };
return {
getModels: function () {

View File

@ -74,8 +74,8 @@
},
"scripts": {
"start": "node app.js",
"lint": "eslint platform src openmct.js",
"lint:fix": "eslint platform src openmct.js --fix",
"lint": "eslint platform example src openmct.js",
"lint:fix": "eslint platform example src openmct.js --fix",
"build:prod": "NODE_ENV=production webpack",
"build:dev": "webpack",
"build:watch": "webpack --watch",

View File

@ -31,8 +31,7 @@ define([
"./res/templates/license-apache.html",
"./res/templates/license-mit.html",
"./res/templates/licenses.html",
"./res/templates/licenses-export-md.html",
'legacyRegistry'
"./res/templates/licenses-export-md.html"
], function (
aboutDialogTemplate,
LogoController,
@ -44,11 +43,12 @@ define([
licenseApacheTemplate,
licenseMitTemplate,
licensesTemplate,
licensesExportMdTemplate,
legacyRegistry
licensesExportMdTemplate
) {
legacyRegistry.register("platform/commonUI/about", {
return {
name:"platform/commonUI/about",
definition: {
"name": "About Open MCT",
"extensions": {
"templates": [
@ -176,5 +176,6 @@ define([
}
]
}
});
}
};
});

View File

@ -32,8 +32,7 @@ define([
"./res/templates/menu-arrow.html",
"./res/templates/back-arrow.html",
"./res/templates/browse/object-properties.html",
"./res/templates/browse/inspector-region.html",
'legacyRegistry'
"./res/templates/browse/inspector-region.html"
], function (
NavigationService,
NavigateAction,
@ -46,11 +45,12 @@ define([
menuArrowTemplate,
backArrowTemplate,
objectPropertiesTemplate,
inspectorRegionTemplate,
legacyRegistry
inspectorRegionTemplate
) {
legacyRegistry.register("platform/commonUI/browse", {
return {
name:"platform/commonUI/browse",
definition: {
"extensions": {
"routes": [
],
@ -172,5 +172,6 @@ define([
}
]
}
});
}
};
});

View File

@ -30,8 +30,7 @@ define([
"./res/templates/message.html",
"./res/templates/notification-message.html",
"./res/templates/overlay-message-list.html",
"./res/templates/overlay.html",
'legacyRegistry'
"./res/templates/overlay.html"
], function (
DialogService,
OverlayService,
@ -42,11 +41,12 @@ define([
messageTemplate,
notificationMessageTemplate,
overlayMessageListTemplate,
overlayTemplate,
legacyRegistry
overlayTemplate
) {
legacyRegistry.register("platform/commonUI/dialog", {
return {
name:"platform/commonUI/dialog",
definition: {
"extensions": {
"services": [
{
@ -107,5 +107,6 @@ define([
}
]
}
});
}
};
});

View File

@ -48,8 +48,7 @@ define([
"./res/templates/library.html",
"./res/templates/edit-object.html",
"./res/templates/edit-action-buttons.html",
"./res/templates/topbar-edit.html",
'legacyRegistry'
"./res/templates/topbar-edit.html"
], function (
EditActionController,
EditPanesController,
@ -78,11 +77,11 @@ define([
libraryTemplate,
editObjectTemplate,
editActionButtonsTemplate,
topbarEditTemplate,
legacyRegistry
topbarEditTemplate
) {
legacyRegistry.register("platform/commonUI/edit", {
return {
name: "platform/commonUI/edit",
definition: {
"extensions": {
"controllers": [
{
@ -349,5 +348,6 @@ define([
}
]
}
});
}
};
});

View File

@ -23,16 +23,16 @@
define([
"./src/FormatProvider",
"./src/UTCTimeFormat",
"./src/DurationFormat",
'legacyRegistry'
"./src/DurationFormat"
], function (
FormatProvider,
UTCTimeFormat,
DurationFormat,
legacyRegistry
DurationFormat
) {
legacyRegistry.register("platform/commonUI/formats", {
return {
name:"platform/commonUI/formats",
definition: {
"name": "Format Registry",
"description": "Provides a registry for formats, which allow parsing and formatting of values.",
"extensions": {
@ -74,5 +74,6 @@ define([
}
]
}
});
}
};
});

View File

@ -66,8 +66,7 @@ define([
"./res/templates/object-inspector.html",
"./res/templates/controls/selector.html",
"./res/templates/controls/datetime-picker.html",
"./res/templates/controls/datetime-field.html",
'legacyRegistry'
"./res/templates/controls/datetime-field.html"
], function (
UrlService,
PopupService,
@ -114,11 +113,12 @@ define([
objectInspectorTemplate,
selectorTemplate,
datetimePickerTemplate,
datetimeFieldTemplate,
legacyRegistry
datetimeFieldTemplate
) {
legacyRegistry.register("platform/commonUI/general", {
return {
name:"platform/commonUI/general",
definition: {
"name": "General UI elements",
"description": "General UI elements, meant to be reused across modes",
"resources": "res",
@ -524,5 +524,6 @@ define([
}
]
}
});
}
};
});

View File

@ -27,8 +27,7 @@ define([
"./res/info-table.html",
"./res/info-bubble.html",
"./res/bubble.html",
"./res/templates/info-button.html",
'legacyRegistry'
"./res/templates/info-button.html"
], function (
InfoGesture,
InfoButtonGesture,
@ -36,11 +35,12 @@ define([
infoTableTemplate,
infoBubbleTemplate,
bubbleTemplate,
infoButtonTemplate,
legacyRegistry
infoButtonTemplate
) {
legacyRegistry.register("platform/commonUI/inspect", {
return {
name:"platform/commonUI/inspect",
definition: {
"extensions": {
"templates": [
{
@ -112,5 +112,6 @@ define([
}
]
}
});
}
};
});

View File

@ -23,16 +23,16 @@
define([
"./src/MCTDevice",
"./src/AgentService",
"./src/DeviceClassifier",
'legacyRegistry'
"./src/DeviceClassifier"
], function (
MCTDevice,
AgentService,
DeviceClassifier,
legacyRegistry
DeviceClassifier
) {
legacyRegistry.register("platform/commonUI/mobile", {
return {
name:"platform/commonUI/mobile",
definition: {
"extensions": {
"directives": [
{
@ -62,5 +62,6 @@ define([
}
]
}
});
}
};
});

View File

@ -24,17 +24,17 @@ define([
"./src/NotificationIndicatorController",
"./src/NotificationIndicator",
"./src/NotificationService",
"./res/notification-indicator.html",
'legacyRegistry'
"./res/notification-indicator.html"
], function (
NotificationIndicatorController,
NotificationIndicator,
NotificationService,
notificationIndicatorTemplate,
legacyRegistry
notificationIndicatorTemplate
) {
legacyRegistry.register("platform/commonUI/notification", {
return {
name:"platform/commonUI/notification",
definition: {
"extensions": {
"templates": [
{
@ -71,5 +71,6 @@ define([
}
]
}
});
}
};
});

View File

@ -22,15 +22,15 @@
define([
'./src/InspectorController',
'./src/EditableRegionPolicy',
'legacyRegistry'
'./src/EditableRegionPolicy'
], function (
InspectorController,
EditableRegionPolicy,
legacyRegistry
EditableRegionPolicy
) {
legacyRegistry.register("platform/commonUI/regions", {
return {
name:"platform/commonUI/regions",
definition: {
"extensions": {
"controllers": [
{
@ -50,5 +50,6 @@ define([
}
]
}
});
}
};
});

View File

@ -25,18 +25,18 @@ define([
"./src/CompositionMutabilityPolicy",
"./src/CompositionModelPolicy",
"./src/ComposeActionPolicy",
"./src/PersistableCompositionPolicy",
'legacyRegistry'
"./src/PersistableCompositionPolicy"
], function (
CompositionPolicy,
CompositionMutabilityPolicy,
CompositionModelPolicy,
ComposeActionPolicy,
PersistableCompositionPolicy,
legacyRegistry
PersistableCompositionPolicy
) {
legacyRegistry.register("platform/containment", {
return {
name:"platform/containment",
definition: {
"extensions": {
"policies": [
{
@ -71,5 +71,6 @@ define([
}
]
}
});
}
};
});

View File

@ -49,8 +49,7 @@ define([
"./src/services/Now",
"./src/services/Throttle",
"./src/services/Topic",
"./src/services/Instantiate",
'legacyRegistry'
"./src/services/Instantiate"
], function (
DomainObjectProvider,
CoreCapabilityProvider,
@ -80,11 +79,12 @@ define([
Now,
Throttle,
Topic,
Instantiate,
legacyRegistry
Instantiate
) {
legacyRegistry.register("platform/core", {
return {
name:"platform/core",
definition: {
"name": "Open MCT Core",
"description": "Defines core concepts of Open MCT.",
"sources": "src",
@ -387,5 +387,6 @@ define([
}
]
}
});
}
};
});

View File

@ -34,8 +34,7 @@ define([
"./src/services/MoveService",
"./src/services/LinkService",
"./src/services/CopyService",
"./src/services/LocationService",
'legacyRegistry'
"./src/services/LocationService"
], function (
MoveAction,
CopyAction,
@ -50,11 +49,12 @@ define([
MoveService,
LinkService,
CopyService,
LocationService,
legacyRegistry
LocationService
) {
legacyRegistry.register("platform/entanglement", {
return {
name:"platform/entanglement",
definition: {
"name": "Entanglement",
"description": "Tools to assist you in entangling the world of WARP.",
"configuration": {},
@ -197,5 +197,6 @@ define([
],
"licenses": []
}
});
}
};
});

View File

@ -21,14 +21,14 @@
*****************************************************************************/
define([
"./src/WorkerService",
'legacyRegistry'
"./src/WorkerService"
], function (
WorkerService,
legacyRegistry
WorkerService
) {
legacyRegistry.register("platform/execution", {
return {
name:"platform/execution",
definition: {
"extensions": {
"services": [
{
@ -41,5 +41,6 @@ define([
}
]
}
});
}
};
});

View File

@ -22,11 +22,12 @@
define([
"./ExportService",
"saveAs",
"legacyRegistry"
], function (ExportService, saveAs, legacyRegistry) {
"saveAs"
], function (ExportService, saveAs) {
legacyRegistry.register("platform/exporters", {
return {
name:"platform/exporters",
definition: {
extensions: {
services: [
{
@ -59,5 +60,6 @@ define([
}
]
}
});
}
};
});

View File

@ -35,8 +35,7 @@ define([
"./src/actions/StopTimerAction",
"./src/actions/PauseTimerAction",
"./res/templates/clock.html",
"./res/templates/timer.html",
'legacyRegistry'
"./res/templates/timer.html"
], function (
MomentTimezone,
ClockIndicator,
@ -52,10 +51,11 @@ define([
StopTimerAction,
PauseTimerAction,
clockTemplate,
timerTemplate,
legacyRegistry
timerTemplate
) {
legacyRegistry.register("platform/features/clock", {
return {
name:"platform/features/clock",
definition: {
"name": "Clocks/Timers",
"descriptions": "Domain objects for displaying current & relative times.",
"configuration": {
@ -316,5 +316,6 @@ define([
}
]
}
});
}
};
});

View File

@ -22,14 +22,14 @@
define([
'./src/HyperlinkController',
'legacyRegistry',
'./res/templates/hyperlink.html'
], function (
HyperlinkController,
legacyRegistry,
hyperlinkTemplate
) {
legacyRegistry.register("platform/features/hyperlink", {
return {
name:"platform/features/hyperlink",
definition: {
"name": "Hyperlink",
"description": "Insert a hyperlink to reference a link",
"extensions": {
@ -115,5 +115,6 @@ define([
}
]
}
});
}
};
});

View File

@ -24,17 +24,17 @@ define([
"./src/policies/ImageryViewPolicy",
"./src/controllers/ImageryController",
"./src/directives/MCTBackgroundImage",
"./res/templates/imagery.html",
'legacyRegistry'
"./res/templates/imagery.html"
], function (
ImageryViewPolicy,
ImageryController,
MCTBackgroundImage,
imageryTemplate,
legacyRegistry
imageryTemplate
) {
legacyRegistry.register("platform/features/imagery", {
return {
name:"platform/features/imagery",
definition: {
"name": "Plot view for telemetry",
"extensions": {
"views": [
@ -81,5 +81,6 @@ define([
}
]
}
});
}
};
});

View File

@ -20,13 +20,10 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
'legacyRegistry'
], function (
legacyRegistry
) {
legacyRegistry.register("platform/features/my-items", {
define([], function () {
return {
name:"platform/features/my-items",
definition: {
"name": "My Items",
"description": "Defines a root named My Items",
"extensions": {
@ -47,5 +44,6 @@ define([
}
]
}
});
}
};
});

View File

@ -22,15 +22,15 @@
define([
"./src/EmbeddedPageController",
"./res/iframe.html",
'legacyRegistry'
"./res/iframe.html"
], function (
EmbeddedPageController,
iframeTemplate,
legacyRegistry
iframeTemplate
) {
legacyRegistry.register("platform/features/pages", {
return {
name:"platform/features/pages",
definition: {
"extensions": {
"types": [
{
@ -72,5 +72,6 @@ define([
}
]
}
});
}
};
});

View File

@ -22,15 +22,14 @@
define([
"./res/markup.html",
'legacyRegistry'
"./res/markup.html"
], function (
markupTemplate,
legacyRegistry
markupTemplate
) {
legacyRegistry.register("platform/features/static-markup", {
return {
name:"platform/features/static-markup",
definition: {
"extensions": {
"types": [
{
@ -52,5 +51,6 @@ define([
}
]
}
});
}
};
});

View File

@ -21,13 +21,13 @@
*****************************************************************************/
define([
"./res/templates/deprecated-timeline-message.html",
'legacyRegistry'
"./res/templates/deprecated-timeline-message.html"
], function (
deprecatedTimelineMessage,
legacyRegistry
deprecatedTimelineMessage
) {
legacyRegistry.register('platform/features/timeline', {
return {
name: 'platform/features/timeline',
definition: {
extensions: {
types: [
{
@ -47,5 +47,6 @@ define([
}
]
}
});
}
};
});

View File

@ -45,8 +45,7 @@ define([
"./res/templates/controls/dialog.html",
"./res/templates/controls/radio.html",
"./res/templates/controls/file-input.html",
"./res/templates/controls/snap-view.html",
'legacyRegistry'
"./res/templates/controls/snap-view.html"
], function (
MCTForm,
MCTControl,
@ -72,11 +71,12 @@ define([
dialogTemplate,
radioTemplate,
fileInputTemplate,
snapViewTemplate,
legacyRegistry
snapViewTemplate
) {
legacyRegistry.register("platform/forms", {
return {
name:"platform/forms",
definition: {
"name": "MCT Forms",
"description": "Form generator; includes directive and some controls.",
"extensions": {
@ -213,5 +213,6 @@ define([
]
}
});
}
};
});

View File

@ -20,15 +20,11 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
define([], function () {
'legacyRegistry'
], function (
legacyRegistry
) {
legacyRegistry.register("platform/framework", {
return {
name:"platform/framework",
definition: {
"name": "Open MCT Framework Component",
"description": "Framework layer for Open MCT; interprets bundle definitions and serves as an intermediary between Require and Angular",
"libraries": "lib",
@ -106,5 +102,6 @@ define([
}
]
}
});
}
};
});

View File

@ -24,17 +24,17 @@ define([
"./src/IdentityAggregator",
"./src/IdentityProvider",
"./src/IdentityCreationDecorator",
"./src/IdentityIndicator",
'legacyRegistry'
"./src/IdentityIndicator"
], function (
IdentityAggregator,
IdentityProvider,
IdentityCreationDecorator,
IdentityIndicator,
legacyRegistry
IdentityIndicator
) {
legacyRegistry.register("platform/identity", {
return {
name:"platform/identity",
definition: {
"extensions": {
"components": [
{
@ -82,5 +82,6 @@ define([
}
]
}
});
}
};
});

View File

@ -21,14 +21,14 @@
*****************************************************************************/
define([
"./src/PersistenceAggregator",
'legacyRegistry'
"./src/PersistenceAggregator"
], function (
PersistenceAggregator,
legacyRegistry
PersistenceAggregator
) {
legacyRegistry.register("platform/persistence/aggregator", {
return {
name:"platform/persistence/aggregator",
definition: {
"extensions": {
"components": [
{
@ -41,5 +41,6 @@ define([
}
]
}
});
}
};
});

View File

@ -22,15 +22,15 @@
define([
"./src/CouchPersistenceProvider",
"./src/CouchIndicator",
'legacyRegistry'
"./src/CouchIndicator"
], function (
CouchPersistenceProvider,
CouchIndicator,
legacyRegistry
CouchIndicator
) {
legacyRegistry.register("platform/persistence/couch", {
return {
name:"platform/persistence/couch",
definition: {
"name": "Couch Persistence",
"description": "Adapter to read and write objects using a CouchDB instance.",
"extensions": {
@ -73,5 +73,6 @@ define([
}
]
}
});
}
};
});

View File

@ -23,16 +23,16 @@
define([
"./src/ElasticPersistenceProvider",
"./src/ElasticSearchProvider",
"./src/ElasticIndicator",
'legacyRegistry'
"./src/ElasticIndicator"
], function (
ElasticPersistenceProvider,
ElasticSearchProvider,
ElasticIndicator,
legacyRegistry
ElasticIndicator
) {
legacyRegistry.register("platform/persistence/elastic", {
return {
name:"platform/persistence/elastic",
definition: {
"name": "ElasticSearch Persistence",
"description": "Adapter to read and write objects using an ElasticSearch instance.",
"extensions": {
@ -92,5 +92,6 @@ define([
}
]
}
});
}
};
});

View File

@ -22,15 +22,15 @@
define([
"./src/LocalStoragePersistenceProvider",
"./src/LocalStorageIndicator",
'legacyRegistry'
"./src/LocalStorageIndicator"
], function (
LocalStoragePersistenceProvider,
LocalStorageIndicator,
legacyRegistry
LocalStorageIndicator
) {
legacyRegistry.register("platform/persistence/local", {
return {
name:"platform/persistence/local",
definition: {
"extensions": {
"components": [
{
@ -56,5 +56,6 @@ define([
}
]
}
});
}
};
});

View File

@ -24,17 +24,17 @@ define([
"./src/QueuingPersistenceCapabilityDecorator",
"./src/PersistenceQueue",
"./src/PersistenceFailureController",
"./res/templates/persistence-failure-dialog.html",
'legacyRegistry'
"./res/templates/persistence-failure-dialog.html"
], function (
QueuingPersistenceCapabilityDecorator,
PersistenceQueue,
PersistenceFailureController,
persistenceFailureDialogTemplate,
legacyRegistry
persistenceFailureDialogTemplate
) {
legacyRegistry.register("platform/persistence/queue", {
return {
name:"platform/persistence/queue",
definition: {
"extensions": {
"components": [
{
@ -77,5 +77,6 @@ define([
}
]
}
});
}
};
});

View File

@ -23,16 +23,16 @@
define([
"./src/PolicyActionDecorator",
"./src/PolicyViewDecorator",
"./src/PolicyProvider",
'legacyRegistry'
"./src/PolicyProvider"
], function (
PolicyActionDecorator,
PolicyViewDecorator,
PolicyProvider,
legacyRegistry
PolicyProvider
) {
legacyRegistry.register("platform/policy", {
return {
name:"platform/policy",
definition: {
"name": "Policy Service",
"description": "Provides support for extension-driven decisions.",
"sources": "src",
@ -64,5 +64,6 @@ define([
}
]
}
});
}
};
});

View File

@ -29,8 +29,7 @@ define([
"./src/gestures/GestureRepresenter",
"./src/services/DndService",
"./src/TemplateLinker",
"./src/TemplatePrefetcher",
'legacyRegistry'
"./src/TemplatePrefetcher"
], function (
MCTInclude,
MCTRepresentation,
@ -40,11 +39,12 @@ define([
GestureRepresenter,
DndService,
TemplateLinker,
TemplatePrefetcher,
legacyRegistry
TemplatePrefetcher
) {
legacyRegistry.register("platform/representation", {
return {
name:"platform/representation",
definition: {
"extensions": {
"directives": [
{
@ -139,5 +139,6 @@ define([
}
]
}
});
}
};
});

View File

@ -29,8 +29,7 @@ define([
"./res/templates/search.html",
"./res/templates/search-menu.html",
"raw-loader!./src/services/GenericSearchWorker.js",
"raw-loader!./src/services/BareBonesSearchWorker.js",
'legacyRegistry'
"raw-loader!./src/services/BareBonesSearchWorker.js"
], function (
SearchController,
SearchMenuController,
@ -40,11 +39,12 @@ define([
searchTemplate,
searchMenuTemplate,
searchWorkerText,
BareBonesSearchWorkerText,
legacyRegistry
BareBonesSearchWorkerText
) {
legacyRegistry.register("platform/search", {
return {
name:"platform/search",
definition: {
"name": "Search",
"description": "Allows the user to search through the file tree.",
"extensions": {
@ -133,5 +133,6 @@ define([
}
]
}
});
}
};
});

View File

@ -23,16 +23,16 @@
define([
"./src/StatusRepresenter",
"./src/StatusCapability",
"./src/StatusService",
'legacyRegistry'
"./src/StatusService"
], function (
StatusRepresenter,
StatusCapability,
StatusService,
legacyRegistry
StatusService
) {
legacyRegistry.register("platform/status", {
return {
name:"platform/status",
definition: {
"extensions": {
"representers": [
{
@ -58,5 +58,6 @@ define([
}
]
}
});
}
};
});

View File

@ -26,19 +26,19 @@ define([
"./src/TelemetryCapability",
"./src/TelemetryFormatter",
"./src/TelemetrySubscriber",
"./src/TelemetryHandler",
'legacyRegistry'
"./src/TelemetryHandler"
], function (
TelemetryAggregator,
TelemetryController,
TelemetryCapability,
TelemetryFormatter,
TelemetrySubscriber,
TelemetryHandler,
legacyRegistry
TelemetryHandler
) {
legacyRegistry.register("platform/telemetry", {
return {
name:"platform/telemetry",
definition: {
"name": "Data bundle",
"description": "Interfaces and infrastructure for real-time and historical data",
"configuration": {
@ -125,5 +125,6 @@ define([
}
]
}
});
}
};
});

View File

@ -22,9 +22,9 @@
define([
'EventEmitter',
'legacyRegistry',
'uuid',
'./defaultRegistry',
'./BundleRegistry',
'./installDefaultBundles',
'./api/api',
'./api/overlays/OverlayAPI',
'./selection/Selection',
@ -50,9 +50,9 @@ define([
'vue'
], function (
EventEmitter,
legacyRegistry,
uuid,
defaultRegistry,
BundleRegistry,
installDefaultBundles,
api,
OverlayAPI,
Selection,
@ -248,7 +248,8 @@ define([
this.branding = BrandingAPI.default;
this.legacyRegistry = defaultRegistry;
this.legacyRegistry = new BundleRegistry();
installDefaultBundles(this.legacyRegistry);
// Plugin's that are installed by default
@ -258,7 +259,6 @@ define([
this.install(LegacyIndicatorsPlugin());
this.install(LicensesPlugin.default());
this.install(RemoveActionPlugin.default());
this.install(this.plugins.ImportExport());
this.install(this.plugins.FolderView());
this.install(this.plugins.Tabs());
this.install(this.plugins.FlexibleLayout());
@ -361,8 +361,8 @@ define([
this.legacyExtension('types', legacyDefinition);
}.bind(this));
legacyRegistry.register('adapter', this.legacyBundle);
legacyRegistry.enable('adapter');
this.legacyRegistry.register('adapter', this.legacyBundle);
this.legacyRegistry.enable('adapter');
this.router.route(/^\/$/, () => {
this.router.setPath('/browse/');

View File

@ -21,7 +21,6 @@
*****************************************************************************/
define([
'legacyRegistry',
'./actions/ActionDialogDecorator',
'./capabilities/AdapterCapability',
'./directives/MCTView',
@ -39,7 +38,6 @@ define([
'./policies/LegacyCompositionPolicyAdapter',
'./actions/LegacyActionAdapter'
], function (
legacyRegistry,
ActionDialogDecorator,
AdapterCapability,
MCTView,
@ -57,7 +55,9 @@ define([
legacyCompositionPolicyAdapter,
LegacyActionAdapter
) {
legacyRegistry.register('src/adapter', {
return {
name: 'src/adapter',
definition: {
"extensions": {
"directives": [
{
@ -213,5 +213,6 @@ define([
}
]
}
});
}
}
});

View File

@ -19,10 +19,41 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
const DEFAULTS = [
'src/adapter',
'platform/framework',
'platform/core',
'platform/representation',
'platform/commonUI/about',
'platform/commonUI/browse',
'platform/commonUI/edit',
'platform/commonUI/dialog',
'platform/commonUI/formats',
'platform/commonUI/general',
'platform/commonUI/inspect',
'platform/commonUI/mobile',
'platform/commonUI/notification',
'platform/containment',
'platform/execution',
'platform/exporters',
'platform/telemetry',
'platform/features/clock',
'platform/features/imagery',
'platform/features/pages',
'platform/features/hyperlink',
'platform/features/timeline',
'platform/forms',
'platform/identity',
'platform/persistence/aggregator',
'platform/persistence/queue',
'platform/policy',
'platform/entanglement',
'platform/search',
'platform/status',
'platform/commonUI/regions'
];
define([
'legacyRegistry',
'../src/adapter/bundle',
'../example/eventGenerator/bundle',
@ -74,45 +105,23 @@ define([
'../platform/search/bundle',
'../platform/status/bundle',
'../platform/telemetry/bundle'
], function (legacyRegistry) {
], function () {
const LEGACY_BUNDLES = Array.from(arguments);
var DEFAULTS = [
'src/adapter',
'platform/framework',
'platform/core',
'platform/representation',
'platform/commonUI/about',
'platform/commonUI/browse',
'platform/commonUI/edit',
'platform/commonUI/dialog',
'platform/commonUI/formats',
'platform/commonUI/general',
'platform/commonUI/inspect',
'platform/commonUI/mobile',
'platform/commonUI/notification',
'platform/containment',
'platform/execution',
'platform/exporters',
'platform/telemetry',
'platform/features/clock',
'platform/features/imagery',
'platform/features/pages',
'platform/features/hyperlink',
'platform/features/timeline',
'platform/forms',
'platform/identity',
'platform/persistence/aggregator',
'platform/persistence/queue',
'platform/policy',
'platform/entanglement',
'platform/search',
'platform/status',
'platform/commonUI/regions'
];
return function installDefaultBundles(bundleRegistry) {
registerLegacyBundles(LEGACY_BUNDLES);
enableDefaultBundles();
DEFAULTS.forEach(function (bundlePath) {
legacyRegistry.enable(bundlePath);
function registerLegacyBundles(bundles) {
bundles.forEach((bundle, i) => {
bundleRegistry.register(bundle.name, bundle.definition);
});
}
return legacyRegistry;
function enableDefaultBundles() {
DEFAULTS.forEach(function (bundlePath) {
bundleRegistry.enable(bundlePath);
});
}
}
});

View File

@ -822,6 +822,7 @@ export default {
this.filterChanged = _.debounce(this.filterChanged, 500);
},
mounted() {
console.log("Table mounted");
this.csvExporter = new CSVExporter();
this.rowsAdded = _.throttle(this.rowsAdded, 200);
this.rowsRemoved = _.throttle(this.rowsRemoved, 200);

View File

@ -0,0 +1,145 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
import TablePlugin from './plugin.js';
import Vue from 'vue';
import {
createOpenMct,
createMouseEvent
} from 'testTools';
let openmct;
let tablePlugin;
let element;
let child;
describe("the plugin", () => {
beforeEach((done) => {
const appHolder = document.createElement('div');
appHolder.style.width = '640px';
appHolder.style.height = '480px';
openmct = createOpenMct();
element = document.createElement('div');
child = document.createElement('div');
element.appendChild(child);
tablePlugin = new TablePlugin();
openmct.install(tablePlugin);
spyOn(openmct.telemetry, 'request').and.returnValue(Promise.resolve([]));
openmct.on('start', done);
openmct.start(appHolder);
});
it("provides a table view for objects with telemetry", () => {
const testTelemetryObject = {
id:"test-object",
type: "test-object",
telemetry: {
values: [{
key: "some-key"
}]
}
};
const applicableViews = openmct.objectViews.get(testTelemetryObject);
let tableView = applicableViews.find((viewProvider) => viewProvider.key === 'table');
expect(tableView).toBeDefined();
});
describe("The table view", () => {
let testTelemetryObject;
let applicableViews;
let tableViewProvider;
let tableView;
beforeEach(() => {
testTelemetryObject = {
identifier:{ namespace: "", key: "test-object"},
type: "test-object",
name: "Test Object",
telemetry: {
values: [{
key: "some-key",
name: "Some attribute",
hints: {
domain: 1
}
}, {
key: "some-other-key",
name: "Another attribute",
hints: {
range: 1
}
}]
}
};
applicableViews = openmct.objectViews.get(testTelemetryObject);
tableViewProvider = applicableViews.find((viewProvider) => viewProvider.key === 'table');
tableView = tableViewProvider.view(testTelemetryObject, true, [testTelemetryObject]);
tableView.show(child, true);
return Vue.nextTick();
});
it("Renders a column for every item in telemetry metadata",() => {
let headers = element.querySelectorAll('span.c-telemetry-table__headers__label');
expect(headers.length).toBe(2);
expect(headers[0].innerText).toBe('Some attribute');
expect(headers[1].innerText).toBe('Another attribute');
});
it("Supports column reordering via drag and drop",() => {
let columns = element.querySelectorAll('tr.c-telemetry-table__headers__labels th');
let fromColumn = columns[0];
let toColumn = columns[1];
let fromColumnText = fromColumn.querySelector('span.c-telemetry-table__headers__label').innerText;
let toColumnText = toColumn.querySelector('span.c-telemetry-table__headers__label').innerText;
let dragStartEvent = createMouseEvent('dragstart');
let dragOverEvent = createMouseEvent('dragover');
let dropEvent = createMouseEvent('drop');
dragStartEvent.dataTransfer =
dragOverEvent.dataTransfer =
dropEvent.dataTransfer = new DataTransfer();
fromColumn.dispatchEvent(dragStartEvent);
toColumn.dispatchEvent(dragOverEvent);
toColumn.dispatchEvent(dropEvent);
return Vue.nextTick().then(() => {
columns = element.querySelectorAll('tr.c-telemetry-table__headers__labels th');
let firstColumn = columns[0];
let secondColumn = columns[1];
let firstColumnText = firstColumn.querySelector('span.c-telemetry-table__headers__label').innerText;
let secondColumnText = secondColumn.querySelector('span.c-telemetry-table__headers__label').innerText;
expect(fromColumnText).not.toEqual(firstColumnText);
expect(fromColumnText).toEqual(secondColumnText);
expect(toColumnText).not.toEqual(secondColumnText);
expect(toColumnText).toEqual(firstColumnText);
});
});
});
});

18
src/testTools.js Normal file
View File

@ -0,0 +1,18 @@
import MCT from 'MCT';
export function createOpenMct() {
const openmct = new MCT();
openmct.install(openmct.plugins.LocalStorage());
openmct.install(openmct.plugins.UTCTimeSystem());
openmct.time.timeSystem('utc', {start: 0, end: 1});
return openmct;
}
export function createMouseEvent(eventName) {
return new MouseEvent(eventName, {
bubbles: true,
cancelable: true,
view: window
});
}

View File

@ -37,7 +37,9 @@ const webpackConfig = {
"vue": path.join(__dirname, "node_modules/vue/dist/vue.js"),
"d3-scale": path.join(__dirname, "node_modules/d3-scale/build/d3-scale.min.js"),
"printj": path.join(__dirname, "node_modules/printj/dist/printj.min.js"),
"styles": path.join(__dirname, "src/styles")
"styles": path.join(__dirname, "src/styles"),
"MCT": path.join(__dirname, "src/MCT"),
"testTools": path.join(__dirname, "src/testTools.js")
}
},
devtool: devMode ? 'eval-source-map' : 'source-map',