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.

180 lines
5.8 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-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(:color='isLatestVersion ? `teal` : `red darken-4`') build
  50. v-card-text
  51. v-icon.dashboard-icon blur_on
  52. .subheading Wiki.js {{info.currentVersion}}
  53. .body-2(v-if='isLatestVersion') You are running the latest version.
  54. .body-2(v-else) A new version is available: {{info.latestVersion}}
  55. v-flex(xs12)
  56. v-card.radius-7
  57. v-card-title.subheading(:class='$vuetify.dark ? `grey darken-2` : `grey lighten-5`') Recent Pages
  58. v-data-table.pb-2(
  59. :items='recentPages'
  60. hide-actions
  61. hide-headers
  62. )
  63. template(slot='items' slot-scope='props')
  64. td(width='20', style='padding-right: 0;'): v-icon insert_drive_file
  65. td
  66. .body-2.primary--text {{ props.item.title }}
  67. .caption.grey--text.text--darken-2 {{ props.item.description }}
  68. td.caption /{{ props.item.path }}
  69. td.grey--text.text--darken-2(width='250')
  70. .caption: strong Updated {{ props.item.updatedAt | moment('from') }}
  71. .caption Created {{ props.item.createdAt | moment('calendar') }}
  72. v-flex(xs12)
  73. v-card.radius-7
  74. v-card-title.subheading(:class='$vuetify.dark ? `grey darken-2` : `grey lighten-5`') Most Popular Pages
  75. v-data-table.pb-2(
  76. :items='popularPages'
  77. hide-actions
  78. hide-headers
  79. )
  80. template(slot='items' slot-scope='props')
  81. td(width='20', style='padding-right: 0;'): v-icon insert_drive_file
  82. td
  83. .body-2.primary--text {{ props.item.title }}
  84. .caption.grey--text.text--darken-2 {{ props.item.description }}
  85. td.caption /{{ props.item.path }}
  86. td.grey--text.text--darken-2(width='250')
  87. .caption: strong Updated {{ props.item.updatedAt | moment('from') }}
  88. .caption Created {{ props.item.createdAt | moment('calendar') }}
  89. v-flex(xs12)
  90. v-card.dashboard-contribute
  91. v-card-text
  92. img(src='/svg/icon-heart-health.svg', alt='Contribute', style='height: 80px;')
  93. .pl-3
  94. .subheading Contribute
  95. .body-2.pt-2 Wiki.js is a free and open source project. There are several ways you can contribute to the project.
  96. .body-1 We need your help!
  97. v-btn.mx-0.mt-2(:color='$vuetify.dark ? `indigo lighten-3` : `indigo`', outline, small, to='/contribute') Learn More
  98. </template>
  99. <script>
  100. import _ from 'lodash'
  101. import AnimatedNumber from 'animated-number-vue'
  102. import { get } from 'vuex-pathify'
  103. export default {
  104. components: {
  105. AnimatedNumber
  106. },
  107. data() {
  108. return {
  109. recentPages: [],
  110. popularPages: []
  111. }
  112. },
  113. computed: {
  114. isLatestVersion() {
  115. return this.info.currentVersion === this.info.latestVersion
  116. },
  117. info: get('admin/info'),
  118. permissions: get('user/permissions')
  119. },
  120. methods: {
  121. round(val) { return Math.round(val) },
  122. hasPermission(prm) {
  123. if (_.isArray(prm)) {
  124. return _.some(prm, p => {
  125. return _.includes(this.permissions, p)
  126. })
  127. } else {
  128. return _.includes(this.permissions, prm)
  129. }
  130. }
  131. }
  132. }
  133. </script>
  134. <style lang='scss'>
  135. .dashboard-card {
  136. display: flex;
  137. border-radius: 7px;
  138. .v-card__text {
  139. overflow: hidden;
  140. position: relative;
  141. }
  142. }
  143. .dashboard-contribute {
  144. background-color: #FFF;
  145. background-image: linear-gradient(to bottom, #FFF 0%, lighten(mc('indigo', '50'), 3%) 100%);
  146. border-radius: 7px;
  147. @at-root .theme--dark & {
  148. background-color: mc('grey', '800');
  149. background-image: linear-gradient(to bottom, mc('grey', '800') 0%, darken(mc('grey', '800'), 6%) 100%);
  150. }
  151. .v-card__text {
  152. display: flex;
  153. align-items: center;
  154. color: mc('indigo', '500');
  155. @at-root .theme--dark & {
  156. color: mc('grey', '300');
  157. }
  158. }
  159. }
  160. .dashboard-icon {
  161. position: absolute;
  162. right: 0;
  163. top: 12px;
  164. font-size: 120px;
  165. opacity: .25;
  166. }
  167. </style>