Spaces:
Building
Building
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
@@ -51,9 +51,10 @@
|
|
51 |
</mat-panel-title>
|
52 |
</mat-expansion-panel-header>
|
53 |
<div class="template-list">
|
54 |
-
<mat-chip *ngFor="let templateVar of
|
55 |
-
(click)="insertTemplateVariable('body_template', templateVar
|
56 |
-
|
|
|
57 |
</mat-chip>
|
58 |
</div>
|
59 |
</mat-expansion-panel>
|
@@ -106,6 +107,52 @@
|
|
106 |
<mat-hint>Use {{'{{api_response}}'}} to reference the API response</mat-hint>
|
107 |
</mat-form-field>
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
<mat-form-field appearance="outline" class="full-width">
|
110 |
<mat-label>Proxy URL (Optional)</mat-label>
|
111 |
<input matInput formControlName="proxy"
|
@@ -156,14 +203,22 @@
|
|
156 |
<mat-expansion-panel-header>
|
157 |
<mat-panel-title>
|
158 |
<mat-icon>help_outline</mat-icon>
|
159 |
-
|
160 |
</mat-panel-title>
|
161 |
</mat-expansion-panel-header>
|
162 |
-
<div class="
|
163 |
-
<
|
164 |
-
|
165 |
-
|
|
|
|
|
|
|
166 |
</div>
|
|
|
|
|
|
|
|
|
|
|
167 |
</mat-expansion-panel>
|
168 |
</div>
|
169 |
</div>
|
@@ -205,6 +260,23 @@
|
|
205 |
placeholder='{"grant_type": "client_credentials"}'
|
206 |
rows="4"
|
207 |
class="json-textarea"></textarea>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
<button mat-button type="button"
|
209 |
(click)="validateJSON('auth.token_request_body')"
|
210 |
[color]="validateJSON('auth.token_request_body') ? 'primary' : 'warn'">
|
@@ -258,6 +330,25 @@
|
|
258 |
</mat-chip-listbox>
|
259 |
</div>
|
260 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
<button mat-raised-button color="accent"
|
262 |
(click)="testAPI()"
|
263 |
[disabled]="testing || !form.get('url')?.valid">
|
@@ -297,7 +388,7 @@
|
|
297 |
|
298 |
<div class="test-note">
|
299 |
<mat-icon>info</mat-icon>
|
300 |
-
<p>Note: Test requests use
|
301 |
</div>
|
302 |
</div>
|
303 |
</div>
|
|
|
51 |
</mat-panel-title>
|
52 |
</mat-expansion-panel-header>
|
53 |
<div class="template-list">
|
54 |
+
<mat-chip *ngFor="let templateVar of getTemplateVariables()"
|
55 |
+
(click)="insertTemplateVariable('body_template', templateVar)"
|
56 |
+
class="template-chip">
|
57 |
+
{{ templateVar }}
|
58 |
</mat-chip>
|
59 |
</div>
|
60 |
</mat-expansion-panel>
|
|
|
107 |
<mat-hint>Use {{'{{api_response}}'}} to reference the API response</mat-hint>
|
108 |
</mat-form-field>
|
109 |
|
110 |
+
<div class="form-section">
|
111 |
+
<div class="section-header">
|
112 |
+
<h4>Response Mappings</h4>
|
113 |
+
<button mat-raised-button color="primary" type="button" (click)="addResponseMapping()">
|
114 |
+
<mat-icon>add</mat-icon>
|
115 |
+
Add Mapping
|
116 |
+
</button>
|
117 |
+
</div>
|
118 |
+
|
119 |
+
<div formArrayName="response_mappings" class="response-mappings-list">
|
120 |
+
<div *ngFor="let mapping of responseMappings.controls; let i = index"
|
121 |
+
[formGroupName]="i"
|
122 |
+
class="mapping-row">
|
123 |
+
<mat-form-field appearance="outline">
|
124 |
+
<mat-label>Variable Name</mat-label>
|
125 |
+
<input matInput formControlName="variable_name" placeholder="departure_time">
|
126 |
+
<mat-hint>snake_case only</mat-hint>
|
127 |
+
</mat-form-field>
|
128 |
+
|
129 |
+
<mat-form-field appearance="outline">
|
130 |
+
<mat-label>Type</mat-label>
|
131 |
+
<mat-select formControlName="type">
|
132 |
+
<mat-option *ngFor="let type of variableTypes" [value]="type">
|
133 |
+
{{ type }}
|
134 |
+
</mat-option>
|
135 |
+
</mat-select>
|
136 |
+
</mat-form-field>
|
137 |
+
|
138 |
+
<mat-form-field appearance="outline" class="json-path-field">
|
139 |
+
<mat-label>JSON Path</mat-label>
|
140 |
+
<input matInput formControlName="json_path" placeholder="FlightInfo.Details.DepartureTime">
|
141 |
+
<mat-hint>Use dot notation for nested values</mat-hint>
|
142 |
+
</mat-form-field>
|
143 |
+
|
144 |
+
<button mat-icon-button color="warn" type="button" (click)="removeResponseMapping(i)">
|
145 |
+
<mat-icon>delete</mat-icon>
|
146 |
+
</button>
|
147 |
+
</div>
|
148 |
+
</div>
|
149 |
+
|
150 |
+
<div *ngIf="responseMappings.length === 0" class="empty-state-small">
|
151 |
+
<mat-icon>info</mat-icon>
|
152 |
+
<p>No response mappings defined. Use this to extract values from API responses into session variables.</p>
|
153 |
+
</div>
|
154 |
+
</div>
|
155 |
+
|
156 |
<mat-form-field appearance="outline" class="full-width">
|
157 |
<mat-label>Proxy URL (Optional)</mat-label>
|
158 |
<input matInput formControlName="proxy"
|
|
|
203 |
<mat-expansion-panel-header>
|
204 |
<mat-panel-title>
|
205 |
<mat-icon>help_outline</mat-icon>
|
206 |
+
Template Variables for Headers
|
207 |
</mat-panel-title>
|
208 |
</mat-expansion-panel-header>
|
209 |
+
<div class="template-list">
|
210 |
+
<mat-chip *ngFor="let templateVar of getTemplateVariables()"
|
211 |
+
class="template-chip">
|
212 |
+
<span (click)="headers.length > 0 ? insertHeaderValue(headers.length - 1, templateVar) : null">
|
213 |
+
{{ templateVar }}
|
214 |
+
</span>
|
215 |
+
</mat-chip>
|
216 |
</div>
|
217 |
+
<p class="hint-text">
|
218 |
+
Common headers:<br>
|
219 |
+
<strong>Authorization:</strong> Bearer {{'{{auth_tokens.api_name.token}}'}}<br>
|
220 |
+
<strong>Content-Type:</strong> application/json
|
221 |
+
</p>
|
222 |
</mat-expansion-panel>
|
223 |
</div>
|
224 |
</div>
|
|
|
260 |
placeholder='{"grant_type": "client_credentials"}'
|
261 |
rows="4"
|
262 |
class="json-textarea"></textarea>
|
263 |
+
<div class="template-helpers">
|
264 |
+
<mat-expansion-panel>
|
265 |
+
<mat-expansion-panel-header>
|
266 |
+
<mat-panel-title>
|
267 |
+
<mat-icon>help_outline</mat-icon>
|
268 |
+
Template Variables
|
269 |
+
</mat-panel-title>
|
270 |
+
</mat-expansion-panel-header>
|
271 |
+
<div class="template-list">
|
272 |
+
<mat-chip *ngFor="let templateVar of getTemplateVariables(false)"
|
273 |
+
(click)="insertTemplateVariable('auth.token_request_body', templateVar)"
|
274 |
+
class="template-chip">
|
275 |
+
{{ templateVar }}
|
276 |
+
</mat-chip>
|
277 |
+
</div>
|
278 |
+
</mat-expansion-panel>
|
279 |
+
</div>
|
280 |
<button mat-button type="button"
|
281 |
(click)="validateJSON('auth.token_request_body')"
|
282 |
[color]="validateJSON('auth.token_request_body') ? 'primary' : 'warn'">
|
|
|
330 |
</mat-chip-listbox>
|
331 |
</div>
|
332 |
|
333 |
+
<div class="form-section">
|
334 |
+
<label class="section-label">Test Request JSON:</label>
|
335 |
+
<div class="json-editor">
|
336 |
+
<textarea [(ngModel)]="testRequestJson"
|
337 |
+
[ngModelOptions]="{standalone: true}"
|
338 |
+
rows="8"
|
339 |
+
class="json-textarea"
|
340 |
+
placeholder='{"key": "value"}'></textarea>
|
341 |
+
<button mat-button type="button"
|
342 |
+
(click)="updateTestRequestJson()">
|
343 |
+
<mat-icon>refresh</mat-icon>
|
344 |
+
Reset to Template
|
345 |
+
</button>
|
346 |
+
</div>
|
347 |
+
<p class="hint-text">
|
348 |
+
Edit the JSON above to customize test values. Template variables are replaced with placeholder values.
|
349 |
+
</p>
|
350 |
+
</div>
|
351 |
+
|
352 |
<button mat-raised-button color="accent"
|
353 |
(click)="testAPI()"
|
354 |
[disabled]="testing || !form.get('url')?.valid">
|
|
|
388 |
|
389 |
<div class="test-note">
|
390 |
<mat-icon>info</mat-icon>
|
391 |
+
<p>Note: Test requests use the JSON content from the text area above.</p>
|
392 |
</div>
|
393 |
</div>
|
394 |
</div>
|