From 54c96657926fa343cba04a8e62ecc9d8300c7aed Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 5 May 2021 15:45:11 +0200 Subject: [PATCH 1/2] transactionslist load and icon --- frontend/src/locales/de.json | 2 +- frontend/src/locales/en.json | 2 +- .../src/views/KontoOverview/GddStatus.vue | 3 +- frontend/src/views/KontoOverview/GddTable.vue | 49 ++++++++------- .../src/views/Layout/DashboardLayout_gdd.vue | 63 ++++++++++++++++--- .../src/views/Pages/KontoOverview.spec.js | 4 +- frontend/src/views/Pages/KontoOverview.vue | 19 +++--- .../Pages/UserProfileTransactionList.vue | 17 ++++- 8 files changed, 112 insertions(+), 47 deletions(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index e3868124c..0fd68c060 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -46,8 +46,8 @@ "send_success":"Deine Zahlung wurde erfolgreich versendet." }, "transaction":{ - "show_part": "Die letzten {count} Transaktionen", "show_all":"Alle {count} Transaktionen ansehen", + "nullTransactions":"Du hast noch keine Transaktionen auf deinem Konto.", "more": "mehr" }, "site": { diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 521f68f0d..f734e75ee 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -47,7 +47,7 @@ }, "transaction":{ "show_part": "The last {count} transactions", - "show_all":"View all {count} transactions", + "nullTransactions":"You don't have any transactions on your account yet.", "more": "more" }, "site": { diff --git a/frontend/src/views/KontoOverview/GddStatus.vue b/frontend/src/views/KontoOverview/GddStatus.vue index 87a06dfb6..ba4c64e68 100644 --- a/frontend/src/views/KontoOverview/GddStatus.vue +++ b/frontend/src/views/KontoOverview/GddStatus.vue @@ -1,6 +1,6 @@ diff --git a/frontend/src/views/Pages/KontoOverview.spec.js b/frontend/src/views/Pages/KontoOverview.spec.js index b0385cbc3..3cb3b8271 100644 --- a/frontend/src/views/Pages/KontoOverview.spec.js +++ b/frontend/src/views/Pages/KontoOverview.spec.js @@ -35,8 +35,8 @@ describe('KontoOverview', () => { expect(wrapper.find('gdd-table-stub').exists()).toBeTruthy() }) - it('updates transctions data when change-transactions is emitted', async () => { - wrapper.find('gdd-table-stub').vm.$emit('change-transactions', [0, 1]) + it('updates transctions data when update-transactions is emitted', async () => { + wrapper.find('gdd-table-stub').vm.$emit('update-transactions', [0, 1]) await wrapper.vm.$nextTick() expect(wrapper.vm.transactions).toEqual(expect.arrayContaining([0, 1])) }) diff --git a/frontend/src/views/Pages/KontoOverview.vue b/frontend/src/views/Pages/KontoOverview.vue index e05a6236d..52b9f832b 100644 --- a/frontend/src/views/Pages/KontoOverview.vue +++ b/frontend/src/views/Pages/KontoOverview.vue @@ -2,11 +2,7 @@
- +

@@ -32,13 +28,16 @@ export default { name: 'Overview', data() { return { - transactions: [], showTransactionList: true, } }, props: { balance: { type: Number, default: 0 }, GdtBalance: { type: Number, default: 0 }, + + transactions: { + default: [], + }, }, components: { GddStatus, @@ -52,8 +51,8 @@ export default { updateBalance(data) { this.$emit('update-balance', data.ammount) }, - setTransactions(transactions) { - this.transactions = transactions + updateTransactions() { + this.$emit('update-transactions') }, }, } diff --git a/frontend/src/views/Pages/UserProfileTransactionList.vue b/frontend/src/views/Pages/UserProfileTransactionList.vue index 2033a189a..7b4ad2ccc 100644 --- a/frontend/src/views/Pages/UserProfileTransactionList.vue +++ b/frontend/src/views/Pages/UserProfileTransactionList.vue @@ -7,19 +7,32 @@ - + + + {{ $t('transaction.nullTransactions') }} + From b3529c0ea36da438e23909ea8b3df1b409f5729e Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 5 May 2021 16:53:09 +0200 Subject: [PATCH 2/2] remove testData, fix test --- .../src/views/Layout/DashboardLayout_gdd.vue | 57 +++---------------- .../src/views/Pages/KontoOverview.spec.js | 6 -- frontend/src/views/Pages/KontoOverview.vue | 3 +- 3 files changed, 8 insertions(+), 58 deletions(-) diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.vue b/frontend/src/views/Layout/DashboardLayout_gdd.vue index cdd72b68d..5fc696574 100755 --- a/frontend/src/views/Layout/DashboardLayout_gdd.vue +++ b/frontend/src/views/Layout/DashboardLayout_gdd.vue @@ -103,56 +103,13 @@ export default { } }, async updateTransactions() { - // const result = await communityAPI.transactions(this.$store.state.session_id) - // if (result.success) { - // this.GdtBalance = result.result.data.gdtSum / 10000 - // this.transactions = result.result.data.transactions - // } else { - // // what to do when loading balance fails? - // } - - this.transactions = [ - { - name: 'Max Mustermann', - email: 'Maxim@Mustermann', - type: 'send', - transaction_id: 2, - date: '2021-02-19T13:25:38+00:00', - balance: 1920000, - memo: 'a piece of cake :)', - pubkey: '038a6f93270dc57b91d76bf110ad3863fcb7d1b08e7692e793fcdb4467e5b6a7', - }, - { - name: 'Bob Bobmann', - email: 'Bob@Bobmann', - type: 'receive', - transaction_id: 3, - date: '2021-03-19T13:27:36+00:00', - balance: 1920000, - memo: 'test text hier eingeben :)', - pubkey: '038a6f93270dc57b91d76bf110ad3863fcb7d1b08e7692e793fcdb4467e5b6a7', - }, - { - name: 'Gradido Akademie', - email: 'Gradido@Akademie', - type: 'creation', - transaction_id: 4, - date: '2021-03-22T13:25:36+00:00', - balance: 10000000, - memo: '1000 Gradidos für das Sammeln von Müll im Wald.', - pubkey: '038a6f93270dc57b91d76bf110ad3863fcb7d1b08e7692e793fcdb4467e5b6a7', - }, - { - name: 'Verfall', - email: 'Gradido@Akademie', - type: 'decay', - transaction_id: 5, - date: '2021-02-22T13:25:37+00:00', - balance: 20000, - memo: 'verfall', - pubkey: '038a6f93270dc57b91d76bf110ad3863fcb7d1b08e7692e793fcdb4467e5b6a7', - }, - ] + const result = await communityAPI.transactions(this.$store.state.session_id) + if (result.success) { + this.GdtBalance = result.result.data.gdtSum / 10000 + this.transactions = result.result.data.transactions + } else { + // what to do when loading balance fails? + } }, updateBalance(ammount) { this.balance -= ammount diff --git a/frontend/src/views/Pages/KontoOverview.spec.js b/frontend/src/views/Pages/KontoOverview.spec.js index 3cb3b8271..7f09e4e2e 100644 --- a/frontend/src/views/Pages/KontoOverview.spec.js +++ b/frontend/src/views/Pages/KontoOverview.spec.js @@ -35,12 +35,6 @@ describe('KontoOverview', () => { expect(wrapper.find('gdd-table-stub').exists()).toBeTruthy() }) - it('updates transctions data when update-transactions is emitted', async () => { - wrapper.find('gdd-table-stub').vm.$emit('update-transactions', [0, 1]) - await wrapper.vm.$nextTick() - expect(wrapper.vm.transactions).toEqual(expect.arrayContaining([0, 1])) - }) - describe('updateBalance method', () => { beforeEach(async () => { wrapper.find('gdd-send-stub').vm.$emit('update-balance', { diff --git a/frontend/src/views/Pages/KontoOverview.vue b/frontend/src/views/Pages/KontoOverview.vue index 52b9f832b..64c5d2417 100644 --- a/frontend/src/views/Pages/KontoOverview.vue +++ b/frontend/src/views/Pages/KontoOverview.vue @@ -34,9 +34,8 @@ export default { props: { balance: { type: Number, default: 0 }, GdtBalance: { type: Number, default: 0 }, - transactions: { - default: [], + default: () => [], }, }, components: {