mirror of
https://github.com/nasa/openmct.git
synced 2025-03-22 03:55:31 +00:00
adding styles interceptor for telemetry tables
This commit is contained in:
parent
8655434e4b
commit
1a59b89ff2
@ -36,11 +36,6 @@ export default class TelemetryTableConfiguration extends EventEmitter {
|
||||
this.defaultOptions = options;
|
||||
this.columns = {};
|
||||
|
||||
// Initialize objectStyles if it doesn't exist, for items with configuration
|
||||
if (this.domainObject.configuration && !this.domainObject.configuration.objectStyles) {
|
||||
this.domainObject.configuration.objectStyles = {};
|
||||
}
|
||||
|
||||
this.removeColumnsForObject = this.removeColumnsForObject.bind(this);
|
||||
this.objectMutated = this.objectMutated.bind(this);
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
import { MODE } from './constants.js';
|
||||
import TableConfigurationViewProvider from './TableConfigurationViewProvider.js';
|
||||
import telemetryTableStylesInterceptor from './telemetryTableStylesInterceptor.js';
|
||||
import getTelemetryTableType from './TelemetryTableType.js';
|
||||
import TelemetryTableViewProvider from './TelemetryTableViewProvider.js';
|
||||
import TelemetryTableViewActions from './ViewActions.js';
|
||||
@ -33,6 +34,7 @@ export default function plugin(
|
||||
openmct.objectViews.addProvider(new TelemetryTableViewProvider(openmct, options));
|
||||
openmct.inspectorViews.addProvider(new TableConfigurationViewProvider(openmct, options));
|
||||
openmct.types.addType('table', getTelemetryTableType(options));
|
||||
openmct.objects.addGetInterceptor(telemetryTableStylesInterceptor(openmct));
|
||||
openmct.composition.addPolicy((parent, child) => {
|
||||
if (parent.type === 'table') {
|
||||
return Object.prototype.hasOwnProperty.call(child, 'telemetry');
|
||||
|
@ -0,0 +1,40 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2024, 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 telemetryTableStylesInterceptor(openmct) {
|
||||
return {
|
||||
appliesTo: (identifier, domainObject) => {
|
||||
return (
|
||||
domainObject.type === 'table' &&
|
||||
domainObject.configuration && // only applies to tables with existing configuration
|
||||
!domainObject.configuration.objectStyles
|
||||
);
|
||||
},
|
||||
invoke: (identifier, domainObject) => {
|
||||
domainObject.configuration.objectStyles = {};
|
||||
|
||||
openmct.objects.save(domainObject);
|
||||
|
||||
return domainObject;
|
||||
}
|
||||
};
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user