Browse Source

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

* Improve data source column by showing resolved name

* Update changelog
pull/7724/head
Thomas Kaul 3 days ago
committed by GitHub
parent
commit
c53730b848
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 19
      apps/api/src/app/endpoints/asset-profiles/asset-profiles.service.ts
  3. 15
      apps/client/src/app/components/admin-market-data/admin-market-data.html
  4. 3
      libs/common/src/lib/interfaces/asset-profile-item.interface.ts

1
CHANGELOG.md

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Harmonized the icons and labels in the access table to share the portfolio - 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 - Migrated the create and edit access dialogs to dedicated routes
- Improved the response of the historical market data gathering endpoint for a specific date - 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 - Introduced a timeout for the asset profile and the historical market data gathering jobs

19
apps/api/src/app/endpoints/asset-profiles/asset-profiles.service.ts

@ -20,6 +20,7 @@ import {
AssetProfileIdentifier, AssetProfileIdentifier,
AssetProfileItem, AssetProfileItem,
AssetProfilesResponse, AssetProfilesResponse,
DataProviderInfo,
EnhancedAssetProfile, EnhancedAssetProfile,
Filter Filter
} from '@ghostfolio/common/interfaces'; } 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( let assetProfiles: AssetProfileItem[] = await Promise.all(
symbolProfiles.map(async (assetProfile) => { symbolProfiles.map(async (assetProfile) => {
const { const {
@ -417,6 +435,7 @@ export class AssetProfilesService {
sectorsCount, sectorsCount,
symbol, symbol,
activitiesCount: _count.activities, activitiesCount: _count.activities,
dataProviderInfo: dataProviderInfoMap.get(dataSource),
date: activities?.[0]?.date, date: activities?.[0]?.date,
isUsedByUsersWithSubscription: await isUsedByUsersWithSubscription, isUsedByUsersWithSubscription: await isUsedByUsersWithSubscription,
watchedByCount: _count.watchedBy watchedByCount: _count.watchedBy

15
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> <th *matHeaderCellDef class="px-1" mat-header-cell mat-sort-header>
<ng-container i18n>Data Source</ng-container> <ng-container i18n>Data Source</ng-container>
</th> </th>
<td *matCellDef="let element" class="px-1" mat-cell> <td
{{ element.dataSource }} *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> </td>
</ng-container> </ng-container>

3
libs/common/src/lib/interfaces/asset-profile-item.interface.ts

@ -1,5 +1,7 @@
import { AssetClass, AssetSubClass, DataSource } from '@prisma/client'; import { AssetClass, AssetSubClass, DataSource } from '@prisma/client';
import { DataProviderInfo } from './data-provider-info.interface';
export interface AssetProfileItem { export interface AssetProfileItem {
activitiesCount: number; activitiesCount: number;
assetClass?: AssetClass; assetClass?: AssetClass;
@ -7,6 +9,7 @@ export interface AssetProfileItem {
comment?: string; comment?: string;
countriesCount: number; countriesCount: number;
currency: string; currency: string;
dataProviderInfo?: DataProviderInfo;
dataSource: DataSource; dataSource: DataSource;
date: Date; date: Date;
id: string; id: string;

Loading…
Cancel
Save