|
|
|
@ -46,12 +46,13 @@ q-layout.admin(view='hHh Lpr lff')
|
|
|
|
|
q-item-section(avatar)
|
|
|
|
|
q-icon(name='img:/_assets/icons/fluent-apps-tab.svg')
|
|
|
|
|
q-item-section {{ t('admin.dashboard.title') }}
|
|
|
|
|
q-item(to='/_admin/sites', v-ripple, active-class='bg-primary text-white')
|
|
|
|
|
q-item(to='/_admin/sites', v-ripple, active-class='bg-primary text-white', v-if='userStore.can(`manage:sites`)')
|
|
|
|
|
q-item-section(avatar)
|
|
|
|
|
q-icon(name='img:/_assets/icons/fluent-change-theme.svg')
|
|
|
|
|
q-item-section {{ t('admin.sites.title') }}
|
|
|
|
|
q-item-section(side)
|
|
|
|
|
q-badge(color='dark-3', :label='adminStore.sites.length')
|
|
|
|
|
template(v-if='siteSectionShown')
|
|
|
|
|
q-item-label.q-mt-sm(header).text-caption.text-blue-grey-4 {{ t('admin.nav.site') }}
|
|
|
|
|
q-item.q-mb-md
|
|
|
|
|
q-item-section
|
|
|
|
@ -87,47 +88,49 @@ q-layout.admin(view='hHh Lpr lff')
|
|
|
|
|
q-item-section(avatar)
|
|
|
|
|
q-icon(name='img:/_assets/icons/fluent-rfid-tag.svg')
|
|
|
|
|
q-item-section {{ t('admin.blocks.title') }}
|
|
|
|
|
q-item(:to='`/_admin/` + adminStore.currentSiteId + `/editors`', v-ripple, active-class='bg-primary text-white')
|
|
|
|
|
q-item(:to='`/_admin/` + adminStore.currentSiteId + `/editors`', v-ripple, active-class='bg-primary text-white', v-if='userStore.can(`manage:sites`)')
|
|
|
|
|
q-item-section(avatar)
|
|
|
|
|
q-icon(name='img:/_assets/icons/fluent-cashbook.svg')
|
|
|
|
|
q-item-section {{ t('admin.editors.title') }}
|
|
|
|
|
q-item(:to='`/_admin/` + adminStore.currentSiteId + `/locale`', v-ripple, active-class='bg-primary text-white')
|
|
|
|
|
q-item(:to='`/_admin/` + adminStore.currentSiteId + `/locale`', v-ripple, active-class='bg-primary text-white', v-if='userStore.can(`manage:sites`)')
|
|
|
|
|
q-item-section(avatar)
|
|
|
|
|
q-icon(name='img:/_assets/icons/fluent-language.svg')
|
|
|
|
|
q-item-section {{ t('admin.locale.title') }}
|
|
|
|
|
q-item(:to='`/_admin/` + adminStore.currentSiteId + `/login`', v-ripple, active-class='bg-primary text-white')
|
|
|
|
|
q-item(:to='`/_admin/` + adminStore.currentSiteId + `/login`', v-ripple, active-class='bg-primary text-white', v-if='userStore.can(`manage:sites`)')
|
|
|
|
|
q-item-section(avatar)
|
|
|
|
|
q-icon(name='img:/_assets/icons/fluent-bunch-of-keys.svg')
|
|
|
|
|
q-item-section {{ t('admin.login.title') }}
|
|
|
|
|
q-item(:to='`/_admin/` + adminStore.currentSiteId + `/navigation`', v-ripple, active-class='bg-primary text-white')
|
|
|
|
|
q-item(:to='`/_admin/` + adminStore.currentSiteId + `/navigation`', v-ripple, active-class='bg-primary text-white', v-if='userStore.can(`manage:sites`) || userStore.can(`manage:navigation`)')
|
|
|
|
|
q-item-section(avatar)
|
|
|
|
|
q-icon(name='img:/_assets/icons/fluent-tree-structure.svg')
|
|
|
|
|
q-item-section {{ t('admin.navigation.title') }}
|
|
|
|
|
q-item(:to='`/_admin/` + adminStore.currentSiteId + `/storage`', v-ripple, active-class='bg-primary text-white')
|
|
|
|
|
q-item(:to='`/_admin/` + adminStore.currentSiteId + `/storage`', v-ripple, active-class='bg-primary text-white', v-if='userStore.can(`manage:sites`)')
|
|
|
|
|
q-item-section(avatar)
|
|
|
|
|
q-icon(name='img:/_assets/icons/fluent-ssd.svg')
|
|
|
|
|
q-item-section {{ t('admin.storage.title') }}
|
|
|
|
|
q-item(:to='`/_admin/` + adminStore.currentSiteId + `/theme`', v-ripple, active-class='bg-primary text-white')
|
|
|
|
|
q-item(:to='`/_admin/` + adminStore.currentSiteId + `/theme`', v-ripple, active-class='bg-primary text-white', v-if='userStore.can(`manage:sites`) || userStore.can(`manage:theme`)')
|
|
|
|
|
q-item-section(avatar)
|
|
|
|
|
q-icon(name='img:/_assets/icons/fluent-paint-roller.svg')
|
|
|
|
|
q-item-section {{ t('admin.theme.title') }}
|
|
|
|
|
template(v-if='usersSectionShown')
|
|
|
|
|
q-item-label.q-mt-sm(header).text-caption.text-blue-grey-4 {{ t('admin.nav.users') }}
|
|
|
|
|
q-item(to='/_admin/auth', v-ripple, active-class='bg-primary text-white')
|
|
|
|
|
q-item(to='/_admin/auth', v-ripple, active-class='bg-primary text-white', v-if='userStore.can(`manage:system`)')
|
|
|
|
|
q-item-section(avatar)
|
|
|
|
|
q-icon(name='img:/_assets/icons/fluent-security-lock.svg')
|
|
|
|
|
q-item-section {{ t('admin.auth.title') }}
|
|
|
|
|
q-item(to='/_admin/groups', v-ripple, active-class='bg-primary text-white')
|
|
|
|
|
q-item(to='/_admin/groups', v-ripple, active-class='bg-primary text-white', v-if='userStore.can(`manage:groups`)')
|
|
|
|
|
q-item-section(avatar)
|
|
|
|
|
q-icon(name='img:/_assets/icons/fluent-people.svg')
|
|
|
|
|
q-item-section {{ t('admin.groups.title') }}
|
|
|
|
|
q-item-section(side)
|
|
|
|
|
q-badge(color='dark-3', :label='adminStore.info.groupsTotal')
|
|
|
|
|
q-item(to='/_admin/users', v-ripple, active-class='bg-primary text-white')
|
|
|
|
|
q-item(to='/_admin/users', v-ripple, active-class='bg-primary text-white', v-if='userStore.can(`manage:users`)')
|
|
|
|
|
q-item-section(avatar)
|
|
|
|
|
q-icon(name='img:/_assets/icons/fluent-account.svg')
|
|
|
|
|
q-item-section {{ t('admin.users.title') }}
|
|
|
|
|
q-item-section(side)
|
|
|
|
|
q-badge(color='dark-3', :label='adminStore.info.usersTotal')
|
|
|
|
|
template(v-if='userStore.can(`manage:system`)')
|
|
|
|
|
q-item-label.q-mt-sm(header).text-caption.text-blue-grey-4 {{ t('admin.nav.system') }}
|
|
|
|
|
q-item(to='/_admin/api', v-ripple, active-class='bg-primary text-white')
|
|
|
|
|
q-item-section(avatar)
|
|
|
|
@ -215,13 +218,14 @@ q-layout.admin(view='hHh Lpr lff')
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import { useMeta, useQuasar, setCssVar } from 'quasar'
|
|
|
|
|
import { defineAsyncComponent, onMounted, reactive, ref, watch } from 'vue'
|
|
|
|
|
import { computed, defineAsyncComponent, onMounted, reactive, ref, watch } from 'vue'
|
|
|
|
|
import { useRouter, useRoute } from 'vue-router'
|
|
|
|
|
import { useI18n } from 'vue-i18n'
|
|
|
|
|
|
|
|
|
|
import { useAdminStore } from 'src/stores/admin'
|
|
|
|
|
import { useFlagsStore } from 'src/stores/flags'
|
|
|
|
|
import { useSiteStore } from 'src/stores/site'
|
|
|
|
|
import { useUserStore } from 'src/stores/user'
|
|
|
|
|
|
|
|
|
|
// COMPONENTS
|
|
|
|
|
|
|
|
|
@ -242,6 +246,7 @@ const $q = useQuasar()
|
|
|
|
|
const adminStore = useAdminStore()
|
|
|
|
|
const flagsStore = useFlagsStore()
|
|
|
|
|
const siteStore = useSiteStore()
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|
|
|
|
|
|
// ROUTER
|
|
|
|
|
|
|
|
|
@ -279,8 +284,23 @@ const barStyle = {
|
|
|
|
|
width: '7px'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// COMPUTED
|
|
|
|
|
|
|
|
|
|
const siteSectionShown = computed(() => {
|
|
|
|
|
return userStore.can('manage:sites') || userStore.can('manage:navigation') || userStore.can('manage:theme')
|
|
|
|
|
})
|
|
|
|
|
const usersSectionShown = computed(() => {
|
|
|
|
|
return userStore.can('manage:groups') || userStore.can('manage:users')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// WATCHERS
|
|
|
|
|
|
|
|
|
|
watch(() => route.path, async (newValue) => {
|
|
|
|
|
if (!newValue.startsWith('/_admin')) { return }
|
|
|
|
|
if (!userStore.can('access:admin')) {
|
|
|
|
|
router.replace('/_error/unauthorized')
|
|
|
|
|
}
|
|
|
|
|
}, { immediate: true })
|
|
|
|
|
watch(() => adminStore.sites, (newValue) => {
|
|
|
|
|
if (adminStore.currentSiteId === null && newValue.length > 0) {
|
|
|
|
|
adminStore.$patch({
|
|
|
|
@ -300,6 +320,11 @@ watch(() => adminStore.currentSiteId, (newValue) => {
|
|
|
|
|
// MOUNTED
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
if (!userStore.can('access:admin')) {
|
|
|
|
|
router.replace('/_error/unauthorized')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await adminStore.fetchSites()
|
|
|
|
|
if (route.params.siteid) {
|
|
|
|
|
adminStore.$patch({
|
|
|
|
|