feat: implements isActive checkbox

pull/4497/head
tobikugel 3 weeks ago
parent c85a87bdcb
commit 4cd2502cf8

@ -480,6 +480,7 @@ export class AdminService {
currency,
dataSource: newDataSource,
holdings,
isActive,
name,
scraperConfiguration,
sectors,
@ -557,6 +558,7 @@ export class AdminService {
currency,
dataSource,
holdings,
isActive,
scraperConfiguration,
sectors,
symbol,

@ -3,6 +3,7 @@ import { IsCurrencyCode } from '@ghostfolio/api/validators/is-currency-code';
import { AssetClass, AssetSubClass, DataSource, Prisma } from '@prisma/client';
import {
IsArray,
IsBoolean,
IsEnum,
IsObject,
IsOptional,
@ -35,6 +36,10 @@ export class UpdateAssetProfileDto {
@IsOptional()
dataSource?: DataSource;
@IsBoolean()
@IsOptional()
isActive?: boolean;
@IsString()
@IsOptional()
name?: string;

@ -546,6 +546,7 @@ export class ImportService {
SymbolProfile: {
currency,
dataSource,
isActive: false,
symbol,
activitiesCount: undefined,
assetClass: undefined,

@ -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 {
@ -79,6 +80,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
historicalData: this.formBuilder.group({
csvString: ''
}),
isActive: [false],
name: ['', Validators.required],
scraperConfiguration: this.formBuilder.group({
defaultMarketPrice: null,
@ -227,6 +229,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:
@ -442,6 +445,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
};
@ -523,6 +527,20 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
});
}
public onToggleIsActive(event: MatCheckboxChange) {
if (event.checked) {
this.assetProfileForm.get('isActive')?.setValue(true);
} else {
this.assetProfileForm.get('isActive')?.setValue(false);
}
event.checked === this.assetProfile.isActive
? this.assetProfileForm.get('isActive')?.markAsPristine()
: this.assetProfileForm.get('isActive')?.markAsDirty();
this.changeDetectorRef.detectChanges();
}
public onUnsetBenchmark({ dataSource, symbol }: AssetProfileIdentifier) {
this.dataService
.deleteBenchmark({ dataSource, symbol })

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

@ -212,6 +212,7 @@ export class AdminService {
countries,
currency,
dataSource: newDataSource,
isActive,
name,
scraperConfiguration,
sectors,
@ -229,6 +230,7 @@ export class AdminService {
countries,
currency,
dataSource: newDataSource,
isActive,
name,
scraperConfiguration,
sectors,

@ -22,6 +22,7 @@ export interface EnhancedSymbolProfile {
figiShareClass?: string;
holdings: Holding[];
id: string;
isActive: boolean;
isin?: string;
name?: string;
scraperConfiguration?: ScraperConfiguration;

Loading…
Cancel
Save