mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Admin page handles loading and error state
This commit is contained in:
parent
37f281b441
commit
c129c3fbae
15
webapp/graphql/admin/Statistics.js
Normal file
15
webapp/graphql/admin/Statistics.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const Statistics = gql`
|
||||||
|
query {
|
||||||
|
statistics {
|
||||||
|
countUsers
|
||||||
|
countPosts
|
||||||
|
countComments
|
||||||
|
countNotifications
|
||||||
|
countInvites
|
||||||
|
countFollows
|
||||||
|
countShouts
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
@ -22,6 +22,7 @@
|
|||||||
},
|
},
|
||||||
"site": {
|
"site": {
|
||||||
"thanks": "Danke!",
|
"thanks": "Danke!",
|
||||||
|
"error-occurred": "Ein Fehler ist aufgetreten.",
|
||||||
"made": "Mit ❤ gemacht",
|
"made": "Mit ❤ gemacht",
|
||||||
"imprint": "Impressum",
|
"imprint": "Impressum",
|
||||||
"data-privacy": "Datenschutz",
|
"data-privacy": "Datenschutz",
|
||||||
|
|||||||
@ -22,6 +22,7 @@
|
|||||||
},
|
},
|
||||||
"site": {
|
"site": {
|
||||||
"thanks": "Thanks!",
|
"thanks": "Thanks!",
|
||||||
|
"error-occurred": "An error occurred.",
|
||||||
"made": "Made with ❤",
|
"made": "Made with ❤",
|
||||||
"imprint": "Imprint",
|
"imprint": "Imprint",
|
||||||
"termsAndConditions": "Terms and conditions",
|
"termsAndConditions": "Terms and conditions",
|
||||||
|
|||||||
@ -1,22 +1,49 @@
|
|||||||
<template>
|
<template>
|
||||||
<ds-card>
|
<ds-card>
|
||||||
<client-only>
|
<ApolloQuery :query="Statistics">
|
||||||
|
<template v-slot="{ result: { loading, error, data } }">
|
||||||
|
<template v-if="loading">
|
||||||
|
<ds-space centered>
|
||||||
|
<ds-spinner size="large"></ds-spinner>
|
||||||
|
</ds-space>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="error">
|
||||||
|
<ds-space centered>
|
||||||
|
<ds-space>
|
||||||
|
<img :src="errorIconPath" width="40" />
|
||||||
|
</ds-space>
|
||||||
|
<ds-text>
|
||||||
|
{{ $t('site.error-occurred') }}
|
||||||
|
</ds-text>
|
||||||
|
</ds-space>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="data">
|
||||||
<ds-space margin="large">
|
<ds-space margin="large">
|
||||||
<ds-flex>
|
<ds-flex>
|
||||||
<ds-flex-item :width="{ base: '100%', sm: '50%', md: '33%' }">
|
<ds-flex-item :width="{ base: '100%', sm: '50%', md: '33%' }">
|
||||||
<ds-space margin="small">
|
<ds-space margin="small">
|
||||||
<ds-number :count="0" :label="$t('admin.dashboard.users')" size="x-large" uppercase>
|
<ds-number
|
||||||
|
:count="0"
|
||||||
|
:label="$t('admin.dashboard.users')"
|
||||||
|
size="x-large"
|
||||||
|
uppercase
|
||||||
|
>
|
||||||
<client-only slot="count">
|
<client-only slot="count">
|
||||||
<hc-count-to :end-val="statistics.countUsers" />
|
<hc-count-to :end-val="data.statistics.countUsers" />
|
||||||
</client-only>
|
</client-only>
|
||||||
</ds-number>
|
</ds-number>
|
||||||
</ds-space>
|
</ds-space>
|
||||||
</ds-flex-item>
|
</ds-flex-item>
|
||||||
<ds-flex-item :width="{ base: '100%', sm: '50%', md: '33%' }">
|
<ds-flex-item :width="{ base: '100%', sm: '50%', md: '33%' }">
|
||||||
<ds-space margin="small">
|
<ds-space margin="small">
|
||||||
<ds-number :count="0" :label="$t('admin.dashboard.posts')" size="x-large" uppercase>
|
<ds-number
|
||||||
|
:count="0"
|
||||||
|
:label="$t('admin.dashboard.posts')"
|
||||||
|
size="x-large"
|
||||||
|
uppercase
|
||||||
|
>
|
||||||
<client-only slot="count">
|
<client-only slot="count">
|
||||||
<hc-count-to :end-val="statistics.countPosts" />
|
<hc-count-to :end-val="data.statistics.countPosts" />
|
||||||
</client-only>
|
</client-only>
|
||||||
</ds-number>
|
</ds-number>
|
||||||
</ds-space>
|
</ds-space>
|
||||||
@ -30,7 +57,7 @@
|
|||||||
uppercase
|
uppercase
|
||||||
>
|
>
|
||||||
<client-only slot="count">
|
<client-only slot="count">
|
||||||
<hc-count-to :end-val="statistics.countComments" />
|
<hc-count-to :end-val="data.statistics.countComments" />
|
||||||
</client-only>
|
</client-only>
|
||||||
</ds-number>
|
</ds-number>
|
||||||
</ds-space>
|
</ds-space>
|
||||||
@ -44,47 +71,64 @@
|
|||||||
uppercase
|
uppercase
|
||||||
>
|
>
|
||||||
<client-only slot="count">
|
<client-only slot="count">
|
||||||
<hc-count-to :end-val="statistics.countNotifications" />
|
<hc-count-to :end-val="data.statistics.countNotifications" />
|
||||||
</client-only>
|
</client-only>
|
||||||
</ds-number>
|
</ds-number>
|
||||||
</ds-space>
|
</ds-space>
|
||||||
</ds-flex-item>
|
</ds-flex-item>
|
||||||
<ds-flex-item :width="{ base: '100%', sm: '50%', md: '33%' }">
|
<ds-flex-item :width="{ base: '100%', sm: '50%', md: '33%' }">
|
||||||
<ds-space margin="small">
|
<ds-space margin="small">
|
||||||
<ds-number :count="0" :label="$t('admin.dashboard.invites')" size="x-large" uppercase>
|
<ds-number
|
||||||
|
:count="0"
|
||||||
|
:label="$t('admin.dashboard.invites')"
|
||||||
|
size="x-large"
|
||||||
|
uppercase
|
||||||
|
>
|
||||||
<client-only slot="count">
|
<client-only slot="count">
|
||||||
<hc-count-to :end-val="statistics.countInvites" />
|
<hc-count-to :end-val="data.statistics.countInvites" />
|
||||||
</client-only>
|
</client-only>
|
||||||
</ds-number>
|
</ds-number>
|
||||||
</ds-space>
|
</ds-space>
|
||||||
</ds-flex-item>
|
</ds-flex-item>
|
||||||
<ds-flex-item :width="{ base: '100%', sm: '50%', md: '33%' }">
|
<ds-flex-item :width="{ base: '100%', sm: '50%', md: '33%' }">
|
||||||
<ds-space margin="small">
|
<ds-space margin="small">
|
||||||
<ds-number :count="0" :label="$t('admin.dashboard.follows')" size="x-large" uppercase>
|
<ds-number
|
||||||
|
:count="0"
|
||||||
|
:label="$t('admin.dashboard.follows')"
|
||||||
|
size="x-large"
|
||||||
|
uppercase
|
||||||
|
>
|
||||||
<client-only slot="count">
|
<client-only slot="count">
|
||||||
<hc-count-to :end-val="statistics.countFollows" />
|
<hc-count-to :end-val="data.statistics.countFollows" />
|
||||||
</client-only>
|
</client-only>
|
||||||
</ds-number>
|
</ds-number>
|
||||||
</ds-space>
|
</ds-space>
|
||||||
</ds-flex-item>
|
</ds-flex-item>
|
||||||
<ds-flex-item :width="{ base: '100%', sm: '50%', md: '33%' }">
|
<ds-flex-item :width="{ base: '100%', sm: '50%', md: '33%' }">
|
||||||
<ds-space margin="small">
|
<ds-space margin="small">
|
||||||
<ds-number :count="0" :label="$t('admin.dashboard.shouts')" size="x-large" uppercase>
|
<ds-number
|
||||||
|
:count="0"
|
||||||
|
:label="$t('admin.dashboard.shouts')"
|
||||||
|
size="x-large"
|
||||||
|
uppercase
|
||||||
|
>
|
||||||
<client-only slot="count">
|
<client-only slot="count">
|
||||||
<hc-count-to :end-val="statistics.countShouts" />
|
<hc-count-to :end-val="data.statistics.countShouts" />
|
||||||
</client-only>
|
</client-only>
|
||||||
</ds-number>
|
</ds-number>
|
||||||
</ds-space>
|
</ds-space>
|
||||||
</ds-flex-item>
|
</ds-flex-item>
|
||||||
</ds-flex>
|
</ds-flex>
|
||||||
</ds-space>
|
</ds-space>
|
||||||
</client-only>
|
</template>
|
||||||
|
</template>
|
||||||
|
</ApolloQuery>
|
||||||
</ds-card>
|
</ds-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import gql from 'graphql-tag'
|
|
||||||
import HcCountTo from '~/components/CountTo.vue'
|
import HcCountTo from '~/components/CountTo.vue'
|
||||||
|
import { Statistics } from '~/graphql/admin/Statistics'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -92,30 +136,9 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
statistics: {},
|
errorIconPath: '/img/svg/emoji/cry.svg',
|
||||||
|
Statistics,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
isClient() {
|
|
||||||
return process.client
|
|
||||||
},
|
|
||||||
},
|
|
||||||
apollo: {
|
|
||||||
statistics: {
|
|
||||||
query: gql`
|
|
||||||
query {
|
|
||||||
statistics {
|
|
||||||
countUsers
|
|
||||||
countPosts
|
|
||||||
countComments
|
|
||||||
countNotifications
|
|
||||||
countInvites
|
|
||||||
countFollows
|
|
||||||
countShouts
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user