fix: [instance:settings] Revert setting back to its original in case of failure
parent
62c228c44e
commit
a9e85a34d3
|
@ -67,14 +67,21 @@ function saveAndUpdateSetting(statusNode, $input, settingName, settingValue) {
|
||||||
settingValue = JSON.stringify(settingValue)
|
settingValue = JSON.stringify(settingValue)
|
||||||
}
|
}
|
||||||
saveSetting(statusNode, settingName, settingValue).then((result) => {
|
saveSetting(statusNode, settingName, settingValue).then((result) => {
|
||||||
window.settingsFlattened[settingName] = result.data
|
updateSettingValue($input, settingName, result.data)
|
||||||
if ($input.attr('type') == 'checkbox') {
|
}).catch((e) => {
|
||||||
$input.prop('checked', result.data.value == true)
|
updateSettingValue($input, settingName, window.settingsFlattened[settingName])
|
||||||
} else {
|
}).finally(() => {
|
||||||
$input.val(result.data.value)
|
|
||||||
}
|
|
||||||
handleSettingValueChange($input)
|
handleSettingValueChange($input)
|
||||||
}).catch((e) => { })
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateSettingValue($input, settingName, settingValue) {
|
||||||
|
window.settingsFlattened[settingName] = settingValue
|
||||||
|
if ($input.attr('type') == 'checkbox') {
|
||||||
|
$input.prop('checked', settingValue.value == true)
|
||||||
|
} else {
|
||||||
|
$input.val(settingValue.value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSettingValueChange($input) {
|
function handleSettingValueChange($input) {
|
||||||
|
|
Loading…
Reference in New Issue