Update Instance tab to accept values from API
This commit is contained in:
parent
a9453448b5
commit
88bae9ced8
2 changed files with 32 additions and 29 deletions
|
@ -19,14 +19,14 @@
|
|||
class="top-margin"
|
||||
@change="updateSetting($event, settingsGroup.key, setting.key)"/>
|
||||
<el-select
|
||||
v-if="setting.type === 'module'"
|
||||
v-if="setting.type === 'module' || (setting.type.includes('atom') && setting.type.includes(false))"
|
||||
:value="data[setting.key]"
|
||||
clearable
|
||||
@change="updateSetting($event, settingsGroup.key, setting.key)">
|
||||
<el-option
|
||||
v-for="option in setting.suggestions"
|
||||
v-for="(option, index) in setting.suggestions"
|
||||
:value="option"
|
||||
:key="option"/>
|
||||
:key="index"/>
|
||||
</el-select>
|
||||
<el-select
|
||||
v-if="Array.isArray(setting.type) && (
|
||||
|
@ -36,7 +36,7 @@
|
|||
filterable
|
||||
allow-create
|
||||
@change="updateSetting($event, settingsGroup.key, setting.key)">
|
||||
<el-option v-for="option in setting.suggestions" :key="option" :value="option"/>
|
||||
<el-option v-for="(option, index) in setting.suggestions" :key="index" :value="option"/>
|
||||
</el-select>
|
||||
<el-select
|
||||
v-if="Array.isArray(setting.type) && setting.type.includes('list') && setting.type.includes('string')"
|
||||
|
@ -45,7 +45,7 @@
|
|||
filterable
|
||||
allow-create
|
||||
@change="updateSetting($event, settingsGroup.key, setting.key)">
|
||||
<el-option v-for="option in setting.suggestions" :key="option" :value="option"/>
|
||||
<el-option v-for="(option, index) in setting.suggestions" :key="index" :value="option"/>
|
||||
</el-select>
|
||||
<editor
|
||||
v-if="Array.isArray(setting.type)
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
<script>
|
||||
import i18n from '@/lang'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { options } from './options'
|
||||
import Setting from './Setting'
|
||||
|
||||
export default {
|
||||
|
@ -47,22 +46,25 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'adminTokenData',
|
||||
'fetchInitialPostsData',
|
||||
'instanceData',
|
||||
'pleromaUserData',
|
||||
'scheduledActivityData',
|
||||
'suggestionsData',
|
||||
'uriSchemesData'
|
||||
'settings'
|
||||
]),
|
||||
adminToken() {
|
||||
return this.$store.state.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() {
|
||||
return this.settings.settings[':admin_token']
|
||||
},
|
||||
fetchInitialPosts() {
|
||||
return this.$store.state.settings.description.find(setting => setting.key === ':fetch_initial_posts')
|
||||
return this.settings.description.find(setting => setting.key === ':fetch_initial_posts')
|
||||
},
|
||||
fetchInitialPostsData() {
|
||||
return this.settings.settings[':fetch_initial_posts']
|
||||
},
|
||||
instance() {
|
||||
return this.$store.state.settings.description.find(setting => setting.key === ':instance')
|
||||
return this.settings.description.find(setting => setting.key === ':instance')
|
||||
},
|
||||
instanceData() {
|
||||
return this.settings.settings[':instance']
|
||||
},
|
||||
isMobile() {
|
||||
return this.$store.state.app.device === 'mobile'
|
||||
|
@ -71,33 +73,34 @@ export default {
|
|||
return this.isMobile ? '100px' : '240px'
|
||||
},
|
||||
loading() {
|
||||
return this.$store.state.settings.loading
|
||||
return this.settings.loading
|
||||
},
|
||||
pleromaUser() {
|
||||
return this.$store.state.settings.description.find(setting => setting.key === 'Pleroma.User')
|
||||
return this.settings.description.find(setting => setting.key === 'Pleroma.User')
|
||||
},
|
||||
pleromaUserData() {
|
||||
return this.settings.settings['Pleroma.User']
|
||||
},
|
||||
scheduledActivity() {
|
||||
return this.$store.state.settings.description.find(setting => setting.key === 'Pleroma.ScheduledActivity')
|
||||
},
|
||||
scheduledActivityData() {
|
||||
return this.settings.settings['Pleroma.ScheduledActivity']
|
||||
},
|
||||
suggestions() {
|
||||
return this.$store.state.settings.description.find(setting => setting.key === ':suggestions')
|
||||
},
|
||||
suggestionsData() {
|
||||
return this.settings.settings[':suggestions']
|
||||
},
|
||||
uriSchemes() {
|
||||
return this.$store.state.settings.description.find(setting => setting.key === ':uri_schemes')
|
||||
},
|
||||
uriSchemesData() {
|
||||
return this.settings.settings[':uri_schemes']
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getRewritePolicyExpl(value) {
|
||||
const policy = options.rewritePolicyOptions.find(el => el.value === value)
|
||||
return policy.expl
|
||||
},
|
||||
processNestedData(value, tab, inputName, childName) {
|
||||
const updatedValue = { ...this.$store.state.settings.settings[tab][inputName], ...{ [childName]: value }}
|
||||
this.updateSetting(updatedValue, tab, inputName)
|
||||
},
|
||||
updateSetting(value, tab, input) {
|
||||
this.$store.dispatch('UpdateSettings', { tab, data: { [input]: value }})
|
||||
},
|
||||
async onSubmit() {
|
||||
try {
|
||||
await this.$store.dispatch('SubmitChanges')
|
||||
|
|
Loading…
Reference in a new issue