Browse Source

Moved to key name prop in Query params

pull/14540/head
Maksym Tsymbarov 9 months ago
parent
commit
07fd49c080
  1. 12
      ui-ngx/src/app/modules/home/components/rule-node/common/kv-list-config.component.ts
  2. 3
      ui-ngx/src/app/modules/home/components/rule-node/external/rest-api-call-config.component.html

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

@ -14,7 +14,7 @@
/// limitations under the License. /// limitations under the License.
/// ///
import { Component, forwardRef, Input, OnInit } from '@angular/core'; import { Component, forwardRef, OnInit } from '@angular/core';
import { import {
AbstractControl, AbstractControl,
ControlValueAccessor, ControlValueAccessor,
@ -44,14 +44,12 @@ 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{
@Input() keyProperty: string = 'key';
override writeValue(kvList: any): void { override writeValue(kvList: any): void {
const keyValsControls: Array<AbstractControl> = []; const keyValsControls: Array<AbstractControl> = [];
if (Array.isArray(kvList) && kvList.length > 0) { if (Array.isArray(kvList) && kvList.length > 0) {
for (const property of kvList) { for (const property of kvList) {
keyValsControls.push(this.fb.group({ keyValsControls.push(this.fb.group({
key: [property[this.keyProperty], [Validators.required]], key: [property.key, [Validators.required]],
value: [property.value, [Validators.required]] value: [property.value, [Validators.required]]
})) }))
} }
@ -79,11 +77,7 @@ export class KvListConfigComponent extends KvMapConfigOldComponent implements Co
if (this.required && !kvList.length || !this.kvListFormGroup.valid) { if (this.required && !kvList.length || !this.kvListFormGroup.valid) {
this.propagateChange(null); this.propagateChange(null);
} else { } else {
const result = kvList.map(entry => ({ this.propagateChange(kvList);
[this.keyProperty]: entry.key,
value: entry.value
}));
this.propagateChange(result);
} }
} }
} }

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

@ -38,8 +38,7 @@
keyRequiredText="rule-node-config.query-params-name-required" keyRequiredText="rule-node-config.query-params-name-required"
valText="rule-node-config.query-params-value" valText="rule-node-config.query-params-value"
valRequiredText="rule-node-config.query-params-value-required" valRequiredText="rule-node-config.query-params-value-required"
emptyText="rule-node-config.query-params-empty" emptyText="rule-node-config.query-params-empty">
keyProperty="name">
</tb-kv-list-config> </tb-kv-list-config>
</ng-template> </ng-template>
</mat-expansion-panel> </mat-expansion-panel>

Loading…
Cancel
Save