Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@

<ng-container matColumnDef="menu">
<th mat-header-cell *matHeaderCellDef class="col-1"></th>

<td mat-cell *matCellDef="let element">
<div class="dropdown" *ngIf="element?.id | canEditApplication">
<a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
<!-- Name Column -->
<ng-container matColumnDef="name">
<th mat-sort-header="name" *matHeaderCellDef mat-header-cell>
{{ "APPLICATION-TABLE.NAME" | translate }}
<div [ngClass]="this.sort.active === 'name' ? 'column-title-color' : 'column-title-color-inactive'">
{{ "APPLICATION-TABLE.NAME" | translate }}
</div>
<app-table-sort-icon [sortDirection]="getSortDirection('name')" />
</th>
<td mat-cell *matCellDef="let iotDevice">
<a [routerLink]="['../iot-device', iotDevice.id]" routerLinkActive="active" class="device-link">{{
Expand All @@ -31,41 +34,80 @@

<!-- Technology Column -->
<ng-container matColumnDef="type">
<th mat-header-cell *matHeaderCellDef mat-sort-header>{{ "IOT-TABLE.NETWORK-TECHNOLOGY" | translate }}</th>
<th mat-header-cell *matHeaderCellDef mat-sort-header>
<div [ngClass]="this.sort.active === 'type' ? 'column-title-color' : 'column-title-color-inactive'">
{{ "IOT-TABLE.NETWORK-TECHNOLOGY" | translate }}
</div>
<app-table-sort-icon [sortDirection]="getSortDirection('type')" />
</th>
<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>
<th mat-header-cell *matHeaderCellDef mat-sort-header>
<div
[ngClass]="this.sort.active === 'commentOnLocation' ? 'column-title-color' : 'column-title-color-inactive'"
>
{{ "GATEWAY.PLACEMENT-LABEL" | translate }}
</div>
<app-table-sort-icon [sortDirection]="getSortDirection('commentOnLocation')" />
</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>
<th mat-header-cell *matHeaderCellDef mat-sort-header>
<div [ngClass]="this.sort.active === 'deviceModel' ? 'column-title-color' : 'column-title-color-inactive'">
{{ "IOTDEVICE.DEVICEMODEL" | translate }}
</div>
<app-table-sort-icon [sortDirection]="getSortDirection('deviceModel')" />
</th>
<td mat-cell *matCellDef="let iotDevice">{{ iotDevice.deviceModel?.body?.name ?? "-" }}</td>
</ng-container>

<ng-container matColumnDef="deviceProfileName">
<th mat-header-cell *matHeaderCellDef mat-sort-header>{{ "IOTDEVICE.LORA.DEVICEPROFILE" | translate }}</th>
<th mat-header-cell *matHeaderCellDef mat-sort-header>
<div
[ngClass]="this.sort.active === 'deviceProfileName' ? 'column-title-color' : 'column-title-color-inactive'"
>
{{ "IOTDEVICE.LORA.DEVICEPROFILE" | translate }}
</div>
<app-table-sort-icon [sortDirection]="getSortDirection('deviceProfileName')" />
</th>
<td mat-cell *matCellDef="let iotDevice">{{ iotDevice.deviceProfileName ?? "-" }}</td>
</ng-container>

<ng-container matColumnDef="deviceEUI">
<th mat-header-cell *matHeaderCellDef mat-sort-header>{{ "IOT-TABLE.DEV-EUI" | translate }}</th>
<th mat-header-cell *matHeaderCellDef mat-sort-header>
<div [ngClass]="this.sort.active === 'deviceEUI' ? 'column-title-color' : 'column-title-color-inactive'">
{{ "IOT-TABLE.DEV-EUI" | translate }}
</div>
<app-table-sort-icon [sortDirection]="getSortDirection('deviceEUI')" />
</th>
<td mat-cell *matCellDef="let iotDevice">{{ iotDevice.deviceEUI ?? "-" }}</td>
</ng-container>

<ng-container matColumnDef="OTAAapplicationKey">
<th mat-header-cell *matHeaderCellDef mat-sort-header>{{ "IOT-TABLE.APP-KEY" | translate }}</th>
<th mat-header-cell *matHeaderCellDef mat-sort-header>
<div
[ngClass]="this.sort.active === 'OTAAapplicationKey' ? 'column-title-color' : 'column-title-color-inactive'"
>
{{ "IOT-TABLE.APP-KEY" | translate }}
</div>
<app-table-sort-icon [sortDirection]="getSortDirection('OTAAapplicationKey')" />
</th>
<td mat-cell *matCellDef="let iotDevice">{{ iotDevice.OTAAapplicationKey ?? "-" }}</td>
</ng-container>

<!-- RSSI column -->
<ng-container matColumnDef="rssi">
<th *matHeaderCellDef mat-header-cell mat-sort-header="rssi">
{{ "IOT-TABLE.RSSI" | translate }}
<div [ngClass]="this.sort.active === 'rssi' ? 'column-title-color' : 'column-title-color-inactive'">
{{ "IOT-TABLE.RSSI" | translate }}
</div>
<app-table-sort-icon [sortDirection]="getSortDirection('rssi')" />
</th>
<td mat-cell *matCellDef="let iotDevice">
<ng-container *ngIf="iotDevice.type === 'LORAWAN' || iotDevice.type === 'SIGFOX'; else notSupported">
Expand All @@ -79,7 +121,10 @@
<!-- SNR column -->
<ng-container matColumnDef="snr">
<th *matHeaderCellDef mat-header-cell mat-sort-header="snr">
{{ "IOT-TABLE.SNR" | translate }}
<div [ngClass]="this.sort.active === 'snr' ? 'column-title-color' : 'column-title-color-inactive'">
{{ "IOT-TABLE.SNR" | translate }}
</div>
<app-table-sort-icon [sortDirection]="getSortDirection('snr')" />
</th>
<td mat-cell *matCellDef="let iotDevice">
<ng-container *ngIf="iotDevice.type === 'LORAWAN' || iotDevice.type === 'SIGFOX'; else notSupported">
Expand All @@ -92,7 +137,10 @@

<ng-container matColumnDef="dataTargets">
<th mat-header-cell *matHeaderCellDef mat-sort-header>
{{ "APPLICATION-TABLE.DATA-TARGETS" | translate }}
<div [ngClass]="this.sort.active === 'dataTargets' ? 'column-title-color' : 'column-title-color-inactive'">
{{ "APPLICATION-TABLE.DATA-TARGETS" | translate }}
</div>
<app-table-sort-icon [sortDirection]="getSortDirection('dataTargets')" />
</th>
<td mat-cell *matCellDef="let iotDevice">{{ iotDevice.connections?.length ?? 0 }}</td>
</ng-container>
Expand All @@ -118,7 +166,10 @@
<!-- Active Column -->
<ng-container matColumnDef="active">
<th mat-header-cell *matHeaderCellDef mat-sort-header="active">
{{ "IOT-TABLE.ACTIVE" | translate }}
<div [ngClass]="this.sort.active === 'active' ? 'column-title-color' : 'column-title-color-inactive'">
{{ "IOT-TABLE.ACTIVE" | translate }}
</div>
<app-table-sort-icon [sortDirection]="getSortDirection('active')" />
</th>
<td mat-cell *matCellDef="let iotDevice">{{ lastActive(iotDevice) }}</td>
</ng-container>
Expand All @@ -142,7 +193,7 @@
>{{ "IOTDEVICE-TABLE-ROW.EDIT" | translate }}
</a>
</li>
<li class="dropdown-item" *ngIf="iotDevice.type!==deviceTypes.SIGFOX">
<li class="dropdown-item" *ngIf="iotDevice.type !== deviceTypes.SIGFOX">
<a (click)="onOpenChangeApplicationDialog(iotDevice.id)" routerLinkActive="active">{{
"IOTDEVICE.CHANGE-APPLICATION.TITLE" | translate
}}</a>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@import "../../../../assets/scss/setup/variables";
.column-title-color {
color: $color-link;
font-weight: bold;
}

.column-title-color-inactive {
color: $default-icon-color;
}

.mat-sort-header-arrow {
display: none !important;
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import { AfterViewInit, Component, Input, OnInit, ViewChild } from "@angular/core";
import { AfterViewInit, Component, Input, OnInit, ViewChild, ViewEncapsulation } from "@angular/core";
import { MatDialog } from "@angular/material/dialog";
import { MatPaginator } from "@angular/material/paginator";
import { MatSort } from "@angular/material/sort";
import { ActivatedRoute } from "@angular/router";
import { IotDevice, IotDevicesResponse } from "@applications/iot-devices/iot-device.model";
import { environment } from "@environments/environment";
import { TranslateService } from "@ngx-translate/core";
import { DeleteDialogComponent } from "@shared/components/delete-dialog/delete-dialog.component";
import { DeleteDialogService } from "@shared/components/delete-dialog/delete-dialog.service";
import { DefaultPageSizeOptions } from "@shared/constants/page.constants";
import { OrganizationAccessScope } from "@shared/enums/access-scopes";
import { DeviceType } from "@shared/enums/device-type";
import { IoTDeviceApplicationDialogModel } from "@shared/models/dialog.model";
import { MeService } from "@shared/services/me.service";
import { OrganizationAccessScope } from "@shared/enums/access-scopes";
import { TableColumn } from "@shared/types/table.type";
import moment from "moment";
import { merge, Observable, of as observableOf } from "rxjs";
import { catchError, map, startWith, switchMap } from "rxjs/operators";
import { RestService } from "src/app/shared/services/rest.service";
import { IoTDeviceService } from "../iot-device.service";
import { DefaultPageSizeOptions } from "@shared/constants/page.constants";
import { ActivatedRoute } from "@angular/router";
import { TableColumn } from "@shared/types/table.type";
import { IoTDeviceChangeApplicationDialogComponent } from "../iot-device-change-application-dialog/iot-device-change-application-dialog.component";
import { IoTDeviceApplicationDialogModel } from "@shared/models/dialog.model";
import { IoTDeviceService } from "../iot-device.service";

const columnDefinitions: TableColumn[] = [
{
Expand Down Expand Up @@ -106,6 +106,7 @@ const columnDefinitions: TableColumn[] = [
selector: "app-iot-devices-table",
templateUrl: "./iot-devices-table.component.html",
styleUrls: ["./iot-devices-table.component.scss"],
encapsulation: ViewEncapsulation.None,
})
export class IotDevicesTableComponent implements AfterViewInit, OnInit {
@Input() applicationId: number;
Expand Down Expand Up @@ -262,6 +263,10 @@ export class IotDevicesTableComponent implements AfterViewInit, OnInit {
});
}

getSortDirection(id: string) {
return columnDefinitions.find(c => c.id === id).sort;
}

public truncateText(text: string): string {
const maxLength = 32;
if (text.length <= maxLength) {
Expand Down
44 changes: 23 additions & 21 deletions src/app/applications/iot-devices/iot-devices.module.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
import { ClipboardModule } from "@angular/cdk/clipboard";
import { CommonModule } from "@angular/common";
import { NgModule } from "@angular/core";
import { FormsModule } from "@angular/forms";
import { RouterModule } from "@angular/router";
import { GraphModule } from "@app/graph/graph.module";
import { IotDeviceDetailsMqttExternalBrokerComponent } from "@applications/iot-devices/iot-device-detail/iot-device-details-mqtt-external-broker/iot-device-details-mqtt-external-broker.component";
import { IotDeviceDetailsMqttInternalBrokerComponent } from "@applications/iot-devices/iot-device-detail/iot-device-details-mqtt-internal-broker/iot-device-details-mqtt-internal-broker.component";
import { FontAwesomeModule } from "@fortawesome/angular-fontawesome";
import { TranslateModule } from "@ngx-translate/core";
import { FormModule } from "@shared/components/forms/form.module";
import { TableSortIconComponent } from "@shared/components/table-sort-icon/table-sort-icon.component";
import { NGMaterialModule } from "@shared/Modules/materiale.module";
import { PipesModule } from "@shared/pipes/pipes.module";
import { SharedModule } from "@shared/shared.module";
import { MonacoEditorModule } from "ngx-monaco-editor-v2";
import { IoTDeviceChangeApplicationDialogComponent } from "./iot-device-change-application-dialog/iot-device-change-application-dialog.component";
import { DataPackageComponent } from "./iot-device-detail/data-package/data-package.component";
import { DataPackagesTimestampComponent } from "./iot-device-detail/data-packages-timestamp/data-packages-timestamp.component";
import { DeviceModelComponent } from "./iot-device-detail/device-model/device-model.component";
import { DownlinkDialogComponent } from "./iot-device-detail/downlink/downlink-dialog/downlink-dialog.component";
import { DownlinkTablesComponent } from "./iot-device-detail/downlink/downlink-tables/downlink-tables.component";
import { DownlinkComponent } from "./iot-device-detail/downlink/downlinks/downlink.component";
import { IotDeviceDataPacketsTabComponent } from "./iot-device-detail/iot-device-data-packets-tab/iot-device-data-packets-tab.component";
import { IotDeviceDetailGenericComponent } from "./iot-device-detail/iot-device-detail-generic/iot-device-detail-generic.component";
import { IotDeviceDetailLorawanComponent } from "./iot-device-detail/iot-device-detail-lorawan/iot-device-detail-lorawan.component";
import { IotDeviceDetailSigfoxComponent } from "./iot-device-detail/iot-device-detail-sigfox/iot-device-detail-sigfox.component";
import { IoTDeviceDetailComponent } from "./iot-device-detail/iot-device-detail.component";
import { IotDeviceEditComponent } from "./iot-device-edit/iot-device-edit.component";
import { SigfoxDeviceEditComponent } from "./iot-device-edit/sigfox-device-edit/sigfox-device-edit.component";
import { IotDevicesTableComponent } from "./iot-devices-table/iot-devices-table.component";
import { DownlinkDialogComponent } from "./iot-device-detail/downlink/downlink-dialog/downlink-dialog.component";
import { SharedModule } from "@shared/shared.module";
import { PipesModule } from "@shared/pipes/pipes.module";
import { DeviceModelComponent } from "./iot-device-detail/device-model/device-model.component";
import { MonacoEditorModule } from "ngx-monaco-editor-v2";
import { DataPackageComponent } from "./iot-device-detail/data-package/data-package.component";
import { DataPackagesTimestampComponent } from "./iot-device-detail/data-packages-timestamp/data-packages-timestamp.component";
import { GraphModule } from "@app/graph/graph.module";
import { IotDevicesTabComponent } from "./iot-devices-tab/iot-devices-tab.component";
import { IotDeviceHistoryTabComponent } from "./iot-device-detail/iot-device-history-tab/iot-device-history-tab.component";
import { IotDeviceDetailsTabComponent } from "./iot-device-detail/iot-device-details-tab/iot-device-details-tab.component";
import { IotDeviceDataPacketsTabComponent } from "./iot-device-detail/iot-device-data-packets-tab/iot-device-data-packets-tab.component";
import { IotDeviceDownlinkTabComponent } from "./iot-device-detail/iot-device-downlink-tab/iot-device-downlink-tab.component";
import { MqttDeviceEditComponent } from "./iot-device-edit/mqtt-device-edit/mqtt-device-edit.component";
import { FontAwesomeModule } from "@fortawesome/angular-fontawesome";
import { IotDeviceHistoryTabComponent } from "./iot-device-detail/iot-device-history-tab/iot-device-history-tab.component";
import { IotDeviceEditComponent } from "./iot-device-edit/iot-device-edit.component";
import { MqttAuthenticationSelectComponent } from "./iot-device-edit/mqtt-device-edit/mqtt-authentication-select/mqtt-authentication-select.component";
import { ClipboardModule } from "@angular/cdk/clipboard";
import { MqttDeviceEditComponent } from "./iot-device-edit/mqtt-device-edit/mqtt-device-edit.component";
import { SigfoxDeviceEditComponent } from "./iot-device-edit/sigfox-device-edit/sigfox-device-edit.component";
import { ExportCsvDialogComponent } from "./iot-devices-tab/export-csv-dialog/export-csv-dialog.component";
import { IotDeviceDetailsMqttInternalBrokerComponent } from "@applications/iot-devices/iot-device-detail/iot-device-details-mqtt-internal-broker/iot-device-details-mqtt-internal-broker.component";
import { IotDeviceDetailsMqttExternalBrokerComponent } from "@applications/iot-devices/iot-device-detail/iot-device-details-mqtt-external-broker/iot-device-details-mqtt-external-broker.component";
import { DownlinkTablesComponent } from "./iot-device-detail/downlink/downlink-tables/downlink-tables.component";
import { IoTDeviceChangeApplicationDialogComponent } from "./iot-device-change-application-dialog/iot-device-change-application-dialog.component";
import { IotDevicesTabComponent } from "./iot-devices-tab/iot-devices-tab.component";
import { IotDevicesTableComponent } from "./iot-devices-table/iot-devices-table.component";

@NgModule({
declarations: [
Expand Down Expand Up @@ -77,6 +78,7 @@ import { IoTDeviceChangeApplicationDialogComponent } from "./iot-device-change-a
GraphModule,
FontAwesomeModule,
ClipboardModule,
TableSortIconComponent,
],
})
export class IotDevicesModule {}
Loading