mirror of
https://github.com/nasa/openmct.git
synced 2025-04-13 22:23:13 +00:00
added remaining interceptors and removed in-component modification, removed debug code
This commit is contained in:
parent
0deb2bfbf5
commit
56326ad6d1
@ -226,11 +226,6 @@ export default {
|
||||
this.composition.load();
|
||||
this.gridDimensions = [this.$el.offsetWidth, this.$el.scrollHeight];
|
||||
|
||||
// Initialize objectStyles if it doesn't exist for older versions
|
||||
if (!this.domainObject.configuration.objectStyles) {
|
||||
this.domainObject.configuration.objectStyles = {};
|
||||
}
|
||||
|
||||
this.unObserveItems = this.openmct.objects.observe(
|
||||
this.domainObject,
|
||||
'configuration.items',
|
||||
|
40
src/plugins/displayLayout/displayLayoutStylesInterceptor.js
Normal file
40
src/plugins/displayLayout/displayLayoutStylesInterceptor.js
Normal file
@ -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 displayLayoutStylesInterceptor(openmct) {
|
||||
return {
|
||||
appliesTo: (identifier, domainObject) => {
|
||||
return domainObject?.type === 'layout';
|
||||
},
|
||||
invoke: (identifier, domainObject) => {
|
||||
if (!domainObject.configuration) {
|
||||
domainObject.configuration = {};
|
||||
}
|
||||
|
||||
if (!domainObject.configuration.objectStyles) {
|
||||
domainObject.configuration.objectStyles = {};
|
||||
}
|
||||
|
||||
return domainObject;
|
||||
}
|
||||
};
|
||||
}
|
@ -25,10 +25,10 @@ import mount from 'utils/mount';
|
||||
import CopyToClipboardAction from './actions/CopyToClipboardAction.js';
|
||||
import AlphaNumericFormatViewProvider from './AlphanumericFormatViewProvider.js';
|
||||
import DisplayLayout from './components/DisplayLayout.vue';
|
||||
import displayLayoutStylesInterceptor from './displayLayoutStylesInterceptor.js';
|
||||
import DisplayLayoutToolbar from './DisplayLayoutToolbar.js';
|
||||
import DisplayLayoutType from './DisplayLayoutType.js';
|
||||
import DisplayLayoutDrawingObjectTypes from './DrawingObjectTypes.js';
|
||||
|
||||
class DisplayLayoutView {
|
||||
constructor(openmct, domainObject, objectPath, options) {
|
||||
this.openmct = openmct;
|
||||
@ -123,6 +123,7 @@ export default function DisplayLayoutPlugin(options) {
|
||||
return 100;
|
||||
}
|
||||
});
|
||||
openmct.objects.addGetInterceptor(displayLayoutStylesInterceptor(openmct));
|
||||
openmct.types.addType('layout', DisplayLayoutType());
|
||||
openmct.toolbars.addProvider(new DisplayLayoutToolbar(openmct));
|
||||
openmct.inspectorViews.addProvider(new AlphaNumericFormatViewProvider(openmct, options));
|
||||
|
@ -159,11 +159,6 @@ export default {
|
||||
this.composition.on('add', this.addFrame);
|
||||
this.composition.load();
|
||||
|
||||
// Initialize objectStyles if it doesn't exist for older versions
|
||||
if (!this.domainObject.configuration.objectStyles) {
|
||||
this.domainObject.configuration.objectStyles = {};
|
||||
}
|
||||
|
||||
this.unObserveContainers = this.openmct.objects.observe(
|
||||
this.domainObject,
|
||||
'configuration.containers',
|
||||
|
@ -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 displayLayoutStylesInterceptor(openmct) {
|
||||
return {
|
||||
appliesTo: (identifier, domainObject) => {
|
||||
return domainObject?.type === 'flexible-layout';
|
||||
},
|
||||
invoke: (identifier, domainObject) => {
|
||||
if (!domainObject.configuration) {
|
||||
domainObject.configuration = {};
|
||||
}
|
||||
|
||||
if (!domainObject.configuration.objectStyles) {
|
||||
domainObject.configuration.objectStyles = {};
|
||||
}
|
||||
|
||||
return domainObject;
|
||||
}
|
||||
};
|
||||
}
|
@ -20,6 +20,7 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
import flexibleLayoutStylesInterceptor from './flexibleLayoutStylesInterceptor.js';
|
||||
import FlexibleLayoutViewProvider from './flexibleLayoutViewProvider.js';
|
||||
import ToolBarProvider from './toolbarProvider.js';
|
||||
import Container from './utils/container.js';
|
||||
@ -43,6 +44,7 @@ export default function plugin() {
|
||||
domainObject.composition = [];
|
||||
}
|
||||
});
|
||||
openmct.objects.addGetInterceptor(flexibleLayoutStylesInterceptor(openmct));
|
||||
|
||||
let toolbar = ToolBarProvider(openmct);
|
||||
|
||||
|
@ -24,6 +24,7 @@ import mount from 'utils/mount';
|
||||
|
||||
import GaugeFormController from './components/GaugeFormController.vue';
|
||||
import GaugeCompositionPolicy from './GaugeCompositionPolicy.js';
|
||||
import gaugeStylesInterceptor from './gaugeStylesInterceptor.js';
|
||||
import GaugeViewProvider from './GaugeViewProvider.js';
|
||||
|
||||
export const GAUGE_TYPES = [
|
||||
@ -37,7 +38,7 @@ export const GAUGE_TYPES = [
|
||||
export default function () {
|
||||
return function install(openmct) {
|
||||
openmct.objectViews.addProvider(new GaugeViewProvider(openmct));
|
||||
|
||||
openmct.objects.addGetInterceptor(gaugeStylesInterceptor(openmct));
|
||||
openmct.forms.addNewFormControl('gauge-controller', getGaugeFormController(openmct));
|
||||
openmct.types.addType('gauge', {
|
||||
name: 'Gauge',
|
||||
|
@ -553,11 +553,6 @@ export default {
|
||||
this.openmct.time.on('boundsChanged', this.refreshData);
|
||||
this.openmct.time.on('timeSystem', this.setTimeSystem);
|
||||
|
||||
// Initialize objectStyles if it doesn't exist
|
||||
if (!this.domainObject.configuration.objectStyles) {
|
||||
this.domainObject.configuration.objectStyles = {};
|
||||
}
|
||||
|
||||
this.setupClockChangedEvent((domainObject) => {
|
||||
this.triggerUnsubscribeFromStaleness(domainObject);
|
||||
this.subscribeToStaleness(domainObject);
|
||||
|
40
src/plugins/gauge/gaugeStylesInterceptor.js
Normal file
40
src/plugins/gauge/gaugeStylesInterceptor.js
Normal file
@ -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 gaugeStylesInterceptor(openmct) {
|
||||
return {
|
||||
appliesTo: (identifier, domainObject) => {
|
||||
return domainObject?.type === 'gauge';
|
||||
},
|
||||
invoke: (identifier, domainObject) => {
|
||||
if (!domainObject.configuration) {
|
||||
domainObject.configuration = {};
|
||||
}
|
||||
|
||||
if (!domainObject.configuration.objectStyles) {
|
||||
domainObject.configuration.objectStyles = {};
|
||||
}
|
||||
|
||||
return domainObject;
|
||||
}
|
||||
};
|
||||
}
|
@ -93,7 +93,6 @@ export default {
|
||||
methods: {
|
||||
setEditState(isEditing) {
|
||||
this.isEditing = isEditing;
|
||||
console.log('this.isEditing', this.isEditing);
|
||||
this.showSelection(this.openmct.selection.get());
|
||||
},
|
||||
showSelection(selection) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user