|
|
@ -34,6 +34,7 @@ import { |
|
|
|
ValidationErrors, |
|
|
|
Validators |
|
|
|
} from '@angular/forms'; |
|
|
|
import { MatCheckboxChange } from '@angular/material/checkbox'; |
|
|
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; |
|
|
|
import { MatSnackBar } from '@angular/material/snack-bar'; |
|
|
|
import { |
|
|
@ -88,6 +89,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit { |
|
|
|
historicalData: this.formBuilder.group({ |
|
|
|
csvString: '' |
|
|
|
}), |
|
|
|
isActive: [true], |
|
|
|
name: ['', Validators.required], |
|
|
|
scraperConfiguration: this.formBuilder.group({ |
|
|
|
defaultMarketPrice: null, |
|
|
@ -254,6 +256,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit { |
|
|
|
historicalData: { |
|
|
|
csvString: AssetProfileDialog.HISTORICAL_DATA_TEMPLATE |
|
|
|
}, |
|
|
|
isActive: this.assetProfile?.isActive, |
|
|
|
name: this.assetProfile.name ?? this.assetProfile.symbol, |
|
|
|
scraperConfiguration: { |
|
|
|
defaultMarketPrice: |
|
|
@ -395,6 +398,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit { |
|
|
|
assetSubClass: this.assetProfileForm.get('assetSubClass').value, |
|
|
|
comment: this.assetProfileForm.get('comment').value || null, |
|
|
|
currency: this.assetProfileForm.get('currency').value, |
|
|
|
isActive: this.assetProfileForm.get('isActive').value, |
|
|
|
name: this.assetProfileForm.get('name').value, |
|
|
|
url: this.assetProfileForm.get('url').value || null |
|
|
|
}; |
|
|
@ -538,6 +542,20 @@ export class AssetProfileDialog implements OnDestroy, OnInit { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public onToggleIsActive({ checked }: MatCheckboxChange) { |
|
|
|
if (checked) { |
|
|
|
this.assetProfileForm.get('isActive')?.setValue(true); |
|
|
|
} else { |
|
|
|
this.assetProfileForm.get('isActive')?.setValue(false); |
|
|
|
} |
|
|
|
|
|
|
|
if (checked === this.assetProfile.isActive) { |
|
|
|
this.assetProfileForm.get('isActive')?.markAsPristine(); |
|
|
|
} else { |
|
|
|
this.assetProfileForm.get('isActive')?.markAsDirty(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public onUnsetBenchmark({ dataSource, symbol }: AssetProfileIdentifier) { |
|
|
|
this.dataService |
|
|
|
.deleteBenchmark({ dataSource, symbol }) |
|
|
|