Skip to content

Commit 55a69e5

Browse files
Merge pull request #161 from OS2iot/feature/IoT_1563_AddPlacementToDeviceList
Feature/iot 1563 add placement to device list
2 parents 1758f0c + febb580 commit 55a69e5

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/app/applications/iot-devices/iot-devices-table/iot-devices-table.component.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
<td mat-cell *matCellDef="let iotDevice">{{"IOT-DEVICE-TYPES." + iotDevice.type | translate }}</td>
3434
</ng-container>
3535

36+
<ng-container matColumnDef="commentOnLocation">
37+
<th mat-header-cell *matHeaderCellDef mat-sort-header>{{ 'GATEWAY.PLACEMENT-LABEL' | translate }}</th>
38+
<td mat-cell *matCellDef="let iotDevice">{{ iotDevice.commentOnLocation ? truncateText(iotDevice.commentOnLocation) : '-' }}</td>
39+
</ng-container>
40+
3641
<ng-container matColumnDef="deviceModel">
3742
<th mat-header-cell *matHeaderCellDef mat-sort-header>{{ 'IOTDEVICE.DEVICEMODEL' | translate }}</th>
3843
<td mat-cell *matCellDef="let iotDevice">{{ iotDevice.deviceModel?.body?.name ?? '-' }}</td>

src/app/applications/iot-devices/iot-devices-table/iot-devices-table.component.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ const columnDefinitions: TableColumn[] = [
3232
default: true,
3333
toggleable: true,
3434
},
35+
{
36+
id: "commentOnLocation",
37+
display: "GATEWAY.PLACEMENT-LABEL",
38+
default: false,
39+
toggleable: true,
40+
},
3541
{
3642
id: "deviceModel",
3743
display: "IOTDEVICE.DEVICEMODEL",
@@ -247,5 +253,13 @@ export class IotDevicesTableComponent implements AfterViewInit, OnInit {
247253
});
248254
}
249255

256+
public truncateText(text: string): string {
257+
const maxLength = 32;
258+
if (text.length <= maxLength) {
259+
return text;
260+
}
261+
return text.substring(0, maxLength) + "...";
262+
}
263+
250264
protected readonly columnDefinitions = columnDefinitions;
251265
}

0 commit comments

Comments
 (0)