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 @@ -10,7 +10,7 @@ import { DropdownButton } from "@shared/models/dropdown-button.model";
import { MeService } from "@shared/services/me.service";
import { Subscription } from "rxjs";
import { OrganizationAccessScope } from "@shared/enums/access-scopes";
import { IotDevicesApplicationMapResponse, IotDevicesResponse } from "@applications/iot-devices/iot-device.model";
import { IotDevicesApplicationMapResponse } from "@applications/iot-devices/iot-device.model";
import { RestService } from "@shared/services/rest.service";
import { Observable } from "rxjs";
import { map } from "rxjs/operators";
Expand Down Expand Up @@ -126,11 +126,7 @@ export class ApplicationDetailComponent implements OnInit, OnDestroy, AfterViewI

private getGateways(): void {
this.gatewaysSubscription = this.chirpstackGatewayService
.getMultiple({
limit: null,
offset: null,
sort: null,
})
.getForMaps()
.subscribe((gateways: GatewayResponseMany) => {
this.gateways = gateways.resultList;
this.mapGatewaysToCoordinateList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,17 @@ export class GatewayMapComponent implements OnInit, OnDestroy, AfterViewInit {
}

private getGateways(): void {
this.gatewaySubscription = this.chirpstackGatewayService
.getMultiple({
limit: null,
offset: null,
sort: null,
})
.subscribe((gateways: GatewayResponseMany) => {
this.gateways = gateways.resultList;
this.mapToCoordinateList();
this.setCanEdit();
this.isLoadingResults = false;
});
this.gatewaySubscription = this.chirpstackGatewayService.getForMaps().subscribe((gateways: GatewayResponseMany) => {
this.gateways = gateways.resultList;
this.mapToCoordinateList();
this.setCanEdit();
this.isLoadingResults = false;
});
}

private getGatewayWith(orgId: number): void {
this.gatewaySubscription = this.chirpstackGatewayService
.getMultiple({
limit: null,
offset: null,
sort: null,
.getForMaps({
organizationId: orgId,
})
.subscribe((gateways: GatewayResponseMany) => {
Expand Down
13 changes: 13 additions & 0 deletions src/app/shared/services/chirpstack-gateway.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@ export class ChirpstackGatewayService {
);
}

public getForMaps(params = {}): Observable<GatewayResponseMany> {
return this.restService.get(`${this.chripstackGatewayUrl}/getAllForMaps`, params).pipe(
map((response: GatewayResponseMany) => {
response.resultList.map(gateway => {
gateway.organizationName = this.sharedVariableService
.getOrganizationInfo()
.find(org => org.id === gateway.organizationId)?.name;
});
return response;
})
);
}

public post(gateway: Gateway): Observable<GatewayData> {
const gatewayRequest: GatewayRequest = new GatewayRequest();
gatewayRequest.gateway = gateway;
Expand Down