Fixes some issues relating to removal of objects (#2366)

* Leave edit mode on navigation after removal

* Only leave edit mode if removing navigated item, or parent of

* Do not emit mutation from filters with out of date object model
This commit is contained in:
Andrew Henry 2019-04-09 10:45:56 -07:00 committed by Deep Tailor
parent b659f205f7
commit 6bf4b3aba8
4 changed files with 20 additions and 9 deletions

View File

@ -23,17 +23,18 @@ export default {
FilterObject
},
inject: [
'openmct',
'providedObject'
'openmct'
],
data() {
let providedObject = this.openmct.selection.get()[0][0].context.item;
let persistedFilters = {};
if (this.providedObject.configuration && this.providedObject.configuration.filters) {
persistedFilters = this.providedObject.configuration.filters;
if (providedObject.configuration && providedObject.configuration.filters) {
persistedFilters = providedObject.configuration.filters;
}
return {
providedObject,
persistedFilters,
children: {}
}
@ -73,13 +74,14 @@ export default {
this.composition.on('add', this.addChildren);
this.composition.on('remove', this.removeChildren);
this.composition.load();
this.unobserve = this.openmct.objects.observe(this.providedObject, 'configuration.filters', this.updatePersistedFilters);
this.unobserveAllMutation = this.openmct.objects.observe(this.providedObject, '*', (mutatedObject) => this.providedObject = mutatedObject);
},
beforeDestroy() {
this.composition.off('add', this.addChildren);
this.composition.off('remove', this.removeChildren);
this.unobserve();
this.unobserveAllMutation();
}
}
</script>

View File

@ -42,14 +42,11 @@ define([
},
view: function (selection) {
let component;
let providedObject = selection[0][0].context.item;
return {
show: function (element) {
component = new Vue({
provide: {
openmct,
providedObject
openmct
},
components: {
FiltersView: FiltersView.default

View File

@ -85,6 +85,10 @@ export default class RemoveAction {
);
this.openmct.objects.mutate(parent, 'composition', composition);
if (this.inNavigationPath(child) && this.openmct.editor.isEditing()) {
this.openmct.editor.save();
}
}
appliesTo(objectPath) {

View File

@ -137,6 +137,10 @@ define([
let requestOptions = this.buildOptionsFromConfiguration(telemetryObject);
return this.openmct.telemetry.request(telemetryObject, requestOptions)
.then(telemetryData => {
//Check that telemetry object has not been removed since telemetry was requested.
if (!this.telemetryObjects.includes(telemetryObject)) {
return;
}
let keyString = this.openmct.objects.makeKeyString(telemetryObject.identifier);
let columnMap = this.getColumnMapForObject(keyString);
let limitEvaluator = this.openmct.telemetry.limitEvaluator(telemetryObject);
@ -194,6 +198,10 @@ define([
let limitEvaluator = this.openmct.telemetry.limitEvaluator(telemetryObject);
this.subscriptions[keyString] = this.openmct.telemetry.subscribe(telemetryObject, (datum) => {
//Check that telemetry object has not been removed since telemetry was requested.
if (!this.telemetryObjects.includes(telemetryObject)) {
return;
}
this.boundedRows.add(new TelemetryTableRow(datum, columnMap, keyString, limitEvaluator));
}, subscribeOptions);
}