Browse Source

hot fixes

pull/8337/head
Maksym Dudnik 3 years ago
parent
commit
2c3905b495
  1. 2
      ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.html
  2. 9
      ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts

2
ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.html

@ -137,7 +137,7 @@
<mat-card fxLayout="row" fxLayout.lt-md="column" fxLayoutGap="15px" fxLayoutGap.lt-md="5px">
<mat-form-field class="mat-block tb-value-type">
<mat-label>{{ 'gateway.connectors-table-name' | translate }}</mat-label>
<input matInput formControlName="name"/>
<input matInput formControlName="name" #nameInput/>
</mat-form-field>
<mat-form-field class="mat-block tb-value-type">
<mat-label>{{ 'gateway.connectors-table-type' | translate }}</mat-label>

9
ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts

@ -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',

Loading…
Cancel
Save