ciyidogan commited on
Commit
095ba3b
·
verified ·
1 Parent(s): 5840398

Upload import-results-dialog.component.ts

Browse files
flare-ui/src/app/dialogs/import-results-dialog/import-results-dialog.component.ts ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Component, Inject } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
4
+ import { MatButtonModule } from '@angular/material/button';
5
+ import { MatIconModule } from '@angular/material/icon';
6
+ import { MatDividerModule } from '@angular/material/divider';
7
+
8
+ interface DialogData {
9
+ title: string;
10
+ imported: number;
11
+ failed: number;
12
+ errors: string[];
13
+ }
14
+
15
+ @Component({
16
+ selector: 'app-import-results-dialog',
17
+ standalone: true,
18
+ imports: [
19
+ CommonModule,
20
+ MatDialogModule,
21
+ MatButtonModule,
22
+ MatIconModule,
23
+ MatDividerModule
24
+ ],
25
+ template: `
26
+ <h2 mat-dialog-title>{{ data.title }}</h2>
27
+
28
+ <mat-dialog-content>
29
+ <div class="summary">
30
+ <div class="stat success" *ngIf="data.imported > 0">
31
+ <mat-icon>check_circle</mat-icon>
32
+ <span>{{ data.imported }} successfully imported</span>
33
+ </div>
34
+
35
+ <div class="stat error" *ngIf="data.failed > 0">
36
+ <mat-icon>error</mat-icon>
37
+ <span>{{ data.failed }} failed to import</span>
38
+ </div>
39
+ </div>
40
+
41
+ <mat-divider *ngIf="data.errors.length > 0"></mat-divider>
42
+
43
+ <div class="errors" *ngIf="data.errors.length > 0">
44
+ <h3>Import Errors:</h3>
45
+ <ul>
46
+ <li *ngFor="let error of data.errors" class="error-item">
47
+ {{ error }}
48
+ </li>
49
+ </ul>
50
+ </div>
51
+ </mat-dialog-content>
52
+
53
+ <mat-dialog-actions align="end">
54
+ <button mat-raised-button color="primary" (click)="close()">OK</button>
55
+ </mat-dialog-actions>
56
+ `,
57
+ styles: [`
58
+ .summary {
59
+ display: flex;
60
+ gap: 24px;
61
+ margin-bottom: 16px;
62
+
63
+ .stat {
64
+ display: flex;
65
+ align-items: center;
66
+ gap: 8px;
67
+ font-size: 16px;
68
+
69
+ &.success {
70
+ color: #4caf50;
71
+ }
72
+
73
+ &.error {
74
+ color: #f44336;
75
+ }
76
+
77
+ mat-icon {
78
+ font-size: 24px;
79
+ width: 24px;
80
+ height: 24px;
81
+ }
82
+ }
83
+ }
84
+
85
+ .errors {
86
+ margin-top: 16px;
87
+
88
+ h3 {
89
+ margin-bottom: 12px;
90
+ color: #f44336;
91
+ }
92
+
93
+ ul {
94
+ margin: 0;
95
+ padding-left: 20px;
96
+ max-height: 300px;
97
+ overflow-y: auto;
98
+ }
99
+
100
+ .error-item {
101
+ margin-bottom: 8px;
102
+ color: #666;
103
+ }
104
+ }
105
+ `]
106
+ })
107
+ export default class ImportResultsDialogComponent {
108
+ constructor(
109
+ public dialogRef: MatDialogRef<ImportResultsDialogComponent>,
110
+ @Inject(MAT_DIALOG_DATA) public data: DialogData
111
+ ) {}
112
+
113
+ close() {
114
+ this.dialogRef.close();
115
+ }
116
+ }