Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Task/improve data source column in market data table of admin control (#7722)

Thomas Kaulc53730b848a0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c1bf235532..0992c55890 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Harmonized the icons and labels in the access table to share the portfolio
+- Improved the data source column in the historical market data table of the admin control panel by showing the name of the data provider
- Migrated the create and edit access dialogs to dedicated routes
- Improved the response of the historical market data gathering endpoint for a specific date
- Introduced a timeout for the asset profile and the historical market data gathering jobs
diff --git a/apps/api/src/app/endpoints/asset-profiles/asset-profiles.service.ts b/apps/api/src/app/endpoints/asset-profiles/asset-profiles.service.ts
index c6ca5ebf45..e9aad6911f 100644
--- a/apps/api/src/app/endpoints/asset-profiles/asset-profiles.service.ts
+++ b/apps/api/src/app/endpoints/asset-profiles/asset-profiles.service.ts
@@ -20,6 +20,7 @@ import {
AssetProfileIdentifier,
AssetProfileItem,
AssetProfilesResponse,
+ DataProviderInfo,
EnhancedAssetProfile,
Filter
} from '@ghostfolio/common/interfaces';
@@ -364,6 +365,23 @@ export class AssetProfilesService {
);
}
+ const dataProviderInfoMap = new Map<DataSource, DataProviderInfo>(
+ [
+ ...new Set(
+ symbolProfiles.map(({ dataSource }) => {
+ return dataSource;
+ })
+ )
+ ].map((dataSource) => {
+ return [
+ dataSource,
+ this.dataProviderService
+ .getDataProvider(dataSource)
+ .getDataProviderInfo()
+ ];
+ })
+ );
+
let assetProfiles: AssetProfileItem[] = await Promise.all(
symbolProfiles.map(async (assetProfile) => {
const {
@@ -417,6 +435,7 @@ export class AssetProfilesService {
sectorsCount,
symbol,
activitiesCount: _count.activities,
+ dataProviderInfo: dataProviderInfoMap.get(dataSource),
date: activities?.[0]?.date,
isUsedByUsersWithSubscription: await isUsedByUsersWithSubscription,
watchedByCount: _count.watchedBy
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 f6744b2632..729ffede3f 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
@@ -106,8 +106,19 @@
<th *matHeaderCellDef class="px-1" mat-header-cell mat-sort-header>
<ng-container i18n>Data Source</ng-container>
</th>
- <td *matCellDef="let element" class="px-1" mat-cell>
- {{ element.dataSource }}
+ <td
+ *matCellDef="let element"
+ class="line-height-normal px-1 text-nowrap"
+ mat-cell
+ >
+ <div>
+ {{ element.dataProviderInfo?.name ?? element.dataSource }}
+ </div>
+ @if (element.dataProviderInfo?.name) {
+ <div>
+ <small class="text-muted">{{ element.dataSource }}</small>
+ </div>
+ }
</td>
</ng-container>
diff --git a/libs/common/src/lib/interfaces/asset-profile-item.interface.ts b/libs/common/src/lib/interfaces/asset-profile-item.interface.ts
index 14e8471c18..382e824cc6 100644
--- a/libs/common/src/lib/interfaces/asset-profile-item.interface.ts
+++ b/libs/common/src/lib/interfaces/asset-profile-item.interface.ts
@@ -1,5 +1,7 @@
import { AssetClass, AssetSubClass, DataSource } from '@prisma/client';
+import { DataProviderInfo } from './data-provider-info.interface';
+
export interface AssetProfileItem {
activitiesCount: number;
assetClass?: AssetClass;
@@ -7,6 +9,7 @@ export interface AssetProfileItem {
comment?: string;
countriesCount: number;
currency: string;
+ dataProviderInfo?: DataProviderInfo;
dataSource: DataSource;
date: Date;
id: string;