mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-25 14:30:28 -05:00
53 lines
1.0 KiB
Vue
53 lines
1.0 KiB
Vue
<template>
|
|
<div>
|
|
<oc-checkbox v-model="value" :label="setting.boolValue.label" @change="applyValue" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import isNil from 'lodash/isNil'
|
|
export default {
|
|
name: 'SettingBoolean',
|
|
props: {
|
|
bundle: {
|
|
type: Object,
|
|
required: true
|
|
},
|
|
setting: {
|
|
type: Object,
|
|
required: true
|
|
},
|
|
persistedValue: {
|
|
type: Object,
|
|
required: false
|
|
}
|
|
},
|
|
data () {
|
|
return {
|
|
value: null
|
|
}
|
|
},
|
|
methods: {
|
|
async applyValue () {
|
|
const value = {
|
|
boolValue: this.value
|
|
}
|
|
await this.$emit('onSave', {
|
|
bundle: this.bundle,
|
|
setting: this.setting,
|
|
value
|
|
})
|
|
// TODO: show a spinner while the request for saving the value is running!
|
|
}
|
|
},
|
|
mounted () {
|
|
if (!isNil(this.persistedValue)) {
|
|
this.value = this.persistedValue.boolValue
|
|
}
|
|
if (isNil(this.value) && !isNil(this.setting.boolValue.default)) {
|
|
this.value = this.setting.boolValue.default
|
|
}
|
|
}
|
|
}
|
|
</script>
|