Fixed SYNC issue with redundant name fields in server and broker config

This commit is contained in:
mpetrov 2024-08-21 12:07:20 +03:00
parent 9e54196ce8
commit b5be7af40f
5 changed files with 1 additions and 18 deletions

View File

@ -33,7 +33,6 @@ import {
} from '@home/components/widget/lib/gateway/gateway-widget.models';
import { SharedModule } from '@shared/shared.module';
import { CommonModule } from '@angular/common';
import { TranslateService } from '@ngx-translate/core';
import { generateSecret } from '@core/utils';
import { Subject } from 'rxjs';
import { GatewayPortTooltipPipe } from '@home/components/widget/lib/gateway/pipes/gateway-port-tooltip.pipe';
@ -74,10 +73,8 @@ export class BrokerConfigControlComponent implements ControlValueAccessor, Valid
private destroy$ = new Subject<void>();
constructor(private fb: FormBuilder,
private cdr: ChangeDetectorRef,
private translate: TranslateService) {
private cdr: ChangeDetectorRef) {
this.brokerConfigFormGroup = this.fb.group({
name: ['', []],
host: ['', [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]],
port: [null, [Validators.required, Validators.min(PortLimits.MIN), Validators.max(PortLimits.MAX)]],
version: [5, []],

View File

@ -77,7 +77,6 @@ export class OpcServerConfigComponent implements ControlValueAccessor, Validator
constructor(private fb: FormBuilder) {
this.serverConfigFormGroup = this.fb.group({
name: ['', []],
url: ['', [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]],
timeoutInMillis: [1000, [Validators.required, Validators.min(1000)]],
scanPeriodInMillis: [1000, [Validators.required, Validators.min(1000)]],

View File

@ -147,8 +147,6 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie
}
ngAfterViewInit(): void {
this.observeName();
this.dataSource.sort = this.sort;
this.dataSource.sortingDataAccessor = this.getSortingDataAccessor();
@ -533,15 +531,6 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie
this.connectorForm.disable();
}
private observeName(): void {
this.connectorForm.get('name').valueChanges
.pipe(
filter(() => this.connectorForm.get('type').value === ConnectorType.MQTT),
takeUntil(this.destroy$)
)
.subscribe(name => this.connectorForm.get('basicConfig').get('broker.name')?.setValue(name));
}
private getSortingDataAccessor(): (data: GatewayAttributeData, sortHeaderId: string) => string | number {
return (data: GatewayAttributeData, sortHeaderId: string) => {
switch (sortHeaderId) {

View File

@ -1,6 +1,5 @@
{
"broker": {
"name": "Default Local Broker",
"host": "127.0.0.1",
"port": 1883,
"clientId": "ThingsBoard_gateway",

View File

@ -1,6 +1,5 @@
{
"server": {
"name": "OPC-UA Default Server",
"url": "localhost:4840/freeopcua/server/",
"timeoutInMillis": 5000,
"scanPeriodInMillis": 5000,