Compare commits

..

4 Commits

11 changed files with 70 additions and 61 deletions

View File

@ -33,8 +33,7 @@ define([
formatString: '%0.2f',
hints: {
range: 1
},
filters: ['equals']
}
},
{
key: "cos",

View File

@ -84,7 +84,7 @@
openmct.install(openmct.plugins.Tabs());
openmct.install(openmct.plugins.FlexibleLayout());
openmct.install(openmct.plugins.LADTable());
openmct.install(openmct.plugins.Filters(['table', 'telemetry.plot.overlay', 'telemetry.plot.stacked']));
openmct.install(openmct.plugins.Filters(['table', 'telemetry.plot.overlay']));
openmct.install(openmct.plugins.ObjectMigration());
openmct.start();
</script>

View File

@ -33,20 +33,25 @@ export default class LegacyContextMenuAction {
}
invoke(objectPath) {
let context = {
category: 'contextual',
domainObject: this.openmct.legacyObject(objectPath)
}
let legacyAction = new this.LegacyAction(context);
this.openmct.objects.getRoot().then((root) => {
let pathWithRoot = objectPath.slice();
pathWithRoot.push(root);
if (!legacyAction.getMetadata) {
let metadata = Object.create(this.LegacyAction.definition);
metadata.context = context;
legacyAction.getMetadata = function () {
return metadata;
}.bind(legacyAction);
}
legacyAction.perform();
let context = {
category: 'contextual',
domainObject: this.openmct.legacyObject(pathWithRoot)
}
let legacyAction = new this.LegacyAction(context);
if (!legacyAction.getMetadata) {
let metadata = Object.create(this.LegacyAction.definition);
metadata.context = context;
legacyAction.getMetadata = function () {
return metadata;
}.bind(legacyAction);
}
legacyAction.perform();
});
}
appliesTo(objectPath) {

View File

@ -28,11 +28,6 @@ export default class Editor extends EventEmitter {
super();
this.editing = false;
this.openmct = openmct;
document.addEventListener('drop', (event) => {
if (!this.isEditing()) {
this.edit();
}
}, {capture: true});
}
/**

View File

@ -42,7 +42,10 @@
<!-- Checkbox list, NOT editing -->
<template v-if="filter.possibleValues && !isEditing">
<span>{{persistedFilters[filter.comparator].join(', ')}}</span>
<span
v-if="persistedFilters[filter.comparator]">
{{persistedFilters[filter.comparator].join(', ')}}
</span>
</template>
</div>
</li>

View File

@ -69,16 +69,17 @@ export default {
}
} else {
if (!this.updatedFilters[key]) {
this.updatedFilters[key] = {};
this.$set(this.updatedFilters, key, {});
}
this.updatedFilters[key][comparator] = [value ? valueName : undefined];
this.$set(this.updatedFilters[key], comparator, [value ? valueName : undefined]);
}
this.$emit('updateFilters', this.keyString, this.updatedFilters);
},
updateTextFilter(key, comparator, value) {
if (!this.updatedFilters[key]) {
this.updatedFilters[key] = {};
this.$set(this.updatedFilters, key, {});
this.$set(this.updatedFilters[key], comparator, '');
}
this.updatedFilters[key][comparator] = value;
this.$emit('updateFilters', this.keyString, this.updatedFilters);

View File

@ -80,8 +80,6 @@ define([
'configuration.filters',
this.updateFiltersAndResubscribe.bind(this)
);
this.listenTo($scope, 'filters:update', this.onFiltersUpdate, this);
}
eventHelpers.extend(PlotController.prototype);
@ -265,10 +263,6 @@ define([
});
};
PlotController.prototype.onFiltersUpdate = function ($event, updatedFilters) {
this.updateFiltersAndResubscribe(updatedFilters);
};
/**
* Export view as JPG.
*/

View File

@ -37,11 +37,6 @@ define([
this.exportImageService = exportImageService;
this.$scope = $scope;
this.cursorGuide = false;
this.domainObject = $scope.domainObject.useCapability('adapter');
var currentFilters = this.domainObject.configuration.filters;
$scope.currentFilters = this.currentFilters;
$scope.telemetryObjects = [];
@ -115,12 +110,6 @@ define([
}
}
function onFilterUpdate(filters) {
$scope.$broadcast('filters:update', filters);
currentFilters = filters;
}
$scope.$watch('domainObject', onDomainObjectChange);
$scope.$watch('domainObject.getModel().composition', onCompositionChange);
@ -140,12 +129,6 @@ define([
$scope.$on('plot:highlight:update', function ($e, point) {
$scope.$broadcast('plot:highlight:set', point);
});
var unobserve = openmct.objects.observe(this.domainObject, 'configuration.filters', onFilterUpdate);
$scope.$on('$destroy', function () {
unobserve();
});
}
StackedPlotController.prototype.exportJPG = function () {

View File

@ -34,7 +34,10 @@ export default {
this.currentObject = this.object;
this.updateView();
this.$el.addEventListener('dragover', this.onDragOver);
this.$el.addEventListener('drop', this.onDrop);
this.$el.addEventListener('drop', this.addObjectToParent);
this.$el.addEventListener('drop', this.editIfEditable, {
capture: true
});
},
methods: {
clear() {
@ -70,22 +73,18 @@ export default {
this.viewContainer = document.createElement('div');
this.viewContainer.classList.add('c-object-view','u-contents');
this.$el.append(this.viewContainer);
let provider = this.openmct.objectViews.getByProviderKey(this.viewKey);
let provider = this.getViewProvider();
if (!provider) {
provider = this.openmct.objectViews.get(this.currentObject)[0];
if (!provider) {
return;
}
return;
}
if (provider.edit && this.showEditView) {
if (this.openmct.editor.isEditing()) {
this.currentView = provider.edit(this.currentObject);
} else {
this.currentView = provider.view(this.currentObject, false);
}
this.openmct.editor.on('isEditing', this.toggleEditView);
this.releaseEditModeHandler = () => this.openmct.editor.off('isEditing', this.toggleEditView);
} else {
@ -133,7 +132,7 @@ export default {
event.preventDefault();
}
},
onDrop(event) {
addObjectToParent(event) {
if (this.hasComposableDomainObject(event)) {
let composableDomainObject = this.getComposableDomainObject(event);
this.currentObject.composition.push(composableDomainObject.identifier);
@ -142,6 +141,25 @@ export default {
event.stopPropagation();
}
},
getViewProvider() {
let provider = this.openmct.objectViews.getByProviderKey(this.viewKey);
if (!provider) {
provider = this.openmct.objectViews.get(this.currentObject)[0];
if (!provider) {
return;
}
}
return provider;
},
editIfEditable(event) {
let provider = this.getViewProvider();
if (provider &&
provider.canEdit(this.currentObject) &&
!this.openmct.editor.isEditing()) {
this.openmct.editor.edit();
}
},
hasComposableDomainObject(event) {
return event.dataTransfer.types.includes('openmct/composable-domain-object')
},

View File

@ -67,6 +67,7 @@
}
</style>
<script>
import _ from 'lodash';
import Search from '../components/search.vue';
import ObjectLabel from '../components/ObjectLabel.vue';
@ -82,7 +83,8 @@ export default {
isEditing: this.openmct.editor.isEditing(),
parentObject: undefined,
currentSearch: '',
isDragging: false
isDragging: false,
selection: []
}
},
mounted() {
@ -99,6 +101,10 @@ export default {
this.showSelection(this.openmct.selection.get());
},
showSelection(selection) {
if (_.isEqual(this.selection, selection)) {
return;
}
this.selection = selection;
this.elements = [];
this.elementsCache = {};
this.listeners = [];

View File

@ -223,18 +223,23 @@
let context = child.object.getCapability('context'),
object = child.object.useCapability('adapter'),
objectPath = [];
objectPath = [],
navigateToParent;
if (context) {
objectPath = context.getPath().slice(1)
.map(oldObject => oldObject.useCapability('adapter'))
.reverse();
.reverse();
navigateToParent = '/browse/' + objectPath.slice(1)
.map((parent) => this.openmct.objects.makeKeyString(parent.identifier))
.join('/');
}
return {
id: this.openmct.objects.makeKeyString(object.identifier),
object,
objectPath
objectPath,
navigateToParent
}
});
});