Make the frontend config work somewhat even without DB config
This commit is contained in:
parent
f9c85c0c49
commit
bfdad56b0d
@ -55,12 +55,16 @@ const FrontendsTab = {
|
|||||||
return fe.refs.includes(frontend.ref)
|
return fe.refs.includes(frontend.ref)
|
||||||
},
|
},
|
||||||
getSuggestedRef (frontend) {
|
getSuggestedRef (frontend) {
|
||||||
|
if (this.adminDraft) {
|
||||||
const defaultFe = this.adminDraft[':pleroma'][':frontends'][':primary']
|
const defaultFe = this.adminDraft[':pleroma'][':frontends'][':primary']
|
||||||
if (defaultFe?.name === frontend.name && this.canInstall(defaultFe)) {
|
if (defaultFe?.name === frontend.name && this.canInstall(defaultFe)) {
|
||||||
return defaultFe.ref
|
return defaultFe.ref
|
||||||
} else {
|
} else {
|
||||||
return frontend.refs[0]
|
return frontend.refs[0]
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return frontend.refs[0]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
update (frontend, suggestRef) {
|
update (frontend, suggestRef) {
|
||||||
const ref = suggestRef || this.getSuggestedRef(frontend)
|
const ref = suggestRef || this.getSuggestedRef(frontend)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<div class="setting-item">
|
<div class="setting-item">
|
||||||
<h2>{{ $t('admin_dash.tabs.frontends') }}</h2>
|
<h2>{{ $t('admin_dash.tabs.frontends') }}</h2>
|
||||||
<p>{{ $t('admin_dash.frontend.wip_notice') }}</p>
|
<p>{{ $t('admin_dash.frontend.wip_notice') }}</p>
|
||||||
<ul class="setting-list">
|
<ul class="setting-list" v-if="adminDraft">
|
||||||
<li>
|
<li>
|
||||||
<h3>{{ $t('admin_dash.frontend.default_frontend') }}</h3>
|
<h3>{{ $t('admin_dash.frontend.default_frontend') }}</h3>
|
||||||
<p>{{ $t('admin_dash.frontend.default_frontend_tip') }}</p>
|
<p>{{ $t('admin_dash.frontend.default_frontend_tip') }}</p>
|
||||||
@ -23,6 +23,10 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<div v-else class="setting-list">
|
||||||
|
{{ $t('admin_dash.frontend.default_frontend_unavail') }}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="setting-list relative">
|
<div class="setting-list relative">
|
||||||
<PanelLoading class="overlay" v-if="working"/>
|
<PanelLoading class="overlay" v-if="working"/>
|
||||||
<h3>{{ $t('admin_dash.frontend.available_frontends') }}</h3>
|
<h3>{{ $t('admin_dash.frontend.available_frontends') }}</h3>
|
||||||
@ -33,9 +37,9 @@
|
|||||||
>
|
>
|
||||||
<strong>{{ frontend.name }}</strong>
|
<strong>{{ frontend.name }}</strong>
|
||||||
{{ ' ' }}
|
{{ ' ' }}
|
||||||
<span v-if="adminDraft[':pleroma'][':frontends'][':primary']?.name === frontend.name">
|
<span v-if="adminDraft && adminDraft[':pleroma'][':frontends'][':primary']?.name === frontend.name">
|
||||||
<i18n-t
|
<i18n-t
|
||||||
v-if="adminDraft[':pleroma'][':frontends'][':primary']?.ref === frontend.refs[0]"
|
v-if="adminDraft && adminDraft[':pleroma'][':frontends'][':primary']?.ref === frontend.refs[0]"
|
||||||
keypath="admin_dash.frontend.is_default"
|
keypath="admin_dash.frontend.is_default"
|
||||||
/>
|
/>
|
||||||
<i18n-t
|
<i18n-t
|
||||||
@ -43,7 +47,7 @@
|
|||||||
keypath="admin_dash.frontend.is_default_custom"
|
keypath="admin_dash.frontend.is_default_custom"
|
||||||
>
|
>
|
||||||
<template #version>
|
<template #version>
|
||||||
<code>{{ adminDraft[':pleroma'][':frontends'][':primary'].ref }}</code>
|
<code>{{ adminDraft && adminDraft[':pleroma'][':frontends'][':primary'].ref }}</code>
|
||||||
</template>
|
</template>
|
||||||
</i18n-t>
|
</i18n-t>
|
||||||
</span>
|
</span>
|
||||||
@ -134,7 +138,7 @@
|
|||||||
class="button button-default btn"
|
class="button button-default btn"
|
||||||
type="button"
|
type="button"
|
||||||
:disabled="
|
:disabled="
|
||||||
adminDraft[':pleroma'][':frontends'][':primary']?.name === frontend.name &&
|
!adminDraft || adminDraft[':pleroma'][':frontends'][':primary']?.name === frontend.name &&
|
||||||
adminDraft[':pleroma'][':frontends'][':primary']?.ref === frontend.refs[0]
|
adminDraft[':pleroma'][':frontends'][':primary']?.ref === frontend.refs[0]
|
||||||
"
|
"
|
||||||
@click="setDefault(frontend)"
|
@click="setDefault(frontend)"
|
||||||
|
@ -195,7 +195,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
canHardReset () {
|
canHardReset () {
|
||||||
return this.realSource === 'admin' && this.$store.state.adminSettings.modifiedPaths.has(this.canonPath.join(' -> '))
|
return this.realSource === 'admin' && this.$store.state.adminSettings.modifiedPaths &&
|
||||||
|
this.$store.state.adminSettings.modifiedPaths.has(this.canonPath.join(' -> '))
|
||||||
},
|
},
|
||||||
matchesExpertLevel () {
|
matchesExpertLevel () {
|
||||||
return (this.expert || 0) <= this.$store.state.config.expertLevel > 0
|
return (this.expert || 0) <= this.$store.state.config.expertLevel > 0
|
||||||
|
@ -928,6 +928,7 @@
|
|||||||
"wip_notice": "Please note that this section is a WIP and lacks certain features as backend implementation of front-end management is incomplete.",
|
"wip_notice": "Please note that this section is a WIP and lacks certain features as backend implementation of front-end management is incomplete.",
|
||||||
"default_frontend": "Default front-end",
|
"default_frontend": "Default front-end",
|
||||||
"default_frontend_tip": "Default front-end will be shown to all users. Currently there's no way to for a user to select personal front-end. If you switch away from PleromaFE you'll most likely have to use old and buggy AdminFE to do instance configuration until we replace it.",
|
"default_frontend_tip": "Default front-end will be shown to all users. Currently there's no way to for a user to select personal front-end. If you switch away from PleromaFE you'll most likely have to use old and buggy AdminFE to do instance configuration until we replace it.",
|
||||||
|
"default_frontend_unavail": "Default frontend settings are not available, as this requires configuration in the database",
|
||||||
"available_frontends": "Available for install",
|
"available_frontends": "Available for install",
|
||||||
"failure_installing_frontend": "Failed to install frontend {version}: {reason}",
|
"failure_installing_frontend": "Failed to install frontend {version}: {reason}",
|
||||||
"success_installing_frontend": "Frontend {version} successfully installed"
|
"success_installing_frontend": "Frontend {version} successfully installed"
|
||||||
|
Loading…
Reference in New Issue
Block a user