Browse Source

refactor: code review

pull/4497/head
tobikugel 3 weeks ago
parent
commit
eb687604da
  1. 3
      apps/api/src/app/import/import.service.ts
  2. 8
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts
  3. 19
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html

3
apps/api/src/app/import/import.service.ts

@ -510,6 +510,7 @@ export class ImportService {
dataSource, dataSource,
date: dateString, date: dateString,
fee, fee,
isActive,
quantity, quantity,
symbol, symbol,
type, type,
@ -546,7 +547,7 @@ export class ImportService {
SymbolProfile: { SymbolProfile: {
currency, currency,
dataSource, dataSource,
isActive: false, isActive,
symbol, symbol,
activitiesCount: undefined, activitiesCount: undefined,
assetClass: undefined, assetClass: undefined,

8
apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts

@ -89,7 +89,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
historicalData: this.formBuilder.group({ historicalData: this.formBuilder.group({
csvString: '' csvString: ''
}), }),
isActive: [false], isActive: [true],
name: ['', Validators.required], name: ['', Validators.required],
scraperConfiguration: this.formBuilder.group({ scraperConfiguration: this.formBuilder.group({
defaultMarketPrice: null, defaultMarketPrice: null,
@ -542,14 +542,14 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
}); });
} }
public onToggleIsActive(event: MatCheckboxChange) { public onToggleIsActive({ checked }: MatCheckboxChange) {
if (event.checked) { if (checked) {
this.assetProfileForm.get('isActive')?.setValue(true); this.assetProfileForm.get('isActive')?.setValue(true);
} else { } else {
this.assetProfileForm.get('isActive')?.setValue(false); this.assetProfileForm.get('isActive')?.setValue(false);
} }
if (event.checked === this.assetProfile.isActive) { if (checked === this.assetProfile.isActive) {
this.assetProfileForm.get('isActive')?.markAsPristine(); this.assetProfileForm.get('isActive')?.markAsPristine();
} else { } else {
this.assetProfileForm.get('isActive')?.markAsDirty(); this.assetProfileForm.get('isActive')?.markAsDirty();

19
apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html

@ -513,15 +513,16 @@
</div> </div>
<div class="d-flex" mat-dialog-actions> <div class="d-flex" mat-dialog-actions>
<mat-checkbox <div class="gf-spacer">
class="gf-spacer" <mat-checkbox
color="primary" color="primary"
[checked]="assetProfile?.isActive ?? false" [checked]="assetProfile?.isActive ?? false"
[disabled]="isEditAssetProfileIdentifierMode" [disabled]="isEditAssetProfileIdentifierMode"
(change)="onToggleIsActive($event)" (change)="onToggleIsActive($event)"
> >
<ng-container i18n>Active</ng-container> <ng-container i18n>Active</ng-container>
</mat-checkbox> </mat-checkbox>
</div>
<button i18n mat-button type="button" (click)="onClose()">Cancel</button> <button i18n mat-button type="button" (click)="onClose()">Cancel</button>
<button <button
color="primary" color="primary"

Loading…
Cancel
Save