[Telemetry Tables] Don't mutate configuration if object is not able to 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
This commit is contained in:
Jamie V 2024-04-03 17:38:59 -07:00 committed by GitHub
parent 311ad0b87a
commit de3dad02b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -40,6 +40,8 @@ export default class TelemetryTableConfiguration extends EventEmitter {
'configuration',
this.objectMutated
);
this.notPersistable = !this.openmct.objects.isPersistable(this.domainObject.identifier);
}
getConfiguration() {
@ -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);
}