Fixed SYNC issue with redundant name fields in server and broker config
This commit is contained in:
parent
9e54196ce8
commit
b5be7af40f
@ -33,7 +33,6 @@ import {
|
|||||||
} from '@home/components/widget/lib/gateway/gateway-widget.models';
|
} from '@home/components/widget/lib/gateway/gateway-widget.models';
|
||||||
import { SharedModule } from '@shared/shared.module';
|
import { SharedModule } from '@shared/shared.module';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
|
||||||
import { generateSecret } from '@core/utils';
|
import { generateSecret } from '@core/utils';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { GatewayPortTooltipPipe } from '@home/components/widget/lib/gateway/pipes/gateway-port-tooltip.pipe';
|
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>();
|
private destroy$ = new Subject<void>();
|
||||||
|
|
||||||
constructor(private fb: FormBuilder,
|
constructor(private fb: FormBuilder,
|
||||||
private cdr: ChangeDetectorRef,
|
private cdr: ChangeDetectorRef) {
|
||||||
private translate: TranslateService) {
|
|
||||||
this.brokerConfigFormGroup = this.fb.group({
|
this.brokerConfigFormGroup = this.fb.group({
|
||||||
name: ['', []],
|
|
||||||
host: ['', [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]],
|
host: ['', [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]],
|
||||||
port: [null, [Validators.required, Validators.min(PortLimits.MIN), Validators.max(PortLimits.MAX)]],
|
port: [null, [Validators.required, Validators.min(PortLimits.MIN), Validators.max(PortLimits.MAX)]],
|
||||||
version: [5, []],
|
version: [5, []],
|
||||||
|
|||||||
@ -77,7 +77,6 @@ export class OpcServerConfigComponent implements ControlValueAccessor, Validator
|
|||||||
|
|
||||||
constructor(private fb: FormBuilder) {
|
constructor(private fb: FormBuilder) {
|
||||||
this.serverConfigFormGroup = this.fb.group({
|
this.serverConfigFormGroup = this.fb.group({
|
||||||
name: ['', []],
|
|
||||||
url: ['', [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]],
|
url: ['', [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]],
|
||||||
timeoutInMillis: [1000, [Validators.required, Validators.min(1000)]],
|
timeoutInMillis: [1000, [Validators.required, Validators.min(1000)]],
|
||||||
scanPeriodInMillis: [1000, [Validators.required, Validators.min(1000)]],
|
scanPeriodInMillis: [1000, [Validators.required, Validators.min(1000)]],
|
||||||
|
|||||||
@ -147,8 +147,6 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit(): void {
|
ngAfterViewInit(): void {
|
||||||
this.observeName();
|
|
||||||
|
|
||||||
this.dataSource.sort = this.sort;
|
this.dataSource.sort = this.sort;
|
||||||
this.dataSource.sortingDataAccessor = this.getSortingDataAccessor();
|
this.dataSource.sortingDataAccessor = this.getSortingDataAccessor();
|
||||||
|
|
||||||
@ -533,15 +531,6 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie
|
|||||||
this.connectorForm.disable();
|
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 {
|
private getSortingDataAccessor(): (data: GatewayAttributeData, sortHeaderId: string) => string | number {
|
||||||
return (data: GatewayAttributeData, sortHeaderId: string) => {
|
return (data: GatewayAttributeData, sortHeaderId: string) => {
|
||||||
switch (sortHeaderId) {
|
switch (sortHeaderId) {
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"broker": {
|
"broker": {
|
||||||
"name": "Default Local Broker",
|
|
||||||
"host": "127.0.0.1",
|
"host": "127.0.0.1",
|
||||||
"port": 1883,
|
"port": 1883,
|
||||||
"clientId": "ThingsBoard_gateway",
|
"clientId": "ThingsBoard_gateway",
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"server": {
|
"server": {
|
||||||
"name": "OPC-UA Default Server",
|
|
||||||
"url": "localhost:4840/freeopcua/server/",
|
"url": "localhost:4840/freeopcua/server/",
|
||||||
"timeoutInMillis": 5000,
|
"timeoutInMillis": 5000,
|
||||||
"scanPeriodInMillis": 5000,
|
"scanPeriodInMillis": 5000,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user