Skip to content

Commit

Permalink
Merge pull request #92 from OS2iot/feature/1356_generic-http-url-overlap
Browse files Browse the repository at this point in the history
Fix generic http url overlap on chromium and webkit browsers
  • Loading branch information
AramAlsabti authored May 25, 2022
2 parents c4cf83d + a231860 commit 4aee35d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
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

0 comments on commit 4aee35d

Please sign in to comment.