Merge branch 'develop' into 'feature/move-emojipacks'

# Conflicts:
#   src/views/settings/index.vue
This commit is contained in:
Angelina Filippova 2020-02-01 13:05:48 +00:00
commit c5be615923
2 changed files with 54 additions and 30 deletions

View file

@ -4,6 +4,8 @@ import _ from 'lodash'
const settings = {
state: {
activeTab: 'instance',
configDisabled: true,
description: [],
settings: {},
updatedSettings: {},
@ -20,6 +22,9 @@ const settings = {
state.updatedSettings = updatedSettings
}
},
SET_ACTIVE_TAB: (state, tab) => {
state.activeTab = tab
},
SET_DESCRIPTION: (state, data) => {
state.description = data
},
@ -45,6 +50,9 @@ const settings = {
state.settings = newSettings
state.db = newDbSettings
},
TOGGLE_TABS: (state, status) => {
state.configDisabled = status
},
UPDATE_SETTINGS: (state, { group, key, input, value, type }) => {
const updatedSetting = !state.updatedSettings[group] || (key === 'Pleroma.Emails.Mailer' && input === ':adapter')
? { [key]: { [input]: [type, value] }}
@ -61,11 +69,18 @@ const settings = {
actions: {
async FetchSettings({ commit, getters }) {
commit('SET_LOADING', true)
const response = await fetchSettings(getters.authHost, getters.token)
const description = await fetchDescription(getters.authHost, getters.token)
commit('SET_DESCRIPTION', description.data)
commit('SET_SETTINGS', response.data.configs)
try {
const response = await fetchSettings(getters.authHost, getters.token)
const description = await fetchDescription(getters.authHost, getters.token)
commit('SET_DESCRIPTION', description.data)
commit('SET_SETTINGS', response.data.configs)
} catch (_e) {
commit('TOGGLE_TABS', true)
commit('SET_ACTIVE_TAB', 'relays')
commit('SET_LOADING', false)
return
}
commit('TOGGLE_TABS', false)
commit('SET_LOADING', false)
},
async RemoveSetting({ commit, getters }, configs) {
@ -75,6 +90,9 @@ const settings = {
commit('SET_SETTINGS', response.data.configs)
commit('REMOVE_SETTING_FROM_UPDATED', { group, key, subkeys: subkeys || [] })
},
SetActiveTab({ commit }, tab) {
commit('SET_ACTIVE_TAB', tab)
},
async SubmitChanges({ getters, commit, state }) {
const updatedData = checkPartialUpdate(state.settings, state.updatedSettings, state.description)
const configs = Object.keys(updatedData).reduce((acc, group) => {

View file

@ -2,64 +2,64 @@
<div class="settings-container">
<h1>{{ $t('settings.settings') }}</h1>
<el-tabs v-model="activeTab" :tab-position="tabPosition">
<el-tab-pane :label="$t('settings.activityPub')" lazy>
<el-tab-pane :label="$t('settings.activityPub')" :disabled="confidDisabled" lazy>
<activity-pub/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.auth')" lazy>
<el-tab-pane :label="$t('settings.auth')" :disabled="confidDisabled" lazy>
<authentication/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.autoLinker')" lazy>
<el-tab-pane :label="$t('settings.autoLinker')" :disabled="confidDisabled" lazy>
<auto-linker/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.esshd')" lazy>
<el-tab-pane :label="$t('settings.esshd')" :disabled="confidDisabled" lazy>
<esshd/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.captcha')" lazy>
<el-tab-pane :label="$t('settings.captcha')" :disabled="confidDisabled" lazy>
<captcha/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.frontend')" lazy>
<el-tab-pane :label="$t('settings.frontend')" :disabled="confidDisabled" lazy>
<frontend/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.gopher')" lazy>
<el-tab-pane :label="$t('settings.gopher')" :disabled="confidDisabled" lazy>
<gopher/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.http')" lazy>
<el-tab-pane :label="$t('settings.http')" :disabled="confidDisabled" lazy>
<http/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.instance')" name="instance">
<el-tab-pane :label="$t('settings.instance')" :disabled="confidDisabled" name="instance">
<instance/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.jobQueue')" lazy>
<el-tab-pane :label="$t('settings.jobQueue')" :disabled="confidDisabled" lazy>
<job-queue/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.logger')" lazy>
<el-tab-pane :label="$t('settings.logger')" :disabled="confidDisabled" lazy>
<logger/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.mailer')" lazy>
<el-tab-pane :label="$t('settings.mailer')" :disabled="confidDisabled" lazy>
<mailer/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.mediaProxy')" lazy>
<el-tab-pane :label="$t('settings.mediaProxy')" :disabled="confidDisabled" lazy>
<media-proxy/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.metadata')" lazy>
<el-tab-pane :label="$t('settings.metadata')" :disabled="confidDisabled" lazy>
<metadata/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.mrf')" lazy>
<el-tab-pane :label="$t('settings.mrf')" :disabled="confidDisabled" lazy>
<mrf/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.rateLimiters')" lazy>
<el-tab-pane :label="$t('settings.rateLimiters')" :disabled="confidDisabled" lazy>
<rate-limiters/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.relays')" lazy>
<el-tab-pane :label="$t('settings.relays')" lazy name="relays">
<relays/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.webPush')" lazy>
<el-tab-pane :label="$t('settings.webPush')" :disabled="confidDisabled" lazy>
<web-push/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.upload')" lazy>
<el-tab-pane :label="$t('settings.upload')" :disabled="confidDisabled" lazy>
<upload/>
</el-tab-pane>
<el-tab-pane :label="$t('settings.other')" lazy>
<el-tab-pane :label="$t('settings.other')" :disabled="confidDisabled" lazy>
<other/>
</el-tab-pane>
</el-tabs>
@ -113,12 +113,18 @@ export default {
Upload,
WebPush
},
data() {
return {
activeTab: 'instance'
}
},
computed: {
activeTab: {
get() {
return this.$store.state.settings.activeTab
},
set(tab) {
this.$store.dispatch('SetActiveTab', tab)
}
},
confidDisabled() {
return this.$store.state.settings.configDisabled
},
isMobile() {
return this.$store.state.app.device === 'mobile'
},