Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Task/improve usability of asset profile details dialog for currencies (#6406)
Thomas Kaul98fb0b86af0f
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 7b79e434f8..08e1b0f1c8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Changed+- Improved the usability of the asset profile details dialog in the admin control panel for currencies- Removed the deprecated static portfolio analysis rule: _Fees_ (Fee Ratio)- Refactored queries in the data provider service to use Prisma’s safe query methodsdiff --git a/apps/api/src/app/admin/admin.service.ts b/apps/api/src/app/admin/admin.service.tsindex d77fde3468..1f8745cd10 100644--- a/apps/api/src/app/admin/admin.service.ts+++ b/apps/api/src/app/admin/admin.service.ts@@ -470,7 +470,9 @@ export class AdminService {let currency: EnhancedSymbolProfile['currency'] = '-';let dateOfFirstActivity: EnhancedSymbolProfile['dateOfFirstActivity'];- if (isCurrency(getCurrencyFromSymbol(symbol))) {+ const isCurrencyAssetProfile = isCurrency(getCurrencyFromSymbol(symbol));++ if (isCurrencyAssetProfile) {currency = getCurrencyFromSymbol(symbol);({ activitiesCount, dateOfFirstActivity } =await this.orderService.getStatisticsByCurrency(currency));@@ -508,6 +510,8 @@ export class AdminService {dataSource,dateOfFirstActivity,symbol,+ assetClass: isCurrencyAssetProfile ? AssetClass.LIQUIDITY : undefined,+ assetSubClass: isCurrencyAssetProfile ? AssetSubClass.CASH : undefined,isActive: true}};diff --git a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.tsindex cbd8deba31..b1519e35be 100644--- a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts+++ b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts@@ -5,7 +5,11 @@ import {PROPERTY_IS_DATA_GATHERING_ENABLED} from '@ghostfolio/common/config';import { UpdateAssetProfileDto } from '@ghostfolio/common/dtos';-import { DATE_FORMAT } from '@ghostfolio/common/helper';+import {+ DATE_FORMAT,+ getCurrencyFromSymbol,+ isCurrency+} from '@ghostfolio/common/helper';import {AdminMarketDataDetails,AssetClassSelectorOption,@@ -138,7 +142,6 @@ export class GfAssetProfileDialogComponent implements OnDestroy, OnInit {});public assetSubClassOptions: AssetClassSelectorOption[] = [];-public assetProfile: AdminMarketDataDetails['assetProfile'];public assetProfileForm = this.formBuilder.group({@@ -180,12 +183,14 @@ export class GfAssetProfileDialogComponent implements OnDestroy, OnInit {);public benchmarks: Partial<SymbolProfile>[];+ public canEditAssetProfile = true;public countries: {[code: string]: { name: string; value: number };};public currencies: string[] = [];+public dateRangeOptions = [{label: $localize`Current week` + ' (' + $localize`WTD` + ')',@@ -260,7 +265,7 @@ export class GfAssetProfileDialogComponent implements OnDestroy, OnInit {}public get canSaveAssetProfileIdentifier() {- return !this.assetProfileForm.dirty;+ return !this.assetProfileForm.dirty && this.canEditAssetProfile;}public ngOnInit() {@@ -324,6 +329,11 @@ export class GfAssetProfileDialogComponent implements OnDestroy, OnInit {this.assetClassLabel = translate(this.assetProfile?.assetClass);this.assetSubClassLabel = translate(this.assetProfile?.assetSubClass);++ this.canEditAssetProfile = !isCurrency(+ getCurrencyFromSymbol(this.data.symbol)+ );+this.countries = {};this.isBenchmark = this.benchmarks.some(({ id }) => {@@ -390,6 +400,10 @@ export class GfAssetProfileDialogComponent implements OnDestroy, OnInit {url: this.assetProfile?.url ?? ''});+ if (!this.canEditAssetProfile) {+ this.assetProfileForm.disable();+ }+this.assetProfileForm.markAsPristine();this.changeDetectorRef.markForCheck();@@ -399,7 +413,9 @@ export class GfAssetProfileDialogComponent implements OnDestroy, OnInit {public onCancelEditAssetProfileIdentifierMode() {this.isEditAssetProfileIdentifierMode = false;- this.assetProfileForm.enable();+ if (this.canEditAssetProfile) {+ this.assetProfileForm.enable();+ }this.assetProfileIdentifierForm.reset();}diff --git a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.htmlindex a60e10edcc..6b3141bfe9 100644--- a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html+++ b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html@@ -300,6 +300,7 @@</div><form#assetProfileFormElement+ [class.d-none]="!canEditAssetProfile"[formGroup]="assetProfileForm"(keyup.enter)="assetProfileForm.valid && onSubmitAssetProfileForm()"(ngSubmit)="onSubmitAssetProfileForm()"@@ -358,7 +359,9 @@<mat-checkboxcolor="primary"[checked]="isBenchmark"- [disabled]="isEditAssetProfileIdentifierMode"+ [disabled]="+ !canEditAssetProfile || isEditAssetProfileIdentifierMode+ "(change)="isBenchmark? onUnsetBenchmark({@@ -581,7 +584,11 @@<mat-checkboxcolor="primary"[checked]="isDataGatheringEnabled && (assetProfile?.isActive ?? false)"- [disabled]="!isDataGatheringEnabled || isEditAssetProfileIdentifierMode"+ [disabled]="+ !canEditAssetProfile ||+ !isDataGatheringEnabled ||+ isEditAssetProfileIdentifierMode+ "(change)="onToggleIsActive($event)"><ng-container i18n>Data Gathering</ng-container>