2019-05-25 22:21:36 +02:00
|
|
|
<div class="generic-instance-settings">
|
|
|
|
<form aria-label={label} ref:form>
|
|
|
|
{#each options as option, i (option.key) }
|
|
|
|
{#if i > 0}
|
|
|
|
<br>
|
|
|
|
{/if}
|
|
|
|
<input type="checkbox"
|
|
|
|
id="instance-option-{option.key}"
|
|
|
|
name="{option.key}"
|
|
|
|
on:change="onChange(event)"
|
|
|
|
>
|
|
|
|
<label for="instance-option-{option.key}">
|
|
|
|
{option.label}
|
|
|
|
</label>
|
|
|
|
{/each}
|
|
|
|
</form>
|
|
|
|
</div>
|
2021-03-14 02:31:17 +01:00
|
|
|
<GenericInstanceSettingsStyle/>
|
2019-05-25 22:21:36 +02:00
|
|
|
<script>
|
2021-03-14 02:31:17 +01:00
|
|
|
import GenericInstanceSettingsStyle from './GenericInstanceSettingsStyle.html'
|
2019-05-25 22:21:36 +02:00
|
|
|
import { store } from '../../../_store/store'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
oncreate () {
|
2019-08-03 22:49:37 +02:00
|
|
|
const { instanceName, options } = this.get()
|
|
|
|
const { form } = this.refs
|
|
|
|
for (const { key, defaultValue } of options) {
|
2019-05-25 22:21:36 +02:00
|
|
|
form.elements[key].checked = this.store.getInstanceSetting(instanceName, key, defaultValue)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onChange (event) {
|
2019-08-03 22:49:37 +02:00
|
|
|
const { instanceName } = this.get()
|
|
|
|
const { target } = event
|
2019-05-25 22:21:36 +02:00
|
|
|
this.store.setInstanceSetting(instanceName, target.name, target.checked)
|
|
|
|
}
|
|
|
|
},
|
2021-03-14 02:31:17 +01:00
|
|
|
store: () => store,
|
|
|
|
components: {
|
|
|
|
GenericInstanceSettingsStyle
|
|
|
|
}
|
2019-05-25 22:21:36 +02:00
|
|
|
}
|
|
|
|
</script>
|