Merge pull request #2137 from nasa/prevent-plot-accidental-remove

[Plot] Update formDomainObject on mutate
This commit is contained in:
Deep Tailor 2018-07-31 12:44:51 -07:00 committed by GitHub
commit 9582fb2b06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -83,6 +83,7 @@ define([
this.listenTo(this, 'change:xKey', this.onXKeyChange, this); this.listenTo(this, 'change:xKey', this.onXKeyChange, this);
this.listenTo(this, 'change:yKey', this.onYKeyChange, this); this.listenTo(this, 'change:yKey', this.onYKeyChange, this);
this.persistedConfig = options.persistedConfig;
Model.apply(this, arguments); Model.apply(this, arguments);
this.onXKeyChange(this.get('xKey')); this.onXKeyChange(this.get('xKey'));
@ -176,8 +177,7 @@ define([
return; return;
} }
var valueMetadata = this.metadata.value(newKey); var valueMetadata = this.metadata.value(newKey);
var persistedConfig = this.get('persistedConfiguration'); if (!this.persistedConfig || !this.persistedConfig.interpolate) {
if (!persistedConfig || !persistedConfig.interpolate) {
if (valueMetadata.format === 'enum') { if (valueMetadata.format === 'enum') {
this.set('interpolate', 'stepAfter'); this.set('interpolate', 'stepAfter');
} else { } else {

View File

@ -54,7 +54,7 @@ define([
domainObject.configuration.series.forEach(function (seriesConfig) { domainObject.configuration.series.forEach(function (seriesConfig) {
var series = this.byIdentifier(seriesConfig.identifier); var series = this.byIdentifier(seriesConfig.identifier);
if (series) { if (series) {
series.set('persistedConfiguration', seriesConfig); series.persistedConfig = seriesConfig;
} }
}, this); }, this);
}, },
@ -90,7 +90,9 @@ define([
model: seriesConfig, model: seriesConfig,
domainObject: domainObject, domainObject: domainObject,
collection: this, collection: this,
openmct: this.openmct openmct: this.openmct,
persistedConfig: this.plot
.getPersistedSeriesConfig(domainObject.identifier)
})); }));
}, },
removeTelemetryObject: function (identifier) { removeTelemetryObject: function (identifier) {

View File

@ -45,6 +45,7 @@ define([
PlotOptionsController.prototype.updateDomainObject = function (domainObject) { PlotOptionsController.prototype.updateDomainObject = function (domainObject) {
this.domainObject = domainObject; this.domainObject = domainObject;
this.$scope.formDomainObject = domainObject;
}; };
PlotOptionsController.prototype.destroy = function () { PlotOptionsController.prototype.destroy = function () {
@ -63,8 +64,7 @@ define([
this.config = this.$scope.config = config; this.config = this.$scope.config = config;
this.$scope.plotSeries = []; this.$scope.plotSeries = [];
this.domainObject = this.config.get('domainObject'); this.updateDomainObject(this.config.get('domainObject'));
this.$scope.formDomainObject = this.domainObject;
this.unlisten = this.openmct.objects.observe(this.domainObject, '*', this.updateDomainObject.bind(this)); this.unlisten = this.openmct.objects.observe(this.domainObject, '*', this.updateDomainObject.bind(this));
this.listenTo(this.$scope, '$destroy', this.destroy, this); this.listenTo(this.$scope, '$destroy', this.destroy, this);