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')
},
gopherData() {
return this.settings.settings[':gopher']
return this.settings.settings.pleroma[':gopher']
},
isMobile() {
return this.$store.state.app.device === 'mobile'

View file

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

View file

@ -38,7 +38,7 @@
</div>
<el-select
v-if="renderMultipleSelect(setting.type)"
:value="data[setting.key]"
:value="setting.key === ':rewrite_policy' ? rewritePolicyValue : inputValue"
multiple
filterable
allow-create
@ -225,7 +225,7 @@ export default {
}
},
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]
},
@ -266,6 +266,9 @@ export default {
return Array.isArray(this.data[this.setting.key])
? Object.entries(this.data[this.setting.key][0])[0]
: false
},
rewritePolicyValue() {
return typeof this.data[this.setting.key] === 'string' ? [this.data[this.setting.key]] : this.data[this.setting.key]
}
},
methods: {
@ -372,10 +375,9 @@ export default {
},
renderMultipleSelect(type) {
return Array.isArray(type) && (
type.includes('module') ||
(type.includes('list') && type.includes('string')) ||
(type.includes('list') && type.includes('atom')) ||
(type.includes('list') && type.includes('module')) ||
(type.includes('module') && type.includes('atom')) ||
(type.includes('regex') && type.includes('string')) ||
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`)
},
adminTokenData() {
return this.settings.settings[':admin_token']
return this.settings.settings.pleroma[':admin_token']
},
fetchInitialPosts() {
return this.settings.description.find(setting => setting.key === ':fetch_initial_posts')
},
fetchInitialPostsData() {
return this.settings.settings[':fetch_initial_posts']
return this.settings.settings.pleroma[':fetch_initial_posts']
},
instance() {
return this.settings.description.find(setting => setting.key === ':instance')
},
instanceData() {
return this.settings.settings[':instance']
return this.settings.settings.pleroma[':instance']
},
isMobile() {
return this.$store.state.app.device === 'mobile'
@ -79,25 +79,25 @@ export default {
return this.settings.description.find(setting => setting.key === 'Pleroma.User')
},
pleromaUserData() {
return this.settings.settings['Pleroma.User']
return this.settings.settings.pleroma['Pleroma.User']
},
scheduledActivity() {
return this.$store.state.settings.description.find(setting => setting.key === 'Pleroma.ScheduledActivity')
},
scheduledActivityData() {
return this.settings.settings['Pleroma.ScheduledActivity']
return this.settings.settings.pleroma['Pleroma.ScheduledActivity']
},
suggestions() {
return this.$store.state.settings.description.find(setting => setting.key === ':suggestions')
},
suggestionsData() {
return this.settings.settings[':suggestions']
return this.settings.settings.pleroma[':suggestions']
},
uriSchemes() {
return this.$store.state.settings.description.find(setting => setting.key === ':uri_schemes')
},
uriSchemesData() {
return this.settings.settings[':uri_schemes']
return this.settings.settings.pleroma[':uri_schemes']
}
},
methods: {