forked from AkkomaGang/admin-fe
Hide unused section of settings based on what uploader is selected
This commit is contained in:
parent
9f8112fe32
commit
fb5bfca562
2 changed files with 18 additions and 4 deletions
|
@ -95,6 +95,9 @@ const settings = {
|
||||||
if (key === 'Pleroma.Emails.Mailer' && input === ':adapter') {
|
if (key === 'Pleroma.Emails.Mailer' && input === ':adapter') {
|
||||||
const subkeys = Object.keys(state.settings[group][key]).filter(el => el !== ':adapter')
|
const subkeys = Object.keys(state.settings[group][key]).filter(el => el !== ':adapter')
|
||||||
await removeSettings([{ group, key, delete: true, subkeys }], getters.authHost, getters.token)
|
await removeSettings([{ group, key, delete: true, subkeys }], getters.authHost, getters.token)
|
||||||
|
} else if (key === 'Pleroma.Upload' && input === ':uploader') {
|
||||||
|
const deletedKey = value === 'Pleroma.Uploaders.Local' ? 'Pleroma.Uploaders.S3' : 'Pleroma.Uploaders.Local'
|
||||||
|
await removeSettings([{ group, key: deletedKey, delete: true }], getters.authHost, getters.token)
|
||||||
}
|
}
|
||||||
key
|
key
|
||||||
? commit('UPDATE_STATE', { group, key, input, value })
|
? commit('UPDATE_STATE', { group, key, input, value })
|
||||||
|
|
|
@ -3,14 +3,17 @@
|
||||||
<el-form ref="uploadData" :model="uploadData" :label-width="labelWidth">
|
<el-form ref="uploadData" :model="uploadData" :label-width="labelWidth">
|
||||||
<setting :setting-group="upload" :data="uploadData"/>
|
<setting :setting-group="upload" :data="uploadData"/>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-form ref="uploadersLocal" :model="uploadersLocalData" :label-width="labelWidth">
|
<el-form v-if="showUploadersLocal" ref="uploadersLocal" :model="uploadersLocalData" :label-width="labelWidth">
|
||||||
|
<el-form-item class="description-container description">
|
||||||
|
<span class="description"><p>Pleroma.Uploaders.Local</p></span>
|
||||||
|
</el-form-item>
|
||||||
<setting :setting-group="uploadersLocal" :data="uploadersLocalData"/>
|
<setting :setting-group="uploadersLocal" :data="uploadersLocalData"/>
|
||||||
</el-form>
|
|
||||||
<div class="line"/>
|
<div class="line"/>
|
||||||
<el-form ref="uploadersS3" :model="uploadersS3Data" :label-width="labelWidth">
|
</el-form>
|
||||||
|
<el-form v-if="showUploadersS3" ref="uploadersS3" :model="uploadersS3Data" :label-width="labelWidth">
|
||||||
<setting :setting-group="uploadersS3" :data="uploadersS3Data"/>
|
<setting :setting-group="uploadersS3" :data="uploadersS3Data"/>
|
||||||
</el-form>
|
|
||||||
<div class="line"/>
|
<div class="line"/>
|
||||||
|
</el-form>
|
||||||
<el-form ref="uploadFilterMogrify" :model="uploadFilterMogrifyData" :label-width="labelWidth">
|
<el-form ref="uploadFilterMogrify" :model="uploadFilterMogrifyData" :label-width="labelWidth">
|
||||||
<setting :setting-group="uploadFilterMogrify" :data="uploadFilterMogrifyData"/>
|
<setting :setting-group="uploadFilterMogrify" :data="uploadFilterMogrifyData"/>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
@ -46,6 +49,14 @@ export default {
|
||||||
loading() {
|
loading() {
|
||||||
return this.settings.loading
|
return this.settings.loading
|
||||||
},
|
},
|
||||||
|
showUploadersS3() {
|
||||||
|
const uploader = _.get(this.settings.settings, [':pleroma', 'Pleroma.Upload', ':uploader'])
|
||||||
|
return uploader === 'Pleroma.Uploaders.S3'
|
||||||
|
},
|
||||||
|
showUploadersLocal() {
|
||||||
|
const uploader = _.get(this.settings.settings, [':pleroma', 'Pleroma.Upload', ':uploader'])
|
||||||
|
return uploader === 'Pleroma.Uploaders.Local'
|
||||||
|
},
|
||||||
upload() {
|
upload() {
|
||||||
return this.settings.description.find(setting => setting.key === 'Pleroma.Upload')
|
return this.settings.description.find(setting => setting.key === 'Pleroma.Upload')
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue