Browse Source

data gathering checkbox of asset profile dialog in sync with global settings

pull/5134/head
csehatt741 2 months ago
committed by Thomas Kaul
parent
commit
1284ea945b
  1. 16
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts
  2. 4
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html

16
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[] = [];
@ -285,6 +289,16 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
this.changeDetectorRef.markForCheck();
});
this.adminService
.fetchAdminData()
.pipe(takeUntil(this.unsubscribeSubject))
.subscribe(({ settings }) => {
this.isDataGatheringEnabled =
settings[PROPERTY_IS_DATA_GATHERING_ENABLED] === false ? false : true;
this.changeDetectorRef.markForCheck();
});
}
public onCancelEditAssetProfileIdentifierMode() {

4
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>

Loading…
Cancel
Save