From d6cc978e56e47fceb84f8b46a254077451afe818 Mon Sep 17 00:00:00 2001 From: Karel De Smet Date: Wed, 21 Jan 2026 07:46:55 +0100 Subject: [PATCH] Used npm run format:write to update formatting since the formatting check in the CI pipeline failed --- .../admin-market-data.component.ts | 69 ++++++++++--------- .../create-asset-profile-dialog.component.ts | 14 ++-- .../symbol-autocomplete.component.ts | 2 +- 3 files changed, 43 insertions(+), 42 deletions(-) diff --git a/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts b/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts index 8fe2ca1b3..823ae0c41 100644 --- a/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts +++ b/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts @@ -10,7 +10,7 @@ import { InfoItem, User } from '@ghostfolio/common/interfaces'; -import { AdminMarketData, AdminMarketDataItem } from '@ghostfolio/common/interfaces/admin-market-data.interface'; +import { AdminMarketDataItem } from '@ghostfolio/common/interfaces/admin-market-data.interface'; import { hasPermission, permissions } from '@ghostfolio/common/permissions'; import { GfSymbolPipe } from '@ghostfolio/common/pipes'; import { GfActivitiesFilterComponent } from '@ghostfolio/ui/activities-filter'; @@ -62,8 +62,8 @@ import { } from 'ionicons/icons'; import { DeviceDetectorService } from 'ngx-device-detector'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; -import { Observable, Subject } from 'rxjs'; -import { distinctUntilChanged, switchMap, takeUntil } from 'rxjs/operators'; +import { Subject } from 'rxjs'; +import { distinctUntilChanged, takeUntil } from 'rxjs/operators'; import { AdminMarketDataService } from './admin-market-data.service'; import { GfAssetProfileDialogComponent } from './asset-profile-dialog/asset-profile-dialog.component'; @@ -416,6 +416,26 @@ export class GfAdminMarketDataComponent }); } + private refreshTable() { + this.isLoading = true; + this.changeDetectorRef.markForCheck(); + + this.adminService + .fetchAdminMarketData({ + filters: this.activeFilters, + take: this.pageSize + }) + .pipe(takeUntil(this.unsubscribeSubject)) + .subscribe(({ marketData }) => { + this.dataSource = new MatTableDataSource(marketData); + this.dataSource.sort = this.sort; + + this.isLoading = false; + + this.changeDetectorRef.markForCheck(); + }); + } + private openAssetProfileDialog({ dataSource, symbol @@ -482,43 +502,24 @@ export class GfAdminMarketDataComponent dialogRef .afterClosed() .pipe(takeUntil(this.unsubscribeSubject)) - .subscribe(({ addAssetProfile, dataSource, symbol } = {}) => { - this.isLoading = true; - this.changeDetectorRef.markForCheck(); - - let observable: Observable; - - if (!addAssetProfile) { - this.openAssetProfileDialog({ dataSource, symbol }); - observable = this.adminService.fetchAdminMarketData({ - filters: this.activeFilters, - take: this.pageSize - }); + .subscribe((result) => { + if (!result) { + return; } + const { addAssetProfile, dataSource, symbol } = result; + if (addAssetProfile && dataSource && symbol) { - observable = this.adminService + this.adminService .addAssetProfile({ dataSource, symbol }) - .pipe( - switchMap(() => { - return this.adminService.fetchAdminMarketData({ - filters: this.activeFilters, - take: this.pageSize - }); - }) - ); + .pipe(takeUntil(this.unsubscribeSubject)) + .subscribe(() => { + this.refreshTable(); + }); + } else { + this.refreshTable(); } - observable.pipe( - takeUntil(this.unsubscribeSubject) - ).subscribe(({ marketData }) => { - this.dataSource = new MatTableDataSource(marketData); - this.dataSource.sort = this.sort; - this.isLoading = false; - - this.changeDetectorRef.markForCheck(); - }); - this.router.navigate(['.'], { relativeTo: this.route }); }); }); diff --git a/apps/client/src/app/components/admin-market-data/create-asset-profile-dialog/create-asset-profile-dialog.component.ts b/apps/client/src/app/components/admin-market-data/create-asset-profile-dialog/create-asset-profile-dialog.component.ts index f8142f145..fbf8afa03 100644 --- a/apps/client/src/app/components/admin-market-data/create-asset-profile-dialog/create-asset-profile-dialog.component.ts +++ b/apps/client/src/app/components/admin-market-data/create-asset-profile-dialog/create-asset-profile-dialog.component.ts @@ -101,10 +101,10 @@ export class GfCreateAssetProfileDialogComponent implements OnDestroy, OnInit { public onSubmit() { if (this.mode === 'auto') { this.dialogRef.close({ + addAssetProfile: true, dataSource: this.createAssetProfileForm.get('searchSymbol').value.dataSource, - symbol: this.createAssetProfileForm.get('searchSymbol').value.symbol, - addAssetProfile: true + symbol: this.createAssetProfileForm.get('searchSymbol').value.symbol }); } else if (this.mode === 'currency') { const currency = this.createAssetProfileForm.get('addCurrency') @@ -122,23 +122,23 @@ export class GfCreateAssetProfileDialogComponent implements OnDestroy, OnInit { switchMap(() => { return this.adminService.gatherSymbol({ dataSource: this.dataSourceForExchangeRates, - symbol: `${DEFAULT_CURRENCY}${currency}`, + symbol: `${DEFAULT_CURRENCY}${currency}` }); }), takeUntil(this.unsubscribeSubject) ) .subscribe(() => { this.dialogRef.close({ + addAssetProfile: false, dataSource: this.dataSourceForExchangeRates, - symbol: `${DEFAULT_CURRENCY}${currency}`, - addAssetProfile: false + symbol: `${DEFAULT_CURRENCY}${currency}` }); }); } else if (this.mode === 'manual') { this.dialogRef.close({ + addAssetProfile: true, dataSource: 'MANUAL', - symbol: `${this.ghostfolioPrefix}${this.createAssetProfileForm.get('addSymbol').value}`, - addAssetProfile: true + symbol: `${this.ghostfolioPrefix}${this.createAssetProfileForm.get('addSymbol').value}` }); } } diff --git a/libs/ui/src/lib/symbol-autocomplete/symbol-autocomplete.component.ts b/libs/ui/src/lib/symbol-autocomplete/symbol-autocomplete.component.ts index 72c3aa6b1..c74e8a077 100644 --- a/libs/ui/src/lib/symbol-autocomplete/symbol-autocomplete.component.ts +++ b/libs/ui/src/lib/symbol-autocomplete/symbol-autocomplete.component.ts @@ -121,7 +121,7 @@ export class GfSymbolAutocompleteComponent this.control.valueChanges .pipe( filter((query) => { - if (query && query.length === 0) { + if (query?.length === 0) { this.showDefaultOptions(); return false;