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.

155 lines
4.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. v-icon(size='80', color='grey lighten-2') dashboard
  7. .admin-header-title
  8. .headline.primary--text {{ $t('admin:dashboard.title') }}
  9. .subheading.grey--text {{ $t('admin:dashboard.subtitle') }}
  10. v-flex(xs12 md6 lg4 xl3 d-flex)
  11. v-card.primary.dashboard-card(dark)
  12. v-card-text
  13. v-icon.dashboard-icon insert_drive_file
  14. .subheading Pages
  15. animated-number.display-1(
  16. :value='info.pagesTotal'
  17. :duration='2000'
  18. :formatValue='round'
  19. easing='easeOutQuint'
  20. )
  21. v-flex(xs12 md6 lg4 xl3 d-flex)
  22. v-card.indigo.lighten-1.dashboard-card(dark)
  23. v-card-text
  24. v-icon.dashboard-icon person
  25. .subheading Users
  26. animated-number.display-1(
  27. :value='info.usersTotal'
  28. :duration='2000'
  29. :formatValue='round'
  30. easing='easeOutQuint'
  31. )
  32. v-flex(xs12 md6 lg4 xl3 d-flex)
  33. v-card.indigo.lighten-2.dashboard-card(dark)
  34. v-card-text
  35. v-icon.dashboard-icon people
  36. .subheading Groups
  37. animated-number.display-1(
  38. :value='info.groupsTotal'
  39. :duration='2000'
  40. :formatValue='round'
  41. easing='easeOutQuint'
  42. )
  43. v-flex(xs12 md6 lg12 xl3 d-flex)
  44. v-card.dashboard-card(
  45. :class='isLatestVersion ? "teal lighten-2" : "red lighten-2"'
  46. dark
  47. )
  48. v-btn(fab, absolute, right, top, small, light, to='system')
  49. v-icon(v-if='isLatestVersion', color='teal') build
  50. v-icon(v-else, color='red darken-4') get_app
  51. v-card-text
  52. v-icon.dashboard-icon blur_on
  53. .subheading Wiki.js {{info.currentVersion}}
  54. .body-2(v-if='isLatestVersion') You are running the latest version.
  55. .body-2(v-else) A new version is available: {{info.latestVersion}}
  56. v-flex(xs12)
  57. v-card
  58. v-card-title.subheading Recent Pages
  59. v-data-table.pb-2(
  60. :items='recentPages'
  61. hide-actions
  62. hide-headers
  63. )
  64. template(slot='items' slot-scope='props')
  65. td(width='20', style='padding-right: 0;'): v-icon insert_drive_file
  66. td
  67. .body-2.primary--text {{ props.item.title }}
  68. .caption.grey--text.text--darken-2 {{ props.item.description }}
  69. td.caption /{{ props.item.path }}
  70. td.grey--text.text--darken-2(width='250')
  71. .caption: strong Updated {{ props.item.updatedAt | moment('from') }}
  72. .caption Created {{ props.item.createdAt | moment('calendar') }}
  73. v-flex(xs12)
  74. v-card
  75. v-card-title.subheading Most Popular Pages
  76. v-data-table.pb-2(
  77. :items='popularPages'
  78. hide-actions
  79. hide-headers
  80. )
  81. template(slot='items' slot-scope='props')
  82. td(width='20', style='padding-right: 0;'): v-icon insert_drive_file
  83. td
  84. .body-2.primary--text {{ props.item.title }}
  85. .caption.grey--text.text--darken-2 {{ props.item.description }}
  86. td.caption /{{ props.item.path }}
  87. td.grey--text.text--darken-2(width='250')
  88. .caption: strong Updated {{ props.item.updatedAt | moment('from') }}
  89. .caption Created {{ props.item.createdAt | moment('calendar') }}
  90. </template>
  91. <script>
  92. import AnimatedNumber from 'animated-number-vue'
  93. import statsQuery from 'gql/admin/dashboard/dashboard-query-stats.gql'
  94. export default {
  95. components: {
  96. AnimatedNumber
  97. },
  98. data() {
  99. return {
  100. info: {
  101. currentVersion: 'n/a',
  102. latestVersion: 'n/a',
  103. groupsTotal: 0,
  104. pagesTotal: 0,
  105. usersTotal: 0
  106. },
  107. recentPages: [],
  108. popularPages: []
  109. }
  110. },
  111. computed: {
  112. isLatestVersion() {
  113. return this.info.currentVersion === this.info.latestVersion
  114. }
  115. },
  116. methods: {
  117. round(val) { return Math.round(val) }
  118. },
  119. apollo: {
  120. info: {
  121. query: statsQuery,
  122. fetchPolicy: 'network-only',
  123. update: (data) => data.system.info,
  124. watchLoading (isLoading) {
  125. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-system-refresh')
  126. }
  127. }
  128. }
  129. }
  130. </script>
  131. <style lang='scss'>
  132. .dashboard-card {
  133. display: flex;
  134. .v-card__text {
  135. overflow: hidden;
  136. position: relative;
  137. }
  138. }
  139. .dashboard-icon {
  140. position: absolute;
  141. right: 0;
  142. top: 12px;
  143. font-size: 120px;
  144. opacity: .25;
  145. }
  146. </style>