2018-09-09 00:57:37 +00:00
|
|
|
<template lang='pug'>
|
2018-09-30 03:30:20 +00:00
|
|
|
v-container(fluid, grid-list-lg)
|
|
|
|
v-layout(row wrap)
|
|
|
|
v-flex(xs12)
|
|
|
|
.admin-header
|
2020-05-15 21:05:11 +00:00
|
|
|
img.animated.fadeInUp(src='/_assets/svg/icon-file.svg', alt='Page', style='width: 80px;')
|
2018-09-30 03:30:20 +00:00
|
|
|
.admin-header-title
|
2019-07-02 05:48:19 +00:00
|
|
|
.headline.blue--text.text--darken-2.animated.fadeInLeft Pages
|
2019-08-03 04:48:55 +00:00
|
|
|
.subtitle-1.grey--text.animated.fadeInLeft.wait-p2s Manage pages
|
2018-09-30 03:30:20 +00:00
|
|
|
v-spacer
|
2019-07-29 04:50:03 +00:00
|
|
|
v-btn.animated.fadeInDown.wait-p1s(color='grey', outlined, @click='refresh', large)
|
|
|
|
v-icon.grey--text mdi-refresh
|
|
|
|
v-btn.animated.fadeInDown.mx-3(color='primary', outlined, large, @click='recyclebin', disabled)
|
|
|
|
v-icon(left) mdi-delete-outline
|
2019-07-21 17:16:30 +00:00
|
|
|
span Recycle Bin
|
2020-01-05 20:04:16 +00:00
|
|
|
v-btn.animated.fadeInDown(color='primary', depressed, large, to='pages/visualize')
|
|
|
|
v-icon(left) mdi-graph
|
|
|
|
span Visualize
|
2019-07-02 05:48:19 +00:00
|
|
|
v-card.wiki-form.mt-3.animated.fadeInUp
|
2019-08-10 16:18:14 +00:00
|
|
|
v-toolbar(flat, :color='$vuetify.theme.dark ? `grey darken-3-d5` : `grey lighten-5`', height='80')
|
2019-04-07 22:10:44 +00:00
|
|
|
v-spacer
|
|
|
|
v-text-field(
|
2019-07-29 04:50:03 +00:00
|
|
|
outlined
|
2019-04-07 22:10:44 +00:00
|
|
|
v-model='search'
|
2019-07-29 04:50:03 +00:00
|
|
|
prepend-inner-icon='mdi-file-search-outline'
|
2019-04-07 22:10:44 +00:00
|
|
|
label='Search Pages...'
|
|
|
|
hide-details
|
|
|
|
)
|
|
|
|
v-select.ml-2(
|
2019-07-29 04:50:03 +00:00
|
|
|
outlined
|
2019-04-07 22:10:44 +00:00
|
|
|
hide-details
|
|
|
|
label='Locale'
|
2019-07-02 05:48:19 +00:00
|
|
|
:items='langs'
|
|
|
|
v-model='selectedLang'
|
2019-04-07 22:10:44 +00:00
|
|
|
)
|
|
|
|
v-select.ml-2(
|
2019-07-29 04:50:03 +00:00
|
|
|
outlined
|
2019-04-07 22:10:44 +00:00
|
|
|
hide-details
|
|
|
|
label='Publish State'
|
2019-07-02 05:48:19 +00:00
|
|
|
:items='states'
|
|
|
|
v-model='selectedState'
|
2019-04-07 22:10:44 +00:00
|
|
|
)
|
|
|
|
v-spacer
|
|
|
|
v-divider
|
2018-09-30 03:30:20 +00:00
|
|
|
v-data-table(
|
2019-07-02 05:48:19 +00:00
|
|
|
:items='filteredPages'
|
2018-09-30 03:30:20 +00:00
|
|
|
:headers='headers'
|
|
|
|
:search='search'
|
2019-08-10 16:18:14 +00:00
|
|
|
:page.sync='pagination'
|
|
|
|
:items-per-page='15'
|
2019-04-07 22:10:44 +00:00
|
|
|
:loading='loading'
|
|
|
|
must-sort,
|
2019-12-15 22:48:11 +00:00
|
|
|
sort-by='updatedAt',
|
|
|
|
sort-desc,
|
2019-08-10 16:18:14 +00:00
|
|
|
hide-default-footer
|
2018-09-30 03:30:20 +00:00
|
|
|
)
|
2019-08-10 16:18:14 +00:00
|
|
|
template(slot='item', slot-scope='props')
|
2019-04-07 22:10:44 +00:00
|
|
|
tr.is-clickable(:active='props.selected', @click='$router.push(`/pages/` + props.item.id)')
|
2018-09-30 03:30:20 +00:00
|
|
|
td.text-xs-right {{ props.item.id }}
|
2019-04-07 22:10:44 +00:00
|
|
|
td
|
2019-08-31 19:00:31 +00:00
|
|
|
.body-2: strong {{ props.item.title }}
|
2019-04-07 22:10:44 +00:00
|
|
|
.caption {{ props.item.description }}
|
|
|
|
td.admin-pages-path
|
2019-08-10 16:18:14 +00:00
|
|
|
v-chip(label, small, :color='$vuetify.theme.dark ? `grey darken-4` : `grey lighten-4`') {{ props.item.locale }}
|
2019-08-31 19:00:31 +00:00
|
|
|
span.ml-2.grey--text(:class='$vuetify.theme.dark ? `text--lighten-1` : `text--darken-2`') / {{ props.item.path }}
|
2018-09-30 03:30:20 +00:00
|
|
|
td {{ props.item.createdAt | moment('calendar') }}
|
|
|
|
td {{ props.item.updatedAt | moment('calendar') }}
|
|
|
|
template(slot='no-data')
|
2019-08-25 02:19:35 +00:00
|
|
|
v-alert.ma-3(icon='mdi-alert', :value='true', outlined) No pages to display.
|
2019-09-09 01:31:22 +00:00
|
|
|
.text-center.py-2.animated.fadeInDown(v-if='this.pageTotal > 1')
|
2019-08-10 16:18:14 +00:00
|
|
|
v-pagination(v-model='pagination', :length='pageTotal')
|
2018-09-09 00:57:37 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-07-02 05:48:19 +00:00
|
|
|
import _ from 'lodash'
|
2019-04-07 22:10:44 +00:00
|
|
|
import pagesQuery from 'gql/admin/pages/pages-query-list.gql'
|
2018-09-09 00:57:37 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2019-04-07 22:10:44 +00:00
|
|
|
selectedPage: {},
|
2019-08-10 16:18:14 +00:00
|
|
|
pagination: 1,
|
2019-04-07 22:10:44 +00:00
|
|
|
pages: [],
|
2018-09-09 00:57:37 +00:00
|
|
|
headers: [
|
2019-08-31 19:00:31 +00:00
|
|
|
{ text: 'ID', value: 'id', width: 80, sortable: true },
|
2018-09-09 00:57:37 +00:00
|
|
|
{ text: 'Title', value: 'title' },
|
|
|
|
{ text: 'Path', value: 'path' },
|
|
|
|
{ text: 'Created', value: 'createdAt', width: 250 },
|
|
|
|
{ text: 'Last Updated', value: 'updatedAt', width: 250 }
|
|
|
|
],
|
2018-09-30 22:19:28 +00:00
|
|
|
search: '',
|
2019-07-02 05:48:19 +00:00
|
|
|
selectedLang: null,
|
|
|
|
selectedState: null,
|
|
|
|
states: [
|
|
|
|
{ text: 'All Publishing States', value: null },
|
|
|
|
{ text: 'Published', value: true },
|
|
|
|
{ text: 'Not Published', value: false }
|
|
|
|
],
|
2019-04-07 22:10:44 +00:00
|
|
|
loading: false
|
2018-09-09 00:57:37 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2019-04-07 22:10:44 +00:00
|
|
|
pageTotal () {
|
2019-08-10 16:18:14 +00:00
|
|
|
return Math.ceil(this.filteredPages.length / 15)
|
2019-07-02 05:48:19 +00:00
|
|
|
},
|
|
|
|
filteredPages () {
|
|
|
|
return _.filter(this.pages, pg => {
|
|
|
|
if (this.selectedLang !== null && this.selectedLang !== pg.locale) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if (this.selectedState !== null && this.selectedState !== pg.isPublished) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
})
|
|
|
|
},
|
|
|
|
langs () {
|
|
|
|
return _.concat({
|
|
|
|
text: 'All Locales',
|
|
|
|
value: null
|
|
|
|
}, _.uniqBy(this.pages, 'locale').map(pg => ({
|
|
|
|
text: pg.locale,
|
|
|
|
value: pg.locale
|
|
|
|
})))
|
2018-09-09 00:57:37 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async refresh() {
|
2019-04-07 22:10:44 +00:00
|
|
|
await this.$apollo.queries.pages.refetch()
|
2018-09-09 00:57:37 +00:00
|
|
|
this.$store.commit('showNotification', {
|
2019-04-07 22:10:44 +00:00
|
|
|
message: 'Page list has been refreshed.',
|
2018-09-09 00:57:37 +00:00
|
|
|
style: 'success',
|
|
|
|
icon: 'cached'
|
|
|
|
})
|
2018-09-30 22:19:28 +00:00
|
|
|
},
|
|
|
|
newpage() {
|
|
|
|
this.pageSelectorShown = true
|
2019-07-21 17:16:30 +00:00
|
|
|
},
|
|
|
|
recyclebin () { }
|
2019-04-07 22:10:44 +00:00
|
|
|
},
|
|
|
|
apollo: {
|
|
|
|
pages: {
|
|
|
|
query: pagesQuery,
|
|
|
|
fetchPolicy: 'network-only',
|
|
|
|
update: (data) => data.pages.list,
|
|
|
|
watchLoading (isLoading) {
|
|
|
|
this.loading = isLoading
|
|
|
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-pages-refresh')
|
|
|
|
}
|
|
|
|
}
|
2018-09-09 00:57:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang='scss'>
|
2019-04-07 22:10:44 +00:00
|
|
|
.admin-pages-path {
|
|
|
|
display: flex;
|
|
|
|
justify-content: flex-start;
|
|
|
|
align-items: center;
|
2019-05-06 01:21:27 +00:00
|
|
|
font-family: 'Roboto Mono', monospace;
|
2019-04-07 22:10:44 +00:00
|
|
|
}
|
2018-09-09 00:57:37 +00:00
|
|
|
</style>
|