mirror of https://github.com/ghostfolio/ghostfolio
Browse Source
* Valid data types * Maximum number of orders * Data provider service returns data for the dataSource / symbol pairpull/416/head
committed by
GitHub
17 changed files with 171 additions and 30 deletions
@ -1,7 +1,11 @@ |
|||||
|
import { CreateOrderDto } from '@ghostfolio/api/app/order/create-order.dto'; |
||||
import { Order } from '@prisma/client'; |
import { Order } from '@prisma/client'; |
||||
import { IsArray } from 'class-validator'; |
import { Type } from 'class-transformer'; |
||||
|
import { IsArray, ValidateNested } from 'class-validator'; |
||||
|
|
||||
export class ImportDataDto { |
export class ImportDataDto { |
||||
@IsArray() |
@IsArray() |
||||
orders: Partial<Order>[]; |
@Type(() => CreateOrderDto) |
||||
|
@ValidateNested({ each: true }) |
||||
|
orders: Order[]; |
||||
} |
} |
||||
|
@ -0,0 +1,36 @@ |
|||||
|
import { |
||||
|
ChangeDetectionStrategy, |
||||
|
Component, |
||||
|
Inject, |
||||
|
OnDestroy |
||||
|
} from '@angular/core'; |
||||
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; |
||||
|
import { Subject } from 'rxjs'; |
||||
|
|
||||
|
import { ImportTransactionDialogParams } from './interfaces/interfaces'; |
||||
|
|
||||
|
@Component({ |
||||
|
changeDetection: ChangeDetectionStrategy.OnPush, |
||||
|
selector: 'gf-import-transaction-dialog', |
||||
|
styleUrls: ['./import-transaction-dialog.scss'], |
||||
|
templateUrl: 'import-transaction-dialog.html' |
||||
|
}) |
||||
|
export class ImportTransactionDialog implements OnDestroy { |
||||
|
private unsubscribeSubject = new Subject<void>(); |
||||
|
|
||||
|
public constructor( |
||||
|
@Inject(MAT_DIALOG_DATA) public data: ImportTransactionDialogParams, |
||||
|
public dialogRef: MatDialogRef<ImportTransactionDialog> |
||||
|
) {} |
||||
|
|
||||
|
public ngOnInit() {} |
||||
|
|
||||
|
public onCancel(): void { |
||||
|
this.dialogRef.close(); |
||||
|
} |
||||
|
|
||||
|
public ngOnDestroy() { |
||||
|
this.unsubscribeSubject.next(); |
||||
|
this.unsubscribeSubject.complete(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
<gf-dialog-header |
||||
|
mat-dialog-title |
||||
|
title="Import Transactions Error" |
||||
|
[deviceType]="data.deviceType" |
||||
|
(closeButtonClicked)="onCancel()" |
||||
|
></gf-dialog-header> |
||||
|
|
||||
|
<div class="flex-grow-1" mat-dialog-content> |
||||
|
<ul class="list-unstyled"> |
||||
|
<li *ngFor="let message of data.messages" class="d-flex"> |
||||
|
<div class="align-items-center d-flex px-2"> |
||||
|
<ion-icon name="warning-outline"></ion-icon> |
||||
|
</div> |
||||
|
<div>{{ message }}</div> |
||||
|
</li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
|
||||
|
<gf-dialog-footer |
||||
|
mat-dialog-actions |
||||
|
[deviceType]="data.deviceType" |
||||
|
(closeButtonClicked)="onCancel()" |
||||
|
></gf-dialog-footer> |
@ -0,0 +1,23 @@ |
|||||
|
import { CommonModule } from '@angular/common'; |
||||
|
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; |
||||
|
import { MatButtonModule } from '@angular/material/button'; |
||||
|
import { MatDialogModule } from '@angular/material/dialog'; |
||||
|
import { GfDialogFooterModule } from '@ghostfolio/client/components/dialog-footer/dialog-footer.module'; |
||||
|
import { GfDialogHeaderModule } from '@ghostfolio/client/components/dialog-header/dialog-header.module'; |
||||
|
|
||||
|
import { ImportTransactionDialog } from './import-transaction-dialog.component'; |
||||
|
|
||||
|
@NgModule({ |
||||
|
declarations: [ImportTransactionDialog], |
||||
|
exports: [], |
||||
|
imports: [ |
||||
|
CommonModule, |
||||
|
GfDialogFooterModule, |
||||
|
GfDialogHeaderModule, |
||||
|
MatButtonModule, |
||||
|
MatDialogModule |
||||
|
], |
||||
|
providers: [], |
||||
|
schemas: [CUSTOM_ELEMENTS_SCHEMA] |
||||
|
}) |
||||
|
export class GfImportTransactionDialogModule {} |
@ -0,0 +1,3 @@ |
|||||
|
:host { |
||||
|
display: block; |
||||
|
} |
@ -0,0 +1,4 @@ |
|||||
|
export interface ImportTransactionDialogParams { |
||||
|
deviceType: string; |
||||
|
messages: string[]; |
||||
|
} |
Loading…
Reference in new issue