ciyidogan commited on
Commit
c26806d
·
verified ·
1 Parent(s): d8dd20c

Update flare-ui/src/app/dialogs/api-edit-dialog/api-edit-dialog.component.html

Browse files
flare-ui/src/app/dialogs/api-edit-dialog/api-edit-dialog.component.html CHANGED
@@ -17,7 +17,7 @@
17
  <div class="tab-content">
18
  <mat-form-field appearance="outline">
19
  <mat-label>Name</mat-label>
20
- <input matInput [formControl]="form.get('name')" placeholder="e.g., get_flights">
21
  <mat-hint>Unique identifier for this API</mat-hint>
22
  @if (form.get('name')?.hasError('required') && form.get('name')?.touched) {
23
  <mat-error>Name is required</mat-error>
@@ -29,7 +29,7 @@
29
 
30
  <mat-form-field appearance="outline">
31
  <mat-label>URL</mat-label>
32
- <input matInput [formControl]="form.get('url')" placeholder="https://api.example.com/endpoint">
33
  <mat-hint>Full URL including protocol</mat-hint>
34
  @if (form.get('url')?.hasError('required') && form.get('url')?.touched) {
35
  <mat-error>URL is required</mat-error>
@@ -42,7 +42,7 @@
42
  <div class="row">
43
  <mat-form-field appearance="outline" class="method-field">
44
  <mat-label>Method</mat-label>
45
- <mat-select [formControl]="form.get('method')">
46
  @for (method of httpMethods; track method) {
47
  <mat-option [value]="method">{{ method }}</mat-option>
48
  }
@@ -51,7 +51,7 @@
51
 
52
  <mat-form-field appearance="outline" class="timeout-field">
53
  <mat-label>Timeout (seconds)</mat-label>
54
- <input matInput type="number" [formControl]="form.get('timeout_seconds')">
55
  <mat-hint>Request timeout in seconds</mat-hint>
56
  @if (form.get('timeout_seconds')?.hasError('min')) {
57
  <mat-error>Minimum 1 second</mat-error>
@@ -65,12 +65,12 @@
65
  <mat-form-field appearance="outline" class="full-width">
66
  <mat-label>Body Template</mat-label>
67
  <textarea matInput
68
- [formControl]="form.get('body_template')"
69
  rows="8"
70
- placeholder='{"key": "{{variables.value}}"}'
71
  (click)="saveCursorPosition('body_template', $event)"
72
  (keyup)="saveCursorPosition('body_template', $event)"></textarea>
73
- <mat-hint>JSON template with {{variables}} support</mat-hint>
74
  @if (!validateJSON('body_template')) {
75
  <mat-error>Invalid JSON format</mat-error>
76
  }
@@ -89,7 +89,7 @@
89
 
90
  <mat-form-field appearance="outline">
91
  <mat-label>Proxy URL (Optional)</mat-label>
92
- <input matInput [formControl]="form.get('proxy')" placeholder="http://proxy.example.com:8080">
93
  <mat-hint>HTTP proxy for this API call</mat-hint>
94
  </mat-form-field>
95
  </div>
@@ -112,7 +112,7 @@
112
  }
113
 
114
  @for (header of headers.controls; track header; let i = $index) {
115
- <div class="array-item" [formGroup]="header">
116
  <mat-form-field appearance="outline" class="key-field">
117
  <mat-label>Header Name</mat-label>
118
  <input matInput formControlName="key" placeholder="Content-Type">
@@ -148,7 +148,7 @@
148
  <mat-form-field appearance="outline" class="full-width">
149
  <mat-label>Response Prompt</mat-label>
150
  <textarea matInput
151
- [formControl]="form.get('response_prompt')"
152
  rows="4"
153
  placeholder="Optional instructions for processing the response"></textarea>
154
  <mat-hint>Instructions for AI to process the response (optional)</mat-hint>
@@ -174,7 +174,7 @@
174
  }
175
 
176
  @for (mapping of responseMappings.controls; track mapping; let i = $index) {
177
- <mat-expansion-panel [formGroup]="mapping">
178
  <mat-expansion-panel-header>
179
  <mat-panel-title>
180
  {{ mapping.get('variable_name')?.value || 'New Mapping' }}
@@ -229,7 +229,7 @@
229
  <!-- Retry Settings -->
230
  <mat-divider></mat-divider>
231
 
232
- <div class="retry-section" [formGroup]="form.get('retry')">
233
  <h3>Retry Settings</h3>
234
 
235
  <div class="row">
@@ -269,11 +269,15 @@
269
  (click)="testAPI()"
270
  [disabled]="testing || !form.get('url')?.valid || !form.get('method')?.valid">
271
  @if (testing) {
272
- <mat-icon class="spin">sync</mat-icon>
273
- Testing...
 
 
274
  } @else {
275
- <mat-icon>play_arrow</mat-icon>
276
- Test API
 
 
277
  }
278
  </button>
279
 
@@ -341,7 +345,7 @@
341
 
342
  <!-- Auth Tab -->
343
  <mat-tab label="Authentication">
344
- <div class="tab-content" [formGroup]="form.get('auth')">
345
  <mat-checkbox formControlName="enabled">
346
  Enable Authentication
347
  </mat-checkbox>
@@ -377,7 +381,7 @@
377
  rows="6"
378
  (click)="saveCursorPosition('auth.token_request_body', $event)"
379
  (keyup)="saveCursorPosition('auth.token_request_body', $event)"
380
- placeholder='{"username": "{{config.api_username}}", "password": "{{config.api_password}}"}'></textarea>
381
  <mat-hint>JSON body for token request</mat-hint>
382
  @if (!validateJSON('auth.token_request_body')) {
383
  <mat-error>Invalid JSON format</mat-error>
@@ -412,7 +416,7 @@
412
  rows="4"
413
  (click)="saveCursorPosition('auth.token_refresh_body', $event)"
414
  (keyup)="saveCursorPosition('auth.token_refresh_body', $event)"
415
- placeholder='{"refresh_token": "{{auth_tokens.api_name.refresh_token}}"}'></textarea>
416
  <mat-hint>JSON body for refresh request</mat-hint>
417
  @if (!validateJSON('auth.token_refresh_body')) {
418
  <mat-error>Invalid JSON format</mat-error>
@@ -449,8 +453,10 @@
449
  (click)="save()"
450
  [disabled]="saving || form.invalid">
451
  @if (saving) {
452
- <mat-icon class="spin">sync</mat-icon>
453
- Saving...
 
 
454
  } @else {
455
  @if (data.mode === 'create' || data.mode === 'duplicate') {
456
  Create
 
17
  <div class="tab-content">
18
  <mat-form-field appearance="outline">
19
  <mat-label>Name</mat-label>
20
+ <input matInput [formControl]="$any(form.get('name'))" placeholder="e.g., get_flights">
21
  <mat-hint>Unique identifier for this API</mat-hint>
22
  @if (form.get('name')?.hasError('required') && form.get('name')?.touched) {
23
  <mat-error>Name is required</mat-error>
 
29
 
30
  <mat-form-field appearance="outline">
31
  <mat-label>URL</mat-label>
32
+ <input matInput [formControl]="$any(form.get('url'))" placeholder="https://api.example.com/endpoint">
33
  <mat-hint>Full URL including protocol</mat-hint>
34
  @if (form.get('url')?.hasError('required') && form.get('url')?.touched) {
35
  <mat-error>URL is required</mat-error>
 
42
  <div class="row">
43
  <mat-form-field appearance="outline" class="method-field">
44
  <mat-label>Method</mat-label>
45
+ <mat-select [formControl]="$any(form.get('method'))">
46
  @for (method of httpMethods; track method) {
47
  <mat-option [value]="method">{{ method }}</mat-option>
48
  }
 
51
 
52
  <mat-form-field appearance="outline" class="timeout-field">
53
  <mat-label>Timeout (seconds)</mat-label>
54
+ <input matInput type="number" [formControl]="$any(form.get('timeout_seconds'))">
55
  <mat-hint>Request timeout in seconds</mat-hint>
56
  @if (form.get('timeout_seconds')?.hasError('min')) {
57
  <mat-error>Minimum 1 second</mat-error>
 
65
  <mat-form-field appearance="outline" class="full-width">
66
  <mat-label>Body Template</mat-label>
67
  <textarea matInput
68
+ [formControl]="$any(form.get('body_template'))"
69
  rows="8"
70
+ placeholder='{"key": "value"}'
71
  (click)="saveCursorPosition('body_template', $event)"
72
  (keyup)="saveCursorPosition('body_template', $event)"></textarea>
73
+ <mat-hint>JSON template with template variable support</mat-hint>
74
  @if (!validateJSON('body_template')) {
75
  <mat-error>Invalid JSON format</mat-error>
76
  }
 
89
 
90
  <mat-form-field appearance="outline">
91
  <mat-label>Proxy URL (Optional)</mat-label>
92
+ <input matInput [formControl]="$any(form.get('proxy'))" placeholder="http://proxy.example.com:8080">
93
  <mat-hint>HTTP proxy for this API call</mat-hint>
94
  </mat-form-field>
95
  </div>
 
112
  }
113
 
114
  @for (header of headers.controls; track header; let i = $index) {
115
+ <div class="array-item" [formGroup]="$any(header)">
116
  <mat-form-field appearance="outline" class="key-field">
117
  <mat-label>Header Name</mat-label>
118
  <input matInput formControlName="key" placeholder="Content-Type">
 
148
  <mat-form-field appearance="outline" class="full-width">
149
  <mat-label>Response Prompt</mat-label>
150
  <textarea matInput
151
+ [formControl]="$any(form.get('response_prompt'))"
152
  rows="4"
153
  placeholder="Optional instructions for processing the response"></textarea>
154
  <mat-hint>Instructions for AI to process the response (optional)</mat-hint>
 
174
  }
175
 
176
  @for (mapping of responseMappings.controls; track mapping; let i = $index) {
177
+ <mat-expansion-panel [formGroup]="$any(mapping)">
178
  <mat-expansion-panel-header>
179
  <mat-panel-title>
180
  {{ mapping.get('variable_name')?.value || 'New Mapping' }}
 
229
  <!-- Retry Settings -->
230
  <mat-divider></mat-divider>
231
 
232
+ <div class="retry-section" [formGroup]="$any(form.get('retry'))">
233
  <h3>Retry Settings</h3>
234
 
235
  <div class="row">
 
269
  (click)="testAPI()"
270
  [disabled]="testing || !form.get('url')?.valid || !form.get('method')?.valid">
271
  @if (testing) {
272
+ <ng-container>
273
+ <mat-icon class="spin">sync</mat-icon>
274
+ Testing...
275
+ </ng-container>
276
  } @else {
277
+ <ng-container>
278
+ <mat-icon>play_arrow</mat-icon>
279
+ Test API
280
+ </ng-container>
281
  }
282
  </button>
283
 
 
345
 
346
  <!-- Auth Tab -->
347
  <mat-tab label="Authentication">
348
+ <div class="tab-content" [formGroup]="$any(form.get('auth'))">
349
  <mat-checkbox formControlName="enabled">
350
  Enable Authentication
351
  </mat-checkbox>
 
381
  rows="6"
382
  (click)="saveCursorPosition('auth.token_request_body', $event)"
383
  (keyup)="saveCursorPosition('auth.token_request_body', $event)"
384
+ placeholder='{"username": "api_user", "password": "api_pass"}'></textarea>
385
  <mat-hint>JSON body for token request</mat-hint>
386
  @if (!validateJSON('auth.token_request_body')) {
387
  <mat-error>Invalid JSON format</mat-error>
 
416
  rows="4"
417
  (click)="saveCursorPosition('auth.token_refresh_body', $event)"
418
  (keyup)="saveCursorPosition('auth.token_refresh_body', $event)"
419
+ placeholder='{"refresh_token": "your_refresh_token"}'></textarea>
420
  <mat-hint>JSON body for refresh request</mat-hint>
421
  @if (!validateJSON('auth.token_refresh_body')) {
422
  <mat-error>Invalid JSON format</mat-error>
 
453
  (click)="save()"
454
  [disabled]="saving || form.invalid">
455
  @if (saving) {
456
+ <ng-container>
457
+ <mat-icon class="spin">sync</mat-icon>
458
+ Saving...
459
+ </ng-container>
460
  } @else {
461
  @if (data.mode === 'create' || data.mode === 'duplicate') {
462
  Create