mirror of
https://github.com/nasa/openmct.git
synced 2025-05-09 20:12:50 +00:00
5834 stacked plot removing objects from a stacked plot will not remove them from the legend (#6022)
* Add listeners to remove stacked plot series and make keys unique Co-authored-by: Shefali Joshi <simplyrender@gmail.com>
This commit is contained in:
parent
5e530aa625
commit
9980aab18f
@ -353,10 +353,8 @@ export default {
|
|||||||
this.config = this.getConfig();
|
this.config = this.getConfig();
|
||||||
this.legend = this.config.legend;
|
this.legend = this.config.legend;
|
||||||
|
|
||||||
if (this.isNestedWithinAStackedPlot) {
|
const configId = this.openmct.objects.makeKeyString(this.domainObject.identifier);
|
||||||
const configId = this.openmct.objects.makeKeyString(this.domainObject.identifier);
|
this.$emit('configLoaded', configId);
|
||||||
this.$emit('configLoaded', configId);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.listenTo(this.config.series, 'add', this.addSeries, this);
|
this.listenTo(this.config.series, 'add', this.addSeries, this);
|
||||||
this.listenTo(this.config.series, 'remove', this.removeSeries, this);
|
this.listenTo(this.config.series, 'remove', this.removeSeries, this);
|
||||||
|
@ -38,7 +38,7 @@ export default {
|
|||||||
PlotOptionsBrowse,
|
PlotOptionsBrowse,
|
||||||
PlotOptionsEdit
|
PlotOptionsEdit
|
||||||
},
|
},
|
||||||
inject: ['openmct', 'domainObject'],
|
inject: ['openmct', 'domainObject', 'path'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isEditing: this.openmct.editor.isEditing()
|
isEditing: this.openmct.editor.isEditing()
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
></div>
|
></div>
|
||||||
<plot-legend-item-collapsed
|
<plot-legend-item-collapsed
|
||||||
v-for="(seriesObject, seriesIndex) in series"
|
v-for="(seriesObject, seriesIndex) in series"
|
||||||
:key="`seriesObject.keyString-${seriesIndex}`"
|
:key="`${seriesObject.keyString}-${seriesIndex}`"
|
||||||
:highlights="highlights"
|
:highlights="highlights"
|
||||||
:value-to-show-when-collapsed="legend.get('valueToShowWhenCollapsed')"
|
:value-to-show-when-collapsed="legend.get('valueToShowWhenCollapsed')"
|
||||||
:series-object="seriesObject"
|
:series-object="seriesObject"
|
||||||
@ -96,7 +96,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<plot-legend-item-expanded
|
<plot-legend-item-expanded
|
||||||
v-for="(seriesObject, seriesIndex) in series"
|
v-for="(seriesObject, seriesIndex) in series"
|
||||||
:key="`seriesObject.keyString-${seriesIndex}`"
|
:key="`${seriesObject.keyString}-${seriesIndex}-expanded`"
|
||||||
:series-object="seriesObject"
|
:series-object="seriesObject"
|
||||||
:highlights="highlights"
|
:highlights="highlights"
|
||||||
:legend="legend"
|
:legend="legend"
|
||||||
|
@ -124,6 +124,7 @@ export default {
|
|||||||
|
|
||||||
const configId = this.openmct.objects.makeKeyString(this.domainObject.identifier);
|
const configId = this.openmct.objects.makeKeyString(this.domainObject.identifier);
|
||||||
this.config = this.getConfig(configId);
|
this.config = this.getConfig(configId);
|
||||||
|
|
||||||
this.legend = this.config.legend;
|
this.legend = this.config.legend;
|
||||||
|
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
@ -142,6 +143,7 @@ export default {
|
|||||||
id: configId,
|
id: configId,
|
||||||
domainObject: this.domainObject,
|
domainObject: this.domainObject,
|
||||||
openmct: this.openmct,
|
openmct: this.openmct,
|
||||||
|
palette: this.colorPalette,
|
||||||
callback: (data) => {
|
callback: (data) => {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
@ -183,6 +185,10 @@ export default {
|
|||||||
this.domainObject.configuration.series.splice(configIndex, 1);
|
this.domainObject.configuration.series.splice(configIndex, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.removeSeries({
|
||||||
|
keyString: id
|
||||||
|
});
|
||||||
|
|
||||||
const childObj = this.compositionObjects.filter((c) => {
|
const childObj = this.compositionObjects.filter((c) => {
|
||||||
const identifier = this.openmct.objects.makeKeyString(c.identifier);
|
const identifier = this.openmct.objects.makeKeyString(c.identifier);
|
||||||
|
|
||||||
@ -244,18 +250,29 @@ export default {
|
|||||||
this.highlights = data;
|
this.highlights = data;
|
||||||
},
|
},
|
||||||
registerSeriesListeners(configId) {
|
registerSeriesListeners(configId) {
|
||||||
this.seriesConfig[configId] = this.getConfig(configId);
|
const config = this.getConfig(configId);
|
||||||
this.listenTo(this.seriesConfig[configId].series, 'add', this.addSeries, this);
|
this.seriesConfig[configId] = config;
|
||||||
this.listenTo(this.seriesConfig[configId].series, 'remove', this.removeSeries, this);
|
const childObject = config.get('domainObject');
|
||||||
|
|
||||||
this.seriesConfig[configId].series.models.forEach(this.addSeries, this);
|
//TODO differentiate between objects with composition and those without
|
||||||
|
if (childObject.type === 'telemetry.plot.overlay') {
|
||||||
|
this.listenTo(config.series, 'add', this.addSeries, this);
|
||||||
|
this.listenTo(config.series, 'remove', this.removeSeries, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
config.series.models.forEach(this.addSeries, this);
|
||||||
},
|
},
|
||||||
addSeries(series) {
|
addSeries(series) {
|
||||||
const index = this.seriesModels.length;
|
const childObject = series.domainObject;
|
||||||
this.$set(this.seriesModels, index, series);
|
//don't add the series if it can have child series this will happen in registerSeriesListeners
|
||||||
|
if (childObject.type !== 'telemetry.plot.overlay') {
|
||||||
|
const index = this.seriesModels.length;
|
||||||
|
this.$set(this.seriesModels, index, series);
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
removeSeries(plotSeries) {
|
removeSeries(plotSeries) {
|
||||||
const index = this.seriesModels.findIndex(seriesModel => this.openmct.objects.areIdsEqual(seriesModel.identifier, plotSeries.identifier));
|
const index = this.seriesModels.findIndex(seriesModel => seriesModel.keyString === plotSeries.keyString);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
this.$delete(this.seriesModels, index);
|
this.$delete(this.seriesModels, index);
|
||||||
}
|
}
|
||||||
|
@ -133,6 +133,7 @@ export default {
|
|||||||
|
|
||||||
//If this object is not persistable, then package it with it's parent
|
//If this object is not persistable, then package it with it's parent
|
||||||
const object = this.getPlotObject();
|
const object = this.getPlotObject();
|
||||||
|
|
||||||
const getProps = this.getProps;
|
const getProps = this.getProps;
|
||||||
const isMissing = openmct.objects.isMissing(object);
|
const isMissing = openmct.objects.isMissing(object);
|
||||||
let viewContainer = document.createElement('div');
|
let viewContainer = document.createElement('div');
|
||||||
@ -160,7 +161,7 @@ export default {
|
|||||||
onGridLinesChange,
|
onGridLinesChange,
|
||||||
setStatus,
|
setStatus,
|
||||||
isMissing,
|
isMissing,
|
||||||
loading: true
|
loading: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user