2018-02-28 05:54:09 +00:00
|
|
|
<template lang='pug'>
|
2018-06-10 00:11:00 +00:00
|
|
|
v-app(:dark='darkMode').admin
|
2019-04-29 00:25:19 +00:00
|
|
|
nav-header(hide-search)
|
|
|
|
template(slot='mid')
|
|
|
|
v-spacer
|
|
|
|
.subheading.grey--text Administration Area
|
|
|
|
v-spacer
|
2018-09-04 00:58:54 +00:00
|
|
|
v-navigation-drawer.pb-0.admin-sidebar(v-model='adminDrawerShown', app, fixed, clipped, left, permanent)
|
2018-11-26 03:10:20 +00:00
|
|
|
vue-scroll(:ops='scrollStyle')
|
|
|
|
v-list(dense)
|
|
|
|
v-list-tile.pt-2(to='/dashboard')
|
|
|
|
v-list-tile-avatar: v-icon dashboard
|
|
|
|
v-list-tile-title {{ $t('admin:dashboard.title') }}
|
2019-01-12 23:33:30 +00:00
|
|
|
template(v-if='hasPermission([`manage:system`, `manage:navigation`, `write:pages`, `manage:pages`, `delete:pages`])')
|
|
|
|
v-divider.my-2
|
|
|
|
v-subheader.pl-4 {{ $t('admin:nav.site') }}
|
|
|
|
v-list-tile(to='/general', v-if='hasPermission(`manage:system`)')
|
|
|
|
v-list-tile-avatar: v-icon widgets
|
|
|
|
v-list-tile-title {{ $t('admin:general.title') }}
|
|
|
|
v-list-tile(to='/locale', v-if='hasPermission(`manage:system`)')
|
|
|
|
v-list-tile-avatar: v-icon language
|
|
|
|
v-list-tile-title {{ $t('admin:locale.title') }}
|
|
|
|
v-list-tile(to='/navigation', v-if='hasPermission([`manage:system`, `manage:navigation`])')
|
|
|
|
v-list-tile-avatar: v-icon near_me
|
|
|
|
v-list-tile-title {{ $t('admin:navigation.title') }}
|
|
|
|
v-list-tile(to='/pages', v-if='hasPermission([`manage:system`, `write:pages`, `manage:pages`, `delete:pages`])')
|
|
|
|
v-list-tile-avatar: v-icon insert_drive_file
|
|
|
|
v-list-tile-title {{ $t('admin:pages.title') }}
|
|
|
|
v-list-tile-action
|
|
|
|
v-chip(small, disabled, :color='darkMode ? `grey darken-3-d4` : `grey lighten-4`')
|
|
|
|
.caption.grey--text {{ info.pagesTotal }}
|
|
|
|
v-list-tile(to='/theme', v-if='hasPermission([`manage:system`, `manage:theme`])')
|
|
|
|
v-list-tile-avatar: v-icon palette
|
|
|
|
v-list-tile-title {{ $t('admin:theme.title') }}
|
|
|
|
template(v-if='hasPermission([`manage:system`, `manage:groups`, `write:groups`, `manage:users`, `write:users`])')
|
|
|
|
v-divider.my-2
|
|
|
|
v-subheader.pl-4 {{ $t('admin:nav.users') }}
|
|
|
|
v-list-tile(to='/groups', v-if='hasPermission([`manage:system`, `manage:groups`, `write:groups`])')
|
|
|
|
v-list-tile-avatar: v-icon people
|
|
|
|
v-list-tile-title {{ $t('admin:groups.title') }}
|
|
|
|
v-list-tile-action
|
|
|
|
v-chip(small, disabled, :color='darkMode ? `grey darken-3-d4` : `grey lighten-4`')
|
|
|
|
.caption.grey--text {{ info.groupsTotal }}
|
|
|
|
v-list-tile(to='/users', v-if='hasPermission([`manage:system`, `manage:groups`, `write:groups`, `manage:users`, `write:users`])')
|
|
|
|
v-list-tile-avatar: v-icon perm_identity
|
|
|
|
v-list-tile-title {{ $t('admin:users.title') }}
|
|
|
|
v-list-tile-action
|
|
|
|
v-chip(small, disabled, :color='darkMode ? `grey darken-3-d4` : `grey lighten-4`')
|
|
|
|
.caption.grey--text {{ info.usersTotal }}
|
2018-12-30 02:30:51 +00:00
|
|
|
template(v-if='hasPermission(`manage:system`)')
|
|
|
|
v-divider.my-2
|
|
|
|
v-subheader.pl-4 {{ $t('admin:nav.modules') }}
|
|
|
|
v-list-tile(to='/auth')
|
|
|
|
v-list-tile-avatar: v-icon lock_outline
|
|
|
|
v-list-tile-title {{ $t('admin:auth.title') }}
|
2019-04-21 00:49:05 +00:00
|
|
|
v-list-tile(to='/editor', disabled)
|
2018-12-30 02:30:51 +00:00
|
|
|
v-list-tile-avatar: v-icon transform
|
|
|
|
v-list-tile-title {{ $t('admin:editor.title') }}
|
|
|
|
v-list-tile(to='/logging')
|
|
|
|
v-list-tile-avatar: v-icon graphic_eq
|
|
|
|
v-list-tile-title {{ $t('admin:logging.title') }}
|
|
|
|
v-list-tile(to='/rendering')
|
|
|
|
v-list-tile-avatar: v-icon system_update_alt
|
|
|
|
v-list-tile-title {{ $t('admin:rendering.title') }}
|
|
|
|
v-list-tile(to='/search')
|
|
|
|
v-list-tile-avatar: v-icon search
|
|
|
|
v-list-tile-title {{ $t('admin:search.title') }}
|
|
|
|
v-list-tile(to='/storage')
|
|
|
|
v-list-tile-avatar: v-icon storage
|
|
|
|
v-list-tile-title {{ $t('admin:storage.title') }}
|
|
|
|
template(v-if='hasPermission([`manage:system`, `manage:api`])')
|
2019-01-12 23:33:30 +00:00
|
|
|
v-divider.my-2
|
2018-12-30 02:30:51 +00:00
|
|
|
v-subheader.pl-4 {{ $t('admin:nav.system') }}
|
|
|
|
v-list-tile(to='/api', v-if='hasPermission([`manage:system`, `manage:api`])')
|
|
|
|
v-list-tile-avatar: v-icon call_split
|
|
|
|
v-list-tile-title {{ $t('admin:api.title') }}
|
|
|
|
v-list-tile(to='/mail', v-if='hasPermission(`manage:system`)')
|
|
|
|
v-list-tile-avatar: v-icon email
|
|
|
|
v-list-tile-title {{ $t('admin:mail.title') }}
|
|
|
|
v-list-tile(to='/system', v-if='hasPermission(`manage:system`)')
|
|
|
|
v-list-tile-avatar: v-icon tune
|
|
|
|
v-list-tile-title {{ $t('admin:system.title') }}
|
2019-01-12 23:33:30 +00:00
|
|
|
v-list-tile(to='/utilities', v-if='hasPermission(`manage:system`)', disabled)
|
|
|
|
v-list-tile-avatar: v-icon(color='grey lighten-2') build
|
2018-12-30 02:30:51 +00:00
|
|
|
v-list-tile-title {{ $t('admin:utilities.title') }}
|
2019-02-23 02:37:26 +00:00
|
|
|
v-list-group(
|
|
|
|
to='/dev'
|
|
|
|
no-action
|
|
|
|
v-if='hasPermission([`manage:system`, `manage:api`])'
|
|
|
|
)
|
|
|
|
v-list-tile(slot='activator')
|
2019-02-23 23:22:25 +00:00
|
|
|
v-list-tile-avatar: v-icon weekend
|
2019-02-23 02:37:26 +00:00
|
|
|
v-list-tile-title {{ $t('admin:dev.title') }}
|
|
|
|
|
|
|
|
v-list-tile(to='/dev-flags')
|
|
|
|
v-list-tile-title {{ $t('admin:dev.flags.title') }}
|
|
|
|
v-list-tile(to='/dev-graphiql')
|
|
|
|
v-list-tile-title {{ $t('admin:dev.graphiql.title') }}
|
|
|
|
v-list-tile(to='/dev-voyager')
|
|
|
|
v-list-tile-title {{ $t('admin:dev.voyager.title') }}
|
2018-12-30 02:30:51 +00:00
|
|
|
v-divider.my-2
|
2018-11-26 03:10:20 +00:00
|
|
|
v-list-tile(to='/contribute')
|
|
|
|
v-list-tile-avatar: v-icon favorite
|
|
|
|
v-list-tile-title {{ $t('admin:contribute.title') }}
|
2018-02-28 05:54:09 +00:00
|
|
|
|
2018-09-04 00:58:54 +00:00
|
|
|
v-content(:class='darkMode ? "grey darken-4" : ""')
|
2018-03-03 06:32:58 +00:00
|
|
|
transition(name='admin-router')
|
|
|
|
router-view
|
2018-02-28 05:54:09 +00:00
|
|
|
|
2018-08-06 03:03:46 +00:00
|
|
|
nav-footer
|
2019-04-22 04:44:24 +00:00
|
|
|
notify
|
2019-03-11 04:47:27 +00:00
|
|
|
search-results
|
2018-02-28 05:54:09 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2018-12-30 02:30:51 +00:00
|
|
|
import _ from 'lodash'
|
2018-02-28 05:54:09 +00:00
|
|
|
import VueRouter from 'vue-router'
|
2018-12-15 22:15:13 +00:00
|
|
|
import { get, sync } from 'vuex-pathify'
|
|
|
|
|
|
|
|
import statsQuery from 'gql/admin/dashboard/dashboard-query-stats.gql'
|
|
|
|
|
|
|
|
import adminStore from '@/store/admin'
|
|
|
|
|
|
|
|
/* global WIKI */
|
|
|
|
|
|
|
|
WIKI.$store.registerModule('admin', adminStore)
|
2018-06-10 00:11:00 +00:00
|
|
|
|
2018-02-28 05:54:09 +00:00
|
|
|
const router = new VueRouter({
|
|
|
|
mode: 'history',
|
|
|
|
base: '/a',
|
|
|
|
routes: [
|
|
|
|
{ path: '/', redirect: '/dashboard' },
|
2018-03-28 04:02:32 +00:00
|
|
|
{ path: '/dashboard', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-dashboard.vue') },
|
|
|
|
{ path: '/general', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-general.vue') },
|
|
|
|
{ path: '/locale', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-locale.vue') },
|
2018-09-23 04:14:01 +00:00
|
|
|
{ path: '/navigation', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-navigation.vue') },
|
2018-09-09 00:57:37 +00:00
|
|
|
{ path: '/pages', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-pages.vue') },
|
2018-03-28 04:02:32 +00:00
|
|
|
{ path: '/theme', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-theme.vue') },
|
|
|
|
{ path: '/groups', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-groups.vue') },
|
|
|
|
{ path: '/groups/:id', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-groups-edit.vue') },
|
|
|
|
{ path: '/users', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-users.vue') },
|
2018-12-15 22:15:13 +00:00
|
|
|
{ path: '/users/:id', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-users-edit.vue') },
|
2018-03-28 04:02:32 +00:00
|
|
|
{ path: '/auth', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-auth.vue') },
|
|
|
|
{ path: '/rendering', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-rendering.vue') },
|
|
|
|
{ path: '/editor', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-editor.vue') },
|
|
|
|
{ path: '/logging', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-logging.vue') },
|
|
|
|
{ path: '/search', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-search.vue') },
|
|
|
|
{ path: '/storage', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-storage.vue') },
|
|
|
|
{ path: '/api', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-api.vue') },
|
2018-12-22 21:18:16 +00:00
|
|
|
{ path: '/mail', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-mail.vue') },
|
2018-03-28 04:02:32 +00:00
|
|
|
{ path: '/system', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-system.vue') },
|
|
|
|
{ path: '/utilities', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-utilities.vue') },
|
2019-02-23 02:37:26 +00:00
|
|
|
{ path: '/dev-flags', component: () => import(/* webpackChunkName: "admin-dev" */ './admin/admin-dev-flags.vue') },
|
|
|
|
{ path: '/dev-graphiql', component: () => import(/* webpackChunkName: "admin-dev" */ './admin/admin-dev-graphiql.vue') },
|
|
|
|
{ path: '/dev-voyager', component: () => import(/* webpackChunkName: "admin-dev" */ './admin/admin-dev-voyager.vue') },
|
2018-06-10 00:11:00 +00:00
|
|
|
{ path: '/contribute', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-contribute.vue') }
|
2018-02-28 05:54:09 +00:00
|
|
|
]
|
|
|
|
})
|
|
|
|
|
|
|
|
export default {
|
2018-06-17 21:29:19 +00:00
|
|
|
i18nOptions: { namespaces: 'admin' },
|
2018-02-28 05:54:09 +00:00
|
|
|
data() {
|
|
|
|
return {
|
2018-11-26 03:10:20 +00:00
|
|
|
adminDrawerShown: true,
|
|
|
|
scrollStyle: {
|
|
|
|
vuescroll: {},
|
|
|
|
scrollPanel: {
|
|
|
|
initialScrollY: 0,
|
|
|
|
initialScrollX: 0,
|
|
|
|
scrollingX: false,
|
|
|
|
easing: 'easeOutQuad',
|
|
|
|
speed: 1000
|
|
|
|
},
|
|
|
|
rail: {
|
|
|
|
gutterOfEnds: '2px'
|
|
|
|
},
|
|
|
|
bar: {
|
|
|
|
onlyShowBarOnScroll: false,
|
|
|
|
background: '#CCC',
|
|
|
|
hoverStyle: {
|
|
|
|
background: '#999'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-02-28 05:54:09 +00:00
|
|
|
}
|
|
|
|
},
|
2018-08-11 22:16:56 +00:00
|
|
|
computed: {
|
2018-12-15 22:15:13 +00:00
|
|
|
darkMode: get('site/dark'),
|
2018-12-30 02:30:51 +00:00
|
|
|
info: sync('admin/info'),
|
|
|
|
permissions: get('user/permissions')
|
2018-08-11 22:16:56 +00:00
|
|
|
},
|
2018-11-19 06:08:55 +00:00
|
|
|
router,
|
|
|
|
created() {
|
|
|
|
this.$store.commit('page/SET_MODE', 'admin')
|
2018-12-15 22:15:13 +00:00
|
|
|
},
|
2018-12-30 02:30:51 +00:00
|
|
|
methods: {
|
|
|
|
hasPermission(prm) {
|
|
|
|
if (_.isArray(prm)) {
|
|
|
|
return _.some(prm, p => {
|
|
|
|
return _.includes(this.permissions, p)
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
return _.includes(this.permissions, prm)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2018-12-15 22:15:13 +00:00
|
|
|
apollo: {
|
|
|
|
info: {
|
|
|
|
query: statsQuery,
|
|
|
|
fetchPolicy: 'network-only',
|
|
|
|
manual: true,
|
|
|
|
result({ data, loading, networkStatus }) {
|
|
|
|
this.info = data.system.info
|
|
|
|
},
|
|
|
|
watchLoading (isLoading) {
|
|
|
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-stats-refresh')
|
|
|
|
}
|
|
|
|
}
|
2018-11-19 06:08:55 +00:00
|
|
|
}
|
2018-02-28 05:54:09 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang='scss'>
|
|
|
|
|
2018-12-03 02:42:43 +00:00
|
|
|
.admin {
|
2019-01-26 23:35:56 +00:00
|
|
|
&.theme--light .application--wrap {
|
2018-12-03 02:42:43 +00:00
|
|
|
background-color: lighten(mc('grey', '200'), 2%);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-03 06:32:58 +00:00
|
|
|
.admin-router {
|
|
|
|
&-enter-active, &-leave-active {
|
|
|
|
transition: opacity .25s ease;
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
&-enter-active {
|
|
|
|
transition-delay: .25s;
|
|
|
|
}
|
|
|
|
&-enter, &-leave-to {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-04 00:58:54 +00:00
|
|
|
.admin-sidebar {
|
|
|
|
.v-list__tile--active {
|
|
|
|
background-color: rgba(mc('theme', 'primary'), .1);
|
|
|
|
|
|
|
|
.v-icon {
|
2018-12-03 02:42:43 +00:00
|
|
|
color: mc('theme', 'primary');
|
2018-09-04 00:58:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.theme--dark {
|
|
|
|
.admin-sidebar .v-list__tile--active {
|
|
|
|
background-color: rgba(0,0,0, .2);
|
2018-12-03 02:42:43 +00:00
|
|
|
color: mc('blue', '500') !important;
|
|
|
|
|
|
|
|
.v-icon {
|
|
|
|
color: mc('blue', '500');
|
|
|
|
}
|
2018-09-04 00:58:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-30 03:30:20 +00:00
|
|
|
.admin-header {
|
|
|
|
display: flex;
|
|
|
|
justify-content: flex-start;
|
|
|
|
align-items: center;
|
2018-09-09 00:57:37 +00:00
|
|
|
|
2018-09-30 03:30:20 +00:00
|
|
|
&-title {
|
|
|
|
margin-left: 1rem;
|
|
|
|
}
|
2018-09-09 00:57:37 +00:00
|
|
|
}
|
|
|
|
|
2018-02-28 05:54:09 +00:00
|
|
|
</style>
|