ciyidogan commited on
Commit
02b26f9
·
verified ·
1 Parent(s): 20cfeff

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
@@ -62,56 +62,15 @@
62
  </mat-form-field>
63
  </div>
64
 
65
- <mat-form-field appearance="outline"
66
- class="full-width"
67
- [class.json-valid]="validateJSON('body_template')"
68
- [class.json-invalid]="!validateJSON('body_template') && form.get('body_template')?.value">
69
- <mat-label>Body Template</mat-label>
70
- <textarea matInput
71
- [formControl]="$any(form.get('body_template'))"
72
- rows="8"
73
- placeholder='{"key": "value"}'
74
- (click)="saveCursorPosition('body_template', $event)"
75
- (keyup)="saveCursorPosition('body_template', $event)"
76
- (keydown)="handleTabKey($event, 'body_template')"
77
- class="code-editor"></textarea>
78
- <mat-hint>JSON template with template variable support</mat-hint>
79
- @if (!validateJSON('body_template')) {
80
- <mat-error>Invalid JSON format</mat-error>
81
- }
82
- </mat-form-field>
83
-
84
- <!-- JSON Validation Indicator -->
85
- <div class="json-validation-status">
86
- @if (validateJSON('body_template')) {
87
- <mat-icon class="valid">check_circle</mat-icon>
88
- <span class="valid">Valid JSON</span>
89
- } @else {
90
- <mat-icon class="invalid">error</mat-icon>
91
- <span class="invalid">Invalid JSON</span>
92
- }
93
- </div>
94
-
95
- <!-- Collapsible Variables Panel -->
96
- <mat-expansion-panel class="variables-panel">
97
- <mat-expansion-panel-header>
98
- <mat-panel-title>
99
- <mat-icon>code</mat-icon>
100
- Available Variables
101
- </mat-panel-title>
102
- <mat-panel-description>
103
- Click to insert template variables
104
- </mat-panel-description>
105
- </mat-expansion-panel-header>
106
-
107
- <mat-chip-set>
108
- @for (variable of getTemplateVariables(false); track variable) {
109
- <mat-chip (click)="insertTemplateVariable('body_template', variable)">
110
- {{ variable }}
111
- </mat-chip>
112
- }
113
- </mat-chip-set>
114
- </mat-expansion-panel>
115
 
116
  <mat-form-field appearance="outline">
117
  <mat-label>Proxy URL (Optional)</mat-label>
@@ -191,7 +150,9 @@
191
  </button>
192
  </div>
193
 
194
- <mat-hint>Extract values from API response and save them as variables for use in subsequent intents</mat-hint>
 
 
195
 
196
  @if (responseMappings.length === 0) {
197
  <p class="empty-message">No response mappings configured.</p>
@@ -311,16 +272,13 @@
311
  </button>
312
  </div>
313
 
314
- <mat-form-field appearance="outline" class="full-width">
315
- <mat-label>Test Request Body</mat-label>
316
- <textarea matInput
317
- [(ngModel)]="testRequestJson"
318
- rows="10"
319
- (keydown)="handleTabKey($event, 'testRequestJson')"
320
- class="code-editor"
321
- placeholder="Enter test request JSON here"></textarea>
322
- <mat-hint>Variables will be replaced with test values</mat-hint>
323
- </mat-form-field>
324
 
325
  @if (testResult) {
326
  <mat-divider></mat-divider>
@@ -400,56 +358,15 @@
400
  }
401
  </mat-form-field>
402
 
403
- <mat-form-field appearance="outline"
404
- class="full-width"
405
- [class.json-valid]="validateJSON('auth.token_request_body')"
406
- [class.json-invalid]="!validateJSON('auth.token_request_body') && form.get('auth.token_request_body')?.value">
407
- <mat-label>Token Request Body</mat-label>
408
- <textarea matInput
409
- formControlName="token_request_body"
410
- rows="6"
411
- (click)="saveCursorPosition('auth.token_request_body', $event)"
412
- (keyup)="saveCursorPosition('auth.token_request_body', $event)"
413
- (keydown)="handleTabKey($event, 'auth.token_request_body')"
414
- class="code-editor"
415
- placeholder='{"username": "api_user", "password": "api_pass"}'></textarea>
416
- <mat-hint>JSON body for token request</mat-hint>
417
- @if (!validateJSON('auth.token_request_body')) {
418
- <mat-error>Invalid JSON format</mat-error>
419
- }
420
- </mat-form-field>
421
-
422
- <!-- JSON Validation Indicator -->
423
- <div class="json-validation-status">
424
- @if (validateJSON('auth.token_request_body')) {
425
- <mat-icon class="valid">check_circle</mat-icon>
426
- <span class="valid">Valid JSON</span>
427
- } @else {
428
- <mat-icon class="invalid">error</mat-icon>
429
- <span class="invalid">Invalid JSON</span>
430
- }
431
- </div>
432
-
433
- <!-- Collapsible Variables Panel -->
434
- <mat-expansion-panel class="variables-panel">
435
- <mat-expansion-panel-header>
436
- <mat-panel-title>
437
- <mat-icon>code</mat-icon>
438
- Available Variables
439
- </mat-panel-title>
440
- <mat-panel-description>
441
- Click to insert template variables
442
- </mat-panel-description>
443
- </mat-expansion-panel-header>
444
-
445
- <mat-chip-set>
446
- @for (variable of getTemplateVariables(); track variable) {
447
- <mat-chip (click)="insertTemplateVariable('auth.token_request_body', variable)">
448
- {{ variable }}
449
- </mat-chip>
450
- }
451
- </mat-chip-set>
452
- </mat-expansion-panel>
453
 
454
  <mat-divider></mat-divider>
455
 
@@ -461,56 +378,15 @@
461
  <mat-hint>URL to refresh expired token</mat-hint>
462
  </mat-form-field>
463
 
464
- <mat-form-field appearance="outline"
465
- class="full-width"
466
- [class.json-valid]="validateJSON('auth.token_refresh_body')"
467
- [class.json-invalid]="!validateJSON('auth.token_refresh_body') && form.get('auth.token_refresh_body')?.value">
468
- <mat-label>Refresh Request Body</mat-label>
469
- <textarea matInput
470
- formControlName="token_refresh_body"
471
- rows="4"
472
- (click)="saveCursorPosition('auth.token_refresh_body', $event)"
473
- (keyup)="saveCursorPosition('auth.token_refresh_body', $event)"
474
- (keydown)="handleTabKey($event, 'auth.token_refresh_body')"
475
- class="code-editor"
476
- placeholder='{"refresh_token": "your_refresh_token"}'></textarea>
477
- <mat-hint>JSON body for refresh request</mat-hint>
478
- @if (!validateJSON('auth.token_refresh_body')) {
479
- <mat-error>Invalid JSON format</mat-error>
480
- }
481
- </mat-form-field>
482
-
483
- <!-- JSON Validation Indicator -->
484
- <div class="json-validation-status">
485
- @if (validateJSON('auth.token_refresh_body')) {
486
- <mat-icon class="valid">check_circle</mat-icon>
487
- <span class="valid">Valid JSON</span>
488
- } @else {
489
- <mat-icon class="invalid">error</mat-icon>
490
- <span class="invalid">Invalid JSON</span>
491
- }
492
- </div>
493
-
494
- <!-- Collapsible Variables Panel -->
495
- <mat-expansion-panel class="variables-panel">
496
- <mat-expansion-panel-header>
497
- <mat-panel-title>
498
- <mat-icon>code</mat-icon>
499
- Available Variables
500
- </mat-panel-title>
501
- <mat-panel-description>
502
- Click to insert template variables
503
- </mat-panel-description>
504
- </mat-expansion-panel-header>
505
-
506
- <mat-chip-set>
507
- @for (variable of getTemplateVariables(); track variable) {
508
- <mat-chip (click)="insertTemplateVariable('auth.token_refresh_body', variable)">
509
- {{ variable }}
510
- </mat-chip>
511
- }
512
- </mat-chip-set>
513
- </mat-expansion-panel>
514
  </div>
515
  }
516
  </div>
 
62
  </mat-form-field>
63
  </div>
64
 
65
+ <app-json-editor
66
+ [formControl]="$any(form.get('body_template'))"
67
+ label="Body Template"
68
+ placeholder='{"key": "value"}'
69
+ hint="JSON template with template variable support"
70
+ [rows]="8"
71
+ [availableVariables]="getTemplateVariables(false)"
72
+ [variableReplacer]="replaceVariablesForValidation">
73
+ </app-json-editor>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
  <mat-form-field appearance="outline">
76
  <mat-label>Proxy URL (Optional)</mat-label>
 
150
  </button>
151
  </div>
152
 
153
+ <p class="info-text">
154
+ Extract values from API response and save them as variables for use in subsequent intents.
155
+ </p>
156
 
157
  @if (responseMappings.length === 0) {
158
  <p class="empty-message">No response mappings configured.</p>
 
272
  </button>
273
  </div>
274
 
275
+ <app-json-editor
276
+ [(ngModel)]="testRequestJson"
277
+ label="Test Request Body"
278
+ placeholder="Enter test request JSON here"
279
+ hint="Variables will be replaced with test values"
280
+ [rows]="10">
281
+ </app-json-editor>
 
 
 
282
 
283
  @if (testResult) {
284
  <mat-divider></mat-divider>
 
358
  }
359
  </mat-form-field>
360
 
361
+ <app-json-editor
362
+ formControlName="token_request_body"
363
+ label="Token Request Body"
364
+ placeholder='{"username": "api_user", "password": "api_pass"}'
365
+ hint="JSON body for token request"
366
+ [rows]="6"
367
+ [availableVariables]="getTemplateVariables()"
368
+ [variableReplacer]="replaceVariablesForValidation">
369
+ </app-json-editor>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
 
371
  <mat-divider></mat-divider>
372
 
 
378
  <mat-hint>URL to refresh expired token</mat-hint>
379
  </mat-form-field>
380
 
381
+ <app-json-editor
382
+ formControlName="token_refresh_body"
383
+ label="Refresh Request Body"
384
+ placeholder='{"refresh_token": "your_refresh_token"}'
385
+ hint="JSON body for refresh request"
386
+ [rows]="4"
387
+ [availableVariables]="getTemplateVariables()"
388
+ [variableReplacer]="replaceVariablesForValidation">
389
+ </app-json-editor>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
390
  </div>
391
  }
392
  </div>