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.
///
import { Component, forwardRef, Input, OnInit } from '@angular/core';
import { Component, forwardRef, OnInit } from '@angular/core';
import {
AbstractControl,
ControlValueAccessor,
@ -44,14 +44,12 @@ import { KvMapConfigOldComponent } from '@home/components/rule-node/common/kv-ma
})
export class KvListConfigComponent extends KvMapConfigOldComponent implements ControlValueAccessor, OnInit, Validator{
@Input() keyProperty: string = 'key';
override writeValue(kvList: any): void {
const keyValsControls: Array<AbstractControl> = [];
if (Array.isArray(kvList) && kvList.length > 0) {
for (const property of kvList) {
keyValsControls.push(this.fb.group({
key: [property[this.keyProperty], [Validators.required]],
key: [property.key, [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) {
this.propagateChange(null);
} else {
const result = kvList.map(entry => ({
[this.keyProperty]: entry.key,
value: entry.value
}));
this.propagateChange(result);
this.propagateChange(kvList);
}
}
}

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"
valText="rule-node-config.query-params-value"
valRequiredText="rule-node-config.query-params-value-required"
emptyText="rule-node-config.query-params-empty"
keyProperty="name">
emptyText="rule-node-config.query-params-empty">
</tb-kv-list-config>
</ng-template>
</mat-expansion-panel>

Loading…
Cancel
Save