You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.4 KiB

  1. <template lang='pug'>
  2. v-container(fluid, grid-list-lg)
  3. v-layout(row wrap)
  4. v-flex(xs12)
  5. .admin-header
  6. v-icon(size='80', color='grey lighten-2') insert_drive_file
  7. .admin-header-title
  8. .headline.blue--text.text--darken-2 Pages
  9. .subheading.grey--text Manage pages
  10. v-spacer
  11. v-btn(color='grey', outline, @click='refresh', large)
  12. v-icon.grey--text refresh
  13. v-btn(color='primary', depressed, @click='save', large)
  14. v-icon(left) add
  15. span New Page
  16. v-card.mt-3
  17. v-data-table(
  18. :items='groups'
  19. :headers='headers'
  20. :search='search'
  21. :pagination.sync='pagination'
  22. :rows-per-page-items='[15]'
  23. hide-actions
  24. )
  25. template(slot='items', slot-scope='props')
  26. tr.is-clickable(:active='props.selected', @click='$router.push("/e/" + props.item.id)')
  27. td.text-xs-right {{ props.item.id }}
  28. td {{ props.item.name }}
  29. td {{ props.item.userCount }}
  30. td {{ props.item.createdAt | moment('calendar') }}
  31. td {{ props.item.updatedAt | moment('calendar') }}
  32. template(slot='no-data')
  33. v-alert.ma-3(icon='warning', :value='true', outline) No pages to display.
  34. .text-xs-center.py-2(v-if='groups.length > 15')
  35. v-pagination(v-model='pagination.page', :length='pages')
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. selectedGroup: {},
  42. pagination: {},
  43. groups: [],
  44. headers: [
  45. { text: 'ID', value: 'id', width: 50, align: 'right' },
  46. { text: 'Title', value: 'title' },
  47. { text: 'Path', value: 'path' },
  48. { text: 'Created', value: 'createdAt', width: 250 },
  49. { text: 'Last Updated', value: 'updatedAt', width: 250 }
  50. ],
  51. search: ''
  52. }
  53. },
  54. computed: {
  55. pages () {
  56. if (this.pagination.rowsPerPage == null || this.pagination.totalItems == null) {
  57. return 0
  58. }
  59. return Math.ceil(this.pagination.totalItems / this.pagination.rowsPerPage)
  60. }
  61. },
  62. methods: {
  63. async refresh() {
  64. // await this.$apollo.queries.groups.refetch()
  65. this.$store.commit('showNotification', {
  66. message: 'Pages have been refreshed.',
  67. style: 'success',
  68. icon: 'cached'
  69. })
  70. }
  71. }
  72. }
  73. </script>
  74. <style lang='scss'>
  75. </style>