|
|
|
@ -99,7 +99,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie |
|
|
|
@Input() |
|
|
|
device: EntityId; |
|
|
|
|
|
|
|
@ViewChild('searchInput') searchInputField: ElementRef; |
|
|
|
@ViewChild('nameInput') nameInput: ElementRef; |
|
|
|
@ViewChild(MatSort) sort: MatSort; |
|
|
|
|
|
|
|
connectorForm: FormGroup; |
|
|
|
@ -217,7 +217,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie |
|
|
|
value |
|
|
|
}]; |
|
|
|
const attributesToDelete = []; |
|
|
|
const scope = (!this.initialConnector || this.activeConnectors.includes(this.initialConnector.name)) ? AttributeScope.SHARED_SCOPE : AttributeScope.SERVER_SCOPE; |
|
|
|
const scope = (this.initialConnector && this.activeConnectors.includes(this.initialConnector.name)) ? AttributeScope.SHARED_SCOPE : AttributeScope.SERVER_SCOPE; |
|
|
|
let updateActiveConnectors = false; |
|
|
|
if (this.initialConnector && this.initialConnector.name !== value.name) { |
|
|
|
attributesToDelete.push({key: this.initialConnector.name}); |
|
|
|
@ -251,6 +251,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie |
|
|
|
tasks.push(this.attributeService.deleteEntityAttributes(this.device, AttributeScope.SHARED_SCOPE, attributesToDelete)); |
|
|
|
} |
|
|
|
forkJoin(tasks).subscribe(_ => { |
|
|
|
this.initialConnector = value; |
|
|
|
this.showToast('Update Successful'); |
|
|
|
this.updateData(true); |
|
|
|
}); |
|
|
|
@ -306,7 +307,9 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie |
|
|
|
if (this.connectorForm.disabled) { |
|
|
|
this.connectorForm.enable(); |
|
|
|
} |
|
|
|
this.nameInput.nativeElement.focus(); |
|
|
|
this.clearOutConnectorForm(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
clearOutConnectorForm(): void { |
|
|
|
@ -381,7 +384,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie |
|
|
|
this.activeConnectors.splice(activeIndex, 1); |
|
|
|
} |
|
|
|
if (inactiveIndex !== -1) { |
|
|
|
this.inactiveConnectors.splice(activeIndex, 1); |
|
|
|
this.inactiveConnectors.splice(inactiveIndex, 1); |
|
|
|
} |
|
|
|
tasks.push(this.attributeService.saveEntityAttributes(this.device, scope, [{ |
|
|
|
key: scope == AttributeScope.SHARED_SCOPE ? 'active_connectors' : 'inactive_connectors', |
|
|
|
|