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.

86 lines
2.7 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. img(src='/svg/icon-file.svg', alt='Page', style='width: 80px;')
  7. .admin-header-title
  8. .headline.blue--text.text--darken-2 Pages
  9. .subheading.grey--text Manage pages #[v-chip(label, color='primary', small).white--text coming soon]
  10. v-spacer
  11. v-btn(color='grey', outline, @click='refresh', large, disabled)
  12. v-icon.grey--text refresh
  13. v-btn(color='primary', depressed, large, @click='newpage', disabled)
  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='this.pages > 0')
  35. v-pagination(v-model='pagination.page', :length='pages')
  36. page-selector(v-model='pageSelectorShown', mode='new')
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. selectedGroup: {},
  43. pagination: {},
  44. groups: [],
  45. headers: [
  46. { text: 'ID', value: 'id', width: 50, align: 'right' },
  47. { text: 'Title', value: 'title' },
  48. { text: 'Path', value: 'path' },
  49. { text: 'Created', value: 'createdAt', width: 250 },
  50. { text: 'Last Updated', value: 'updatedAt', width: 250 }
  51. ],
  52. search: '',
  53. pageSelectorShown: false
  54. }
  55. },
  56. computed: {
  57. pages () {
  58. if (this.pagination.rowsPerPage == null || this.pagination.totalItems == null) {
  59. return 0
  60. }
  61. return Math.ceil(this.pagination.totalItems / this.pagination.rowsPerPage)
  62. }
  63. },
  64. methods: {
  65. async refresh() {
  66. // await this.$apollo.queries.groups.refetch()
  67. this.$store.commit('showNotification', {
  68. message: 'Pages have been refreshed.',
  69. style: 'success',
  70. icon: 'cached'
  71. })
  72. },
  73. newpage() {
  74. this.pageSelectorShown = true
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang='scss'>
  80. </style>