Compare commits

..

1 Commits

Author SHA1 Message Date
317cb68b53 wip 2019-04-09 12:00:05 -07:00
11 changed files with 61 additions and 70 deletions

View File

@ -33,7 +33,8 @@ 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']));
openmct.install(openmct.plugins.Filters(['table', 'telemetry.plot.overlay', 'telemetry.plot.stacked']));
openmct.install(openmct.plugins.ObjectMigration());
openmct.start();
</script>

View File

@ -33,25 +33,20 @@ export default class LegacyContextMenuAction {
}
invoke(objectPath) {
this.openmct.objects.getRoot().then((root) => {
let pathWithRoot = objectPath.slice();
pathWithRoot.push(root);
let context = {
category: 'contextual',
domainObject: this.openmct.legacyObject(objectPath)
}
let legacyAction = new this.LegacyAction(context);
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();
});
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,6 +28,11 @@ 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,10 +42,7 @@
<!-- Checkbox list, NOT editing -->
<template v-if="filter.possibleValues && !isEditing">
<span
v-if="persistedFilters[filter.comparator]">
{{persistedFilters[filter.comparator].join(', ')}}
</span>
<span>{{persistedFilters[filter.comparator].join(', ')}}</span>
</template>
</div>
</li>

View File

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

View File

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

View File

@ -37,6 +37,11 @@ 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 = [];
@ -110,6 +115,12 @@ define([
}
}
function onFilterUpdate(filters) {
$scope.$broadcast('filters:update', filters);
currentFilters = filters;
}
$scope.$watch('domainObject', onDomainObjectChange);
$scope.$watch('domainObject.getModel().composition', onCompositionChange);
@ -129,6 +140,12 @@ 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,10 +34,7 @@ export default {
this.currentObject = this.object;
this.updateView();
this.$el.addEventListener('dragover', this.onDragOver);
this.$el.addEventListener('drop', this.addObjectToParent);
this.$el.addEventListener('drop', this.editIfEditable, {
capture: true
});
this.$el.addEventListener('drop', this.onDrop);
},
methods: {
clear() {
@ -73,18 +70,22 @@ export default {
this.viewContainer = document.createElement('div');
this.viewContainer.classList.add('c-object-view','u-contents');
this.$el.append(this.viewContainer);
let provider = this.getViewProvider();
let provider = this.openmct.objectViews.getByProviderKey(this.viewKey);
if (!provider) {
return;
provider = this.openmct.objectViews.get(this.currentObject)[0];
if (!provider) {
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 {
@ -132,7 +133,7 @@ export default {
event.preventDefault();
}
},
addObjectToParent(event) {
onDrop(event) {
if (this.hasComposableDomainObject(event)) {
let composableDomainObject = this.getComposableDomainObject(event);
this.currentObject.composition.push(composableDomainObject.identifier);
@ -141,25 +142,6 @@ 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,7 +67,6 @@
}
</style>
<script>
import _ from 'lodash';
import Search from '../components/search.vue';
import ObjectLabel from '../components/ObjectLabel.vue';
@ -83,8 +82,7 @@ export default {
isEditing: this.openmct.editor.isEditing(),
parentObject: undefined,
currentSearch: '',
isDragging: false,
selection: []
isDragging: false
}
},
mounted() {
@ -101,10 +99,6 @@ 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,23 +223,18 @@
let context = child.object.getCapability('context'),
object = child.object.useCapability('adapter'),
objectPath = [],
navigateToParent;
objectPath = [];
if (context) {
objectPath = context.getPath().slice(1)
.map(oldObject => oldObject.useCapability('adapter'))
.reverse();
navigateToParent = '/browse/' + objectPath.slice(1)
.map((parent) => this.openmct.objects.makeKeyString(parent.identifier))
.join('/');
.reverse();
}
return {
id: this.openmct.objects.makeKeyString(object.identifier),
object,
objectPath,
navigateToParent
objectPath
}
});
});