admin-dashboard.vue 4.8 KB

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