|
| 1 | +<app-column-selector |
| 2 | + [(displayedColumns)]="displayedColumns" |
| 3 | + [columnDefinitions]="columnDefinitions" |
| 4 | + [localStorageKey]="iotDeviceSavedColumns" |
| 5 | + [placeholder]="" |
| 6 | +></app-column-selector> |
| 7 | + |
1 | 8 | <div class="mat-elevation-z8"> |
2 | 9 | <div class="loading-shade" *ngIf="isLoadingResults"> |
3 | 10 | <mat-spinner *ngIf="isLoadingResults"></mat-spinner> |
|
15 | 22 | <th mat-sort-header="name" *matHeaderCellDef mat-header-cell> |
16 | 23 | {{ 'APPLICATION-TABLE.NAME' | translate }} |
17 | 24 | </th> |
18 | | - <td mat-cell *matCellDef="let element"> |
19 | | - <a [routerLink]="['../iot-device', element.id]" routerLinkActive="active" class="device-link">{{element.name}}</a> |
| 25 | + <td mat-cell *matCellDef="let iotDevice"> |
| 26 | + <a [routerLink]="['../iot-device', iotDevice.id]" routerLinkActive="active" class="device-link">{{iotDevice.name}}</a> |
20 | 27 | </td> |
21 | 28 | </ng-container> |
22 | 29 |
|
23 | 30 | <!-- Technology Column --> |
24 | | - <ng-container matColumnDef="technology"> |
25 | | - <th mat-header-cell *matHeaderCellDef>{{ 'IOT-TABLE.NETWORK-TECHNOLOGY' | translate }}</th> |
26 | | - <td mat-cell *matCellDef="let element">{{"IOT-DEVICE-TYPES." + element.type | translate}}</td> |
| 31 | + <ng-container matColumnDef="type"> |
| 32 | + <th mat-header-cell *matHeaderCellDef mat-sort-header>{{ 'IOT-TABLE.NETWORK-TECHNOLOGY' | translate }}</th> |
| 33 | + <td mat-cell *matCellDef="let iotDevice">{{"IOT-DEVICE-TYPES." + iotDevice.type | translate }}</td> |
27 | 34 | </ng-container> |
28 | 35 |
|
29 | | - <!-- Alarm Column --> |
30 | | - <ng-container matColumnDef="alarm"> |
31 | | - <th mat-header-cell *matHeaderCellDef>{{ 'IOT-TABLE.ALARM' | translate }}</th> |
32 | | - <td mat-cell *matCellDef="let element"> |
33 | | - N/A |
34 | | - </td> |
| 36 | + <ng-container matColumnDef="deviceModel"> |
| 37 | + <th mat-header-cell *matHeaderCellDef mat-sort-header>{{ 'IOTDEVICE.DEVICEMODEL' | translate }}</th> |
| 38 | + <td mat-cell *matCellDef="let iotDevice">{{ iotDevice.deviceModel?.body?.name ?? '-' }}</td> |
35 | 39 | </ng-container> |
36 | 40 |
|
37 | | - <!-- Battery Column --> |
38 | | - <ng-container matColumnDef="battery"> |
39 | | - <th *matHeaderCellDef mat-header-cell> |
40 | | - {{ 'IOT-TABLE.BATTERY' | translate }} |
41 | | - </th> |
42 | | - <td mat-cell *matCellDef="let element"> |
43 | | - <div *ngIf="element.type === 'LORAWAN'; else noBatteryStatus"> |
44 | | - <app-batteri-status [color]="batteryStatusColor" [percentage]="getBatteryProcentage(element)"> |
45 | | - </app-batteri-status> |
46 | | - </div> |
47 | | - <ng-template #noBatteryStatus> |
48 | | - <div> |
49 | | - {{ 'IOTDEVICE-TABLE-ROW.NOT-SUPPORTED-SHORT' | translate }} |
50 | | - </div> |
51 | | - </ng-template> |
52 | | - </td> |
| 41 | + <ng-container matColumnDef="deviceProfileName"> |
| 42 | + <th mat-header-cell *matHeaderCellDef mat-sort-header>{{ 'IOTDEVICE.LORA.DEVICEPROFILE' | translate }}</th> |
| 43 | + <td mat-cell *matCellDef="let iotDevice">{{ iotDevice.deviceProfileName ?? '-'}}</td> |
53 | 44 | </ng-container> |
54 | 45 |
|
55 | | - <!-- Active Column --> |
56 | | - <ng-container matColumnDef="active"> |
57 | | - <th mat-header-cell *matHeaderCellDef mat-sort-header="active"> |
58 | | - {{ 'IOT-TABLE.ACTIVE' | translate }} |
59 | | - </th> |
60 | | - <td mat-cell *matCellDef="let element">{{lastActive(element)}}</td> |
| 46 | + <ng-container matColumnDef="deviceEUI"> |
| 47 | + <th mat-header-cell *matHeaderCellDef mat-sort-header>{{ 'IOT-TABLE.DEV-EUI' | translate }}</th> |
| 48 | + <td mat-cell *matCellDef="let iotDevice">{{iotDevice.deviceEUI ?? '-'}}</td> |
| 49 | + </ng-container> |
| 50 | + |
| 51 | + <ng-container matColumnDef="OTAAapplicationKey"> |
| 52 | + <th mat-header-cell *matHeaderCellDef mat-sort-header>{{ 'IOT-TABLE.APP-KEY' | translate }}</th> |
| 53 | + <td mat-cell *matCellDef="let iotDevice">{{iotDevice.OTAAapplicationKey ?? '-'}}</td> |
61 | 54 | </ng-container> |
62 | 55 |
|
| 56 | + |
63 | 57 | <!-- RSSI column --> |
64 | 58 | <ng-container matColumnDef="rssi"> |
65 | 59 | <th *matHeaderCellDef mat-header-cell mat-sort-header="rssi"> |
66 | 60 | {{ 'IOT-TABLE.RSSI' | translate }} |
67 | 61 | </th> |
68 | | - <td mat-cell *matCellDef="let element"> |
69 | | - <ng-container *ngIf="element.type === 'LORAWAN' || element.type === 'SIGFOX'; else notSupported"> |
70 | | - <div *ngIf="element.latestReceivedMessage?.rssi; else notAvailable"> |
71 | | - {{element.latestReceivedMessage.rssi}} |
| 62 | + <td mat-cell *matCellDef="let iotDevice"> |
| 63 | + <ng-container *ngIf="iotDevice.type === 'LORAWAN' || iotDevice.type === 'SIGFOX'; else notSupported"> |
| 64 | + <div *ngIf="iotDevice.latestReceivedMessage?.rssi; else notAvailable"> |
| 65 | + {{iotDevice.latestReceivedMessage.rssi}} |
72 | 66 | </div> |
73 | 67 | </ng-container> |
74 | 68 | </td> |
|
79 | 73 | <th *matHeaderCellDef mat-header-cell mat-sort-header="snr"> |
80 | 74 | {{ 'IOT-TABLE.SNR' | translate }} |
81 | 75 | </th> |
82 | | - <td mat-cell *matCellDef="let element"> |
83 | | - <ng-container *ngIf="element.type === 'LORAWAN' || element.type === 'SIGFOX'; else notSupported"> |
84 | | - <div *ngIf="element.latestReceivedMessage?.snr; else notAvailable"> |
85 | | - {{element.latestReceivedMessage?.snr}} |
| 76 | + <td mat-cell *matCellDef="let iotDevice"> |
| 77 | + <ng-container *ngIf="iotDevice.type === 'LORAWAN' || iotDevice.type === 'SIGFOX'; else notSupported"> |
| 78 | + <div *ngIf="iotDevice.latestReceivedMessage?.snr; else notAvailable"> |
| 79 | + {{iotDevice.latestReceivedMessage?.snr}} |
86 | 80 | </div> |
87 | 81 | </ng-container> |
88 | 82 | </td> |
89 | 83 | </ng-container> |
90 | 84 |
|
| 85 | + <ng-container matColumnDef="dataTargets"> |
| 86 | + <th mat-header-cell *matHeaderCellDef mat-sort-header>{{ 'APPLICATION-TABLE.DATA-TARGETS' | translate }}</th> |
| 87 | + <td mat-cell *matCellDef="let iotDevice">{{iotDevice.connections?.length ?? 0}}</td> |
| 88 | + </ng-container> |
| 89 | + |
| 90 | + <!-- Battery Column --> |
| 91 | + <ng-container matColumnDef="battery"> |
| 92 | + <th *matHeaderCellDef mat-header-cell> |
| 93 | + {{ 'IOT-TABLE.BATTERY' | translate }} |
| 94 | + </th> |
| 95 | + <td mat-cell *matCellDef="let iotDevice"> |
| 96 | + <div *ngIf="iotDevice.type === 'LORAWAN'; else noBatteryStatus"> |
| 97 | + <app-batteri-status [color]="batteryStatusColor" [percentage]="getBatteryProcentage(iotDevice)"> |
| 98 | + </app-batteri-status> |
| 99 | + </div> |
| 100 | + <ng-template #noBatteryStatus> |
| 101 | + <div> |
| 102 | + {{ 'IOTDEVICE-TABLE-ROW.NOT-SUPPORTED-SHORT' | translate }} |
| 103 | + </div> |
| 104 | + </ng-template> |
| 105 | + </td> |
| 106 | + </ng-container> |
| 107 | + |
| 108 | + <!-- Active Column --> |
| 109 | + <ng-container matColumnDef="active"> |
| 110 | + <th mat-header-cell *matHeaderCellDef mat-sort-header="active"> |
| 111 | + {{ 'IOT-TABLE.ACTIVE' | translate }} |
| 112 | + </th> |
| 113 | + <td mat-cell *matCellDef="let iotDevice">{{lastActive(iotDevice)}}</td> |
| 114 | + </ng-container> |
| 115 | + |
91 | 116 | <ng-container matColumnDef="menu"> |
92 | 117 | <th mat-header-cell *matHeaderCellDef></th> |
93 | | - <td mat-cell *matCellDef="let element"> |
| 118 | + <td mat-cell *matCellDef="let iotDevice"> |
94 | 119 | <div class="dropdown" *ngIf="canEdit"> |
95 | | - <a href="#" role="button" id="tableRowDropdown-{{element.id}}" class="applicationRow__edit dropdown-toggle" |
| 120 | + <a href="#" role="button" id="tableRowDropdown-{{iotDevice.id}}" class="applicationRow__edit dropdown-toggle" |
96 | 121 | data-toggle="dropdown" aria-expanded="false" |
97 | 122 | [attr.aria-label]="'APPLICATION-TABLE-ROW.SHOW-OPTIONS' | translate"></a> |
98 | | - <ul class="dropdown-menu dropdown-menu--table" attr.aria-labelledby="tableRowDropdown-{{element.id}}"> |
| 123 | + <ul class="dropdown-menu dropdown-menu--table" attr.aria-labelledby="tableRowDropdown-{{iotDevice.id}}"> |
99 | 124 | <li class="dropdown-item"> |
100 | | - <a [routerLink]="['../iot-device-edit', element.id]" routerLinkActive="active">{{ 'IOTDEVICE-TABLE-ROW.EDIT' |
| 125 | + <a [routerLink]="['../iot-device-edit', iotDevice.id]" routerLinkActive="active">{{ 'IOTDEVICE-TABLE-ROW.EDIT' |
101 | 126 | | translate }} |
102 | 127 | </a> |
103 | 128 | </li> |
104 | 129 | <li class="dropdown-item"> |
105 | | - <a (click)="clickDelete(element)" [routerLink]="[]">{{ 'IOTDEVICE-TABLE-ROW.DELETE' | translate }}</a> |
| 130 | + <a (click)="clickDelete(iotDevice)" [routerLink]="[]">{{ 'IOTDEVICE-TABLE-ROW.DELETE' | translate }}</a> |
106 | 131 | </li> |
107 | 132 | </ul> |
108 | 133 | </div> |
|
0 commit comments