Skip to content

Commit 74b56c1

Browse files
committed
Fix device Detection
1 parent ab6cbf3 commit 74b56c1

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/app/select-slave/select-slave.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747

4848
<mat-select matInput formControlName="specificationid" (selectionChange)="onSpecificationChange(uislave)"
4949
[compareWith]="compareSpecificationIdentification">
50-
<ng-container *ngIf="uislave.specs;else undetectedTemplate">
51-
<ng-container *ngFor="let ispec of uislave.specs">
50+
<ng-container *ngIf="uislave.specsObservable|async as identSpecs;else undetectedTemplate">
51+
<ng-container *ngFor="let ispec of identSpecs">
5252
<mat-option [value]="ispec">
5353
<mat-icon
5454
[matTooltip]="statusTooltip(ispec?ispec.status:3)">{{statusIcon(ispec?ispec.status:3)}}</mat-icon>

src/app/select-slave/select-slave.component.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ import { isUndefined } from "cypress/types/lodash";
8080
interface IuiSlave {
8181
slave: Islave;
8282
label: string;
83-
specs?: IidentificationSpecification[];
83+
specsObservable?: Observable<IidentificationSpecification[]>;
8484
specification?: Ispecification;
8585
slaveForm: FormGroup;
8686
commandEntities?: ImodbusEntity[];
@@ -119,7 +119,8 @@ interface IuiSlave {
119119
MatExpansionPanelHeader,
120120
MatExpansionPanelTitle,
121121
MatInput,
122-
MatError
122+
MatError,
123+
AsyncPipe
123124
],
124125
})
125126
export class SelectSlaveComponent extends SessionStorage implements OnInit {
@@ -347,7 +348,10 @@ export class SelectSlaveComponent extends SessionStorage implements OnInit {
347348
resolve(rci)
348349
}
349350
if( uiSlave && uiSlave.slave.specificationid )
350-
this.entityApiService.getModbusSpecification(this.bus.busId,uiSlave.slave.slaveid,uiSlave.slave.specificationid, true).subscribe(fct)
351+
this.entityApiService.getModbusSpecification(this.bus.busId,uiSlave.slave.slaveid,uiSlave.slave.specificationid, false).subscribe((spec)=>{
352+
console.log("DSSSS")
353+
fct(spec)
354+
})
351355
else
352356
fct(undefined )
353357
})
@@ -359,7 +363,9 @@ export class SelectSlaveComponent extends SessionStorage implements OnInit {
359363
label: this.getSlaveName(slave),
360364
slaveForm: fg,
361365
} as any;
362-
this.getIdentSpecs(rc).then((identSpecs)=>{rc.specs = identSpecs}).catch(e=>{ console.log(e.message)}) // getDetectedSpecs is disabled, because of performance issues
366+
let sub = new Subject<IidentificationSpecification[]>()
367+
rc.specsObservable = sub
368+
this.getIdentSpecs(rc).then((identSpecs)=>{ sub.next(identSpecs)}).catch(e=>{ console.log(e.message)}) // getDetectedSpecs is disabled, because of performance issues
363369
this.addSpecificationToUiSlave(rc);
364370
(rc.selectedEntitites = this.getSelectedEntites(slave)),
365371
this.fillCommandTopics(rc);

0 commit comments

Comments
 (0)