Skip to content

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

Feature/reflect global settings in data gathering checkbox of asset profile dialog (#5134)

Attila Cseh15be42c7a66f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6e687137b7..8844015322 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
+- Improved the asset profile dialog’s data gathering checkbox of the admin control panel to reflect the global settings
- Improved the language localization for Catalan (`ca`)
- Improved the language localization for Portuguese (`pt`)
- Improved the language localization for Spanish (`es`)
diff --git a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts
index 958679fcdf..3dad224888 100644
--- a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts
+++ b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts
@@ -5,7 +5,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 { validateObjectForForm } from '@ghostfolio/client/util/form.util';
-import { ghostfolioScraperApiSymbolPrefix } from '@ghostfolio/common/config';
+import {
+ ghostfolioScraperApiSymbolPrefix,
+ PROPERTY_IS_DATA_GATHERING_ENABLED
+} from '@ghostfolio/common/config';
import { DATE_FORMAT } from '@ghostfolio/common/helper';
import {
AdminMarketDataDetails,
@@ -133,6 +136,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
public ghostfolioScraperApiSymbolPrefix = ghostfolioScraperApiSymbolPrefix;
public historicalDataItems: LineChartItem[];
public isBenchmark = false;
+ public isDataGatheringEnabled: boolean;
public isEditAssetProfileIdentifierMode = false;
public marketDataItems: MarketData[] = [];
@@ -196,6 +200,16 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
public initialize() {
this.historicalDataItems = undefined;
+ this.adminService
+ .fetchAdminData()
+ .pipe(takeUntil(this.unsubscribeSubject))
+ .subscribe(({ settings }) => {
+ this.isDataGatheringEnabled =
+ settings[PROPERTY_IS_DATA_GATHERING_ENABLED] === false ? false : true;
+
+ this.changeDetectorRef.markForCheck();
+ });
+
this.userService.stateChanged
.pipe(takeUntil(this.unsubscribeSubject))
.subscribe((state) => {
diff --git a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html
index 4c7d39fc05..0657d9fa57 100644
--- a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html
+++ b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html
@@ -534,8 +534,8 @@
<div class="gf-spacer">
<mat-checkbox
color="primary"
- [checked]="assetProfile?.isActive ?? false"
- [disabled]="isEditAssetProfileIdentifierMode"
+ [checked]="isDataGatheringEnabled && (assetProfile?.isActive ?? false)"
+ [disabled]="!isDataGatheringEnabled || isEditAssetProfileIdentifierMode"
(change)="onToggleIsActive($event)"
>
<ng-container i18n>Data Gathering</ng-container>