mirror of
https://github.com/nasa/openmct.git
synced 2024-12-23 15:02:23 +00:00
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:
parent
b659f205f7
commit
6bf4b3aba8
@ -23,17 +23,18 @@ export default {
|
|||||||
FilterObject
|
FilterObject
|
||||||
},
|
},
|
||||||
inject: [
|
inject: [
|
||||||
'openmct',
|
'openmct'
|
||||||
'providedObject'
|
|
||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
|
let providedObject = this.openmct.selection.get()[0][0].context.item;
|
||||||
let persistedFilters = {};
|
let persistedFilters = {};
|
||||||
|
|
||||||
if (this.providedObject.configuration && this.providedObject.configuration.filters) {
|
if (providedObject.configuration && providedObject.configuration.filters) {
|
||||||
persistedFilters = this.providedObject.configuration.filters;
|
persistedFilters = providedObject.configuration.filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
providedObject,
|
||||||
persistedFilters,
|
persistedFilters,
|
||||||
children: {}
|
children: {}
|
||||||
}
|
}
|
||||||
@ -73,13 +74,14 @@ export default {
|
|||||||
this.composition.on('add', this.addChildren);
|
this.composition.on('add', this.addChildren);
|
||||||
this.composition.on('remove', this.removeChildren);
|
this.composition.on('remove', this.removeChildren);
|
||||||
this.composition.load();
|
this.composition.load();
|
||||||
|
|
||||||
this.unobserve = this.openmct.objects.observe(this.providedObject, 'configuration.filters', this.updatePersistedFilters);
|
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() {
|
beforeDestroy() {
|
||||||
this.composition.off('add', this.addChildren);
|
this.composition.off('add', this.addChildren);
|
||||||
this.composition.off('remove', this.removeChildren);
|
this.composition.off('remove', this.removeChildren);
|
||||||
this.unobserve();
|
this.unobserve();
|
||||||
|
this.unobserveAllMutation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -42,14 +42,11 @@ define([
|
|||||||
},
|
},
|
||||||
view: function (selection) {
|
view: function (selection) {
|
||||||
let component;
|
let component;
|
||||||
let providedObject = selection[0][0].context.item;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
show: function (element) {
|
show: function (element) {
|
||||||
component = new Vue({
|
component = new Vue({
|
||||||
provide: {
|
provide: {
|
||||||
openmct,
|
openmct
|
||||||
providedObject
|
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
FiltersView: FiltersView.default
|
FiltersView: FiltersView.default
|
||||||
|
@ -85,6 +85,10 @@ export default class RemoveAction {
|
|||||||
);
|
);
|
||||||
|
|
||||||
this.openmct.objects.mutate(parent, 'composition', composition);
|
this.openmct.objects.mutate(parent, 'composition', composition);
|
||||||
|
|
||||||
|
if (this.inNavigationPath(child) && this.openmct.editor.isEditing()) {
|
||||||
|
this.openmct.editor.save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
appliesTo(objectPath) {
|
appliesTo(objectPath) {
|
||||||
|
@ -137,6 +137,10 @@ define([
|
|||||||
let requestOptions = this.buildOptionsFromConfiguration(telemetryObject);
|
let requestOptions = this.buildOptionsFromConfiguration(telemetryObject);
|
||||||
return this.openmct.telemetry.request(telemetryObject, requestOptions)
|
return this.openmct.telemetry.request(telemetryObject, requestOptions)
|
||||||
.then(telemetryData => {
|
.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 keyString = this.openmct.objects.makeKeyString(telemetryObject.identifier);
|
||||||
let columnMap = this.getColumnMapForObject(keyString);
|
let columnMap = this.getColumnMapForObject(keyString);
|
||||||
let limitEvaluator = this.openmct.telemetry.limitEvaluator(telemetryObject);
|
let limitEvaluator = this.openmct.telemetry.limitEvaluator(telemetryObject);
|
||||||
@ -194,6 +198,10 @@ define([
|
|||||||
let limitEvaluator = this.openmct.telemetry.limitEvaluator(telemetryObject);
|
let limitEvaluator = this.openmct.telemetry.limitEvaluator(telemetryObject);
|
||||||
|
|
||||||
this.subscriptions[keyString] = this.openmct.telemetry.subscribe(telemetryObject, (datum) => {
|
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));
|
this.boundedRows.add(new TelemetryTableRow(datum, columnMap, keyString, limitEvaluator));
|
||||||
}, subscribeOptions);
|
}, subscribeOptions);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user