diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b5da1168..11726fb72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Changed + +- Improved the usability to delete an asset profile in the historical market data table and the asset profile details dialog of the admin control + ### Fixed - Added missing dates to edit historical market data in the asset profile details dialog of the admin control panel diff --git a/apps/api/src/app/admin/admin.service.ts b/apps/api/src/app/admin/admin.service.ts index 2e7f76610..e8a2432e8 100644 --- a/apps/api/src/app/admin/admin.service.ts +++ b/apps/api/src/app/admin/admin.service.ts @@ -212,6 +212,7 @@ export class AdminService { countries: true, currency: true, dataSource: true, + id: true, name: true, Order: { orderBy: [{ date: 'asc' }], @@ -235,6 +236,7 @@ export class AdminService { countries, currency, dataSource, + id, name, Order, sectors, @@ -257,6 +259,7 @@ export class AdminService { currency, countriesCount, dataSource, + id, name, symbol, marketDataItemCount, @@ -413,6 +416,7 @@ export class AdminService { assetClass: 'CASH', countriesCount: 0, currency: symbol.replace(DEFAULT_CURRENCY, ''), + id: undefined, name: symbol, sectorsCount: 0 }; 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 408141beb..874c2a0d9 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 @@ -1,6 +1,10 @@ import { AdminService } from '@ghostfolio/client/services/admin.service'; +import { DataService } from '@ghostfolio/client/services/data.service'; import { UserService } from '@ghostfolio/client/services/user/user.service'; -import { DEFAULT_PAGE_SIZE } from '@ghostfolio/common/config'; +import { + DEFAULT_PAGE_SIZE, + ghostfolioScraperApiSymbolPrefix +} from '@ghostfolio/common/config'; import { getDateFormatString } from '@ghostfolio/common/helper'; import { Filter, UniqueAsset, User } from '@ghostfolio/common/interfaces'; import { AdminMarketDataItem } from '@ghostfolio/common/interfaces/admin-market-data.interface'; @@ -20,7 +24,7 @@ import { MatPaginator, PageEvent } from '@angular/material/paginator'; import { MatSort, Sort, SortDirection } from '@angular/material/sort'; import { MatTableDataSource } from '@angular/material/table'; import { ActivatedRoute, Router } from '@angular/router'; -import { AssetSubClass, DataSource } from '@prisma/client'; +import { AssetSubClass, DataSource, SymbolProfile } from '@prisma/client'; import { isUUID } from 'class-validator'; import { DeviceDetectorService } from 'ngx-device-detector'; import { Subject } from 'rxjs'; @@ -79,6 +83,7 @@ export class AdminMarketDataComponent type: 'PRESET_ID' } ]); + public benchmarks: Partial[]; public currentDataSource: DataSource; public currentSymbol: string; public dataSource: MatTableDataSource = @@ -99,6 +104,7 @@ export class AdminMarketDataComponent 'actions' ]; public filters$ = new Subject(); + public ghostfolioScraperApiSymbolPrefix = ghostfolioScraperApiSymbolPrefix; public isLoading = false; public isUUID = isUUID; public placeholder = ''; @@ -112,6 +118,7 @@ export class AdminMarketDataComponent private adminMarketDataService: AdminMarketDataService, private adminService: AdminService, private changeDetectorRef: ChangeDetectorRef, + private dataService: DataService, private deviceService: DeviceDetectorService, private dialog: MatDialog, private route: ActivatedRoute, @@ -171,6 +178,9 @@ export class AdminMarketDataComponent } public ngOnInit() { + const { benchmarks } = this.dataService.fetchInfo(); + + this.benchmarks = benchmarks; this.deviceType = this.deviceService.getDeviceInfo().deviceType; } @@ -282,7 +292,16 @@ export class AdminMarketDataComponent .subscribe(({ count, marketData }) => { this.totalItems = count; - this.dataSource = new MatTableDataSource(marketData); + this.dataSource = new MatTableDataSource( + marketData.map((marketDataItem) => { + return { + ...marketDataItem, + isBenchmark: this.benchmarks.some(({ id }) => { + return id === marketDataItem.id; + }) + }; + }) + ); this.dataSource.sort = this.sort; this.isLoading = false; diff --git a/apps/client/src/app/components/admin-market-data/admin-market-data.html b/apps/client/src/app/components/admin-market-data/admin-market-data.html index 83e7f7533..8cc8b65c6 100644 --- a/apps/client/src/app/components/admin-market-data/admin-market-data.html +++ b/apps/client/src/app/components/admin-market-data/admin-market-data.html @@ -177,7 +177,11 @@