fix: fix more settings persistence bug(s) for datasync/configure

esp. for the profile consumers info
This commit is contained in:
Lance Edgar 2024-07-18 17:58:59 -05:00
parent f4f79f170a
commit 1bba6d9947

View file

@ -734,16 +734,9 @@
this.editingProfilePendingConsumers = []
for (let consumer of row.consumers_data) {
let pending = {
const pending = {
...consumer,
original_key: consumer.key,
key: consumer.key,
consumer_spec: consumer.consumer_spec,
consumer_dbkey: consumer.consumer_dbkey,
consumer_delay: consumer.consumer_delay,
consumer_retry_attempts: consumer.consumer_retry_attempts,
consumer_retry_delay: consumer.consumer_retry_delay,
consumer_runas: consumer.consumer_runas,
enabled: consumer.enabled,
}
this.editingProfilePendingConsumers.push(pending)
}
@ -791,8 +784,8 @@
this.editingProfilePendingWatcherKwargs.splice(i, 1)
}
ThisPage.methods.findOriginalConsumer = function(key) {
for (let consumer of this.editingProfile.consumers_data) {
ThisPage.methods.findConsumer = function(profileConsumers, key) {
for (const consumer of profileConsumers) {
if (consumer.key == key) {
return consumer
}
@ -803,9 +796,12 @@
const row = this.editingProfile
const newRow = !row.key
let originalProfile = null
if (newRow) {
row.consumers_data = []
this.profilesData.push(row)
} else {
originalProfile = this.findProfile(row)
}
row.key = this.editingProfileKey
@ -853,7 +849,8 @@
for (let pending of this.editingProfilePendingConsumers) {
persistentConsumers.push(pending.key)
if (pending.original_key) {
let consumer = this.findOriginalConsumer(pending.original_key)
const consumer = this.findConsumer(originalProfile.consumers_data,
pending.original_key)
consumer.key = pending.key
consumer.consumer_spec = pending.consumer_spec
consumer.consumer_dbkey = pending.consumer_dbkey
@ -941,8 +938,10 @@
}
ThisPage.methods.updateConsumer = function() {
let pending = this.editingConsumer
let isNew = !pending.key
const pending = this.findConsumer(
this.editingProfilePendingConsumers,
this.editingConsumer.key)
const isNew = !pending.key
pending.key = this.editingConsumerKey
pending.consumer_spec = this.editingConsumerSpec