admin-dashboard.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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-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 { get } from 'vuex-pathify'
  94. export default {
  95. components: {
  96. AnimatedNumber
  97. },
  98. data() {
  99. return {
  100. recentPages: [],
  101. popularPages: []
  102. }
  103. },
  104. computed: {
  105. isLatestVersion() {
  106. return this.info.currentVersion === this.info.latestVersion
  107. },
  108. info: get('admin/info')
  109. },
  110. methods: {
  111. round(val) { return Math.round(val) }
  112. }
  113. }
  114. </script>
  115. <style lang='scss'>
  116. .dashboard-card {
  117. display: flex;
  118. .v-card__text {
  119. overflow: hidden;
  120. position: relative;
  121. }
  122. }
  123. .dashboard-icon {
  124. position: absolute;
  125. right: 0;
  126. top: 12px;
  127. font-size: 120px;
  128. opacity: .25;
  129. }
  130. </style>