Skip to content

Commit

Permalink
[Telemetry Tables] Don't mutate configuration if object is not able t…
Browse files Browse the repository at this point in the history
…o be persisted (#7626)

* source maps

* do not persist if obj is not persistable

* nope

* prevent mutation of configuration

* static roots are read only by nature

* helps to use functions correctly

* update persistModeChange logic

* remove debug

* remove unnecessary change
  • Loading branch information
jvigliotta authored Apr 4, 2024
1 parent 311ad0b commit de3dad0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/plugins/telemetryTable/TelemetryTableConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export default class TelemetryTableConfiguration extends EventEmitter {
'configuration',
this.objectMutated
);

this.notPersistable = !this.openmct.objects.isPersistable(this.domainObject.identifier);
}

getConfiguration() {
Expand All @@ -52,14 +54,19 @@ export default class TelemetryTableConfiguration extends EventEmitter {
// anything that doesn't have a telemetryMode existed before the change and should
// take the properties of any passed in defaults or the defaults from the plugin
configuration.telemetryMode = configuration.telemetryMode ?? this.defaultOptions.telemetryMode;
configuration.persistModeChange =
configuration.persistModeChange ?? this.defaultOptions.persistModeChange;
configuration.persistModeChange = this.notPersistable
? false
: configuration.persistModeChange ?? this.defaultOptions.persistModeChange;
configuration.rowLimit = configuration.rowLimit ?? this.defaultOptions.rowLimit;

return configuration;
}

updateConfiguration(configuration) {
if (this.notPersistable) {
return;
}

this.openmct.objects.mutate(this.domainObject, 'configuration', configuration);
}

Expand Down

0 comments on commit de3dad0

Please sign in to comment.