wikijs-fork/client/components/admin/admin-dashboard.vue

181 lines
5.9 KiB
Vue
Raw Normal View History

2018-02-28 05:54:09 +00:00
<template lang='pug'>
v-container(fluid, grid-list-lg)
v-layout(row, wrap)
v-flex(xs12)
.admin-header
2019-03-17 17:39:58 +00:00
img.animated.fadeInUp(src='/svg/icon-browse-page.svg', alt='Dashboard', style='width: 80px;')
.admin-header-title
2019-03-17 17:39:58 +00:00
.headline.primary--text.animated.fadeInLeft {{ $t('admin:dashboard.title') }}
.subheading.grey--text.animated.fadeInLeft.wait-p2s {{ $t('admin:dashboard.subtitle') }}
v-flex(xs12 md6 lg4 xl3 d-flex)
2019-03-17 17:39:58 +00:00
v-card.primary.dashboard-card.animated.fadeInUp(dark)
v-card-text
v-icon.dashboard-icon insert_drive_file
.subheading Pages
animated-number.display-1(
:value='info.pagesTotal'
:duration='2000'
:formatValue='round'
easing='easeOutQuint'
)
v-flex(xs12 md6 lg4 xl3 d-flex)
2019-03-17 17:39:58 +00:00
v-card.indigo.lighten-1.dashboard-card.animated.fadeInUp.wait-p2s(dark)
v-card-text
v-icon.dashboard-icon person
.subheading Users
animated-number.display-1(
:value='info.usersTotal'
:duration='2000'
:formatValue='round'
easing='easeOutQuint'
)
v-flex(xs12 md6 lg4 xl3 d-flex)
2019-03-17 17:39:58 +00:00
v-card.indigo.lighten-2.dashboard-card.animated.fadeInUp.wait-p4s(dark)
v-card-text
v-icon.dashboard-icon people
.subheading Groups
animated-number.display-1(
:value='info.groupsTotal'
:duration='2000'
:formatValue='round'
easing='easeOutQuint'
)
v-flex(xs12 md6 lg12 xl3 d-flex)
2019-03-17 17:39:58 +00:00
v-card.dashboard-card.animated.fadeInUp.wait-p6s(
:class='isLatestVersion ? "teal lighten-2" : "red lighten-2"'
dark
)
2019-01-12 23:33:30 +00:00
v-btn(fab, absolute, right, top, small, light, to='system', v-if='hasPermission(`manage:system`)')
2019-01-13 20:37:45 +00:00
v-icon(:color='isLatestVersion ? `teal` : `red darken-4`') build
v-card-text
v-icon.dashboard-icon blur_on
2019-01-13 20:37:45 +00:00
.subheading Wiki.js {{info.currentVersion}}
.body-2(v-if='isLatestVersion') You are running the latest version.
.body-2(v-else) A new version is available: {{info.latestVersion}}
v-flex(xs12)
2018-12-30 03:12:52 +00:00
v-card.radius-7
v-card-title.subheading(:class='$vuetify.dark ? `grey darken-2` : `grey lighten-5`') Recent Pages
v-data-table.pb-2(
:items='recentPages'
hide-actions
hide-headers
)
template(slot='items' slot-scope='props')
td(width='20', style='padding-right: 0;'): v-icon insert_drive_file
td
.body-2.primary--text {{ props.item.title }}
.caption.grey--text.text--darken-2 {{ props.item.description }}
td.caption /{{ props.item.path }}
td.grey--text.text--darken-2(width='250')
.caption: strong Updated {{ props.item.updatedAt | moment('from') }}
.caption Created {{ props.item.createdAt | moment('calendar') }}
v-flex(xs12)
2018-12-30 03:12:52 +00:00
v-card.radius-7
v-card-title.subheading(:class='$vuetify.dark ? `grey darken-2` : `grey lighten-5`') Most Popular Pages
v-data-table.pb-2(
:items='popularPages'
hide-actions
hide-headers
)
template(slot='items' slot-scope='props')
td(width='20', style='padding-right: 0;'): v-icon insert_drive_file
td
.body-2.primary--text {{ props.item.title }}
.caption.grey--text.text--darken-2 {{ props.item.description }}
td.caption /{{ props.item.path }}
td.grey--text.text--darken-2(width='250')
.caption: strong Updated {{ props.item.updatedAt | moment('from') }}
.caption Created {{ props.item.createdAt | moment('calendar') }}
2018-09-03 04:27:48 +00:00
2018-12-30 03:12:52 +00:00
v-flex(xs12)
v-card.dashboard-contribute
v-card-text
img(src='/svg/icon-heart-health.svg', alt='Contribute', style='height: 80px;')
.pl-3
.subheading Contribute
.body-2.pt-2 Wiki.js is a free and open source project. There are several ways you can contribute to the project.
.body-1 We need your help!
v-btn.mx-0.mt-2(:color='$vuetify.dark ? `indigo lighten-3` : `indigo`', outline, small, to='/contribute') Learn More
2018-02-28 05:54:09 +00:00
</template>
<script>
2019-01-12 23:33:30 +00:00
import _ from 'lodash'
2018-09-03 04:27:48 +00:00
import AnimatedNumber from 'animated-number-vue'
import { get } from 'vuex-pathify'
2018-02-28 05:54:09 +00:00
export default {
2018-09-03 04:27:48 +00:00
components: {
AnimatedNumber
},
2018-02-28 05:54:09 +00:00
data() {
return {
recentPages: [],
popularPages: []
}
},
computed: {
isLatestVersion() {
return this.info.currentVersion === this.info.latestVersion
},
2019-01-12 23:33:30 +00:00
info: get('admin/info'),
permissions: get('user/permissions')
2018-09-03 04:27:48 +00:00
},
methods: {
2019-01-12 23:33:30 +00:00
round(val) { return Math.round(val) },
hasPermission(prm) {
if (_.isArray(prm)) {
return _.some(prm, p => {
return _.includes(this.permissions, p)
})
} else {
return _.includes(this.permissions, prm)
}
}
2018-02-28 05:54:09 +00:00
}
}
</script>
<style lang='scss'>
.dashboard-card {
display: flex;
2018-12-30 03:12:52 +00:00
border-radius: 7px;
.v-card__text {
overflow: hidden;
position: relative;
}
}
2018-12-30 03:12:52 +00:00
.dashboard-contribute {
background-color: #FFF;
background-image: linear-gradient(to bottom, #FFF 0%, lighten(mc('indigo', '50'), 3%) 100%);
border-radius: 7px;
@at-root .theme--dark & {
background-color: mc('grey', '800');
background-image: linear-gradient(to bottom, mc('grey', '800') 0%, darken(mc('grey', '800'), 6%) 100%);
}
.v-card__text {
display: flex;
align-items: center;
color: mc('indigo', '500');
@at-root .theme--dark & {
color: mc('grey', '300');
}
}
}
2018-09-03 04:27:48 +00:00
.dashboard-icon {
position: absolute;
right: 0;
top: 12px;
font-size: 120px;
opacity: .25;
}
2018-02-28 05:54:09 +00:00
</style>