diff --git a/webapp/graphql/admin/Statistics.js b/webapp/graphql/admin/Statistics.js new file mode 100644 index 000000000..94c3f91f0 --- /dev/null +++ b/webapp/graphql/admin/Statistics.js @@ -0,0 +1,15 @@ +import gql from 'graphql-tag' + +export const Statistics = gql` + query { + statistics { + countUsers + countPosts + countComments + countNotifications + countInvites + countFollows + countShouts + } + } +` diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 506cefde2..0d283f8af 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -22,6 +22,7 @@ }, "site": { "thanks": "Danke!", + "error-occurred": "Ein Fehler ist aufgetreten.", "made": "Mit ❤ gemacht", "imprint": "Impressum", "data-privacy": "Datenschutz", diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 05d8ac631..b1283c9b2 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -22,6 +22,7 @@ }, "site": { "thanks": "Thanks!", + "error-occurred": "An error occurred.", "made": "Made with ❤", "imprint": "Imprint", "termsAndConditions": "Terms and conditions", diff --git a/webapp/pages/admin/index.spec.js b/webapp/pages/admin/index.spec.js new file mode 100644 index 000000000..68256aa9d --- /dev/null +++ b/webapp/pages/admin/index.spec.js @@ -0,0 +1,53 @@ +import { mount, createLocalVue } from '@vue/test-utils' +import AdminIndexPage from './index.vue' +import Styleguide from '@human-connection/styleguide' +import VueApollo from 'vue-apollo' + +const localVue = createLocalVue() + +localVue.use(Styleguide) +localVue.use(VueApollo) + +describe('admin/index.vue', () => { + let Wrapper + let store + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + }) + + describe('mount', () => { + Wrapper = () => { + return mount(AdminIndexPage, { + store, + mocks, + localVue, + }) + } + + describe('in loading state', () => { + beforeEach(() => { + mocks = { ...mocks, $apolloData: { loading: true } } + }) + + it.skip('shows a loading spinner', () => { + // I don't know how to mock the data that gets passed to + // ApolloQuery component + // What I found: + // https://github.com/Akryum/vue-apollo/issues/656 + // https://github.com/Akryum/vue-apollo/issues/609 + Wrapper() + const calls = mocks.$t.mock.calls + const expected = [['site.error-occurred']] + expect(calls).toEqual(expected) + }) + }) + + describe('in error state', () => { + it.todo('displays an error message') + }) + }) +}) diff --git a/webapp/pages/admin/index.vue b/webapp/pages/admin/index.vue index 17d756fbd..b966fd416 100644 --- a/webapp/pages/admin/index.vue +++ b/webapp/pages/admin/index.vue @@ -1,90 +1,134 @@