2018-09-23 04:14:01 +00:00
|
|
|
<template lang='pug'>
|
2018-09-30 03:30:20 +00:00
|
|
|
v-container(fluid, grid-list-lg)
|
2018-09-23 04:14:01 +00:00
|
|
|
v-layout(row wrap)
|
|
|
|
v-flex(xs12)
|
2018-09-30 03:30:20 +00:00
|
|
|
.admin-header
|
2019-04-07 16:37:33 +00:00
|
|
|
img.animated.fadeInUp(src='/svg/icon-triangle-arrow.svg', alt='Navigation', style='width: 80px;')
|
2018-09-30 03:30:20 +00:00
|
|
|
.admin-header-title
|
2019-04-07 16:37:33 +00:00
|
|
|
.headline.primary--text.animated.fadeInLeft {{$t('navigation.title')}}
|
2019-08-03 04:48:55 +00:00
|
|
|
.subtitle-1.grey--text.animated.fadeInLeft.wait-p4s {{$t('navigation.subtitle')}}
|
2018-09-30 03:30:20 +00:00
|
|
|
v-spacer
|
2019-07-29 04:50:03 +00:00
|
|
|
v-btn.animated.fadeInDown.wait-p2s.mr-3(outlined, color='grey', @click='refresh', large)
|
|
|
|
v-icon mdi-refresh
|
2019-04-07 16:37:33 +00:00
|
|
|
v-btn.animated.fadeInDown(color='success', depressed, @click='save', large)
|
2019-07-29 04:50:03 +00:00
|
|
|
v-icon(left) mdi-check
|
2018-09-30 03:30:20 +00:00
|
|
|
span {{$t('common:actions.apply')}}
|
2018-09-23 04:14:01 +00:00
|
|
|
v-container.pa-0.mt-3(fluid, grid-list-lg)
|
2020-02-02 21:26:44 +00:00
|
|
|
v-row(dense)
|
|
|
|
v-col(cols='3')
|
2019-04-07 16:37:33 +00:00
|
|
|
v-card.animated.fadeInUp
|
2020-02-02 21:26:44 +00:00
|
|
|
v-toolbar(color='teal', dark, dense, flat, height='56')
|
|
|
|
v-toolbar-title.subtitle-1 {{$t('admin:navigation.mode')}}
|
|
|
|
v-list(nav, two-line)
|
2020-04-12 22:05:48 +00:00
|
|
|
v-list-item-group(v-model='config.mode', mandatory, :color='$vuetify.theme.dark ? `teal lighten-3` : `teal`')
|
|
|
|
v-list-item(value='TREE')
|
2020-02-02 21:26:44 +00:00
|
|
|
v-list-item-avatar
|
|
|
|
img(src='/svg/icon-tree-structure-dotted.svg', alt='Site Tree')
|
|
|
|
v-list-item-content
|
|
|
|
v-list-item-title {{$t('admin:navigation.modeSiteTree.title')}}
|
|
|
|
v-list-item-subtitle {{$t('admin:navigation.modeSiteTree.description')}}
|
|
|
|
v-list-item-avatar
|
2020-04-12 22:05:48 +00:00
|
|
|
v-icon(v-if='$vuetify.theme.dark', :color='config.mode === `TREE` ? `teal lighten-3` : `grey darken-2`') mdi-check-circle
|
|
|
|
v-icon(v-else, :color='config.mode === `TREE` ? `teal` : `grey lighten-3`') mdi-check-circle
|
|
|
|
v-list-item(value='MIXED')
|
2020-02-02 21:26:44 +00:00
|
|
|
v-list-item-avatar
|
|
|
|
img(src='/svg/icon-user-menu-male-dotted.svg', alt='Custom Navigation')
|
|
|
|
v-list-item-content
|
|
|
|
v-list-item-title {{$t('admin:navigation.modeCustom.title')}}
|
|
|
|
v-list-item-subtitle {{$t('admin:navigation.modeCustom.description')}}
|
|
|
|
v-list-item-avatar
|
2020-04-12 22:05:48 +00:00
|
|
|
v-icon(v-if='$vuetify.theme.dark', :color='config.mode === `MIXED` ? `teal lighten-3` : `grey darken-2`') mdi-check-circle
|
|
|
|
v-icon(v-else, :color='config.mode === `MIXED` ? `teal` : `grey lighten-3`') mdi-check-circle
|
|
|
|
v-list-item(value='NONE')
|
2020-02-02 21:26:44 +00:00
|
|
|
v-list-item-avatar
|
|
|
|
img(src='/svg/icon-cancel-dotted.svg', alt='None')
|
|
|
|
v-list-item-content
|
|
|
|
v-list-item-title {{$t('admin:navigation.modeNone.title')}}
|
|
|
|
v-list-item-subtitle {{$t('admin:navigation.modeNone.description')}}
|
|
|
|
v-list-item-avatar
|
2020-04-12 22:05:48 +00:00
|
|
|
v-icon(v-if='$vuetify.theme.dark', :color='config.mode === `none` ? `teal lighten-3` : `grey darken-2`') mdi-check-circle
|
|
|
|
v-icon(v-else, :color='config.mode === `none` ? `teal` : `grey lighten-3`') mdi-check-circle
|
|
|
|
v-col(cols='9', v-if='config.mode === `MIXED`')
|
2020-02-02 21:26:44 +00:00
|
|
|
v-card.animated.fadeInUp.wait-p2s
|
|
|
|
v-row(no-gutters, align='stretch')
|
|
|
|
v-col(style='flex: 0 0 350px;')
|
|
|
|
v-card.grey(flat, style='height: 100%; border-radius: 4px 0 0 4px;', :class='$vuetify.theme.dark ? `darken-4-l5` : `lighten-3`')
|
|
|
|
.teal.pa-2(style='margin-bottom: 1px; height: 56px;')
|
|
|
|
v-select(
|
|
|
|
v-if='locales.length > 0'
|
|
|
|
label='Locale'
|
|
|
|
hide-details
|
|
|
|
solo
|
|
|
|
flat
|
|
|
|
background-color='teal darken-2'
|
|
|
|
dark
|
|
|
|
dense
|
|
|
|
v-model='currentLang'
|
|
|
|
:items='locales'
|
|
|
|
item-text='name'
|
|
|
|
item-value='code'
|
2018-09-29 19:39:09 +00:00
|
|
|
)
|
2020-02-02 21:26:44 +00:00
|
|
|
v-list.py-2(dense, nav, dark, class='blue darken-2', style='border-radius: 0;')
|
2020-04-18 22:25:16 +00:00
|
|
|
v-list-item(v-if='currentTree.length < 1')
|
2020-02-02 21:26:44 +00:00
|
|
|
v-list-item-avatar(size='24'): v-icon(color='blue lighten-3') mdi-alert
|
|
|
|
v-list-item-content
|
|
|
|
em.caption.blue--text.text--lighten-4 {{$t('navigation.emptyList')}}
|
2020-04-18 22:25:16 +00:00
|
|
|
draggable(v-model='currentTree')
|
|
|
|
template(v-for='navItem in currentTree')
|
2020-02-02 21:26:44 +00:00
|
|
|
v-list-item(
|
|
|
|
v-if='navItem.kind === "link"'
|
|
|
|
:key='navItem.id'
|
|
|
|
:class='(navItem === current) ? "blue" : ""'
|
|
|
|
@click='selectItem(navItem)'
|
|
|
|
)
|
|
|
|
v-list-item-avatar(size='24'): v-icon {{navItem.icon}}
|
|
|
|
v-list-item-title {{navItem.label}}
|
|
|
|
.py-2.clickable(
|
|
|
|
v-else-if='navItem.kind === "divider"'
|
|
|
|
:key='navItem.id'
|
|
|
|
:class='(navItem === current) ? "blue" : ""'
|
|
|
|
@click='selectItem(navItem)'
|
|
|
|
)
|
|
|
|
v-divider
|
|
|
|
v-subheader.pl-4.clickable(
|
|
|
|
v-else-if='navItem.kind === "header"'
|
|
|
|
:key='navItem.id'
|
|
|
|
:class='(navItem === current) ? "blue" : ""'
|
|
|
|
@click='selectItem(navItem)'
|
|
|
|
) {{navItem.label}}
|
|
|
|
v-card-chin
|
|
|
|
v-menu(offset-y, bottom, min-width='200px', style='flex: 1 1;')
|
|
|
|
template(v-slot:activator='{ on }')
|
|
|
|
v-btn(v-on='on', color='primary', depressed, block)
|
|
|
|
v-icon(left) mdi-plus
|
|
|
|
span {{$t('common:actions.add')}}
|
|
|
|
v-list
|
|
|
|
v-list-item(@click='addItem("link")')
|
|
|
|
v-list-item-avatar(size='24'): v-icon mdi-link
|
|
|
|
v-list-item-title {{$t('navigation.link')}}
|
|
|
|
v-list-item(@click='addItem("header")')
|
|
|
|
v-list-item-avatar(size='24'): v-icon mdi-format-title
|
|
|
|
v-list-item-title {{$t('navigation.header')}}
|
|
|
|
v-list-item(@click='addItem("divider")')
|
|
|
|
v-list-item-avatar(size='24'): v-icon mdi-minus
|
|
|
|
v-list-item-title {{$t('navigation.divider')}}
|
|
|
|
v-col
|
|
|
|
v-card(flat, style='border-radius: 0 4px 4px 0;')
|
|
|
|
template(v-if='current.kind === "link"')
|
|
|
|
v-toolbar(height='56', color='teal lighten-1', flat, dark)
|
|
|
|
.subtitle-1 {{$t('navigation.edit', { kind: $t('navigation.link') })}}
|
|
|
|
v-spacer
|
|
|
|
v-btn.px-5(color='white', outlined, @click='deleteItem(current)')
|
|
|
|
v-icon(left) mdi-delete
|
|
|
|
span {{$t('navigation.delete', { kind: $t('navigation.link') })}}
|
|
|
|
v-card-text
|
|
|
|
v-text-field(
|
|
|
|
outlined
|
|
|
|
:label='$t("navigation.label")'
|
|
|
|
prepend-icon='mdi-format-title'
|
|
|
|
v-model='current.label'
|
|
|
|
counter='255'
|
|
|
|
)
|
|
|
|
v-text-field(
|
|
|
|
outlined
|
|
|
|
:label='$t("navigation.icon")'
|
|
|
|
prepend-icon='mdi-dice-5'
|
|
|
|
v-model='current.icon'
|
|
|
|
hide-details
|
|
|
|
)
|
|
|
|
.caption.pt-3.pl-5 The default icon set is #[strong Material Design Icons]. In order to use another icon set, you must first select it in the Theme administration section.
|
|
|
|
.caption.pt-3.pl-5: strong Material Design Icons
|
|
|
|
.caption.pl-5 Refer to the #[a(href='https://materialdesignicons.com/', target='_blank') Material Design Icons Reference] for the list of all possible values. You must prefix all values with #[code mdi-], e.g. #[code mdi-home]
|
|
|
|
.caption.pt-3.pl-5: strong Font Awesome 5
|
|
|
|
.caption.pl-5 Refer to the #[a(href='https://fontawesome.com/icons?d=gallery&m=free', target='_blank') Font Awesome 5 Reference] for the list of all possible values. You must prefix all values with #[code fas fa-], e.g. #[code fas fa-home]. Note that some icons use different prefixes (e.g. #[code fab], #[code fad], #[code fal], #[code far]).
|
|
|
|
.caption.pt-3.pl-5: strong Font Awesome 4
|
|
|
|
.caption.pl-5 Refer to the #[a(href='https://fontawesome.com/v4.7.0/icons/', target='_blank') Font Awesome 4 Reference] for the list of all possible values. You must prefix all values with #[code fa fa-], e.g. #[code fa fa-home]
|
|
|
|
v-divider
|
|
|
|
v-card-text
|
|
|
|
v-select(
|
|
|
|
outlined
|
|
|
|
:label='$t("navigation.targetType")'
|
|
|
|
prepend-icon='mdi-near-me'
|
|
|
|
:items='navTypes'
|
|
|
|
v-model='current.targetType'
|
|
|
|
hide-details
|
|
|
|
)
|
|
|
|
v-text-field.mt-4(
|
|
|
|
v-if='current.targetType === `external`'
|
|
|
|
outlined
|
|
|
|
:label='$t("navigation.target")'
|
|
|
|
prepend-icon='mdi-near-me'
|
|
|
|
v-model='current.target'
|
|
|
|
hide-details
|
|
|
|
)
|
|
|
|
.d-flex.align-center.mt-4(v-else-if='current.targetType === "page"')
|
|
|
|
v-btn.ml-8(
|
|
|
|
color='primary'
|
|
|
|
dark
|
|
|
|
@click='selectPage'
|
|
|
|
)
|
|
|
|
v-icon(left) mdi-magnify
|
|
|
|
span {{$t('admin:navigation.selectPageButton')}}
|
|
|
|
.caption.ml-4.primary--text {{current.target}}
|
|
|
|
v-text-field(
|
|
|
|
v-else-if='current.targetType === `search`'
|
|
|
|
outlined
|
|
|
|
:label='$t("navigation.navType.searchQuery")'
|
|
|
|
prepend-icon='search'
|
|
|
|
v-model='current.target'
|
|
|
|
)
|
|
|
|
v-divider
|
|
|
|
|
|
|
|
template(v-else-if='current.kind === "header"')
|
|
|
|
v-toolbar(height='56', color='teal lighten-1', flat, dark)
|
|
|
|
.subtitle-1 {{$t('navigation.edit', { kind: $t('navigation.header') })}}
|
|
|
|
v-spacer
|
|
|
|
v-btn.px-5(color='white', outlined, @click='deleteItem(current)')
|
|
|
|
v-icon(left) mdi-delete
|
|
|
|
span {{$t('navigation.delete', { kind: $t('navigation.header') })}}
|
|
|
|
v-card-text
|
|
|
|
v-text-field(
|
|
|
|
outlined
|
|
|
|
:label='$t("navigation.label")'
|
|
|
|
prepend-icon='mdi-format-title'
|
|
|
|
v-model='current.label'
|
|
|
|
)
|
2018-09-23 04:14:01 +00:00
|
|
|
v-divider
|
2018-12-03 02:42:43 +00:00
|
|
|
|
2020-02-02 21:26:44 +00:00
|
|
|
div(v-else-if='current.kind === "divider"')
|
|
|
|
v-toolbar(height='56', color='teal lighten-1', flat, dark)
|
|
|
|
.subtitle-1 {{$t('navigation.edit', { kind: $t('navigation.divider') })}}
|
|
|
|
v-spacer
|
|
|
|
v-btn.px-5(color='white', outlined, @click='deleteItem(current)')
|
|
|
|
v-icon(left) mdi-delete
|
|
|
|
span {{$t('navigation.delete', { kind: $t('navigation.divider') })}}
|
|
|
|
|
|
|
|
v-card-text(v-if='current.kind')
|
|
|
|
v-radio-group.pl-8(v-model='current.visibilityMode', mandatory, hide-details)
|
|
|
|
v-radio(:label='$t("admin:navigation.visibilityMode.all")', value='all', color='primary')
|
|
|
|
v-radio.mt-3(:label='$t("admin:navigation.visibilityMode.restricted")', value='restricted', color='primary')
|
|
|
|
.pl-8
|
|
|
|
v-select.pl-8.mt-3(
|
|
|
|
item-text='name'
|
|
|
|
item-value='id'
|
|
|
|
outlined
|
|
|
|
prepend-icon='mdi-account-group'
|
|
|
|
label='Groups'
|
|
|
|
:disabled='current.visibilityMode !== `restricted`'
|
|
|
|
v-model='current.visibilityGroups'
|
|
|
|
:items='groups'
|
|
|
|
persistent-hint
|
|
|
|
clearable
|
|
|
|
multiple
|
|
|
|
)
|
|
|
|
template(v-else)
|
|
|
|
v-toolbar(height='56', color='teal lighten-1', flat, dark)
|
2020-04-18 22:25:16 +00:00
|
|
|
v-card-text.grey--text(v-if='currentTree.length > 0') {{$t('navigation.noSelectionText')}}
|
2020-02-02 21:26:44 +00:00
|
|
|
v-card-text.grey--text(v-else) {{$t('navigation.noItemsText')}}
|
|
|
|
|
|
|
|
page-selector(mode='select', v-model='selectPageModal', :open-handler='selectPageHandle', path='home', :locale='currentLang')
|
2018-09-23 04:14:01 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2018-09-29 19:39:09 +00:00
|
|
|
import _ from 'lodash'
|
2020-02-02 21:26:44 +00:00
|
|
|
import gql from 'graphql-tag'
|
2020-04-12 22:05:48 +00:00
|
|
|
import { v4 as uuid } from 'uuid'
|
2018-09-29 19:39:09 +00:00
|
|
|
|
2020-02-02 21:26:44 +00:00
|
|
|
import groupsQuery from 'gql/admin/users/users-query-groups.gql'
|
2018-09-29 19:39:09 +00:00
|
|
|
|
2018-09-23 04:14:01 +00:00
|
|
|
import draggable from 'vuedraggable'
|
|
|
|
|
2020-02-02 21:26:44 +00:00
|
|
|
/* global siteConfig, siteLangs */
|
|
|
|
|
2018-09-23 04:14:01 +00:00
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
draggable
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2020-02-02 21:26:44 +00:00
|
|
|
selectPageModal: false,
|
2020-04-18 22:25:16 +00:00
|
|
|
trees: [],
|
2020-02-02 21:26:44 +00:00
|
|
|
current: {},
|
2020-04-18 22:25:16 +00:00
|
|
|
currentLang: siteConfig.lang,
|
2020-04-12 22:05:48 +00:00
|
|
|
groups: [],
|
|
|
|
config: {
|
|
|
|
mode: 'NONE'
|
|
|
|
}
|
2018-09-23 04:14:01 +00:00
|
|
|
}
|
|
|
|
},
|
2018-09-29 19:39:09 +00:00
|
|
|
computed: {
|
2020-02-02 21:26:44 +00:00
|
|
|
navTypes () {
|
2018-09-29 19:39:09 +00:00
|
|
|
return [
|
2020-02-02 21:26:44 +00:00
|
|
|
{ text: this.$t('navigation.navType.external'), value: 'external' },
|
2018-09-29 19:39:09 +00:00
|
|
|
{ text: this.$t('navigation.navType.home'), value: 'home' },
|
2020-02-02 21:26:44 +00:00
|
|
|
{ text: this.$t('navigation.navType.page'), value: 'page' }
|
2019-07-02 05:48:19 +00:00
|
|
|
// { text: this.$t('navigation.navType.searchQuery'), value: 'search' }
|
2018-09-29 19:39:09 +00:00
|
|
|
]
|
2020-02-02 21:26:44 +00:00
|
|
|
},
|
|
|
|
locales () {
|
|
|
|
return siteLangs
|
2020-04-18 22:25:16 +00:00
|
|
|
},
|
|
|
|
currentTree: {
|
|
|
|
get () {
|
|
|
|
return _.get(_.find(this.trees, ['locale', this.currentLang]), 'items', null) || []
|
|
|
|
},
|
|
|
|
set (val) {
|
|
|
|
const tree = _.find(this.trees, ['locale', this.currentLang])
|
|
|
|
if (tree) {
|
|
|
|
tree.items = val
|
|
|
|
} else {
|
|
|
|
this.trees = [...this.trees, {
|
|
|
|
locale: this.currentLang,
|
|
|
|
items: val
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
currentLang (newValue, oldValue) {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
if (this.currentTree.length > 0) {
|
|
|
|
this.current = this.currentTree[0]
|
|
|
|
} else {
|
|
|
|
this.current = {}
|
|
|
|
}
|
|
|
|
})
|
2018-09-29 19:39:09 +00:00
|
|
|
}
|
|
|
|
},
|
2018-09-23 04:14:01 +00:00
|
|
|
methods: {
|
|
|
|
addItem(kind) {
|
|
|
|
let newItem = {
|
2018-09-29 19:39:09 +00:00
|
|
|
id: uuid(),
|
2020-02-02 21:26:44 +00:00
|
|
|
kind,
|
|
|
|
visibilityMode: 'all',
|
|
|
|
visibilityGroups: []
|
2018-09-23 04:14:01 +00:00
|
|
|
}
|
|
|
|
switch (kind) {
|
|
|
|
case 'link':
|
|
|
|
newItem = {
|
|
|
|
...newItem,
|
2018-09-29 19:39:09 +00:00
|
|
|
label: this.$t('navigation.untitled', { kind: this.$t(`navigation.link`) }),
|
2019-07-29 04:50:03 +00:00
|
|
|
icon: 'mdi-chevron-right',
|
2018-09-23 04:14:01 +00:00
|
|
|
targetType: 'home',
|
|
|
|
target: '/'
|
|
|
|
}
|
|
|
|
break
|
|
|
|
case 'header':
|
2018-09-29 19:39:09 +00:00
|
|
|
newItem.label = this.$t('navigation.untitled', { kind: this.$t(`navigation.header`) })
|
2018-09-23 04:14:01 +00:00
|
|
|
break
|
|
|
|
}
|
2020-04-18 22:25:16 +00:00
|
|
|
this.currentTree = [...this.currentTree, newItem]
|
2018-09-23 04:14:01 +00:00
|
|
|
this.current = newItem
|
|
|
|
},
|
2018-09-29 19:39:09 +00:00
|
|
|
deleteItem(item) {
|
2020-04-18 22:25:16 +00:00
|
|
|
this.currentTree = _.pull(this.currentTree, item)
|
2018-09-29 19:39:09 +00:00
|
|
|
this.current = {}
|
|
|
|
},
|
2018-09-23 04:14:01 +00:00
|
|
|
selectItem(item) {
|
|
|
|
this.current = item
|
2018-09-29 19:39:09 +00:00
|
|
|
},
|
2019-07-02 05:48:19 +00:00
|
|
|
selectPage() {
|
2020-02-02 21:26:44 +00:00
|
|
|
this.selectPageModal = true
|
|
|
|
},
|
|
|
|
selectPageHandle ({ path, locale }) {
|
|
|
|
this.current.target = `/${locale}/${path}`
|
2019-07-02 05:48:19 +00:00
|
|
|
},
|
2018-09-29 19:39:09 +00:00
|
|
|
async save() {
|
|
|
|
this.$store.commit(`loadingStart`, 'admin-navigation-save')
|
|
|
|
try {
|
2018-10-22 02:25:17 +00:00
|
|
|
const resp = await this.$apollo.mutate({
|
2020-02-02 21:26:44 +00:00
|
|
|
mutation: gql`
|
|
|
|
mutation ($tree: [NavigationTreeInput]!) {
|
|
|
|
navigation{
|
|
|
|
updateTree(tree: $tree) {
|
|
|
|
responseResult {
|
|
|
|
succeeded
|
|
|
|
errorCode
|
|
|
|
slug
|
|
|
|
message
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`,
|
2018-09-29 19:39:09 +00:00
|
|
|
variables: {
|
2020-04-18 22:25:16 +00:00
|
|
|
tree: this.trees
|
2018-09-29 19:39:09 +00:00
|
|
|
}
|
|
|
|
})
|
2018-10-22 02:25:17 +00:00
|
|
|
if (_.get(resp, 'data.navigation.updateTree.responseResult.succeeded', false)) {
|
|
|
|
this.$store.commit('showNotification', {
|
|
|
|
message: this.$t('navigation.saveSuccess'),
|
|
|
|
style: 'success',
|
|
|
|
icon: 'check'
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
throw new Error(_.get(resp, 'data.navigation.updateTree.responseResult.message', 'An unexpected error occured.'))
|
|
|
|
}
|
2018-09-29 19:39:09 +00:00
|
|
|
} catch (err) {
|
2019-01-13 03:33:30 +00:00
|
|
|
this.$store.commit('pushGraphError', err)
|
2018-09-29 19:39:09 +00:00
|
|
|
}
|
|
|
|
this.$store.commit(`loadingStop`, 'admin-navigation-save')
|
2018-10-22 02:25:17 +00:00
|
|
|
},
|
|
|
|
async refresh() {
|
2020-04-18 22:25:16 +00:00
|
|
|
await this.$apollo.queries.trees.refetch()
|
2018-10-22 02:25:17 +00:00
|
|
|
this.current = {}
|
|
|
|
this.$store.commit('showNotification', {
|
|
|
|
message: 'Navigation has been refreshed.',
|
|
|
|
style: 'success',
|
|
|
|
icon: 'cached'
|
|
|
|
})
|
2018-09-29 19:39:09 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
apollo: {
|
2020-04-12 22:05:48 +00:00
|
|
|
config: {
|
|
|
|
query: gql`
|
|
|
|
{
|
|
|
|
navigation {
|
|
|
|
config {
|
|
|
|
mode
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`,
|
|
|
|
fetchPolicy: 'network-only',
|
|
|
|
update: (data) => _.cloneDeep(data.navigation.config),
|
|
|
|
watchLoading (isLoading) {
|
|
|
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-navigation-config')
|
|
|
|
}
|
|
|
|
},
|
2020-04-18 22:25:16 +00:00
|
|
|
trees: {
|
2020-02-02 21:26:44 +00:00
|
|
|
query: gql`
|
|
|
|
{
|
|
|
|
navigation {
|
|
|
|
tree {
|
|
|
|
locale
|
|
|
|
items {
|
|
|
|
id
|
|
|
|
kind
|
|
|
|
label
|
|
|
|
icon
|
|
|
|
targetType
|
|
|
|
target
|
2020-04-18 22:25:16 +00:00
|
|
|
visibilityMode
|
|
|
|
visibilityGroups
|
2020-02-02 21:26:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`,
|
2018-09-29 19:39:09 +00:00
|
|
|
fetchPolicy: 'network-only',
|
|
|
|
update: (data) => _.cloneDeep(data.navigation.tree),
|
|
|
|
watchLoading (isLoading) {
|
|
|
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-navigation-tree')
|
|
|
|
}
|
2020-02-02 21:26:44 +00:00
|
|
|
},
|
|
|
|
groups: {
|
|
|
|
query: groupsQuery,
|
|
|
|
fetchPolicy: 'network-only',
|
|
|
|
update: (data) => data.groups.list,
|
|
|
|
watchLoading (isLoading) {
|
|
|
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-navigation-groups')
|
|
|
|
}
|
2018-09-23 04:14:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang='scss' scoped>
|
|
|
|
|
|
|
|
.clickable {
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background-color: rgba(mc('blue', '500'), .25);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|