From 183ac8fa2b976992eb25ec2bbf646f5c1175a4c8 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 12 Aug 2023 21:51:35 +0200 Subject: [PATCH] Feature/add data export to user account page (#2234) * Add data export * Update changelog --- CHANGELOG.md | 20 ++++++++----- .../pages/account/account-page.component.ts | 23 ++++++++++++++- .../src/app/pages/account/account-page.html | 8 ++++++ apps/client/src/locales/messages.de.xlf | 28 ++++++++++++------- apps/client/src/locales/messages.es.xlf | 28 ++++++++++++------- apps/client/src/locales/messages.fr.xlf | 28 ++++++++++++------- apps/client/src/locales/messages.it.xlf | 28 ++++++++++++------- apps/client/src/locales/messages.nl.xlf | 28 ++++++++++++------- apps/client/src/locales/messages.pt.xlf | 28 ++++++++++++------- apps/client/src/locales/messages.xlf | 27 +++++++++++------- 10 files changed, 168 insertions(+), 78 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0db0895aa..9cd9ed8c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Added + +- Added the data export feature to the user account page + ## 1.300.0 - 2023-08-11 ### Added @@ -611,7 +617,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Changed the slide toggles to checkboxes on the account page +- Changed the slide toggles to checkboxes on the user account page - Changed the slide toggles to checkboxes in the admin control panel - Increased the density of the theme - Migrated the style of various components to `@angular/material` `15` (mdc) @@ -1173,7 +1179,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Improved the language selector on the account page +- Improved the language selector on the user account page - Improved the wording in the _X-ray_ section (net worth instead of investment) - Extended the asset profile details dialog in the admin control panel - Updated the browserslist database @@ -1591,7 +1597,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Added a language selector to the account page +- Added a language selector to the user account page - Added support for translated labels in the value component ### Changed @@ -1920,7 +1926,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Added the user id to the account page +- Added the user id to the user account page - Added a new view with jobs of the queue to the admin control panel ### Changed @@ -3575,7 +3581,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Respected the cash balance on the analysis page -- Improved the settings selectors on the account page +- Improved the settings selectors on the user account page - Harmonized the slogan to "Open Source Wealth Management Software" ### Fixed @@ -4041,7 +4047,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added a gradient to the line charts -- Added a selector to set the base currency on the account page +- Added a selector to set the base currency on the user account page ## 0.81.0 - 06.04.2021 @@ -4355,7 +4361,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Added the membership status to the account page +- Added the membership status to the user account page ### Fixed diff --git a/apps/client/src/app/pages/account/account-page.component.ts b/apps/client/src/app/pages/account/account-page.component.ts index 5ab140265..0e4527eeb 100644 --- a/apps/client/src/app/pages/account/account-page.component.ts +++ b/apps/client/src/app/pages/account/account-page.component.ts @@ -21,7 +21,7 @@ import { } from '@ghostfolio/client/services/settings-storage.service'; import { UserService } from '@ghostfolio/client/services/user/user.service'; import { WebAuthnService } from '@ghostfolio/client/services/web-authn.service'; -import { getDateFormatString } from '@ghostfolio/common/helper'; +import { downloadAsFile, getDateFormatString } from '@ghostfolio/common/helper'; import { Access, User } from '@ghostfolio/common/interfaces'; import { hasPermission, permissions } from '@ghostfolio/common/permissions'; import { uniq } from 'lodash'; @@ -31,6 +31,7 @@ import { EMPTY, Subject } from 'rxjs'; import { catchError, switchMap, takeUntil } from 'rxjs/operators'; import { CreateOrUpdateAccessDialog } from './create-or-update-access-dialog/create-or-update-access-dialog.component'; +import { format, parseISO } from 'date-fns'; @Component({ host: { class: 'page' }, @@ -237,6 +238,26 @@ export class AccountPageComponent implements OnDestroy, OnInit { }); } + public onExport() { + this.dataService + .fetchExport() + .pipe(takeUntil(this.unsubscribeSubject)) + .subscribe((data) => { + for (const activity of data.activities) { + delete activity.id; + } + + downloadAsFile({ + content: data, + fileName: `ghostfolio-export-${format( + parseISO(data.meta.date), + 'yyyyMMddHHmm' + )}.json`, + format: 'json' + }); + }); + } + public onRedeemCoupon() { let couponCode = prompt($localize`Please enter your coupon code:`); couponCode = couponCode?.trim(); diff --git a/apps/client/src/app/pages/account/account-page.html b/apps/client/src/app/pages/account/account-page.html index fbf14544a..aeba71320 100644 --- a/apps/client/src/app/pages/account/account-page.html +++ b/apps/client/src/app/pages/account/account-page.html @@ -273,6 +273,14 @@
User ID
{{ user?.id }}
+
+
+
+ +
+
diff --git a/apps/client/src/locales/messages.de.xlf b/apps/client/src/locales/messages.de.xlf index 683bc61b8..c5eb2bdd8 100644 --- a/apps/client/src/locales/messages.de.xlf +++ b/apps/client/src/locales/messages.de.xlf @@ -622,7 +622,7 @@ Hinzufügen apps/client/src/app/components/admin-overview/admin-overview.html - 181 + 183 @@ -630,7 +630,7 @@ Verwaltung apps/client/src/app/components/admin-overview/admin-overview.html - 188 + 190 @@ -638,7 +638,7 @@ Cache leeren apps/client/src/app/components/admin-overview/admin-overview.html - 192 + 194 @@ -1570,7 +1570,7 @@ Bitte gebe deinen Gutscheincode ein: apps/client/src/app/pages/account/account-page.component.ts - 241 + 262 @@ -1578,7 +1578,7 @@ Gutscheincode konnte nicht eingelöst werden apps/client/src/app/pages/account/account-page.component.ts - 251 + 272 @@ -1586,7 +1586,7 @@ Gutscheincode wurde eingelöst apps/client/src/app/pages/account/account-page.component.ts - 263 + 284 @@ -1594,7 +1594,7 @@ Neu laden apps/client/src/app/pages/account/account-page.component.ts - 264 + 285 @@ -1602,7 +1602,7 @@ Möchtest du diese Anmeldemethode wirklich löschen? apps/client/src/app/pages/account/account-page.component.ts - 310 + 331 @@ -1726,7 +1726,7 @@ Zugangsberechtigung apps/client/src/app/pages/account/account-page.html - 282 + 290 @@ -2878,7 +2878,7 @@ Automatisch apps/client/src/app/pages/account/account-page.component.ts - 46 + 47 @@ -7249,6 +7249,14 @@ 128 + + Export Data + Daten exportieren + + apps/client/src/app/pages/account/account-page.html + 280 + + diff --git a/apps/client/src/locales/messages.es.xlf b/apps/client/src/locales/messages.es.xlf index 2bdc4bc6d..532ad66a2 100644 --- a/apps/client/src/locales/messages.es.xlf +++ b/apps/client/src/locales/messages.es.xlf @@ -623,7 +623,7 @@ Añadir apps/client/src/app/components/admin-overview/admin-overview.html - 181 + 183 @@ -631,7 +631,7 @@ Tareas domésticas apps/client/src/app/components/admin-overview/admin-overview.html - 188 + 190 @@ -639,7 +639,7 @@ Limpiar caché apps/client/src/app/components/admin-overview/admin-overview.html - 192 + 194 @@ -1571,7 +1571,7 @@ Por favor, ingresa tu código de cupón: apps/client/src/app/pages/account/account-page.component.ts - 241 + 262 @@ -1579,7 +1579,7 @@ No se puede canjear este código de cupón apps/client/src/app/pages/account/account-page.component.ts - 251 + 272 @@ -1587,7 +1587,7 @@ El codigo de cupón ha sido canjeado apps/client/src/app/pages/account/account-page.component.ts - 263 + 284 @@ -1595,7 +1595,7 @@ Refrescar apps/client/src/app/pages/account/account-page.component.ts - 264 + 285 @@ -1603,7 +1603,7 @@ ¿Estás seguro de eliminar este método de acceso? apps/client/src/app/pages/account/account-page.component.ts - 310 + 331 @@ -1727,7 +1727,7 @@ Acceso concedido apps/client/src/app/pages/account/account-page.html - 282 + 290 @@ -2879,7 +2879,7 @@ Automático apps/client/src/app/pages/account/account-page.component.ts - 46 + 47 @@ -7250,6 +7250,14 @@ 128 + + Export Data + Export Data + + apps/client/src/app/pages/account/account-page.html + 280 + + diff --git a/apps/client/src/locales/messages.fr.xlf b/apps/client/src/locales/messages.fr.xlf index 5af9678fc..1a3c726c0 100644 --- a/apps/client/src/locales/messages.fr.xlf +++ b/apps/client/src/locales/messages.fr.xlf @@ -870,7 +870,7 @@ Ajouter apps/client/src/app/components/admin-overview/admin-overview.html - 181 + 183 @@ -878,7 +878,7 @@ Maintenance apps/client/src/app/components/admin-overview/admin-overview.html - 188 + 190 @@ -886,7 +886,7 @@ Vider le Cache apps/client/src/app/components/admin-overview/admin-overview.html - 192 + 194 @@ -1854,7 +1854,7 @@ Auto apps/client/src/app/pages/account/account-page.component.ts - 46 + 47 @@ -1862,7 +1862,7 @@ Veuillez entrer votre code promotionnel : apps/client/src/app/pages/account/account-page.component.ts - 241 + 262 @@ -1870,7 +1870,7 @@ Le code promotionnel n'a pas pu être appliqué apps/client/src/app/pages/account/account-page.component.ts - 251 + 272 @@ -1878,7 +1878,7 @@ Le code promotionnel a été appliqué apps/client/src/app/pages/account/account-page.component.ts - 263 + 284 @@ -1886,7 +1886,7 @@ Rafraîchir apps/client/src/app/pages/account/account-page.component.ts - 264 + 285 @@ -1894,7 +1894,7 @@ Voulez-vous vraiment supprimer cette méthode de connexion ? apps/client/src/app/pages/account/account-page.component.ts - 310 + 331 @@ -2098,7 +2098,7 @@ Accès donné apps/client/src/app/pages/account/account-page.html - 282 + 290 @@ -7249,6 +7249,14 @@ 128 + + Export Data + Export Data + + apps/client/src/app/pages/account/account-page.html + 280 + + diff --git a/apps/client/src/locales/messages.it.xlf b/apps/client/src/locales/messages.it.xlf index 07462d173..0850040b4 100644 --- a/apps/client/src/locales/messages.it.xlf +++ b/apps/client/src/locales/messages.it.xlf @@ -623,7 +623,7 @@ Aggiungi apps/client/src/app/components/admin-overview/admin-overview.html - 181 + 183 @@ -631,7 +631,7 @@ Bilancio domestico apps/client/src/app/components/admin-overview/admin-overview.html - 188 + 190 @@ -639,7 +639,7 @@ Svuota la cache apps/client/src/app/components/admin-overview/admin-overview.html - 192 + 194 @@ -1571,7 +1571,7 @@ Inserisci il tuo codice del buono: apps/client/src/app/pages/account/account-page.component.ts - 241 + 262 @@ -1579,7 +1579,7 @@ Impossibile riscattare il codice del buono apps/client/src/app/pages/account/account-page.component.ts - 251 + 272 @@ -1587,7 +1587,7 @@ Il codice del buono è stato riscattato apps/client/src/app/pages/account/account-page.component.ts - 263 + 284 @@ -1595,7 +1595,7 @@ Ricarica apps/client/src/app/pages/account/account-page.component.ts - 264 + 285 @@ -1603,7 +1603,7 @@ Vuoi davvero rimuovere questo metodo di accesso? apps/client/src/app/pages/account/account-page.component.ts - 310 + 331 @@ -1727,7 +1727,7 @@ Accesso concesso apps/client/src/app/pages/account/account-page.html - 282 + 290 @@ -2879,7 +2879,7 @@ Auto apps/client/src/app/pages/account/account-page.component.ts - 46 + 47 @@ -7250,6 +7250,14 @@ 128 + + Export Data + Export Data + + apps/client/src/app/pages/account/account-page.html + 280 + + diff --git a/apps/client/src/locales/messages.nl.xlf b/apps/client/src/locales/messages.nl.xlf index ed453c46b..1d51a4bbe 100644 --- a/apps/client/src/locales/messages.nl.xlf +++ b/apps/client/src/locales/messages.nl.xlf @@ -622,7 +622,7 @@ Toevoegen apps/client/src/app/components/admin-overview/admin-overview.html - 181 + 183 @@ -630,7 +630,7 @@ Huishouding apps/client/src/app/components/admin-overview/admin-overview.html - 188 + 190 @@ -638,7 +638,7 @@ Cache legen apps/client/src/app/components/admin-overview/admin-overview.html - 192 + 194 @@ -1570,7 +1570,7 @@ Voer uw couponcode in: apps/client/src/app/pages/account/account-page.component.ts - 241 + 262 @@ -1578,7 +1578,7 @@ Kon kortingscode niet inwisselen apps/client/src/app/pages/account/account-page.component.ts - 251 + 272 @@ -1586,7 +1586,7 @@ Couponcode is ingewisseld apps/client/src/app/pages/account/account-page.component.ts - 263 + 284 @@ -1594,7 +1594,7 @@ Herladen apps/client/src/app/pages/account/account-page.component.ts - 264 + 285 @@ -1602,7 +1602,7 @@ Wilt u deze aanmeldingsmethode echt verwijderen? apps/client/src/app/pages/account/account-page.component.ts - 310 + 331 @@ -1726,7 +1726,7 @@ Verleende toegang apps/client/src/app/pages/account/account-page.html - 282 + 290 @@ -2878,7 +2878,7 @@ Auto apps/client/src/app/pages/account/account-page.component.ts - 46 + 47 @@ -7249,6 +7249,14 @@ 128 + + Export Data + Export Data + + apps/client/src/app/pages/account/account-page.html + 280 + + diff --git a/apps/client/src/locales/messages.pt.xlf b/apps/client/src/locales/messages.pt.xlf index ff884ded9..4a9a2e538 100644 --- a/apps/client/src/locales/messages.pt.xlf +++ b/apps/client/src/locales/messages.pt.xlf @@ -750,7 +750,7 @@ Adicionar apps/client/src/app/components/admin-overview/admin-overview.html - 181 + 183 @@ -758,7 +758,7 @@ Manutenção apps/client/src/app/components/admin-overview/admin-overview.html - 188 + 190 @@ -766,7 +766,7 @@ Limpar Cache apps/client/src/app/components/admin-overview/admin-overview.html - 192 + 194 @@ -1838,7 +1838,7 @@ Auto apps/client/src/app/pages/account/account-page.component.ts - 46 + 47 @@ -1846,7 +1846,7 @@ Por favor, insira o seu código de cupão: apps/client/src/app/pages/account/account-page.component.ts - 241 + 262 @@ -1854,7 +1854,7 @@ Não foi possível resgatar o código de cupão apps/client/src/app/pages/account/account-page.component.ts - 251 + 272 @@ -1862,7 +1862,7 @@ Código de cupão foi resgatado apps/client/src/app/pages/account/account-page.component.ts - 263 + 284 @@ -1870,7 +1870,7 @@ Atualizar apps/client/src/app/pages/account/account-page.component.ts - 264 + 285 @@ -1878,7 +1878,7 @@ Deseja realmente remover este método de início de sessão? apps/client/src/app/pages/account/account-page.component.ts - 310 + 331 @@ -2062,7 +2062,7 @@ Acesso Concedido apps/client/src/app/pages/account/account-page.html - 282 + 290 @@ -7249,6 +7249,14 @@ 128 + + Export Data + Export Data + + apps/client/src/app/pages/account/account-page.html + 280 + + diff --git a/apps/client/src/locales/messages.xlf b/apps/client/src/locales/messages.xlf index 6da2b478d..a0f460764 100644 --- a/apps/client/src/locales/messages.xlf +++ b/apps/client/src/locales/messages.xlf @@ -572,21 +572,21 @@ Add apps/client/src/app/components/admin-overview/admin-overview.html - 181 + 183 Housekeeping apps/client/src/app/components/admin-overview/admin-overview.html - 188 + 190 Flush Cache apps/client/src/app/components/admin-overview/admin-overview.html - 192 + 194 @@ -1447,35 +1447,35 @@ Please enter your coupon code: apps/client/src/app/pages/account/account-page.component.ts - 241 + 262 Could not redeem coupon code apps/client/src/app/pages/account/account-page.component.ts - 251 + 272 Coupon code has been redeemed apps/client/src/app/pages/account/account-page.component.ts - 263 + 284 Reload apps/client/src/app/pages/account/account-page.component.ts - 264 + 285 Do you really want to remove this sign in method? apps/client/src/app/pages/account/account-page.component.ts - 310 + 331 @@ -1585,7 +1585,7 @@ Granted Access apps/client/src/app/pages/account/account-page.html - 282 + 290 @@ -2628,7 +2628,7 @@ Auto apps/client/src/app/pages/account/account-page.component.ts - 46 + 47 @@ -6789,6 +6789,13 @@ 128 + + Export Data + + apps/client/src/app/pages/account/account-page.html + 280 + +