diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/broker-security.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/broker-security.component.html index 30200f0fa5..319b10f0b2 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/broker-security.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/broker-security.component.html @@ -20,12 +20,12 @@
gateway.security
- {{ SecurityTypeTranslations.get(type) | translate }} + {{ SecurityTypeTranslationsMap.get(type) | translate }} - +
gateway.username
@@ -50,36 +50,18 @@
- - warning -
- +
{{ 'gateway.path-hint' | translate }}
gateway.CA-certificate-path
- - warning -
@@ -88,15 +70,6 @@
- - warning -
@@ -105,15 +78,6 @@
- - warning -
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/broker-security.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/broker-security.component.ts index f0e397e1ac..179329a38d 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/broker-security.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/broker-security.component.ts @@ -40,11 +40,14 @@ import { FormBuilder, NG_VALIDATORS, NG_VALUE_ACCESSOR, - UntypedFormGroup, ValidationErrors, Validator, Validators + UntypedFormGroup, + ValidationErrors, + Validator, + Validators } from '@angular/forms'; import { - BrokerSecurityTypes, - BrokerSecurityTypeTranslations, + BrokerSecurityType, + BrokerSecurityTypeTranslationsMap, } from '@home/components/widget/lib/gateway/gateway-widget.models'; import { takeUntil } from 'rxjs/operators'; @@ -68,11 +71,11 @@ import { takeUntil } from 'rxjs/operators'; }) export class BrokerSecurityComponent extends PageComponent implements ControlValueAccessor, Validator, AfterViewInit, OnInit, OnDestroy { - BrokerSecurityTypes = BrokerSecurityTypes; + BrokerSecurityType = BrokerSecurityType; - securityTypes = Object.values(BrokerSecurityTypes); + securityTypes = Object.values(BrokerSecurityType); - SecurityTypeTranslations = BrokerSecurityTypeTranslations; + SecurityTypeTranslationsMap = BrokerSecurityTypeTranslationsMap; securityFormGroup: UntypedFormGroup; @@ -93,12 +96,12 @@ export class BrokerSecurityComponent extends PageComponent implements ControlVal private fb: FormBuilder) { super(store); this.securityFormGroup = this.fb.group({ - type: [BrokerSecurityTypes.ANONYMOUS, []], + type: [BrokerSecurityType.ANONYMOUS, []], username: ['', [Validators.required]], - password: ['', [Validators.required]], - pathToCACert: ['', [Validators.required]], - pathToPrivateKey: ['', [Validators.required]], - pathToClientCert: ['', [Validators.required]] + password: ['', []], + pathToCACert: ['', []], + pathToPrivateKey: ['', []], + pathToClientCert: ['', []] }); this.securityFormGroup.valueChanges.pipe( takeUntil(this.destroy$) @@ -132,7 +135,7 @@ export class BrokerSecurityComponent extends PageComponent implements ControlVal writeValue(deviceInfo: any) { if (!deviceInfo.type) { - deviceInfo.type = BrokerSecurityTypes.ANONYMOUS; + deviceInfo.type = BrokerSecurityType.ANONYMOUS; } this.securityFormGroup.reset(deviceInfo); this.updateView(deviceInfo); @@ -155,10 +158,10 @@ export class BrokerSecurityComponent extends PageComponent implements ControlVal this.securityFormGroup.get('pathToCACert').disable({emitEvent: false}); this.securityFormGroup.get('pathToPrivateKey').disable({emitEvent: false}); this.securityFormGroup.get('pathToClientCert').disable({emitEvent: false}); - if (type === BrokerSecurityTypes.BASIC) { + if (type === BrokerSecurityType.BASIC) { this.securityFormGroup.get('username').enable({emitEvent: false}); this.securityFormGroup.get('password').enable({emitEvent: false}); - } else if (type === BrokerSecurityTypes.CERTIFICATES) { + } else if (type === BrokerSecurityType.CERTIFICATES) { this.securityFormGroup.get('pathToCACert').enable({emitEvent: false}); this.securityFormGroup.get('pathToPrivateKey').enable({emitEvent: false}); this.securityFormGroup.get('pathToClientCert').enable({emitEvent: false}); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/device-info-table.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/device-info-table.component.ts index 2f6b903646..e9cec11420 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/device-info-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/device-info-table.component.ts @@ -42,9 +42,13 @@ import { ControlValueAccessor, FormBuilder, NG_VALIDATORS, NG_VALUE_ACCESSOR, - UntypedFormGroup, ValidationErrors, Validator, Validators + UntypedFormGroup, + ValidationErrors, + Validator, + Validators } from '@angular/forms'; import { + DeviceInfoType, SourceTypes, SourceTypeTranslationsMap } from '@home/components/widget/lib/gateway/gateway-widget.models'; @@ -129,7 +133,7 @@ export class DeviceInfoTableComponent extends PageComponent implements ControlVa this.mappingFormGroup.addControl('deviceNameExpressionSource', this.fb.control(SourceTypes.MSG, [])); } - if (this.deviceInfoTypeValue === 'full') { + if (this.deviceInfoType === DeviceInfoType.FULL) { if (this.useSource) { this.mappingFormGroup.addControl('deviceProfileExpressionSource', this.fb.control(SourceTypes.MSG, [])); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/mapping-data-keys-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/mapping-data-keys-panel.component.ts index 341646e6f1..a9ee443f22 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/mapping-data-keys-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/mapping-data-keys-panel.component.ts @@ -35,6 +35,7 @@ import { AppState } from '@core/core.state'; import { PageComponent } from '@shared/components/page.component'; import { isDefinedAndNotNull } from '@core/utils'; import { + MappingDataKey, MappingKeysType, MappingValueType, mappingValueTypesMap @@ -61,7 +62,7 @@ export class MappingDataKeysPanelComponent extends PageComponent implements OnIn noKeysText: string; @Input() - keys: string; + keys: Array | {[key: string]: any}; @Input() keysType: string; @@ -140,7 +141,7 @@ export class MappingDataKeysPanelComponent extends PageComponent implements OnIn this.keysDataApplied.emit(keys); } - private prepareKeysFormArray(keys: any): UntypedFormArray { + private prepareKeysFormArray(keys: Array | {[key: string]: any}): UntypedFormArray { const keysControlGroups: Array = []; if (keys) { if (this.keysType === MappingKeysType.CUSTOM) { @@ -161,7 +162,7 @@ export class MappingDataKeysPanelComponent extends PageComponent implements OnIn return this.fb.array(keysControlGroups); } - valueTitle(value: any): any { + valueTitle(value: any): string { if (isDefinedAndNotNull(value)) { if (typeof value === 'object') { return JSON.stringify(value); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/mapping-table.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/mapping-table.component.html index 6e7afd1a45..2cc388a2aa 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/mapping-table.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/mapping-table.component.html @@ -15,12 +15,12 @@ limitations under the License. --> -
-
+
+
- {{mappingTypeTranslationsMap.get(mappingType) | translate}} + {{mappingTypeTranslationsMap.get(mappingType) | translate}}