From 43735f17aea3d8378c2022713121ec3a11f05e7b Mon Sep 17 00:00:00 2001 From: rusikv Date: Mon, 27 Mar 2023 16:29:31 +0300 Subject: [PATCH 1/2] Added string items list for sparkplug transport configuration --- ...ile-transport-configuration.component.html | 27 ++++++---------- ...ofile-transport-configuration.component.ts | 32 ------------------- 2 files changed, 9 insertions(+), 50 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/profile/device/mqtt-device-profile-transport-configuration.component.html b/ui-ngx/src/app/modules/home/components/profile/device/mqtt-device-profile-transport-configuration.component.html index 1ef7892ecb..ecc9d1923d 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/mqtt-device-profile-transport-configuration.component.html +++ b/ui-ngx/src/app/modules/home/components/profile/device/mqtt-device-profile-transport-configuration.component.html @@ -21,24 +21,15 @@
- - device-profile.mqtt-device-topic-filters-spark-plug-attribute-metric-names - - - {{name}} - close - - - - - + + +
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 cf931a7fed..24b3f60fb4 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 @@ -41,8 +41,6 @@ import { import { isDefinedAndNotNull } from '@core/utils'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { COMMA, ENTER, SEMICOLON } from '@angular/cdk/keycodes'; -import { MatChipInputEvent } from '@angular/material/chips'; @Component({ selector: 'tb-mqtt-device-profile-transport-configuration', @@ -79,8 +77,6 @@ export class MqttDeviceProfileTransportConfigurationComponent implements Control private propagateChange = (v: any) => { }; - separatorKeysCodes = [ENTER, COMMA, SEMICOLON]; - constructor(private store: Store, private fb: UntypedFormBuilder) { } @@ -175,34 +171,6 @@ 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) { From c94d5041a6b5c80e5f02a292332cbebf2928d0b6 Mon Sep 17 00:00:00 2001 From: rusikv Date: Mon, 27 Mar 2023 17:08:23 +0300 Subject: [PATCH 2/2] Moved sparkplug hint to string items list attribute, added subscriptSizing --- ...-profile-transport-configuration.component.html | 14 +++++++------- .../components/string-items-list.component.html | 2 +- .../components/string-items-list.component.ts | 5 ++++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/profile/device/mqtt-device-profile-transport-configuration.component.html b/ui-ngx/src/app/modules/home/components/profile/device/mqtt-device-profile-transport-configuration.component.html index ecc9d1923d..ac91bf3de3 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/mqtt-device-profile-transport-configuration.component.html +++ b/ui-ngx/src/app/modules/home/components/profile/device/mqtt-device-profile-transport-configuration.component.html @@ -22,14 +22,14 @@
+ editable + label="{{ 'device-profile.mqtt-device-topic-filters-spark-plug-attribute-metric-names' | translate }}" + placeholder="{{'device-profile.mqtt-device-topic-filters-spark-plug-attribute-metric-names' | translate}}" + hint="{{ 'device-profile.mqtt-device-topic-filters-spark-plug-attribute-metric-names-hint' | translate }}" + floatLabel="always" + subscriptSizing="dynamic" + formControlName="sparkplugAttributesMetricNames"> -
diff --git a/ui-ngx/src/app/shared/components/string-items-list.component.html b/ui-ngx/src/app/shared/components/string-items-list.component.html index a3820211b6..f1f9f0d118 100644 --- a/ui-ngx/src/app/shared/components/string-items-list.component.html +++ b/ui-ngx/src/app/shared/components/string-items-list.component.html @@ -16,7 +16,7 @@ -->
- + {{ label }} { }; constructor(private fb: FormBuilder) {