Optionally provide list of object types to show as views rather than telemetry in Display Layouts (#2339)

* Optionally provide list of object types to show as views rather than alpha numerics to display layouts

* Only make table view available for objects that have telemetry to show
This commit is contained in:
Andrew Henry 2019-03-28 22:21:27 -07:00 committed by Deep Tailor
parent 57efef3160
commit bc5e300ba9
5 changed files with 25 additions and 10 deletions

View File

@ -54,6 +54,9 @@
openmct.install(openmct.plugins.AutoflowView({
type: "telemetry.panel"
}));
openmct.install(openmct.plugins.DisplayLayout({
showAsView: ['summary-widget', 'example.imagery']
}));
openmct.install(openmct.plugins.Conductor({
menuOptions: [
{

View File

@ -248,7 +248,6 @@ define([
this.legacyRegistry = defaultRegistry;
this.install(this.plugins.Plot());
this.install(this.plugins.TelemetryTable());
this.install(this.plugins.DisplayLayout());
this.install(PreviewPlugin.default());
this.install(LegacyIndicatorsPlugin());
this.install(LicensesPlugin.default());
@ -257,7 +256,6 @@ define([
if (typeof BUILD_CONSTANTS !== 'undefined') {
this.install(buildInfoPlugin(BUILD_CONSTANTS));
}
}
MCT.prototype = Object.create(EventEmitter.prototype);
@ -328,6 +326,12 @@ define([
* MCT; if undefined, MCT will be run in the body of the document
*/
MCT.prototype.start = function (domElement) {
if (!this.plugins.DisplayLayout._installed) {
this.install(this.plugins.DisplayLayout({
showAsView: ['summary-widget']
}));
}
if (!domElement) {
domElement = document.body;
}

View File

@ -152,7 +152,7 @@
return this.internalDomainObject.configuration.items;
}
},
inject: ['openmct'],
inject: ['openmct', 'options'],
props: ['domainObject'],
components: ITEM_TYPE_VIEW_MAP,
methods: {
@ -283,9 +283,8 @@
}
},
isTelemetry(domainObject) {
if (this.openmct.telemetry.isTelemetryObject(domainObject)
&& domainObject.type !== 'summary-widget'
&& domainObject.type !== 'example.imagery') {
if (this.openmct.telemetry.isTelemetryObject(domainObject) &&
!this.options.showAsView.includes(domainObject.type)) {
return true;
} else {
return false;

View File

@ -25,8 +25,7 @@ import Vue from 'vue'
import objectUtils from '../../api/objects/object-utils.js'
import DisplayLayoutType from './DisplayLayoutType.js'
import DisplayLayoutToolbar from './DisplayLayoutToolbar.js'
export default function () {
export default function DisplayLayoutPlugin(options) {
return function (openmct) {
openmct.objectViews.addProvider({
key: 'layout.view',
@ -47,7 +46,8 @@ export default function () {
template: '<layout ref="displayLayout" :domain-object="domainObject"></layout>',
provide: {
openmct,
objectUtils
objectUtils,
options
},
el: container,
data () {
@ -83,5 +83,6 @@ export default function () {
return true;
}
});
DisplayLayoutPlugin._installed = true;
}
}

View File

@ -32,12 +32,20 @@ define([
Vue
) {
function TelemetryTableViewProvider(openmct) {
function hasTelemetry(domainObject) {
if (!domainObject.hasOwnProperty('telemetry')) {
return false;
}
let metadata = openmct.telemetry.getMetadata(domainObject);
return metadata.values().length > 0;
}
return {
key: 'table',
name: 'Telemetry Table',
cssClass: 'icon-tabular-realtime',
canView(domainObject) {
return domainObject.type === 'table' || domainObject.hasOwnProperty('telemetry');
return domainObject.type === 'table' ||
hasTelemetry(domainObject)
},
canEdit(domainObject) {
return domainObject.type === 'table';