diff --git a/src/components/settings_modal/settings_modal_admin_content.js b/src/components/settings_modal/settings_modal_admin_content.js
index 07d4cf2e..1c239e59 100644
--- a/src/components/settings_modal/settings_modal_admin_content.js
+++ b/src/components/settings_modal/settings_modal_admin_content.js
@@ -9,7 +9,7 @@ import { library } from '@fortawesome/fontawesome-svg-core'
import {
faWrench,
faHand,
- faFilter,
+ faLaptopCode,
faPaintBrush,
faBell,
faDownload,
@@ -20,7 +20,7 @@ import {
library.add(
faWrench,
faHand,
- faFilter,
+ faLaptopCode,
faPaintBrush,
faBell,
faDownload,
@@ -38,6 +38,9 @@ const SettingsModalAdminContent = {
LimitsTab
},
computed: {
+ user () {
+ return this.$store.state.users.currentUser
+ },
isLoggedIn () {
return !!this.$store.state.users.currentUser
},
@@ -46,6 +49,17 @@ const SettingsModalAdminContent = {
},
bodyLock () {
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: {
diff --git a/src/components/settings_modal/settings_modal_admin_content.vue b/src/components/settings_modal/settings_modal_admin_content.vue
index 52c6ddf5..ae670a90 100644
--- a/src/components/settings_modal/settings_modal_admin_content.vue
+++ b/src/components/settings_modal/settings_modal_admin_content.vue
@@ -4,9 +4,40 @@
class="settings_tab-switcher"
:side-tab-bar="true"
:scrollable-tabs="true"
+ :render-only-focused="true"
:body-scroll-lock="bodyLock"
>
+
+
+
+
diff --git a/src/i18n/en.json b/src/i18n/en.json
index dd78d148..86ae7f06 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -845,8 +845,16 @@
"reset_all": "Reset all",
"commit_all": "Save all",
"tabs": {
+ "nodb": "No DB Config",
"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": {
"native": "Native",
diff --git a/src/modules/adminSettings.js b/src/modules/adminSettings.js
index 25fb8e50..fef73974 100644
--- a/src/modules/adminSettings.js
+++ b/src/modules/adminSettings.js
@@ -1,11 +1,13 @@
import { set, get, cloneDeep, differenceWith, isEqual, flatten } from 'lodash'
export const defaultState = {
+ loaded: false,
needsReboot: null,
config: null,
modifiedPaths: null,
descriptions: null,
- draft: null
+ draft: null,
+ dbConfigEnabled: null
}
export const newUserFlags = {
@@ -17,7 +19,13 @@ const adminSettingsStorage = {
...cloneDeep(defaultState)
},
mutations: {
+ setInstanceAdminNoDbConfig (state) {
+ state.loaded = false
+ state.dbConfigEnabled = false
+ },
updateAdminSettings (state, { config, modifiedPaths }) {
+ state.loaded = true
+ state.dbConfigEnabled = true
state.config = config
state.modifiedPaths = modifiedPaths
},
@@ -40,6 +48,26 @@ const adminSettingsStorage = {
}
},
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 }) {
const config = state.config || {}
const modifiedPaths = new Set()
diff --git a/src/modules/users.js b/src/modules/users.js
index 45cba334..a23f6d7d 100644
--- a/src/modules/users.js
+++ b/src/modules/users.js
@@ -564,12 +564,6 @@ const users = {
user.domainMutes = []
commit('setCurrentUser', 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])
dispatch('fetchEmoji')