From ee086638f30d916728e2861617e7485bfb19e99c Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Wed, 26 Jun 2024 20:18:53 +0200 Subject: [PATCH 1/2] Feature/add benchmarks preset to admin control panel (#3513) * Add benchmarks preset * Update changelog --- CHANGELOG.md | 4 ++++ apps/api/src/app/admin/admin.module.ts | 2 ++ apps/api/src/app/admin/admin.service.ts | 13 ++++++++++++- .../admin-market-data.component.ts | 5 +++++ .../common/src/lib/types/market-data-preset.type.ts | 1 + 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc7e4378f..1332fd6e0 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 +### Added + +- Added a benchmarks preset to the historical market data table of the admin control panel + ### Fixed - Changed the mechanism of the `INTRADAY` data gathering to persist data only if the market state is `OPEN` diff --git a/apps/api/src/app/admin/admin.module.ts b/apps/api/src/app/admin/admin.module.ts index de9aecf3b..f8cf8e8ac 100644 --- a/apps/api/src/app/admin/admin.module.ts +++ b/apps/api/src/app/admin/admin.module.ts @@ -1,3 +1,4 @@ +import { BenchmarkModule } from '@ghostfolio/api/app/benchmark/benchmark.module'; import { OrderModule } from '@ghostfolio/api/app/order/order.module'; import { SubscriptionModule } from '@ghostfolio/api/app/subscription/subscription.module'; import { TransformDataSourceInRequestModule } from '@ghostfolio/api/interceptors/transform-data-source-in-request/transform-data-source-in-request.module'; @@ -20,6 +21,7 @@ import { QueueModule } from './queue/queue.module'; @Module({ imports: [ ApiModule, + BenchmarkModule, ConfigurationModule, DataGatheringModule, DataProviderModule, diff --git a/apps/api/src/app/admin/admin.service.ts b/apps/api/src/app/admin/admin.service.ts index 21f0253ee..3d81435ab 100644 --- a/apps/api/src/app/admin/admin.service.ts +++ b/apps/api/src/app/admin/admin.service.ts @@ -1,3 +1,4 @@ +import { BenchmarkService } from '@ghostfolio/api/app/benchmark/benchmark.service'; import { OrderService } from '@ghostfolio/api/app/order/order.service'; import { SubscriptionService } from '@ghostfolio/api/app/subscription/subscription.service'; import { environment } from '@ghostfolio/api/environments/environment'; @@ -41,6 +42,7 @@ import { groupBy } from 'lodash'; @Injectable() export class AdminService { public constructor( + private readonly benchmarkService: BenchmarkService, private readonly configurationService: ConfigurationService, private readonly dataProviderService: DataProviderService, private readonly exchangeRateDataService: ExchangeRateDataService, @@ -151,7 +153,16 @@ export class AdminService { [{ symbol: 'asc' }]; const where: Prisma.SymbolProfileWhereInput = {}; - if (presetId === 'CURRENCIES') { + if (presetId === 'BENCHMARKS') { + const benchmarkAssetProfiles = + await this.benchmarkService.getBenchmarkAssetProfiles(); + + where.id = { + in: benchmarkAssetProfiles.map(({ id }) => { + return id; + }) + }; + } else if (presetId === 'CURRENCIES') { return this.getMarketDataForCurrencies(); } else if ( presetId === 'ETF_WITHOUT_COUNTRIES' || 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 61f11c9bd..6051c94dc 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 @@ -68,6 +68,11 @@ export class AdminMarketDataComponent }; }) .concat([ + { + id: 'BENCHMARKS', + label: $localize`Benchmarks`, + type: 'PRESET_ID' + }, { id: 'CURRENCIES', label: $localize`Currencies`, diff --git a/libs/common/src/lib/types/market-data-preset.type.ts b/libs/common/src/lib/types/market-data-preset.type.ts index 497c4cf3c..0dbf914fa 100644 --- a/libs/common/src/lib/types/market-data-preset.type.ts +++ b/libs/common/src/lib/types/market-data-preset.type.ts @@ -1,4 +1,5 @@ export type MarketDataPreset = + | 'BENCHMARKS' | 'CURRENCIES' | 'ETF_WITHOUT_COUNTRIES' | 'ETF_WITHOUT_SECTORS'; From 8b3cc5c11ae168ab80cc112b7b3f6bb60c74b1d1 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Wed, 26 Jun 2024 20:19:25 +0200 Subject: [PATCH 2/2] Bugfix/fix dialog position on mobile (#3521) * Fix dialog position on mobile * Update changelog --- CHANGELOG.md | 1 + apps/client/src/styles.scss | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1332fd6e0..106773ae1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed the dialog position (center) on mobile - Changed the mechanism of the `INTRADAY` data gathering to persist data only if the market state is `OPEN` - Fixed the creation of activities with `MANUAL` data source (with no historical market data) diff --git a/apps/client/src/styles.scss b/apps/client/src/styles.scss index 9d548f1ff..b9b7ce828 100644 --- a/apps/client/src/styles.scss +++ b/apps/client/src/styles.scss @@ -214,16 +214,6 @@ body { } } - .mat-mdc-menu-panel { - &.assistant { - max-width: unset !important; - - .mat-mdc-menu-content { - padding: 0; - } - } - } - &.is-dark-theme { background: var(--dark-background); color: rgba(var(--light-primary-text)); @@ -366,6 +356,10 @@ ngx-skeleton-loader { } .cdk-overlay-container { + .cdk-global-overlay-wrapper { + justify-content: center !important; + } + .cdk-overlay-pane { max-width: 95vw !important; } @@ -453,6 +447,14 @@ ngx-skeleton-loader { } .mat-mdc-menu-panel { + &.assistant { + max-width: unset !important; + + .mat-mdc-menu-content { + padding: 0; + } + } + .mat-mdc-menu-item { &.font-weight-bold { .mat-mdc-menu-item-text {