Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show signal strength #81

Merged
merged 8 commits into from
Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from 7 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
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"all": "0.0.0",
"animate.css": "^4.1.1",
"bootstrap": "5.0.0-alpha2",
"chart.js": "^3.7.1",
"file-saver": "^2.0.2",
"guid-typescript": "^1.0.9",
"jwt-decode": "^2.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function tokenGetter() {
tokenGetter
},
}),
MonacoEditorModule.forRoot()
MonacoEditorModule.forRoot(),
],
bootstrap: [AppComponent],
exports: [TranslateModule],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="row ">
<div class="row">
<div class="col-md-6 d-flex align-items-stretch">
<div class="jumbotron jumbotron--m-right jumbotron--full-width">
<h3>{{ 'IOTDEVICE.DETAIL' | translate }}</h3>
Expand All @@ -12,9 +12,12 @@ <h3>{{ 'IOTDEVICE.DETAIL' | translate }}</h3>
[percentage]="batteryStatusPercentage"></app-batteri-status>
<ng-template #noBatteryStatus>
<div>
<p>{{ 'IOTDEVICE-TABLE-ROW.BATTERY-ERROR-MESSAGE' | translate }}</p>
<p>{{ 'IOTDEVICE-TABLE-ROW.NOT-SUPPORTED-SHORT' | translate }}</p>
</div>
</ng-template>
<ng-template #notAvailable>
<span>{{'IOTDEVICE-TABLE-ROW.NOT-AVAILABLE' | translate}}</span>
</ng-template>
</div>
<mat-divider></mat-divider>

Expand All @@ -29,6 +32,13 @@ <h3>{{ 'IOTDEVICE.DETAIL' | translate }}</h3>
<ng-container *ngIf="device.type === 'SIGFOX' && device.sigfoxSettings">
<app-iot-device-detail-sigfox [device]="device"></app-iot-device-detail-sigfox>
</ng-container>
<ng-container *ngIf="device.type === 'GENERIC_HTTP'">
<mat-divider></mat-divider>
<p>
<strong>{{ 'IOTDEVICE.GENERIC_HTTP.APIKEY' | translate }}</strong>
<span class="pre">{{ getGenericHttpDeviceUrl(device) }}</span>
</p>
</ng-container>
<!-- Comment -->
<mat-divider></mat-divider>
<p>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.pre {
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -o-pre-wrap;
font-family: monospace;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from '@angular/core';
import { IotDevice } from '@applications/iot-devices/iot-device.model';
import { IoTDeviceService } from '@applications/iot-devices/iot-device.service';
import { environment } from '@environments/environment';
import { TranslateService } from '@ngx-translate/core';
import { jsonToList } from '@shared/helpers/json.helper';
import { KeyValue } from '@shared/types/tuple.type';
Expand All @@ -28,6 +29,7 @@ export class IotDeviceDetailGenericComponent
@Input() latitude = 0;
@Input() longitude = 0;
deleteDevice = new EventEmitter();
baseUrl: string = environment.baseUrl;

private readonly CHIRPSTACK_BATTERY_NOT_AVAILIBLE = 255;

Expand Down Expand Up @@ -74,5 +76,9 @@ export class IotDeviceDetailGenericComponent
return Math.round(this.device?.lorawanSettings?.deviceStatusBattery);
}

getGenericHttpDeviceUrl(device: IotDevice): string {
return `${this.baseUrl}receive-data?apiKey=${device.apiKey}`;
}

ngOnDestroy(): void {}
}
Original file line number Diff line number Diff line change
@@ -1,48 +1,72 @@
<div *ngIf="device">
<app-top-bar [data]="device" [backButton]="backButton" [subPage]="true" [addDetailDowndown]="true"
[dropDownButton]="dropdownButton" (deleteSelectedInDropdown)="clickDelete()">
</app-top-bar>
<!-- General details & map -->
<div class="container-fluid">
<app-top-bar [data]="device" [backButton]="backButton" [subPage]="true" [addDetailDowndown]="true"
[dropDownButton]="dropdownButton" (deleteSelectedInDropdown)="clickDelete()">
</app-top-bar>
<!-- General details & map -->
<mat-tab-group animationDuration="200ms" (selectedTabChange)="selectedTabChange($event)">
<mat-tab label="{{'APPLICATION.DETAILS' | translate}}">
<div class="container-fluid">
<app-iot-device-detail-generic [device]="device" [longitude]=longitude [latitude]="latitude">
</app-iot-device-detail-generic>
<div class="row">
<div class="col-md-6 d-flex align-items-stretch">
<div class="jumbotron jumbotron--m-right jumbotron--full-width">
<!-- Datapackage, Downlink, API Key -->
<mat-tab-group animationDuration="200ms">
<mat-tab label="{{'IOTDEVICE.DETAIL-TAB' | translate}}">
<ng-container *ngIf="device.latestReceivedMessage; else noSentTime">
<app-data-package [latestReceivedMessage]="device.latestReceivedMessage">
</app-data-package>
<mat-divider></mat-divider>
<app-data-packages-timestamp [receivedMessagesMetadata]="device.receivedMessagesMetadata">
</app-data-packages-timestamp>
</ng-container>
<ng-template #noSentTime>
<p class="my-2 mx-3">
{{ 'IOTDEVICE.NO-DATAPACKAGE' | translate }}
</p>
</ng-template>
</mat-tab>
<mat-tab label="{{'IOTDEVICE.DOWNLINK-TAB' | translate}}" *ngIf="canStartDownlink">
<app-downlink [device]="device" [errorMessages]="errorMessages"></app-downlink>
</mat-tab>
<mat-tab *ngIf="device.type === 'GENERIC_HTTP'"
label="{{ 'IOTDEVICE.GENERIC_HTTP.APIKEY' | translate }}">
<div class="my-2 mx-3">
<pre>{{ getGenericHttpDeviceUrl(device) }}</pre>
</div>
</mat-tab>
</mat-tab-group>
</div>
<!-- Device model -->
<div class="col-md-6 d-flex align-items-stretch">
<div class="jumbotron jumbotron--m-right jumbotron--full-width">
<app-device-model [device]="device"></app-device-model>
</div>
</div>
</div>
</mat-tab>
<mat-tab label="{{'IOTDEVICE.HISTORY' | translate}}">
<ng-container *ngIf="device.type === 'LORAWAN' || device.type === 'SIGFOX'; else historyNotSupported">
<div class="container-fluid mt-4">
<div class="row">
<div class="col-md-6 d-flex align-items-stretch mt-1 mb-4">
<app-graph *ngIf="device.type === 'SIGFOX' || device.type === 'LORAWAN'" [data]="rssiChartData"
[type]="'line'" [options]="rssiChartOptions" [title]="'IOTDEVICE.HISTORY-TAB.RSSI' | translate">
</app-graph>
</div>
<!-- Device model -->
<div class="col-md-6 d-flex align-items-stretch mt-1 mb-4">
<app-graph *ngIf="device.type === 'SIGFOX' || device.type === 'LORAWAN'" [data]="snrChartData"
[type]="'line'" [options]="snrChartOptions" [title]="'IOTDEVICE.HISTORY-TAB.SNR' | translate">
</app-graph>
</div>
</div>
<div class="row mb-4">
<div class="col-md-6 d-flex align-items-stretch">
<div class="jumbotron jumbotron--m-left jumbotron--full-width">
<app-device-model [device]="device"></app-device-model>
</div>
<app-graph *ngIf="device.type === 'LORAWAN'" [data]="dataRateChartData" [type]="'bar'"
[options]="dataRateChartOptions" [title]="'IOTDEVICE.HISTORY-TAB.DATA-RATE' | translate"></app-graph>
</div>
</div>
</div>
</ng-container>
<ng-template #historyNotSupported>
<div class="jumbotron jumbotron--full-width">
<p class="my-2 mx-3">
{{ 'IOTDEVICE.HISTORY-TAB.HISTORY-NOT-SUPPORTED' | translate }}
</p>
</div>
</div>
</ng-template>
</mat-tab>
<mat-tab label="{{'IOTDEVICE.DATA-PACKETS' | translate}}">
<div class="jumbotron jumbotron--full-width">
<ng-container *ngIf="device.latestReceivedMessage; else noSentTime">
<app-data-package [latestReceivedMessage]="device.latestReceivedMessage">
</app-data-package>
<mat-divider></mat-divider>
<app-data-packages-timestamp [receivedMessagesMetadata]="device.receivedMessagesMetadata">
</app-data-packages-timestamp>
</ng-container>
<ng-template #noSentTime>
<p class="my-2 mx-3">
{{ 'IOTDEVICE.NO-DATAPACKAGE' | translate }}
</p>
</ng-template>
</div>
</mat-tab>
<mat-tab label="{{'IOTDEVICE.DOWNLINK-TAB' | translate}}" *ngIf="canStartDownlink">
<div class="jumbotron jumbotron--full-width">
<app-downlink [device]="device" [errorMessages]="errorMessages"></app-downlink>
</div>
</mat-tab>
</mat-tab-group>
</div>
Loading