mirror of
https://github.com/nasa/openmct.git
synced 2025-06-25 18:50:11 +00:00
Compare commits
2 Commits
v4.0.0-rc3
...
remove-ang
Author | SHA1 | Date | |
---|---|---|---|
cf5ef9fa60 | |||
756e5d301e |
48
src/MCT.js
48
src/MCT.js
@ -284,6 +284,7 @@ define([
|
|||||||
this.install(this.plugins.ViewDatumAction());
|
this.install(this.plugins.ViewDatumAction());
|
||||||
this.install(this.plugins.ObjectInterceptors());
|
this.install(this.plugins.ObjectInterceptors());
|
||||||
this.install(this.plugins.NonEditableFolder());
|
this.install(this.plugins.NonEditableFolder());
|
||||||
|
this.install(this.plugins.Devices());
|
||||||
}
|
}
|
||||||
|
|
||||||
MCT.prototype = Object.create(EventEmitter.prototype);
|
MCT.prototype = Object.create(EventEmitter.prototype);
|
||||||
@ -403,39 +404,24 @@ define([
|
|||||||
this.router.setPath('/browse/');
|
this.router.setPath('/browse/');
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
if (!isHeadlessMode) {
|
||||||
* Fired by [MCT]{@link module:openmct.MCT} when the application
|
const appLayout = new Vue({
|
||||||
* is started.
|
components: {
|
||||||
* @event start
|
'Layout': Layout.default
|
||||||
* @memberof module:openmct.MCT~
|
},
|
||||||
*/
|
provide: {
|
||||||
const startPromise = new Main();
|
openmct: this
|
||||||
startPromise.run(this)
|
},
|
||||||
.then(function (angular) {
|
template: '<Layout ref="layout"></Layout>'
|
||||||
this.$angular = angular;
|
});
|
||||||
// OpenMCT Object provider doesn't operate properly unless
|
domElement.appendChild(appLayout.$mount().$el);
|
||||||
// something has depended upon objectService. Cool, right?
|
|
||||||
this.$injector.get('objectService');
|
|
||||||
|
|
||||||
if (!isHeadlessMode) {
|
this.layout = appLayout.$refs.layout;
|
||||||
const appLayout = new Vue({
|
Browse(this);
|
||||||
components: {
|
}
|
||||||
'Layout': Layout.default
|
|
||||||
},
|
|
||||||
provide: {
|
|
||||||
openmct: this
|
|
||||||
},
|
|
||||||
template: '<Layout ref="layout"></Layout>'
|
|
||||||
});
|
|
||||||
domElement.appendChild(appLayout.$mount().$el);
|
|
||||||
|
|
||||||
this.layout = appLayout.$refs.layout;
|
this.router.start();
|
||||||
Browse(this);
|
this.emit('start');
|
||||||
}
|
|
||||||
|
|
||||||
this.router.start();
|
|
||||||
this.emit('start');
|
|
||||||
}.bind(this));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
MCT.prototype.startHeadless = function () {
|
MCT.prototype.startHeadless = function () {
|
||||||
|
@ -38,9 +38,6 @@ function ObjectAPI(typeRegistry, openmct) {
|
|||||||
this.eventEmitter = new EventEmitter();
|
this.eventEmitter = new EventEmitter();
|
||||||
this.providers = {};
|
this.providers = {};
|
||||||
this.rootRegistry = new RootRegistry();
|
this.rootRegistry = new RootRegistry();
|
||||||
this.injectIdentifierService = function () {
|
|
||||||
this.identifierService = openmct.$injector.get("identifierService");
|
|
||||||
};
|
|
||||||
|
|
||||||
this.rootProvider = new RootObjectProvider(this.rootRegistry);
|
this.rootProvider = new RootObjectProvider(this.rootRegistry);
|
||||||
this.cache = {};
|
this.cache = {};
|
||||||
@ -55,33 +52,16 @@ ObjectAPI.prototype.supersecretSetFallbackProvider = function (p) {
|
|||||||
this.fallbackProvider = p;
|
this.fallbackProvider = p;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
ObjectAPI.prototype.getIdentifierService = function () {
|
|
||||||
// Lazily acquire identifier service
|
|
||||||
if (!this.identifierService) {
|
|
||||||
this.injectIdentifierService();
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.identifierService;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the provider for a given identifier.
|
* Retrieve the provider for a given identifier.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ObjectAPI.prototype.getProvider = function (identifier) {
|
ObjectAPI.prototype.getProvider = function (identifier) {
|
||||||
//handles the '' vs 'mct' namespace issue
|
|
||||||
const keyString = utils.makeKeyString(identifier);
|
|
||||||
const identifierService = this.getIdentifierService();
|
|
||||||
const namespace = identifierService.parse(keyString).getSpace();
|
|
||||||
|
|
||||||
if (identifier.key === 'ROOT') {
|
if (identifier.key === 'ROOT') {
|
||||||
return this.rootProvider;
|
return this.rootProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.providers[namespace] || this.fallbackProvider;
|
return this.providers[identifier.namespace] || this.fallbackProvider;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,11 +116,9 @@ define([
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
DefaultMetadataProvider.prototype.typeHasTelemetry = function (domainObject) {
|
DefaultMetadataProvider.prototype.typeHasTelemetry = function (domainObject) {
|
||||||
if (!this.typeService) {
|
const type = this.openmct.types.get(domainObject.type);
|
||||||
this.typeService = this.openmct.$injector.get('typeService');
|
|
||||||
}
|
|
||||||
|
|
||||||
return Boolean(this.typeService.getType(domainObject.type).typeDef.telemetry);
|
return Boolean(type.definition.telemetry);
|
||||||
};
|
};
|
||||||
|
|
||||||
return DefaultMetadataProvider;
|
return DefaultMetadataProvider;
|
||||||
|
@ -142,6 +142,8 @@ define([
|
|||||||
this.metadataCache = new WeakMap();
|
this.metadataCache = new WeakMap();
|
||||||
this.formatMapCache = new WeakMap();
|
this.formatMapCache = new WeakMap();
|
||||||
this.valueFormatterCache = new WeakMap();
|
this.valueFormatterCache = new WeakMap();
|
||||||
|
|
||||||
|
this.formatters = new Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -413,17 +415,6 @@ define([
|
|||||||
return _.sortBy(options, sortKeys);
|
return _.sortBy(options, sortKeys);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
TelemetryAPI.prototype.getFormatService = function () {
|
|
||||||
if (!this.formatService) {
|
|
||||||
this.formatService = this.openmct.$injector.get('formatService');
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.formatService;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a value formatter for a given valueMetadata.
|
* Get a value formatter for a given valueMetadata.
|
||||||
*
|
*
|
||||||
@ -433,7 +424,7 @@ define([
|
|||||||
if (!this.valueFormatterCache.has(valueMetadata)) {
|
if (!this.valueFormatterCache.has(valueMetadata)) {
|
||||||
this.valueFormatterCache.set(
|
this.valueFormatterCache.set(
|
||||||
valueMetadata,
|
valueMetadata,
|
||||||
new TelemetryValueFormatter(valueMetadata, this.getFormatService())
|
new TelemetryValueFormatter(valueMetadata, this.formatters)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,9 +438,11 @@ define([
|
|||||||
* @returns {Format}
|
* @returns {Format}
|
||||||
*/
|
*/
|
||||||
TelemetryAPI.prototype.getFormatter = function (key) {
|
TelemetryAPI.prototype.getFormatter = function (key) {
|
||||||
const formatMap = this.getFormatService().formatMap;
|
if (this.formatters.has(key)) {
|
||||||
|
return this.formatters.get(key);
|
||||||
return formatMap[key];
|
} else {
|
||||||
|
throw new Error(`Unknown type ${key}`);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -476,12 +469,7 @@ define([
|
|||||||
* @param {Format} format the
|
* @param {Format} format the
|
||||||
*/
|
*/
|
||||||
TelemetryAPI.prototype.addFormat = function (format) {
|
TelemetryAPI.prototype.addFormat = function (format) {
|
||||||
this.openmct.legacyExtension('formats', {
|
this.formatters.set(format.key, format);
|
||||||
key: format.key,
|
|
||||||
implementation: function () {
|
|
||||||
return format;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,8 +28,7 @@ define([
|
|||||||
printj
|
printj
|
||||||
) {
|
) {
|
||||||
|
|
||||||
// TODO: needs reference to formatService;
|
function TelemetryValueFormatter(valueMetadata, formatters) {
|
||||||
function TelemetryValueFormatter(valueMetadata, formatService) {
|
|
||||||
const numberFormatter = {
|
const numberFormatter = {
|
||||||
parse: function (x) {
|
parse: function (x) {
|
||||||
return Number(x);
|
return Number(x);
|
||||||
@ -43,13 +42,7 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.valueMetadata = valueMetadata;
|
this.valueMetadata = valueMetadata;
|
||||||
try {
|
this.formatter = formatters.get(valueMetadata.format) || numberFormatter;
|
||||||
this.formatter = formatService
|
|
||||||
.getFormat(valueMetadata.format, valueMetadata);
|
|
||||||
} catch (e) {
|
|
||||||
// TODO: Better formatting
|
|
||||||
this.formatter = numberFormatter;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (valueMetadata.format === 'enum') {
|
if (valueMetadata.format === 'enum') {
|
||||||
this.formatter = {};
|
this.formatter = {};
|
||||||
|
31
src/plugins/devices/plugin.js
Normal file
31
src/plugins/devices/plugin.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2021, 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.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
export default function plugin() {
|
||||||
|
return function install(openmct) {
|
||||||
|
openmct.on('start', () => {
|
||||||
|
const body = document.getElementsByTagName('body')[0];
|
||||||
|
body.classList.add('desktop');
|
||||||
|
body.classList.add('portrait');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
@ -29,6 +29,13 @@ define([
|
|||||||
) {
|
) {
|
||||||
return function plugin() {
|
return function plugin() {
|
||||||
return function install(openmct) {
|
return function install(openmct) {
|
||||||
|
openmct.types.addType('folder', {
|
||||||
|
name: "Folder",
|
||||||
|
key: "folder",
|
||||||
|
description: "Create folders to organize other objects or links to objects without the ability to edit it's properties.",
|
||||||
|
cssClass: "icon-folder",
|
||||||
|
creatable: true
|
||||||
|
});
|
||||||
openmct.objectViews.addProvider(new FolderGridView(openmct));
|
openmct.objectViews.addProvider(new FolderGridView(openmct));
|
||||||
openmct.objectViews.addProvider(new FolderListView(openmct));
|
openmct.objectViews.addProvider(new FolderListView(openmct));
|
||||||
};
|
};
|
||||||
|
@ -3,6 +3,10 @@ import myItemsInterceptor from "./myItemsInterceptor";
|
|||||||
|
|
||||||
export default function plugin() {
|
export default function plugin() {
|
||||||
return function install(openmct) {
|
return function install(openmct) {
|
||||||
|
openmct.objects.addRoot({
|
||||||
|
namespace: '',
|
||||||
|
key: 'mine'
|
||||||
|
});
|
||||||
myItemsInterceptor(openmct);
|
myItemsInterceptor(openmct);
|
||||||
missingObjectInterceptor(openmct);
|
missingObjectInterceptor(openmct);
|
||||||
};
|
};
|
||||||
|
41
src/plugins/localStorage/LocalStorageObjectProvider.js
Normal file
41
src/plugins/localStorage/LocalStorageObjectProvider.js
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
export default class LocalStorageObjectProvider {
|
||||||
|
constructor({spaceKey = 'mct'}) {
|
||||||
|
this.localStorage = window.localStorage;
|
||||||
|
this.space = this.initializeSpace(spaceKey);
|
||||||
|
}
|
||||||
|
get(identifier) {
|
||||||
|
if (this.getSpaceAsObject()[identifier.key] !== undefined) {
|
||||||
|
const persistedModel = this.getSpaceAsObject()[identifier.key];
|
||||||
|
const domainObject = {
|
||||||
|
identifier,
|
||||||
|
...persistedModel
|
||||||
|
};
|
||||||
|
|
||||||
|
return Promise.resolve(domainObject);
|
||||||
|
} else {
|
||||||
|
return Promise.resolve(undefined);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getSpaceAsObject() {
|
||||||
|
return JSON.parse(this.space);
|
||||||
|
}
|
||||||
|
create(model) {
|
||||||
|
return this.setModel(model);
|
||||||
|
}
|
||||||
|
update(model) {
|
||||||
|
return this.setModel(model);
|
||||||
|
}
|
||||||
|
setModel(model) {
|
||||||
|
this.space[model.identifier.key] = JSON.stringify(model);
|
||||||
|
this.persist();
|
||||||
|
|
||||||
|
return Promise.resolve(true);
|
||||||
|
}
|
||||||
|
initializeSpace(spaceKey) {
|
||||||
|
if (this.localStorage[spaceKey] === undefined) {
|
||||||
|
this.localStorage[spaceKey] = JSON.stringify({});
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.localStorage[spaceKey];
|
||||||
|
}
|
||||||
|
}
|
29
src/plugins/localStorage/plugin.js
Normal file
29
src/plugins/localStorage/plugin.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT Web 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 Web 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 LocalStorageObjectProvider from './LocalStorageObjectProvider';
|
||||||
|
|
||||||
|
export default function (namespace = '', storageSpace = 'mct') {
|
||||||
|
return function (openmct) {
|
||||||
|
openmct.objects.addProvider(namespace, new LocalStorageObjectProvider(storageSpace));
|
||||||
|
};
|
||||||
|
}
|
@ -85,33 +85,33 @@ define([
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"views": [
|
"views": [
|
||||||
{
|
// {
|
||||||
"name": "Plot",
|
// "name": "Plot",
|
||||||
"key": "plot-single",
|
// "key": "plot-single",
|
||||||
"cssClass": "icon-telemetry",
|
// "cssClass": "icon-telemetry",
|
||||||
"template": PlotTemplate,
|
// "template": PlotTemplate,
|
||||||
"needs": [
|
// "needs": [
|
||||||
"telemetry"
|
// "telemetry"
|
||||||
],
|
// ],
|
||||||
"delegation": false,
|
// "delegation": false,
|
||||||
"priority": "mandatory"
|
// "priority": "mandatory"
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
"name": "Overlay Plot",
|
// "name": "Overlay Plot",
|
||||||
"key": "overlayPlot",
|
// "key": "overlayPlot",
|
||||||
"cssClass": "icon-plot-overlay",
|
// "cssClass": "icon-plot-overlay",
|
||||||
"type": "telemetry.plot.overlay",
|
// "type": "telemetry.plot.overlay",
|
||||||
"template": PlotTemplate,
|
// "template": PlotTemplate,
|
||||||
"editable": true
|
// "editable": true
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
"name": "Stacked Plot",
|
// "name": "Stacked Plot",
|
||||||
"key": "stackedPlot",
|
// "key": "stackedPlot",
|
||||||
"cssClass": "icon-plot-stacked",
|
// "cssClass": "icon-plot-stacked",
|
||||||
"type": "telemetry.plot.stacked",
|
// "type": "telemetry.plot.stacked",
|
||||||
"template": StackedPlotTemplate,
|
// "template": StackedPlotTemplate,
|
||||||
"editable": true
|
// "editable": true
|
||||||
}
|
// }
|
||||||
],
|
],
|
||||||
"directives": [
|
"directives": [
|
||||||
{
|
{
|
||||||
|
@ -426,12 +426,6 @@ export default {
|
|||||||
synchronized(value) {
|
synchronized(value) {
|
||||||
if (typeof value !== 'undefined') {
|
if (typeof value !== 'undefined') {
|
||||||
this._synchronized = value;
|
this._synchronized = value;
|
||||||
const isUnsynced = !value && this.openmct.time.clock();
|
|
||||||
const domainObject = this.openmct.legacyObject(this.domainObject);
|
|
||||||
if (domainObject.getCapability('status')) {
|
|
||||||
domainObject.getCapability('status')
|
|
||||||
.set('timeconductor-unsynced', isUnsynced);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._synchronized;
|
return this._synchronized;
|
||||||
|
@ -100,7 +100,7 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
eventHelpers.extend(this);
|
eventHelpers.extend(this);
|
||||||
|
|
||||||
this.exportImageService = this.openmct.$injector.get('exportImageService');
|
//this.exportImageService = this.openmct.$injector.get('exportImageService');
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
|
@ -40,7 +40,7 @@ export default function PlotViewProvider(openmct) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isCompactView(objectPath) {
|
function isCompactView(objectPath) {
|
||||||
return objectPath.find(object => object.type === 'time-strip');
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -71,8 +71,7 @@ export default class XAxisModel extends Model {
|
|||||||
defaults(options) {
|
defaults(options) {
|
||||||
const bounds = options.openmct.time.bounds();
|
const bounds = options.openmct.time.bounds();
|
||||||
const timeSystem = options.openmct.time.timeSystem();
|
const timeSystem = options.openmct.time.timeSystem();
|
||||||
const format = options.openmct.$injector.get('formatService')
|
const format = options.openmct.telemetry.getFormatter(timeSystem.timeFormat);
|
||||||
.getFormat(timeSystem.timeFormat);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: timeSystem.name,
|
name: timeSystem.name,
|
||||||
|
@ -65,7 +65,9 @@ define([
|
|||||||
'./interceptors/plugin',
|
'./interceptors/plugin',
|
||||||
'./performanceIndicator/plugin',
|
'./performanceIndicator/plugin',
|
||||||
'./CouchDBSearchFolder/plugin',
|
'./CouchDBSearchFolder/plugin',
|
||||||
'./timeline/plugin'
|
'./localStorage/plugin',
|
||||||
|
'./timeline/plugin',
|
||||||
|
'./devices/plugin'
|
||||||
], function (
|
], function (
|
||||||
_,
|
_,
|
||||||
UTCTimeSystem,
|
UTCTimeSystem,
|
||||||
@ -111,10 +113,11 @@ define([
|
|||||||
ObjectInterceptors,
|
ObjectInterceptors,
|
||||||
PerformanceIndicator,
|
PerformanceIndicator,
|
||||||
CouchDBSearchFolder,
|
CouchDBSearchFolder,
|
||||||
Timeline
|
LocalStorage,
|
||||||
|
Timeline,
|
||||||
|
Devices
|
||||||
) {
|
) {
|
||||||
const bundleMap = {
|
const bundleMap = {
|
||||||
LocalStorage: 'platform/persistence/local',
|
|
||||||
MyItems: 'platform/features/my-items',
|
MyItems: 'platform/features/my-items',
|
||||||
Elasticsearch: 'platform/persistence/elastic'
|
Elasticsearch: 'platform/persistence/elastic'
|
||||||
};
|
};
|
||||||
@ -127,12 +130,14 @@ define([
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
plugins.LocalStorage = LocalStorage.default;
|
||||||
plugins.UTCTimeSystem = UTCTimeSystem;
|
plugins.UTCTimeSystem = UTCTimeSystem;
|
||||||
plugins.LocalTimeSystem = LocalTimeSystem;
|
plugins.LocalTimeSystem = LocalTimeSystem;
|
||||||
|
|
||||||
plugins.ImportExport = ImportExport;
|
plugins.ImportExport = ImportExport;
|
||||||
|
|
||||||
plugins.StaticRootPlugin = StaticRootPlugin;
|
plugins.StaticRootPlugin = StaticRootPlugin;
|
||||||
|
plugins.Devices = Devices.default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A tabular view showing the latest values of multiple telemetry points at
|
* A tabular view showing the latest values of multiple telemetry points at
|
||||||
|
62
src/plugins/utcTimeSystem/DurationFormat.js
Normal file
62
src/plugins/utcTimeSystem/DurationFormat.js
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT Web 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 Web 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.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'moment'
|
||||||
|
], function (
|
||||||
|
moment
|
||||||
|
) {
|
||||||
|
|
||||||
|
const DATE_FORMAT = "HH:mm:ss";
|
||||||
|
const DATE_FORMATS = [
|
||||||
|
DATE_FORMAT
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formatter for duration. Uses moment to produce a date from a given
|
||||||
|
* value, but output is formatted to display only time. Can be used for
|
||||||
|
* specifying a time duration. For specifying duration, it's best to
|
||||||
|
* specify a date of January 1, 1970, as the ms offset will equal the
|
||||||
|
* duration represented by the time.
|
||||||
|
*
|
||||||
|
* @implements {Format}
|
||||||
|
* @constructor
|
||||||
|
* @memberof platform/commonUI/formats
|
||||||
|
*/
|
||||||
|
function DurationFormat() {
|
||||||
|
this.key = "duration";
|
||||||
|
}
|
||||||
|
|
||||||
|
DurationFormat.prototype.format = function (value) {
|
||||||
|
return moment.utc(value).format(DATE_FORMAT);
|
||||||
|
};
|
||||||
|
|
||||||
|
DurationFormat.prototype.parse = function (text) {
|
||||||
|
return moment.duration(text).asMilliseconds();
|
||||||
|
};
|
||||||
|
|
||||||
|
DurationFormat.prototype.validate = function (text) {
|
||||||
|
return moment.utc(text, DATE_FORMATS, true).isValid();
|
||||||
|
};
|
||||||
|
|
||||||
|
return DurationFormat;
|
||||||
|
});
|
83
src/plugins/utcTimeSystem/UTCTimeFormat.js
Normal file
83
src/plugins/utcTimeSystem/UTCTimeFormat.js
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, 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.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'moment'
|
||||||
|
], function (
|
||||||
|
moment
|
||||||
|
) {
|
||||||
|
|
||||||
|
const DATE_FORMAT = "YYYY-MM-DD HH:mm:ss.SSS";
|
||||||
|
const DATE_FORMATS = [
|
||||||
|
DATE_FORMAT,
|
||||||
|
DATE_FORMAT + "Z",
|
||||||
|
"YYYY-MM-DD HH:mm:ss",
|
||||||
|
"YYYY-MM-DD HH:mm",
|
||||||
|
"YYYY-MM-DD"
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef Scale
|
||||||
|
* @property {number} min the minimum scale value, in ms
|
||||||
|
* @property {number} max the maximum scale value, in ms
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formatter for UTC timestamps. Interprets numeric values as
|
||||||
|
* milliseconds since the start of 1970.
|
||||||
|
*
|
||||||
|
* @implements {Format}
|
||||||
|
* @constructor
|
||||||
|
* @memberof platform/commonUI/formats
|
||||||
|
*/
|
||||||
|
function UTCTimeFormat() {
|
||||||
|
this.key = "utc";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {number} value The value to format.
|
||||||
|
* @returns {string} the formatted date(s). If multiple values were requested, then an array of
|
||||||
|
* formatted values will be returned. Where a value could not be formatted, `undefined` will be returned at its position
|
||||||
|
* in the array.
|
||||||
|
*/
|
||||||
|
UTCTimeFormat.prototype.format = function (value) {
|
||||||
|
if (value !== undefined) {
|
||||||
|
return moment.utc(value).format(DATE_FORMAT) + "Z";
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
UTCTimeFormat.prototype.parse = function (text) {
|
||||||
|
if (typeof text === 'number') {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
return moment.utc(text, DATE_FORMATS).valueOf();
|
||||||
|
};
|
||||||
|
|
||||||
|
UTCTimeFormat.prototype.validate = function (text) {
|
||||||
|
return moment.utc(text, DATE_FORMATS, true).isValid();
|
||||||
|
};
|
||||||
|
|
||||||
|
return UTCTimeFormat;
|
||||||
|
});
|
@ -22,10 +22,14 @@
|
|||||||
|
|
||||||
define([
|
define([
|
||||||
"./UTCTimeSystem",
|
"./UTCTimeSystem",
|
||||||
"./LocalClock"
|
"./LocalClock",
|
||||||
|
"./UTCTimeFormat",
|
||||||
|
"./DurationFormat"
|
||||||
], function (
|
], function (
|
||||||
UTCTimeSystem,
|
UTCTimeSystem,
|
||||||
LocalClock
|
LocalClock,
|
||||||
|
UTCTimeFormat,
|
||||||
|
DurationFormat
|
||||||
) {
|
) {
|
||||||
/**
|
/**
|
||||||
* Install a time system that supports UTC times. It also installs a local
|
* Install a time system that supports UTC times. It also installs a local
|
||||||
@ -36,6 +40,8 @@ define([
|
|||||||
const timeSystem = new UTCTimeSystem();
|
const timeSystem = new UTCTimeSystem();
|
||||||
openmct.time.addTimeSystem(timeSystem);
|
openmct.time.addTimeSystem(timeSystem);
|
||||||
openmct.time.addClock(new LocalClock(100));
|
openmct.time.addClock(new LocalClock(100));
|
||||||
|
openmct.telemetry.addFormat(new UTCTimeFormat());
|
||||||
|
openmct.telemetry.addFormat(new DurationFormat());
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<span v-if="!singleSelectNonObject"
|
<span v-if="!singleSelectNonObject"
|
||||||
class="c-inspector__selected c-object-label__name"
|
class="c-inspector__selected c-object-label__name"
|
||||||
>{{ item.name }}</span>
|
>{{ domainObject.name }}</span>
|
||||||
<div v-if="singleSelectNonObject"
|
<div v-if="singleSelectNonObject"
|
||||||
class="c-inspector__selected c-inspector__selected--non-domain-object c-object-label"
|
class="c-inspector__selected c-inspector__selected--non-domain-object c-object-label"
|
||||||
>
|
>
|
||||||
@ -36,7 +36,7 @@ export default {
|
|||||||
inject: ['openmct'],
|
inject: ['openmct'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
domainObject: {},
|
domainObject: undefined,
|
||||||
keyString: undefined,
|
keyString: undefined,
|
||||||
multiSelect: false,
|
multiSelect: false,
|
||||||
itemsSelected: 0,
|
itemsSelected: 0,
|
||||||
@ -44,21 +44,22 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
item() {
|
|
||||||
return this.domainObject || {};
|
|
||||||
},
|
|
||||||
type() {
|
type() {
|
||||||
return this.openmct.types.get(this.item.type);
|
if (this.domainObject !== undefined) {
|
||||||
|
return this.openmct.types.get(this.domainObject.type);
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
typeCssClass() {
|
typeCssClass() {
|
||||||
if (this.type.definition.cssClass === undefined) {
|
if (this.type === undefined || this.type.definition.cssClass === undefined) {
|
||||||
return 'icon-object';
|
return 'icon-object';
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.type.definition.cssClass;
|
return this.type.definition.cssClass;
|
||||||
},
|
},
|
||||||
singleSelectNonObject() {
|
singleSelectNonObject() {
|
||||||
return !this.item.identifier && !this.multiSelect;
|
return !this.domainObject && !this.multiSelect;
|
||||||
},
|
},
|
||||||
statusClass() {
|
statusClass() {
|
||||||
return this.status ? `is-status--${this.status}` : '';
|
return this.status ? `is-status--${this.status}` : '';
|
||||||
|
@ -108,7 +108,6 @@
|
|||||||
import Inspector from '../inspector/Inspector.vue';
|
import Inspector from '../inspector/Inspector.vue';
|
||||||
import MctTree from './mct-tree.vue';
|
import MctTree from './mct-tree.vue';
|
||||||
import ObjectView from '../components/ObjectView.vue';
|
import ObjectView from '../components/ObjectView.vue';
|
||||||
import MctTemplate from '../legacy/mct-template.vue';
|
|
||||||
import CreateButton from './CreateButton.vue';
|
import CreateButton from './CreateButton.vue';
|
||||||
import multipane from './multipane.vue';
|
import multipane from './multipane.vue';
|
||||||
import pane from './pane.vue';
|
import pane from './pane.vue';
|
||||||
@ -123,7 +122,6 @@ export default {
|
|||||||
Inspector,
|
Inspector,
|
||||||
MctTree,
|
MctTree,
|
||||||
ObjectView,
|
ObjectView,
|
||||||
'mct-template': MctTemplate,
|
|
||||||
CreateButton,
|
CreateButton,
|
||||||
multipane,
|
multipane,
|
||||||
pane,
|
pane,
|
||||||
|
@ -308,9 +308,6 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async initialize() {
|
async initialize() {
|
||||||
// required to index tree objects that do not have search providers
|
|
||||||
this.openmct.$injector.get('searchService');
|
|
||||||
|
|
||||||
window.addEventListener('resize', this.handleWindowResize);
|
window.addEventListener('resize', this.handleWindowResize);
|
||||||
|
|
||||||
await this.calculateHeights();
|
await this.calculateHeights();
|
||||||
|
Reference in New Issue
Block a user