handle db config disabled case
This commit is contained in:
parent
df9fe6d261
commit
4c3af5c362
|
@ -9,7 +9,7 @@ import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import {
|
import {
|
||||||
faWrench,
|
faWrench,
|
||||||
faHand,
|
faHand,
|
||||||
faFilter,
|
faLaptopCode,
|
||||||
faPaintBrush,
|
faPaintBrush,
|
||||||
faBell,
|
faBell,
|
||||||
faDownload,
|
faDownload,
|
||||||
|
@ -20,7 +20,7 @@ import {
|
||||||
library.add(
|
library.add(
|
||||||
faWrench,
|
faWrench,
|
||||||
faHand,
|
faHand,
|
||||||
faFilter,
|
faLaptopCode,
|
||||||
faPaintBrush,
|
faPaintBrush,
|
||||||
faBell,
|
faBell,
|
||||||
faDownload,
|
faDownload,
|
||||||
|
@ -38,6 +38,9 @@ const SettingsModalAdminContent = {
|
||||||
LimitsTab
|
LimitsTab
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
user () {
|
||||||
|
return this.$store.state.users.currentUser
|
||||||
|
},
|
||||||
isLoggedIn () {
|
isLoggedIn () {
|
||||||
return !!this.$store.state.users.currentUser
|
return !!this.$store.state.users.currentUser
|
||||||
},
|
},
|
||||||
|
@ -46,6 +49,17 @@ const SettingsModalAdminContent = {
|
||||||
},
|
},
|
||||||
bodyLock () {
|
bodyLock () {
|
||||||
return this.$store.state.interface.settingsModalState === 'visible'
|
return this.$store.state.interface.settingsModalState === 'visible'
|
||||||
|
},
|
||||||
|
adminDbLoaded () {
|
||||||
|
return this.$store.state.adminSettings.loaded
|
||||||
|
},
|
||||||
|
noDb () {
|
||||||
|
return this.$store.state.adminSettings.dbConfigEnabled === false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
if (this.user.rights.admin) {
|
||||||
|
this.$store.dispatch('loadAdminStuff')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -4,9 +4,40 @@
|
||||||
class="settings_tab-switcher"
|
class="settings_tab-switcher"
|
||||||
:side-tab-bar="true"
|
:side-tab-bar="true"
|
||||||
:scrollable-tabs="true"
|
:scrollable-tabs="true"
|
||||||
|
:render-only-focused="true"
|
||||||
:body-scroll-lock="bodyLock"
|
:body-scroll-lock="bodyLock"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
v-if="noDb"
|
||||||
|
:label="$t('admin_dash.tabs.nodb')"
|
||||||
|
icon="exclamation-triangle"
|
||||||
|
data-tab-name="nodb-notice"
|
||||||
|
>
|
||||||
|
<div :label="$t('admin_dash.tabs.nodb')">
|
||||||
|
<div class="setting-item">
|
||||||
|
<h2>{{ $t('admin_dash.nodb.heading') }}</h2>
|
||||||
|
<i18n-t keypath="admin_dash.nodb.text">
|
||||||
|
<template #documentation>
|
||||||
|
<a
|
||||||
|
href="https://docs-develop.pleroma.social/backend/configuration/howto_database_config/"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
{{ $t("admin_dash.nodb.documentation") }}
|
||||||
|
</a>
|
||||||
|
</template>
|
||||||
|
<template #property>
|
||||||
|
<code>config :pleroma, configurable_from_database</code>
|
||||||
|
</template>
|
||||||
|
<template #value>
|
||||||
|
<code>true</code>
|
||||||
|
</template>
|
||||||
|
</i18n-t>
|
||||||
|
<p>{{ $t('admin_dash.nodb.text2') }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="adminDbLoaded"
|
||||||
:label="$t('admin_dash.tabs.instance')"
|
:label="$t('admin_dash.tabs.instance')"
|
||||||
icon="wrench"
|
icon="wrench"
|
||||||
data-tab-name="general"
|
data-tab-name="general"
|
||||||
|
@ -14,12 +45,20 @@
|
||||||
<InstanceTab />
|
<InstanceTab />
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
v-if="adminDbLoaded"
|
||||||
:label="$t('admin_dash.tabs.limits')"
|
:label="$t('admin_dash.tabs.limits')"
|
||||||
icon="hand"
|
icon="hand"
|
||||||
data-tab-name="limits"
|
data-tab-name="limits"
|
||||||
>
|
>
|
||||||
<LimitsTab />
|
<LimitsTab />
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
:label="$t('admin_dash.tabs.frontends')"
|
||||||
|
icon="laptop-code"
|
||||||
|
data-tab-name="frontends"
|
||||||
|
>
|
||||||
|
<FrontendsTab />
|
||||||
|
</div>
|
||||||
</tab-switcher>
|
</tab-switcher>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -845,8 +845,16 @@
|
||||||
"reset_all": "Reset all",
|
"reset_all": "Reset all",
|
||||||
"commit_all": "Save all",
|
"commit_all": "Save all",
|
||||||
"tabs": {
|
"tabs": {
|
||||||
|
"nodb": "No DB Config",
|
||||||
"instance": "Instance",
|
"instance": "Instance",
|
||||||
"limits": "Limits"
|
"limits": "Limits",
|
||||||
|
"frontends": "Front-ends"
|
||||||
|
},
|
||||||
|
"nodb": {
|
||||||
|
"heading": "Database config is disabled",
|
||||||
|
"text": "You need to change backend config files so that {property} is set to {value}, see more in {documentation}.",
|
||||||
|
"documentation": "documentation",
|
||||||
|
"text2": "Most configuration options will be unavailable."
|
||||||
},
|
},
|
||||||
"captcha": {
|
"captcha": {
|
||||||
"native": "Native",
|
"native": "Native",
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
import { set, get, cloneDeep, differenceWith, isEqual, flatten } from 'lodash'
|
import { set, get, cloneDeep, differenceWith, isEqual, flatten } from 'lodash'
|
||||||
|
|
||||||
export const defaultState = {
|
export const defaultState = {
|
||||||
|
loaded: false,
|
||||||
needsReboot: null,
|
needsReboot: null,
|
||||||
config: null,
|
config: null,
|
||||||
modifiedPaths: null,
|
modifiedPaths: null,
|
||||||
descriptions: null,
|
descriptions: null,
|
||||||
draft: null
|
draft: null,
|
||||||
|
dbConfigEnabled: null
|
||||||
}
|
}
|
||||||
|
|
||||||
export const newUserFlags = {
|
export const newUserFlags = {
|
||||||
|
@ -17,7 +19,13 @@ const adminSettingsStorage = {
|
||||||
...cloneDeep(defaultState)
|
...cloneDeep(defaultState)
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
|
setInstanceAdminNoDbConfig (state) {
|
||||||
|
state.loaded = false
|
||||||
|
state.dbConfigEnabled = false
|
||||||
|
},
|
||||||
updateAdminSettings (state, { config, modifiedPaths }) {
|
updateAdminSettings (state, { config, modifiedPaths }) {
|
||||||
|
state.loaded = true
|
||||||
|
state.dbConfigEnabled = true
|
||||||
state.config = config
|
state.config = config
|
||||||
state.modifiedPaths = modifiedPaths
|
state.modifiedPaths = modifiedPaths
|
||||||
},
|
},
|
||||||
|
@ -40,6 +48,26 @@ const adminSettingsStorage = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
loadAdminStuff ({ state, rootState, dispatch, commit }) {
|
||||||
|
rootState.api.backendInteractor.fetchInstanceDBConfig()
|
||||||
|
.then(backendDbConfig => {
|
||||||
|
if (backendDbConfig.error) {
|
||||||
|
if (backendDbConfig.error.status === 400) {
|
||||||
|
backendDbConfig.error.json().then(errorJson => {
|
||||||
|
if (/configurable_from_database/.test(errorJson.error)) {
|
||||||
|
commit('setInstanceAdminNoDbConfig')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dispatch('setInstanceAdminSettings', { backendDbConfig })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (state.descriptions === null) {
|
||||||
|
rootState.api.backendInteractor.fetchInstanceConfigDescriptions()
|
||||||
|
.then(backendDescriptions => this.$store.dispatch('setInstanceAdminDescriptions', { backendDescriptions }))
|
||||||
|
}
|
||||||
|
},
|
||||||
setInstanceAdminSettings ({ state, commit, dispatch }, { backendDbConfig }) {
|
setInstanceAdminSettings ({ state, commit, dispatch }, { backendDbConfig }) {
|
||||||
const config = state.config || {}
|
const config = state.config || {}
|
||||||
const modifiedPaths = new Set()
|
const modifiedPaths = new Set()
|
||||||
|
|
|
@ -564,12 +564,6 @@ const users = {
|
||||||
user.domainMutes = []
|
user.domainMutes = []
|
||||||
commit('setCurrentUser', user)
|
commit('setCurrentUser', user)
|
||||||
commit('setServerSideStorage', user)
|
commit('setServerSideStorage', user)
|
||||||
if (user.rights.admin) {
|
|
||||||
store.rootState.api.backendInteractor.fetchInstanceDBConfig()
|
|
||||||
.then(backendDbConfig => dispatch('setInstanceAdminSettings', { backendDbConfig }))
|
|
||||||
store.rootState.api.backendInteractor.fetchInstanceConfigDescriptions()
|
|
||||||
.then(backendDescriptions => dispatch('setInstanceAdminDescriptions', { backendDescriptions }))
|
|
||||||
}
|
|
||||||
commit('addNewUsers', [user])
|
commit('addNewUsers', [user])
|
||||||
|
|
||||||
dispatch('fetchEmoji')
|
dispatch('fetchEmoji')
|
||||||
|
|
Loading…
Reference in New Issue