admin-dashboard.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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', v-if='hasPermission(`manage: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}} BETA
  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.radius-7
  58. v-card-title.subheading(:class='$vuetify.dark ? `grey darken-2` : `grey lighten-5`') 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.radius-7
  75. v-card-title.subheading(:class='$vuetify.dark ? `grey darken-2` : `grey lighten-5`') 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. v-flex(xs12)
  91. v-card.dashboard-contribute
  92. v-card-text
  93. img(src='/svg/icon-heart-health.svg', alt='Contribute', style='height: 80px;')
  94. .pl-3
  95. .subheading Contribute
  96. .body-2.pt-2 Wiki.js is a free and open source project. There are several ways you can contribute to the project.
  97. .body-1 We need your help!
  98. v-btn.mx-0.mt-2(:color='$vuetify.dark ? `indigo lighten-3` : `indigo`', outline, small, to='/contribute') Learn More
  99. </template>
  100. <script>
  101. import _ from 'lodash'
  102. import AnimatedNumber from 'animated-number-vue'
  103. import { get } from 'vuex-pathify'
  104. export default {
  105. components: {
  106. AnimatedNumber
  107. },
  108. data() {
  109. return {
  110. recentPages: [],
  111. popularPages: []
  112. }
  113. },
  114. computed: {
  115. isLatestVersion() {
  116. return this.info.currentVersion === this.info.latestVersion
  117. },
  118. info: get('admin/info'),
  119. permissions: get('user/permissions')
  120. },
  121. methods: {
  122. round(val) { return Math.round(val) },
  123. hasPermission(prm) {
  124. if (_.isArray(prm)) {
  125. return _.some(prm, p => {
  126. return _.includes(this.permissions, p)
  127. })
  128. } else {
  129. return _.includes(this.permissions, prm)
  130. }
  131. }
  132. }
  133. }
  134. </script>
  135. <style lang='scss'>
  136. .dashboard-card {
  137. display: flex;
  138. border-radius: 7px;
  139. .v-card__text {
  140. overflow: hidden;
  141. position: relative;
  142. }
  143. }
  144. .dashboard-contribute {
  145. background-color: #FFF;
  146. background-image: linear-gradient(to bottom, #FFF 0%, lighten(mc('indigo', '50'), 3%) 100%);
  147. border-radius: 7px;
  148. @at-root .theme--dark & {
  149. background-color: mc('grey', '800');
  150. background-image: linear-gradient(to bottom, mc('grey', '800') 0%, darken(mc('grey', '800'), 6%) 100%);
  151. }
  152. .v-card__text {
  153. display: flex;
  154. align-items: center;
  155. color: mc('indigo', '500');
  156. @at-root .theme--dark & {
  157. color: mc('grey', '300');
  158. }
  159. }
  160. }
  161. .dashboard-icon {
  162. position: absolute;
  163. right: 0;
  164. top: 12px;
  165. font-size: 120px;
  166. opacity: .25;
  167. }
  168. </style>