From eb7f8290aff7f7b43c9ee380765e185e03e90936 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 8 Jun 2022 22:15:59 +0200 Subject: [PATCH 01/75] add Page Community, add query listContributionLinks --- frontend/src/components/Menu/Sidebar.vue | 4 ++ frontend/src/graphql/queries.js | 15 +++++++ frontend/src/pages/Community.vue | 50 ++++++++++++++++++++++++ frontend/src/routes/routes.js | 7 ++++ 4 files changed, 76 insertions(+) create mode 100644 frontend/src/pages/Community.vue diff --git a/frontend/src/components/Menu/Sidebar.vue b/frontend/src/components/Menu/Sidebar.vue index 028b7aca6..8062e5ef5 100644 --- a/frontend/src/components/Menu/Sidebar.vue +++ b/frontend/src/components/Menu/Sidebar.vue @@ -34,6 +34,10 @@ {{ $t('navigation.admin_area') }} + + + {{ $t('community.community') }} + {{ $t('navigation.logout') }} diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index 601880a51..c6c847868 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -144,3 +144,18 @@ export const listTransactionLinks = gql` } } ` + +export const listContributionLinks = gql` + query { + listContributionLinks { + startDate + endDate + name + memo + amount + cycle + repetition + maxAmount + } + } +` diff --git a/frontend/src/pages/Community.vue b/frontend/src/pages/Community.vue new file mode 100644 index 000000000..1786f30a0 --- /dev/null +++ b/frontend/src/pages/Community.vue @@ -0,0 +1,50 @@ + + diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index e68f97502..540ef9d69 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -38,6 +38,13 @@ const routes = [ requiresAuth: true, }, }, + { + path: '/community', + component: () => import('@/pages/Community.vue'), + meta: { + requiresAuth: true, + }, + }, { path: '/login/:code?', component: () => import('@/pages/Login.vue'), From 83ebf4aa2efb8396dc6ee42c8b7d3454567ee340 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 8 Jun 2022 22:25:14 +0200 Subject: [PATCH 02/75] add Statistik Container --- frontend/src/pages/Community.vue | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/frontend/src/pages/Community.vue b/frontend/src/pages/Community.vue index 1786f30a0..a59d708d8 100644 --- a/frontend/src/pages/Community.vue +++ b/frontend/src/pages/Community.vue @@ -34,6 +34,20 @@ suport@gradido.net +
+ +
Statistik
+
+
+ Mitglieder + 1203 +
+
+ Mitglieder + 1203 +
+
+
diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index 540ef9d69..bd8f67524 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -45,6 +45,13 @@ const routes = [ requiresAuth: true, }, }, + { + path: '/info', + component: () => import('@/pages/InfoStatistic.vue'), + meta: { + requiresAuth: true, + }, + }, { path: '/login/:code?', component: () => import('@/pages/Login.vue'), From 4ab160ec44ec04d1cea76d93deea0a4ed87f41e9 Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 5 Aug 2022 11:15:38 +0200 Subject: [PATCH 08/75] =?UTF-8?q?add=20query=20listContributionLinks=1B[D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/graphql/queries.js | 27 ++++++++++------ frontend/src/locales/de.json | 3 +- frontend/src/locales/en.json | 3 +- frontend/src/pages/InfoStatistic.vue | 46 +++++++++++++++++++++++++--- 4 files changed, 63 insertions(+), 16 deletions(-) diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index fdbbd1e93..ab7cc849f 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -164,16 +164,23 @@ export const listTransactionLinks = gql` ` export const listContributionLinks = gql` - query { - listContributionLinks { - startDate - endDate - name - memo - amount - cycle - repetition - maxAmount + query($currentPage: Int = 1, $pageSize: Int = 25, $order: Order = DESC) { + listContributionLinks(currentPage: $currentPage, pageSize: $pageSize, order: $order) { + links { + id + amount + name + memo + code + link + createdAt + validFrom + validTo + maxAmountPerMonth + cycle + maxPerCycle + } + count } } ` diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 1db4d75a6..e98d53287 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -63,7 +63,8 @@ "updated": "Der Beitrag wurde geändert." }, "contribution-link": { - "thanksYouWith": "dankt dir mit" + "thanksYouWith": "dankt dir mit", + "unique":"( einmalig )" }, "decay": { "before_startblock_transaction": "Diese Transaktion beinhaltet keine Vergänglichkeit.", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 8c6caf7df..8b7cff5aa 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -63,7 +63,8 @@ "updated": "The contribution was changed." }, "contribution-link": { - "thanksYouWith": "thanks you with" + "thanksYouWith": "thanks you with", + "unique":"( unique )" }, "decay": { "before_startblock_transaction": "This transaction does not include decay.", diff --git a/frontend/src/pages/InfoStatistic.vue b/frontend/src/pages/InfoStatistic.vue index 6363292f7..464dfd1a9 100644 --- a/frontend/src/pages/InfoStatistic.vue +++ b/frontend/src/pages/InfoStatistic.vue @@ -17,17 +17,25 @@ {{ $t('community.openContributionLinkText', { _name_: CONFIG.COMMUNITY_NAME }) }} + Momentan gibt es aktuell {{ count }} Aktionen.
    -
  • {{ item.id }}
  • +
  • +
    {{ item.name }}
    +
    {{ item.memo }}
    +
    + {{ item.amount | GDD }} + {{ $t('contribution-link.unique') }} +
    +

{{ $t('community.moderators') }}
    -
  • {{ item.id }}
  • +
  • {{ item.name }}
- {{ supportMail }} + {{ supportMail }}

@@ -43,16 +51,46 @@ From 45f877f559e3ab88e68d795dc03e6b2020973fbe Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 5 Aug 2022 11:20:23 +0200 Subject: [PATCH 09/75] add count to the locales: openContributionLinkText --- frontend/src/locales/de.json | 2 +- frontend/src/locales/en.json | 2 +- frontend/src/pages/InfoStatistic.vue | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index e98d53287..bed4e0be6 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -30,7 +30,7 @@ "moderators": "Moderatoren", "myContributions": "Meine Beiträge zum Gemeinwohl", "openContributionLinks": "öffentliche Beitragslinklist", - "openContributionLinkText": "Folgende automatische Schöpfungen werden zur Zeit durch die Gemeinschaft '{_name_}' bereitgestellt.", + "openContributionLinkText": "Folgende {_count_} automatische Schöpfungen werden zur Zeit durch die Gemeinschaft '{_name_}' bereitgestellt.", "other-communities": "Weitere Gemeinschaften", "statistic": "Statistik", "submitContribution": "Beitrag einreichen", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 8b7cff5aa..ffef7c441 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -30,7 +30,7 @@ "moderators": "Moderators", "myContributions": "My contributions to the common good", "openContributionLinks": "open Contribution links list", - "openContributionLinkText": "The following automatic creations are currently provided by the '{_name_}' community.", + "openContributionLinkText": "The following {_count_} automatic creations are currently provided by the '{_name_}' community.", "other-communities": "Other communities", "statistic": "Statistics", "submitContribution": "Submit contribution", diff --git a/frontend/src/pages/InfoStatistic.vue b/frontend/src/pages/InfoStatistic.vue index 464dfd1a9..f8aaefbf3 100644 --- a/frontend/src/pages/InfoStatistic.vue +++ b/frontend/src/pages/InfoStatistic.vue @@ -15,9 +15,13 @@
{{ $t('community.openContributionLinks') }}
- {{ $t('community.openContributionLinkText', { _name_: CONFIG.COMMUNITY_NAME }) }} + {{ + $t('community.openContributionLinkText', { + _name_: CONFIG.COMMUNITY_NAME, + _count_: count, + }) + }} - Momentan gibt es aktuell {{ count }} Aktionen.
  • {{ item.name }}
    From 7fbdbb521784ebe3e491ec99bf34c62c48cfe09d Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 5 Aug 2022 11:58:48 +0200 Subject: [PATCH 10/75] spec test for info page --- frontend/src/graphql/queries.js | 2 - frontend/src/pages/InfoStatistic.spec.js | 77 ++++++++++++++++++++++++ frontend/src/pages/InfoStatistic.vue | 2 +- 3 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 frontend/src/pages/InfoStatistic.spec.js diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index ab7cc849f..b7d778147 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -171,8 +171,6 @@ export const listContributionLinks = gql` amount name memo - code - link createdAt validFrom validTo diff --git a/frontend/src/pages/InfoStatistic.spec.js b/frontend/src/pages/InfoStatistic.spec.js new file mode 100644 index 000000000..ade3a0340 --- /dev/null +++ b/frontend/src/pages/InfoStatistic.spec.js @@ -0,0 +1,77 @@ +import { mount } from '@vue/test-utils' +import InfoStatistic from './InfoStatistic' +import { toastErrorSpy } from '../../test/testSetup' + +const localVue = global.localVue + +const apolloQueryMock = jest.fn().mockResolvedValue({ + data: { + listContributionLinks: { + count: 2, + links: [ + { + id: 1, + amount: 200, + name: 'Dokumenta 2017', + memo: 'Vielen Dank für deinen Besuch bei der Dokumenta 2017', + cycle: 'ONCE', + }, + { + id: 2, + amount: 200, + name: 'Dokumenta 2022', + memo: 'Vielen Dank für deinen Besuch bei der Dokumenta 2022', + cycle: 'ONCE', + }, + ], + }, + }, +}) + +describe('InfoStatistic', () => { + let wrapper + + const mocks = { + $i18n: { + locale: 'en', + }, + $t: jest.fn((t) => t), + $apollo: { + query: apolloQueryMock, + }, + } + + const Wrapper = () => { + return mount(InfoStatistic, { localVue, mocks }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders the info page', () => { + expect(wrapper.find('div.info-statistic').exists()).toBe(true) + }) + + it('calls listUnconfirmedContributions', () => { + expect(apolloQueryMock).toBeCalled() + }) + + describe('error apolloQueryMock', () => { + beforeEach(async () => { + apolloQueryMock.mockRejectedValue({ + message: 'uups', + }) + wrapper = Wrapper() + jest.clearAllMocks() + }) + + it('toasts the error message', () => { + expect(toastErrorSpy).toBeCalledWith( + 'listContributionLinks has no result, use default data', + ) + }) + }) + }) +}) diff --git a/frontend/src/pages/InfoStatistic.vue b/frontend/src/pages/InfoStatistic.vue index f8aaefbf3..7b48eaf64 100644 --- a/frontend/src/pages/InfoStatistic.vue +++ b/frontend/src/pages/InfoStatistic.vue @@ -1,5 +1,5 @@ diff --git a/admin/src/config/index.js b/admin/src/config/index.js index fe373386d..7468227ef 100644 --- a/admin/src/config/index.js +++ b/admin/src/config/index.js @@ -32,6 +32,10 @@ const endpoints = { WALLET_URL: process.env.WALLET_URL || 'http://localhost/login', } +const community = { + COMMUNITY_NAME: process.env.COMMUNITY_NAME || 'Gradido Entwicklung', +} + const debug = { DEBUG_DISABLE_AUTH: process.env.DEBUG_DISABLE_AUTH === 'true' || false, } @@ -53,6 +57,7 @@ const CONFIG = { ...version, ...environment, ...endpoints, + ...community, ...debug, } diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index 3d88e0257..22cb833bf 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -73,6 +73,7 @@ "hide_details": "Details verbergen", "lastname": "Nachname", "math": { + "colon": ":", "exclaim": "!", "pipe": "|", "plus": "+" @@ -105,6 +106,16 @@ "removeNotSelf": "Als Admin/Moderator kannst du dich nicht selber löschen.", "remove_all": "alle Nutzer entfernen", "save": "Speichern", + "statistic": { + "activeUsers": "aktive Mitglieder", + "deletedUsers": "gelöschte Mitglieder", + "name": "Statistik", + "totalGradidoAvailable": "GDD insgesamt im Umflauf", + "totalGradidoCreated": "GDD insgesamt geschöpft", + "totalGradidoDecayed": "GDD insgesamt verfallen", + "totalGradidoUnbookedDecayed": "GDD nicht gebuchter verfall", + "totalUsers": "Mitglieder" + }, "status": "Status", "success": "Erfolg", "text": "Text", diff --git a/admin/src/locales/en.json b/admin/src/locales/en.json index f23c61e21..ca5928bcd 100644 --- a/admin/src/locales/en.json +++ b/admin/src/locales/en.json @@ -73,6 +73,7 @@ "hide_details": "Hide details", "lastname": "Lastname", "math": { + "colon": ":", "exclaim": "!", "pipe": "|", "plus": "+" @@ -105,6 +106,16 @@ "removeNotSelf": "As an admin/moderator, you cannot delete yourself.", "remove_all": "Remove all users", "save": "Speichern", + "statistic": { + "activeUsers": "active members", + "deletedUsers": "deleted members", + "name": "Statistic", + "totalGradidoAvailable": "Total GDD in circulation", + "totalGradidoCreated": "GDD total created", + "totalGradidoDecayed": "Total GDD decayed", + "totalGradidoUnbookedDecayed": "GDD not booked decayed", + "totalUsers": "Members" + }, "status": "Status", "success": "Success", "text": "Text", diff --git a/admin/src/pages/Overview.vue b/admin/src/pages/Overview.vue index 69aa15c1a..cbe0c1ae1 100644 --- a/admin/src/pages/Overview.vue +++ b/admin/src/pages/Overview.vue @@ -29,22 +29,36 @@ +