ciyidogan commited on
Commit
b5f3a59
·
verified ·
1 Parent(s): 8a80284

Update flare-ui/src/app/components/apis/apis.component.ts

Browse files
flare-ui/src/app/components/apis/apis.component.ts CHANGED
@@ -344,25 +344,21 @@ export class ApisComponent implements OnInit {
344
  });
345
  }
346
 
347
- testAPI(api: API) {
348
- this.apiService.testAPI(api).subscribe({
349
- next: (result) => {
350
- if (result.success) {
351
- this.snackBar.open(`API test successful! Status: ${result.status_code}`, 'Close', {
352
- duration: 3000
353
- });
354
- } else {
355
- this.snackBar.open(`API test failed: ${result.error}`, 'Close', {
356
- duration: 5000,
357
- panelClass: 'error-snackbar'
358
- });
359
- }
360
- },
361
- error: (err) => {
362
- this.snackBar.open('Failed to test API', 'Close', {
363
- duration: 5000,
364
- panelClass: 'error-snackbar'
365
- });
366
  }
367
  });
368
  }
 
344
  });
345
  }
346
 
347
+ async testAPI(api: API) {
348
+ const { default: ApiEditDialogComponent } = await import('../../dialogs/api-edit-dialog/api-edit-dialog.component');
349
+
350
+ const dialogRef = this.dialog.open(ApiEditDialogComponent, {
351
+ width: '800px',
352
+ data: {
353
+ mode: 'test', // Test modunda açıyoruz
354
+ api: { ...api },
355
+ activeTab: 3 // Test tab'ını aktif yap (0-based index)
356
+ }
357
+ });
358
+
359
+ dialogRef.afterClosed().subscribe((result: any) => {
360
+ if (result) {
361
+ this.loadAPIs();
 
 
 
 
362
  }
363
  });
364
  }