minor fixes and moves

This commit is contained in:
Henry Jameson 2025-12-01 20:09:05 +02:00
commit 4a98ec9611
9 changed files with 373 additions and 141 deletions

View file

@ -0,0 +1,21 @@
import Setting from './setting.js'
export default {
...Setting,
components: {
...Setting.components
},
props: {
...Setting.props
},
computed: {
...Setting.computed
},
methods: {
...Setting.methods,
updateValue (e) {
console.log(e.target.value)
//this.configSink(this.path, parseFloat(e.target.value) + this.stateUnit)
}
}
}

View file

@ -0,0 +1,45 @@
<template>
<label
v-if="matchesExpertLevel"
class="StringSetting"
>
<label
:for="path"
class="setting-label"
:class="{ 'faint': shouldBeDisabled }"
>
<template v-if="backendDescriptionLabel">
{{ backendDescriptionLabel + ' ' }}
</template>
<template v-else-if="source === 'admin'">
MISSING LABEL FOR {{ path }}
</template>
<slot v-else />
</label>
{{ ' ' }}
<Checkbox
v-for="option in value"
:model-value="value"
:disabled="shouldBeDisabled"
@update:model-value="update"
>
{{ value }}
</Checkbox>
{{ ' ' }}
<ModifiedIndicator
:changed="isChanged"
:onclick="reset"
/>
<ProfileSettingIndicator :is-profile="isProfileSetting" />
<DraftButtons />
<p
v-if="backendDescriptionDescription"
class="setting-description"
:class="{ 'faint': shouldBeDisabled }"
>
{{ backendDescriptionDescription + ' ' }}
</p>
</label>
</template>
<script src="./string_setting.js"></script>

View file

@ -77,7 +77,7 @@ export default {
},
created () {
if (this.realDraftMode && (this.realSource !== 'admin' || this.path == null)) {
this.draft = this.state
this.draft = cloneDeep(this.state)
}
},
computed: {
@ -158,7 +158,14 @@ export default {
if (this.path == null) {
return this.disabled
}
const parentValue = this.parentPath !== undefined ? get(this.configSource, this.parentPath) : null
let parentValue = null
if (this.parentPath !== undefined && this.realSource === 'admin') {
if (this.realDraftMode) {
parentValue = get(this.$store.state.adminSettings.draft, this.parentPath)
} else {
parentValue = get(this.configSource, this.parentPath)
}
}
return this.disabled || (parentValue !== null ? (this.parentInvert ? parentValue : !parentValue) : false)
},
configSource () {