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 @@ -36,7 +36,7 @@ <h3>{{ 'IOTDEVICE.DETAIL' | translate }}</h3>
<mat-divider></mat-divider>
<p>
<strong>{{ 'IOTDEVICE.GENERIC_HTTP.APIKEY' | translate }}</strong>
<span class="pre">{{ getGenericHttpDeviceUrl(device) }}</span>
<span class="pre text-break">{{ httpDeviceUrl }}</span>
</p>
</ng-container>
<!-- Comment -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class IotDeviceDetailGenericComponent
@Input() longitude = 0;
deleteDevice = new EventEmitter();
baseUrl: string = environment.baseUrl;
httpDeviceUrl: string;

private readonly CHIRPSTACK_BATTERY_NOT_AVAILIBLE = 255;

Expand All @@ -43,6 +44,7 @@ export class IotDeviceDetailGenericComponent

ngOnChanges(changes: SimpleChanges): void {
this.batteryStatusPercentage = this.getBatteryProcentage();
this.httpDeviceUrl = this.getGenericHttpDeviceUrl();

if (
changes?.device?.previousValue?.metadata !==
Expand All @@ -66,7 +68,7 @@ export class IotDeviceDetailGenericComponent
};
}

getBatteryProcentage(): number {
private getBatteryProcentage(): number {
if (
this.device?.lorawanSettings?.deviceStatusBattery ===
this.CHIRPSTACK_BATTERY_NOT_AVAILIBLE
Expand All @@ -76,8 +78,8 @@ export class IotDeviceDetailGenericComponent
return Math.round(this.device?.lorawanSettings?.deviceStatusBattery);
}

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

ngOnDestroy(): void {}
Expand Down