* improve_settings_reusability: better frontends tab, now you can set default frontend frontends tab initial implementation, now you can (re)install frontends! yay! fix handle db config disabled case localization strings added mass-draft-push and mass-draft-reset, small stylistic fixesshigusegubu-vue3
commit
85c79f666c
@ -0,0 +1,64 @@ |
||||
import BooleanSetting from '../helpers/boolean_setting.vue' |
||||
import ChoiceSetting from '../helpers/choice_setting.vue' |
||||
import IntegerSetting from '../helpers/integer_setting.vue' |
||||
import StringSetting from '../helpers/string_setting.vue' |
||||
import GroupSetting from '../helpers/group_setting.vue' |
||||
import Popover from 'src/components/popover/popover.vue' |
||||
|
||||
import SharedComputedObject from '../helpers/shared_computed_object.js' |
||||
import { library } from '@fortawesome/fontawesome-svg-core' |
||||
import { |
||||
faGlobe |
||||
} from '@fortawesome/free-solid-svg-icons' |
||||
|
||||
library.add( |
||||
faGlobe |
||||
) |
||||
|
||||
const FrontendsTab = { |
||||
provide () { |
||||
return { |
||||
defaultDraftMode: true, |
||||
defaultSource: 'admin' |
||||
} |
||||
}, |
||||
components: { |
||||
BooleanSetting, |
||||
ChoiceSetting, |
||||
IntegerSetting, |
||||
StringSetting, |
||||
GroupSetting, |
||||
Popover |
||||
}, |
||||
created () { |
||||
if (this.user.rights.admin) { |
||||
this.$store.dispatch('loadFrontendsStuff') |
||||
} |
||||
}, |
||||
computed: { |
||||
frontends () { |
||||
return this.$store.state.adminSettings.frontends |
||||
}, |
||||
...SharedComputedObject() |
||||
}, |
||||
methods: { |
||||
update (frontend, suggestRef) { |
||||
const ref = suggestRef || frontend.refs[0] |
||||
const { name } = frontend |
||||
const payload = { name, ref } |
||||
|
||||
this.$store.state.api.backendInteractor.installFrontend({ payload }) |
||||
.then((externalUser) => { |
||||
this.$store.dispatch('loadFrontendsStuff') |
||||
}) |
||||
}, |
||||
setDefault (frontend, suggestRef) { |
||||
const ref = suggestRef || frontend.refs[0] |
||||
const { name } = frontend |
||||
|
||||
this.$store.commit('updateAdminDraft', { path: [':pleroma', ':frontends', ':primary'], value: { name, ref } }) |
||||
} |
||||
} |
||||
} |
||||
|
||||
export default FrontendsTab |
@ -0,0 +1,13 @@ |
||||
.frontends-tab { |
||||
.cards-list { |
||||
padding: 0; |
||||
} |
||||
|
||||
dd { |
||||
text-overflow: ellipsis; |
||||
word-wrap: nowrap; |
||||
white-space: nowrap; |
||||
overflow-x: hidden; |
||||
max-width: 10em; |
||||
} |
||||
} |
@ -0,0 +1,162 @@ |
||||
<template> |
||||
<div class="frontends-tab" :label="$t('admin_dash.tabs.frontends')"> |
||||
<div class="setting-item"> |
||||
<h2>{{ $t('admin_dash.tabs.frontends') }}</h2> |
||||
<p>{{ $t('admin_dash.frontend.wip_notice') }}</p> |
||||
<ul class="setting-list"> |
||||
<li> |
||||
<h3>{{ $t('admin_dash.frontend.default_frontend') }}</h3> |
||||
<p>{{ $t('admin_dash.frontend.default_frontend_tip') }}</p> |
||||
<p>{{ $t('admin_dash.frontend.default_frontend_tip2') }}</p> |
||||
</li> |
||||
<li> |
||||
<StringSetting path=":pleroma.:frontends.:primary.name"> |
||||
NAME |
||||
</StringSetting> |
||||
</li> |
||||
<li> |
||||
<StringSetting path=":pleroma.:frontends.:primary.ref"> |
||||
REF |
||||
</StringSetting> |
||||
</li> |
||||
<li> |
||||
<GroupSetting path=":pleroma.:frontends.:primary"/> |
||||
</li> |
||||
</ul> |
||||
<div class="setting-list"> |
||||
<h3>{{ $t('admin_dash.frontend.available_frontends') }}</h3> |
||||
<ul class="cards-list"> |
||||
<li v-for="frontend in frontends" :key="frontend.name"> |
||||
<strong>{{ frontend.name }}</strong> |
||||
{{ ' ' }} |
||||
<span v-if="adminDraft[':pleroma'][':frontends'][':primary'].name === frontend.name"> |
||||
<i18n-t |
||||
keypath="admin_dash.frontend.is_default" |
||||
v-if="adminDraft[':pleroma'][':frontends'][':primary'].ref === frontend.refs[0]" |
||||
/> |
||||
<i18n-t |
||||
keypath="admin_dash.frontend.is_default_custom" |
||||
v-else |
||||
> |
||||
<template #version> |
||||
<code>{{ adminDraft[':pleroma'][':frontends'][':primary'].ref }}</code> |
||||
</template> |
||||
</i18n-t> |
||||
</span> |
||||
<dl> |
||||
<dt>{{ $t('admin_dash.frontend.repository') }}</dt> |
||||
<dd><a :href="frontend.git" target="_blank">{{ frontend.git }}</a></dd> |
||||
<template v-if="expertLevel"> |
||||
<dt>{{ $t('admin_dash.frontend.versions') }}</dt> |
||||
<dd v-for="ref in frontend.refs" :key="ref"><code>{{ ref }}</code></dd> |
||||
</template> |
||||
<dt v-if="expertLevel">{{ $t('admin_dash.frontend.build_url') }}</dt> |
||||
<dd v-if="expertLevel"><a :href="frontend.build_url" target="_blank">{{ frontend.build_url }}</a></dd> |
||||
</dl> |
||||
<div> |
||||
<span class="btn-group"> |
||||
<button |
||||
class="button button-default btn" |
||||
type="button" |
||||
:title="$t('admin_dash.frontend.update')" |
||||
@click="update(frontend)" |
||||
> |
||||
{{ |
||||
frontend.installed |
||||
? $t('admin_dash.frontend.reinstall') |
||||
: $t('admin_dash.frontend.install') |
||||
}} |
||||
</button> |
||||
<Popover |
||||
v-if="frontend.refs.length > 1" |
||||
trigger="click" |
||||
class="button-dropdown" |
||||
placement="bottom" |
||||
> |
||||
<template #content> |
||||
<div class="dropdown-menu"> |
||||
<button |
||||
v-for="ref in frontend.refs" |
||||
:key="ref" |
||||
class="button-default dropdown-item" |
||||
@click="update(frontend, ref)" |
||||
> |
||||
<i18n-t keypath="admin_dash.frontend.install_version"> |
||||
<template #version> |
||||
<code>{{ ref }}</code> |
||||
</template> |
||||
</i18n-t> |
||||
</button> |
||||
</div> |
||||
</template> |
||||
<template #trigger> |
||||
<button |
||||
class="button button-default btn dropdown-button" |
||||
type="button" |
||||
:title="$t('admin_dash.frontend.update')" |
||||
> |
||||
<FAIcon icon="chevron-down" /> |
||||
</button> |
||||
</template> |
||||
</Popover> |
||||
</span> |
||||
<span class="btn-group" v-if="frontend.name !== 'admin-fe'"> |
||||
<button |
||||
class="button button-default btn" |
||||
type="button" |
||||
:disabled=" |
||||
adminDraft[':pleroma'][':frontends'][':primary'].name === frontend.name && |
||||
adminDraft[':pleroma'][':frontends'][':primary'].ref === frontend.refs[0] |
||||
" |
||||
:title="$t('admin_dash.frontend.update')" |
||||
@click="setDefault(frontend)" |
||||
> |
||||
{{ |
||||
$t('admin_dash.frontend.set_default') |
||||
}} |
||||
</button> |
||||
{{ ' ' }} |
||||
<Popover |
||||
v-if="frontend.refs.length > 1" |
||||
trigger="click" |
||||
class="button-dropdown" |
||||
placement="bottom" |
||||
> |
||||
<template #content> |
||||
<div class="dropdown-menu"> |
||||
<button |
||||
v-for="ref in frontend.refs.slice(1)" |
||||
:key="ref" |
||||
class="button-default dropdown-item" |
||||
@click="setDefault(frontend, ref)" |
||||
> |
||||
<i18n-t keypath="admin_dash.frontend.set_default_version"> |
||||
<template #version> |
||||
<code>{{ ref }}</code> |
||||
</template> |
||||
</i18n-t> |
||||
</button> |
||||
</div> |
||||
</template> |
||||
<template #trigger> |
||||
<button |
||||
class="button button-default btn dropdown-button" |
||||
type="button" |
||||
:title="$t('admin_dash.frontend.update')" |
||||
> |
||||
<FAIcon icon="chevron-down" /> |
||||
</button> |
||||
</template> |
||||
</Popover> |
||||
</span> |
||||
</div> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script src="./frontends_tab.js"></script> |
||||
|
||||
<style lang="scss" src="./frontends_tab.scss"></style> |
Loading…
Reference in new issue