Fix parsing data for Http and Instance tabs, update computed for Http, Instance and Gopher tabs

This commit is contained in:
Angelina Filippova 2019-11-20 11:12:08 +09:00
parent 63951408b8
commit c9d609e3db
4 changed files with 17 additions and 24 deletions

View file

@ -23,7 +23,7 @@ export default {
return this.settings.description.find(setting => setting.key === ':gopher') return this.settings.description.find(setting => setting.key === ':gopher')
}, },
gopherData() { gopherData() {
return this.settings.settings[':gopher'] return this.settings.settings.pleroma[':gopher']
}, },
isMobile() { isMobile() {
return this.$store.state.app.device === 'mobile' return this.$store.state.app.device === 'mobile'

View file

@ -10,9 +10,6 @@
<div class="line"/> <div class="line"/>
<el-form ref="httpSecurityData" :model="httpSecurityData" :label-width="labelWidth"> <el-form ref="httpSecurityData" :model="httpSecurityData" :label-width="labelWidth">
<setting :setting-group="httpSecurity" :data="httpSecurityData"/> <setting :setting-group="httpSecurity" :data="httpSecurityData"/>
</el-form>
<div class="line"/>
<el-form ref="hackneyPoolsData" :model="hackneyPoolsData" :label-width="labelWidth">
<el-form-item> <el-form-item>
<el-button type="primary" @click="onSubmit">Submit</el-button> <el-button type="primary" @click="onSubmit">Submit</el-button>
</el-form-item> </el-form-item>
@ -36,25 +33,19 @@ export default {
return this.settings.description.find(setting => setting.group === ':cors_plug') return this.settings.description.find(setting => setting.group === ':cors_plug')
}, },
corsPlugData() { corsPlugData() {
return this.settings.settings[':cors_plug'] return this.settings.settings.cors_plug
},
hackneyPools() {
return this.settings.description.find(setting => setting.key === ':hackney_pools')
},
hackneyPoolsData() {
return this.settings.settings[':hackney_pools']
}, },
http() { http() {
return this.settings.description.find(setting => setting.key === ':http') return this.settings.description.find(setting => setting.key === ':http')
}, },
httpData() { httpData() {
return this.settings.settings[':http'] return this.settings.settings.pleroma[':http']
}, },
httpSecurity() { httpSecurity() {
return this.settings.description.find(setting => setting.key === ':http_security') return this.settings.description.find(setting => setting.key === ':http_security')
}, },
httpSecurityData() { httpSecurityData() {
return this.settings.settings[':http_security'] return this.settings.settings.pleroma[':http_security']
}, },
isMobile() { isMobile() {
return this.$store.state.app.device === 'mobile' return this.$store.state.app.device === 'mobile'

View file

@ -38,7 +38,7 @@
</div> </div>
<el-select <el-select
v-if="renderMultipleSelect(setting.type)" v-if="renderMultipleSelect(setting.type)"
:value="data[setting.key]" :value="setting.key === ':rewrite_policy' ? rewritePolicyValue : inputValue"
multiple multiple
filterable filterable
allow-create allow-create
@ -225,7 +225,7 @@ export default {
} }
}, },
inputValue() { inputValue() {
return ([':esshd'].includes(this.settingGroup.group) && this.data[this.setting.key]) return ([':esshd', ':cors_plug'].includes(this.settingGroup.group) && this.data[this.setting.key])
? this.data[this.setting.key].value ? this.data[this.setting.key].value
: this.data[this.setting.key] : this.data[this.setting.key]
}, },
@ -266,6 +266,9 @@ export default {
return Array.isArray(this.data[this.setting.key]) return Array.isArray(this.data[this.setting.key])
? Object.entries(this.data[this.setting.key][0])[0] ? Object.entries(this.data[this.setting.key][0])[0]
: false : false
},
rewritePolicyValue() {
return typeof this.data[this.setting.key] === 'string' ? [this.data[this.setting.key]] : this.data[this.setting.key]
} }
}, },
methods: { methods: {
@ -372,10 +375,9 @@ export default {
}, },
renderMultipleSelect(type) { renderMultipleSelect(type) {
return Array.isArray(type) && ( return Array.isArray(type) && (
type.includes('module') ||
(type.includes('list') && type.includes('string')) || (type.includes('list') && type.includes('string')) ||
(type.includes('list') && type.includes('atom')) || (type.includes('list') && type.includes('atom')) ||
(type.includes('list') && type.includes('module')) ||
(type.includes('module') && type.includes('atom')) ||
(type.includes('regex') && type.includes('string')) || (type.includes('regex') && type.includes('string')) ||
this.setting.key === ':args' this.setting.key === ':args'
) )

View file

@ -52,19 +52,19 @@ export default {
return this.settings.description.find(setting => setting.description === `Allows to set a token that can be used to authenticate with the admin api without using an actual user by giving it as the 'admin_token' parameter`) return this.settings.description.find(setting => setting.description === `Allows to set a token that can be used to authenticate with the admin api without using an actual user by giving it as the 'admin_token' parameter`)
}, },
adminTokenData() { adminTokenData() {
return this.settings.settings[':admin_token'] return this.settings.settings.pleroma[':admin_token']
}, },
fetchInitialPosts() { fetchInitialPosts() {
return this.settings.description.find(setting => setting.key === ':fetch_initial_posts') return this.settings.description.find(setting => setting.key === ':fetch_initial_posts')
}, },
fetchInitialPostsData() { fetchInitialPostsData() {
return this.settings.settings[':fetch_initial_posts'] return this.settings.settings.pleroma[':fetch_initial_posts']
}, },
instance() { instance() {
return this.settings.description.find(setting => setting.key === ':instance') return this.settings.description.find(setting => setting.key === ':instance')
}, },
instanceData() { instanceData() {
return this.settings.settings[':instance'] return this.settings.settings.pleroma[':instance']
}, },
isMobile() { isMobile() {
return this.$store.state.app.device === 'mobile' return this.$store.state.app.device === 'mobile'
@ -79,25 +79,25 @@ export default {
return this.settings.description.find(setting => setting.key === 'Pleroma.User') return this.settings.description.find(setting => setting.key === 'Pleroma.User')
}, },
pleromaUserData() { pleromaUserData() {
return this.settings.settings['Pleroma.User'] return this.settings.settings.pleroma['Pleroma.User']
}, },
scheduledActivity() { scheduledActivity() {
return this.$store.state.settings.description.find(setting => setting.key === 'Pleroma.ScheduledActivity') return this.$store.state.settings.description.find(setting => setting.key === 'Pleroma.ScheduledActivity')
}, },
scheduledActivityData() { scheduledActivityData() {
return this.settings.settings['Pleroma.ScheduledActivity'] return this.settings.settings.pleroma['Pleroma.ScheduledActivity']
}, },
suggestions() { suggestions() {
return this.$store.state.settings.description.find(setting => setting.key === ':suggestions') return this.$store.state.settings.description.find(setting => setting.key === ':suggestions')
}, },
suggestionsData() { suggestionsData() {
return this.settings.settings[':suggestions'] return this.settings.settings.pleroma[':suggestions']
}, },
uriSchemes() { uriSchemes() {
return this.$store.state.settings.description.find(setting => setting.key === ':uri_schemes') return this.$store.state.settings.description.find(setting => setting.key === ':uri_schemes')
}, },
uriSchemesData() { uriSchemesData() {
return this.settings.settings[':uri_schemes'] return this.settings.settings.pleroma[':uri_schemes']
} }
}, },
methods: { methods: {