Compare commits

..

3 Commits

Author SHA1 Message Date
1b57999059 [TextHighlight] Fixed, "not updating when text string changes" (#3796)
Co-authored-by: David Tsay <3614296+davetsay@users.noreply.github.com>
2021-04-09 12:38:59 -07:00
b7460cef41 Update master to snapshot version of next sprint (#3786) 2021-04-08 12:55:17 -07:00
46f7f6dd04 [Notebook] Fixing pages with no entries breaking search (#3791)
* also added result count to search results
2021-04-06 17:17:38 -07:00
26 changed files with 147 additions and 346 deletions

View File

@ -1,6 +1,6 @@
{
"name": "openmct",
"version": "1.6.3-SNAPSHOT",
"version": "1.7.1-SNAPSHOT",
"description": "The Open MCT core platform",
"dependencies": {},
"devDependencies": {

View File

@ -284,7 +284,6 @@ define([
this.install(this.plugins.ViewDatumAction());
this.install(this.plugins.ObjectInterceptors());
this.install(this.plugins.NonEditableFolder());
this.install(this.plugins.Devices());
}
MCT.prototype = Object.create(EventEmitter.prototype);
@ -404,24 +403,39 @@ define([
this.router.setPath('/browse/');
});
if (!isHeadlessMode) {
const appLayout = new Vue({
components: {
'Layout': Layout.default
},
provide: {
openmct: this
},
template: '<Layout ref="layout"></Layout>'
});
domElement.appendChild(appLayout.$mount().$el);
/**
* Fired by [MCT]{@link module:openmct.MCT} when the application
* is started.
* @event start
* @memberof module:openmct.MCT~
*/
const startPromise = new Main();
startPromise.run(this)
.then(function (angular) {
this.$angular = angular;
// OpenMCT Object provider doesn't operate properly unless
// something has depended upon objectService. Cool, right?
this.$injector.get('objectService');
this.layout = appLayout.$refs.layout;
Browse(this);
}
if (!isHeadlessMode) {
const appLayout = new Vue({
components: {
'Layout': Layout.default
},
provide: {
openmct: this
},
template: '<Layout ref="layout"></Layout>'
});
domElement.appendChild(appLayout.$mount().$el);
this.router.start();
this.emit('start');
this.layout = appLayout.$refs.layout;
Browse(this);
}
this.router.start();
this.emit('start');
}.bind(this));
};
MCT.prototype.startHeadless = function () {

View File

@ -38,6 +38,9 @@ function ObjectAPI(typeRegistry, openmct) {
this.eventEmitter = new EventEmitter();
this.providers = {};
this.rootRegistry = new RootRegistry();
this.injectIdentifierService = function () {
this.identifierService = openmct.$injector.get("identifierService");
};
this.rootProvider = new RootObjectProvider(this.rootRegistry);
this.cache = {};
@ -52,16 +55,33 @@ ObjectAPI.prototype.supersecretSetFallbackProvider = function (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.
* @private
*/
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') {
return this.rootProvider;
}
return this.providers[identifier.namespace] || this.fallbackProvider;
return this.providers[namespace] || this.fallbackProvider;
};
/**

View File

@ -116,9 +116,11 @@ define([
* @private
*/
DefaultMetadataProvider.prototype.typeHasTelemetry = function (domainObject) {
const type = this.openmct.types.get(domainObject.type);
if (!this.typeService) {
this.typeService = this.openmct.$injector.get('typeService');
}
return Boolean(type.definition.telemetry);
return Boolean(this.typeService.getType(domainObject.type).typeDef.telemetry);
};
return DefaultMetadataProvider;

View File

@ -142,8 +142,6 @@ define([
this.metadataCache = new WeakMap();
this.formatMapCache = new WeakMap();
this.valueFormatterCache = new WeakMap();
this.formatters = new Map();
}
/**
@ -415,6 +413,17 @@ define([
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.
*
@ -424,7 +433,7 @@ define([
if (!this.valueFormatterCache.has(valueMetadata)) {
this.valueFormatterCache.set(
valueMetadata,
new TelemetryValueFormatter(valueMetadata, this.formatters)
new TelemetryValueFormatter(valueMetadata, this.getFormatService())
);
}
@ -438,11 +447,9 @@ define([
* @returns {Format}
*/
TelemetryAPI.prototype.getFormatter = function (key) {
if (this.formatters.has(key)) {
return this.formatters.get(key);
} else {
throw new Error(`Unknown type ${key}`);
}
const formatMap = this.getFormatService().formatMap;
return formatMap[key];
};
/**
@ -469,7 +476,12 @@ define([
* @param {Format} format the
*/
TelemetryAPI.prototype.addFormat = function (format) {
this.formatters.set(format.key, format);
this.openmct.legacyExtension('formats', {
key: format.key,
implementation: function () {
return format;
}
});
};
/**

View File

@ -28,7 +28,8 @@ define([
printj
) {
function TelemetryValueFormatter(valueMetadata, formatters) {
// TODO: needs reference to formatService;
function TelemetryValueFormatter(valueMetadata, formatService) {
const numberFormatter = {
parse: function (x) {
return Number(x);
@ -42,7 +43,13 @@ define([
};
this.valueMetadata = valueMetadata;
this.formatter = formatters.get(valueMetadata.format) || numberFormatter;
try {
this.formatter = formatService
.getFormat(valueMetadata.format, valueMetadata);
} catch (e) {
// TODO: Better formatting
this.formatter = numberFormatter;
}
if (valueMetadata.format === 'enum') {
this.formatter = {};

View File

@ -1,31 +0,0 @@
/*****************************************************************************
* 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');
});
};
}

View File

@ -29,13 +29,6 @@ define([
) {
return function plugin() {
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 FolderListView(openmct));
};

View File

@ -3,10 +3,6 @@ import myItemsInterceptor from "./myItemsInterceptor";
export default function plugin() {
return function install(openmct) {
openmct.objects.addRoot({
namespace: '',
key: 'mine'
});
myItemsInterceptor(openmct);
missingObjectInterceptor(openmct);
};

View File

@ -1,41 +0,0 @@
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];
}
}

View File

@ -1,29 +0,0 @@
/*****************************************************************************
* 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));
};
}

View File

@ -430,7 +430,7 @@ export default {
}
// check for no entries first
if (entries[section.id]) {
if (entries[section.id] && entries[section.id][page.id]) {
const pageEntries = entries[section.id][page.id];
pageEntries.forEach(entry => {

View File

@ -22,7 +22,7 @@
<template>
<div class="c-notebook__search-results">
<div class="c-notebook__search-results__header">Search Results</div>
<div class="c-notebook__search-results__header">Search Results ({{ results.length }})</div>
<div class="c-notebook__entries">
<NotebookEntry v-for="(result, index) in results"
:key="index"

View File

@ -85,33 +85,33 @@ define([
}
],
"views": [
// {
// "name": "Plot",
// "key": "plot-single",
// "cssClass": "icon-telemetry",
// "template": PlotTemplate,
// "needs": [
// "telemetry"
// ],
// "delegation": false,
// "priority": "mandatory"
// },
// {
// "name": "Overlay Plot",
// "key": "overlayPlot",
// "cssClass": "icon-plot-overlay",
// "type": "telemetry.plot.overlay",
// "template": PlotTemplate,
// "editable": true
// },
// {
// "name": "Stacked Plot",
// "key": "stackedPlot",
// "cssClass": "icon-plot-stacked",
// "type": "telemetry.plot.stacked",
// "template": StackedPlotTemplate,
// "editable": true
// }
{
"name": "Plot",
"key": "plot-single",
"cssClass": "icon-telemetry",
"template": PlotTemplate,
"needs": [
"telemetry"
],
"delegation": false,
"priority": "mandatory"
},
{
"name": "Overlay Plot",
"key": "overlayPlot",
"cssClass": "icon-plot-overlay",
"type": "telemetry.plot.overlay",
"template": PlotTemplate,
"editable": true
},
{
"name": "Stacked Plot",
"key": "stackedPlot",
"cssClass": "icon-plot-stacked",
"type": "telemetry.plot.stacked",
"template": StackedPlotTemplate,
"editable": true
}
],
"directives": [
{

View File

@ -426,6 +426,12 @@ export default {
synchronized(value) {
if (typeof value !== 'undefined') {
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;

View File

@ -100,7 +100,7 @@ export default {
mounted() {
eventHelpers.extend(this);
//this.exportImageService = this.openmct.$injector.get('exportImageService');
this.exportImageService = this.openmct.$injector.get('exportImageService');
},
beforeDestroy() {
this.destroy();

View File

@ -40,7 +40,7 @@ export default function PlotViewProvider(openmct) {
}
function isCompactView(objectPath) {
return true;
return objectPath.find(object => object.type === 'time-strip');
}
return {

View File

@ -71,7 +71,8 @@ export default class XAxisModel extends Model {
defaults(options) {
const bounds = options.openmct.time.bounds();
const timeSystem = options.openmct.time.timeSystem();
const format = options.openmct.telemetry.getFormatter(timeSystem.timeFormat);
const format = options.openmct.$injector.get('formatService')
.getFormat(timeSystem.timeFormat);
return {
name: timeSystem.name,

View File

@ -65,9 +65,7 @@ define([
'./interceptors/plugin',
'./performanceIndicator/plugin',
'./CouchDBSearchFolder/plugin',
'./localStorage/plugin',
'./timeline/plugin',
'./devices/plugin'
'./timeline/plugin'
], function (
_,
UTCTimeSystem,
@ -113,11 +111,10 @@ define([
ObjectInterceptors,
PerformanceIndicator,
CouchDBSearchFolder,
LocalStorage,
Timeline,
Devices
Timeline
) {
const bundleMap = {
LocalStorage: 'platform/persistence/local',
MyItems: 'platform/features/my-items',
Elasticsearch: 'platform/persistence/elastic'
};
@ -130,14 +127,12 @@ define([
};
});
plugins.LocalStorage = LocalStorage.default;
plugins.UTCTimeSystem = UTCTimeSystem;
plugins.LocalTimeSystem = LocalTimeSystem;
plugins.ImportExport = ImportExport;
plugins.StaticRootPlugin = StaticRootPlugin;
plugins.Devices = Devices.default;
/**
* A tabular view showing the latest values of multiple telemetry points at

View File

@ -1,62 +0,0 @@
/*****************************************************************************
* 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;
});

View File

@ -1,83 +0,0 @@
/*****************************************************************************
* 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;
});

View File

@ -22,14 +22,10 @@
define([
"./UTCTimeSystem",
"./LocalClock",
"./UTCTimeFormat",
"./DurationFormat"
"./LocalClock"
], function (
UTCTimeSystem,
LocalClock,
UTCTimeFormat,
DurationFormat
LocalClock
) {
/**
* Install a time system that supports UTC times. It also installs a local
@ -40,8 +36,6 @@ define([
const timeSystem = new UTCTimeSystem();
openmct.time.addTimeSystem(timeSystem);
openmct.time.addClock(new LocalClock(100));
openmct.telemetry.addFormat(new UTCTimeFormat());
openmct.telemetry.addFormat(new DurationFormat());
};
};
});

View File

@ -13,7 +13,7 @@
</div>
<span v-if="!singleSelectNonObject"
class="c-inspector__selected c-object-label__name"
>{{ domainObject.name }}</span>
>{{ item.name }}</span>
<div v-if="singleSelectNonObject"
class="c-inspector__selected c-inspector__selected--non-domain-object c-object-label"
>
@ -36,7 +36,7 @@ export default {
inject: ['openmct'],
data() {
return {
domainObject: undefined,
domainObject: {},
keyString: undefined,
multiSelect: false,
itemsSelected: 0,
@ -44,22 +44,21 @@ export default {
};
},
computed: {
item() {
return this.domainObject || {};
},
type() {
if (this.domainObject !== undefined) {
return this.openmct.types.get(this.domainObject.type);
} else {
return undefined;
}
return this.openmct.types.get(this.item.type);
},
typeCssClass() {
if (this.type === undefined || this.type.definition.cssClass === undefined) {
if (this.type.definition.cssClass === undefined) {
return 'icon-object';
}
return this.type.definition.cssClass;
},
singleSelectNonObject() {
return !this.domainObject && !this.multiSelect;
return !this.item.identifier && !this.multiSelect;
},
statusClass() {
return this.status ? `is-status--${this.status}` : '';

View File

@ -108,6 +108,7 @@
import Inspector from '../inspector/Inspector.vue';
import MctTree from './mct-tree.vue';
import ObjectView from '../components/ObjectView.vue';
import MctTemplate from '../legacy/mct-template.vue';
import CreateButton from './CreateButton.vue';
import multipane from './multipane.vue';
import pane from './pane.vue';
@ -122,6 +123,7 @@ export default {
Inspector,
MctTree,
ObjectView,
'mct-template': MctTemplate,
CreateButton,
multipane,
pane,

View File

@ -308,6 +308,9 @@ export default {
},
methods: {
async initialize() {
// required to index tree objects that do not have search providers
this.openmct.$injector.get('searchService');
window.addEventListener('resize', this.handleWindowResize);
await this.calculateHeights();

View File

@ -66,6 +66,9 @@ export default {
watch: {
highlight() {
this.highlightText();
},
text() {
this.highlightText();
}
},
mounted() {