Browse Source

fix: address PR review comments for REST API call node

- Fix JSON formatting inconsistency in locale file (extra space before colon)
- Add i18n for hard-coded "Request URL" panel title
- Fix missing semicolon and space in KvListConfigComponent
- Add standalone: false to KvListConfigComponent for NgModule compatibility
- Fix misleading comment in TbRestApiCallNodeConfiguration.isValid()
- Always show readTimeoutMs field regardless of proxy settings

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pull/14540/head
Dmytro Skarzhynets 8 months ago
parent
commit
2bf4ac3270
No known key found for this signature in database GPG Key ID: 2B51652F224037DF
  1. 2
      rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/rest/TbRestApiCallNodeConfiguration.java
  2. 5
      ui-ngx/src/app/modules/home/components/rule-node/common/kv-list-config.component.ts
  3. 5
      ui-ngx/src/app/modules/home/components/rule-node/external/rest-api-call-config.component.html
  4. 3
      ui-ngx/src/assets/locale/locale.constant-en_US.json

2
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/rest/TbRestApiCallNodeConfiguration.java

@ -57,7 +57,7 @@ public class TbRestApiCallNodeConfiguration implements NodeConfiguration<TbRestA
@AssertTrue(message = "query parameter names and values must be non-null") @AssertTrue(message = "query parameter names and values must be non-null")
public boolean isValid() { public boolean isValid() {
if (queryParams == null) { if (queryParams == null) {
return true; // @NotNull will handle this return true; // null indicates legacy configuration; keep using old URL encoding logic
} }
for (KeyValueEntry<String, String> queryParam : queryParams) { for (KeyValueEntry<String, String> queryParam : queryParams) {
if (queryParam == null || queryParam.key() == null || queryParam.value() == null) { if (queryParam == null || queryParam.key() == null || queryParam.value() == null) {

5
ui-ngx/src/app/modules/home/components/rule-node/common/kv-list-config.component.ts

@ -29,6 +29,7 @@ import { KvMapConfigOldComponent } from '@home/components/rule-node/common/kv-ma
selector: 'tb-kv-list-config', selector: 'tb-kv-list-config',
templateUrl: './kv-map-config-old.component.html', templateUrl: './kv-map-config-old.component.html',
styleUrls: ['./kv-map-config-old.component.scss'], styleUrls: ['./kv-map-config-old.component.scss'],
standalone: false,
providers: [ providers: [
{ {
provide: NG_VALUE_ACCESSOR, provide: NG_VALUE_ACCESSOR,
@ -42,7 +43,7 @@ import { KvMapConfigOldComponent } from '@home/components/rule-node/common/kv-ma
} }
] ]
}) })
export class KvListConfigComponent extends KvMapConfigOldComponent implements ControlValueAccessor, OnInit, Validator{ export class KvListConfigComponent extends KvMapConfigOldComponent implements ControlValueAccessor, OnInit, Validator {
override writeValue(kvList: any): void { override writeValue(kvList: any): void {
const keyValsControls: Array<AbstractControl> = []; const keyValsControls: Array<AbstractControl> = [];
@ -51,7 +52,7 @@ export class KvListConfigComponent extends KvMapConfigOldComponent implements Co
keyValsControls.push(this.fb.group({ keyValsControls.push(this.fb.group({
key: [property.key, [Validators.required]], key: [property.key, [Validators.required]],
value: [property.value, [Validators.required]] value: [property.value, [Validators.required]]
})) }));
} }
} }
this.kvListFormGroup.setControl('keyVals', this.fb.array(keyValsControls), {emitEvent: false}); this.kvListFormGroup.setControl('keyVals', this.fb.array(keyValsControls), {emitEvent: false});

5
ui-ngx/src/app/modules/home/components/rule-node/external/rest-api-call-config.component.html

@ -17,7 +17,7 @@
--> -->
<section [formGroup]="restApiCallConfigForm" class="flex flex-col gap-4"> <section [formGroup]="restApiCallConfigForm" class="flex flex-col gap-4">
<div class="tb-form-panel stroked"> <div class="tb-form-panel stroked">
<div class="tb-form-panel-title">Request URL</div> <div class="tb-form-panel-title" translate>rule-node-config.request-url</div>
<mat-form-field class="mat-block" subscriptSizing="dynamic"> <mat-form-field class="mat-block" subscriptSizing="dynamic">
<mat-label translate>rule-node-config.url</mat-label> <mat-label translate>rule-node-config.url</mat-label>
<input required matInput formControlName="restEndpointUrlPattern"> <input required matInput formControlName="restEndpointUrlPattern">
@ -129,8 +129,7 @@
{{ 'rule-node-config.ignore-request-body' | translate }} {{ 'rule-node-config.ignore-request-body' | translate }}
</mat-slide-toggle> </mat-slide-toggle>
</div> </div>
<mat-form-field *ngIf="restApiCallConfigForm.get('enableProxy').value" class="mat-block" <mat-form-field class="mat-block" subscriptSizing="dynamic">
subscriptSizing="dynamic">
<mat-label translate>rule-node-config.read-timeout</mat-label> <mat-label translate>rule-node-config.read-timeout</mat-label>
<input type="text" min="0" [max]="IntLimit" inputmode="numeric" pattern="[0-9]*" matInput formControlName="readTimeoutMs"> <input type="text" min="0" [max]="IntLimit" inputmode="numeric" pattern="[0-9]*" matInput formControlName="readTimeoutMs">
<mat-hint translate>rule-node-config.read-timeout-hint</mat-hint> <mat-hint translate>rule-node-config.read-timeout-hint</mat-hint>

3
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -5947,7 +5947,7 @@
"tell-failure-aws-lambda-hint": "Rule node forces failure of message processing if AWS Lambda function execution raises exception.", "tell-failure-aws-lambda-hint": "Rule node forces failure of message processing if AWS Lambda function execution raises exception.",
"basic-mode": "Basic", "basic-mode": "Basic",
"advanced-mode": "Advanced", "advanced-mode": "Advanced",
"url-hint" : "Enter the request URL. Ensure special characters are percent-encoded.", "url-hint": "Enter the request URL. Ensure special characters are percent-encoded.",
"query-params": "Query parameters", "query-params": "Query parameters",
"query-params-hint": "Additional query parameters to include in the request URL. Both names and values support templatization and are strictly (RFC 3986) encoded after template resolution.", "query-params-hint": "Additional query parameters to include in the request URL. Both names and values support templatization and are strictly (RFC 3986) encoded after template resolution.",
"query-params-empty": "No query parameters configured", "query-params-empty": "No query parameters configured",
@ -5956,6 +5956,7 @@
"query-params-name-required": "Name is required", "query-params-name-required": "Name is required",
"query-params-value-required": "Value is required", "query-params-value-required": "Value is required",
"headers-empty": "No headers configured", "headers-empty": "No headers configured",
"request-url": "Request URL",
"url": "URL", "url": "URL",
"save-time-series": { "save-time-series": {
"processing-settings": "Processing settings", "processing-settings": "Processing settings",

Loading…
Cancel
Save