Skip to content

Commit

Permalink
Merge pull request #161 from OS2iot/feature/IoT_1563_AddPlacementToDe…
Browse files Browse the repository at this point in the history
…viceList

Feature/iot 1563 add placement to device list
  • Loading branch information
augusthjerrild committed May 2, 2024
2 parents 1758f0c + febb580 commit 55a69e5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Expand Up @@ -33,6 +33,11 @@
<td mat-cell *matCellDef="let iotDevice">{{"IOT-DEVICE-TYPES." + iotDevice.type | translate }}</td>
</ng-container>

<ng-container matColumnDef="commentOnLocation">
<th mat-header-cell *matHeaderCellDef mat-sort-header>{{ 'GATEWAY.PLACEMENT-LABEL' | translate }}</th>
<td mat-cell *matCellDef="let iotDevice">{{ iotDevice.commentOnLocation ? truncateText(iotDevice.commentOnLocation) : '-' }}</td>
</ng-container>

<ng-container matColumnDef="deviceModel">
<th mat-header-cell *matHeaderCellDef mat-sort-header>{{ 'IOTDEVICE.DEVICEMODEL' | translate }}</th>
<td mat-cell *matCellDef="let iotDevice">{{ iotDevice.deviceModel?.body?.name ?? '-' }}</td>
Expand Down
Expand Up @@ -32,6 +32,12 @@ const columnDefinitions: TableColumn[] = [
default: true,
toggleable: true,
},
{
id: "commentOnLocation",
display: "GATEWAY.PLACEMENT-LABEL",
default: false,
toggleable: true,
},
{
id: "deviceModel",
display: "IOTDEVICE.DEVICEMODEL",
Expand Down Expand Up @@ -247,5 +253,13 @@ export class IotDevicesTableComponent implements AfterViewInit, OnInit {
});
}

public truncateText(text: string): string {
const maxLength = 32;
if (text.length <= maxLength) {
return text;
}
return text.substring(0, maxLength) + "...";
}

protected readonly columnDefinitions = columnDefinitions;
}

0 comments on commit 55a69e5

Please sign in to comment.