Don't store/show the state of write-only toggle switches

This commit is contained in:
Fabio Manganiello 2022-10-23 00:28:01 +02:00
parent 8cd5cb3338
commit 3e6ebdd23b
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 12 additions and 2 deletions

View File

@ -11,8 +11,11 @@
</div>
<div class="col-2 switch pull-right">
<ToggleSwitch :value="value.state" @input="toggle"
@click.stop :disabled="loading || value.is_read_only" />
<ToggleSwitch
:value="value.is_write_only ? false : value.state"
:disabled="loading || value.is_read_only"
@input="toggle"
@click.stop />
</div>
</div>
</div>
@ -38,6 +41,13 @@ export default {
id: this.value.id,
action: 'toggle',
})
if (this.value.is_write_only) {
// Show a quick on/off animation for write-only switches
const self = this
self.value.state = true
setTimeout(() => self.value.state = false, 250)
}
} finally {
this.$emit('loading', false)
}