forked from AkkomaGang/admin-fe
Add label and description to children settings of ssl-option
This commit is contained in:
parent
51a2b72793
commit
82c077112f
1 changed files with 26 additions and 13 deletions
|
@ -1,15 +1,18 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div v-for="subSetting in setting.children" :key="subSetting.key">
|
<div v-for="subSetting in setting.children" :key="subSetting.key">
|
||||||
<el-select
|
<el-form-item :label="subSetting.label" :label-width="customLabelWidth">
|
||||||
v-if="subSetting.type.includes('list') && subSetting.type.includes('atom')"
|
<el-select
|
||||||
:value="data[setting.key][subSetting.key]"
|
v-if="subSetting.type.includes('list') && subSetting.type.includes('atom')"
|
||||||
multiple
|
:value="data[setting.key][subSetting.key]"
|
||||||
filterable
|
multiple
|
||||||
allow-create
|
filterable
|
||||||
@change="update($event, subSetting.key)">
|
allow-create
|
||||||
<el-option v-for="(option, index) in subSetting.suggestions" :key="index" :value="option"/>
|
@change="update($event, subSetting.key)">
|
||||||
</el-select>
|
<el-option v-for="(option, index) in subSetting.suggestions" :key="index" :value="option"/>
|
||||||
|
</el-select>
|
||||||
|
<p class="expl">{{ subSetting.description }}</p>
|
||||||
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -61,11 +64,21 @@ export default {
|
||||||
inputValue(key) {
|
inputValue(key) {
|
||||||
return this.data[this.setting.key][key]
|
return this.data[this.setting.key][key]
|
||||||
},
|
},
|
||||||
update(value, key) {
|
update(value, childKey) {
|
||||||
const updatedState = { ...this.data, [this.setting.key]: { ...this.data[this.setting.key], [key]: value }}
|
const [group, key, parentKey, input] = [this.settingGroup.group, this.settingGroup.key, this.setting.key, this.settingParent.key]
|
||||||
|
const { updatedSettings, description } = this.$store.state.settings
|
||||||
|
const type = description
|
||||||
|
.find(element => element.group === group && element.key === key).children
|
||||||
|
.find(child => child.key === ':adapter').children.find(child => child.key === ':ssl_options').children
|
||||||
|
.find(child => child.key === childKey).type
|
||||||
|
|
||||||
this.$store.dispatch('UpdateSettings', { group: this.settingGroup.group, key: this.settingGroup.key, input: this.settingParent.key, value: updatedState, type: this.settingParent.type })
|
const updatedState = { ...this.data, [parentKey]: { ...this.data[parentKey], [childKey]: value }}
|
||||||
this.$store.dispatch('UpdateState', { group: this.settingGroup.group, key: this.settingGroup.key, input: this.settingParent.key, value: updatedState })
|
const updatedSetting = !updatedSettings[group] || !updatedSettings[group][key]
|
||||||
|
? { [parentKey]: ['keyword', { [childKey]: [type, value] }] }
|
||||||
|
: { ...updatedSettings[group][key][parentKey], [parentKey]: { ...updatedSettings[group][key][parentKey], [childKey]: [type, value] }}
|
||||||
|
|
||||||
|
this.$store.dispatch('UpdateSettings', { group, key, input, value: updatedSetting, type: this.settingParent.type })
|
||||||
|
this.$store.dispatch('UpdateState', { group, key, input, value: updatedState })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue