From fcbdc4194b8700c33a3db4c02f38fa740e07f276 Mon Sep 17 00:00:00 2001 From: rusikv Date: Tue, 14 Feb 2023 10:35:25 +0200 Subject: [PATCH] changed wrong variable name --- ...ofile-transport-configuration.component.ts | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/profile/device/mqtt-device-profile-transport-configuration.component.ts b/ui-ngx/src/app/modules/home/components/profile/device/mqtt-device-profile-transport-configuration.component.ts index efcde3d46b..dfed5099e2 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/mqtt-device-profile-transport-configuration.component.ts +++ b/ui-ngx/src/app/modules/home/components/profile/device/mqtt-device-profile-transport-configuration.component.ts @@ -175,6 +175,34 @@ export class MqttDeviceProfileTransportConfigurationComponent implements Control } } + removeAttributeMetricName(name: string): void { + const names: string[] = this.mqttDeviceProfileTransportConfigurationFormGroup.get('sparkPlugAttributesMetricNames').value; + const index = names.indexOf(name); + if (index >= 0) { + names.splice(index, 1); + this.mqttDeviceProfileTransportConfigurationFormGroup.get('sparkPlugAttributesMetricNames').setValue(names); + } + } + + addAttributeMetricName(event: MatChipInputEvent): void { + const input = event.input; + let value = event.value; + if ((value || '').trim()) { + value = value.trim(); + let names: string[] = this.mqttDeviceProfileTransportConfigurationFormGroup.get('sparkPlugAttributesMetricNames').value; + if (!names || names.indexOf(value) === -1) { + if (!names) { + names = []; + } + names.push(value); + this.mqttDeviceProfileTransportConfigurationFormGroup.get('sparkPlugAttributesMetricNames').setValue(names, {emitEvent: true}); + } + } + if (input) { + input.value = ''; + } + } + private updateModel() { let configuration: DeviceProfileTransportConfiguration = null; if (this.mqttDeviceProfileTransportConfigurationFormGroup.valid) { @@ -214,34 +242,6 @@ export class MqttDeviceProfileTransportConfigurationComponent implements Control } } - public removeAttributeMetricName(name: string): void { - const names: string[] = this.mqttDeviceProfileTransportConfigurationFormGroup.get('sparkPlugAttributesMetricNames').value; - const index = names.indexOf(name); - if (index >= 0) { - names.splice(index, 1); - this.mqttDeviceProfileTransportConfigurationFormGroup.get('sparkPlugAttributesMetricNames').setValue(names); - } - } - - public addAttributeMetricName(event: MatChipInputEvent): void { - const input = event.input; - let value = event.value; - if ((value || '').trim()) { - value = value.trim(); - let keys: string[] = this.mqttDeviceProfileTransportConfigurationFormGroup.get('sparkPlugAttributesMetricNames').value; - if (!keys || keys.indexOf(value) === -1) { - if (!keys) { - keys = []; - } - keys.push(value); - this.mqttDeviceProfileTransportConfigurationFormGroup.get('sparkPlugAttributesMetricNames').setValue(keys, {emitEvent: true}); - } - } - if (input) { - input.value = ''; - } - } - private validationMQTTTopic(): ValidatorFn { return (c: FormControl) => { const newTopic = c.value;