@@ -16,6 +16,7 @@ import { ServiceProfile, ServiceProfileResponseMany } from 'src/app/profiles/ser
1616import { ServiceProfileService } from '../../services/service-profile.service' ;
1717import { DeviceProfile } from 'src/app/profiles/device-profiles/device-profile.model' ;
1818import { DeviceProfileService } from '../../services/device-profile.service' ;
19+ import { SharedVariableService } from '@app/shared-variable/shared-variable.service' ;
1920
2021@Component ( {
2122 selector : 'app-form-body-iot-devices' ,
@@ -54,7 +55,8 @@ export class FormBodyIotDevicesComponent implements OnInit, OnDestroy {
5455 private deviceProfileService : DeviceProfileService ,
5556 private applicationService : ApplicationService ,
5657 private iotDeviceService : IoTDeviceService ,
57- private location : Location
58+ private location : Location ,
59+ private shareVariable : SharedVariableService ,
5860 ) { }
5961
6062 ngOnInit ( ) : void {
@@ -75,7 +77,7 @@ export class FormBodyIotDevicesComponent implements OnInit, OnDestroy {
7577
7678 getApplications ( ) : void {
7779 this . applicationsSubscription = this . applicationService
78- . getApplications ( 0 , 0 , 'ASC' , 'name' )
80+ . getApplications ( 0 , 0 , 'ASC' , 'name' , this . shareVariable . getSelectedOrganisationId ( ) )
7981 . subscribe ( ( applications ) => {
8082 this . applications = applications . data ;
8183 } ) ;
@@ -85,15 +87,15 @@ export class FormBodyIotDevicesComponent implements OnInit, OnDestroy {
8587 this . deviceSubscription = this . iotDeviceService
8688 . getIoTDevice ( id )
8789 . subscribe ( ( device : IotDevice ) => {
88- this . iotDevice = device ;
89- if ( this . iotDevice ?. application ?. id ) {
90+ this . iotDevice = device ;
91+ if ( this . iotDevice ?. application ?. id ) {
9092 this . iotDevice . applicationId = device . application ?. id ;
9193 }
92- if ( device . location ) {
94+ if ( device . location ) {
9395 this . iotDevice . longitude = device . location . coordinates [ 0 ] ;
9496 this . iotDevice . latitude = device . location . coordinates [ 1 ] ;
9597 }
96- this . OTAA = this . iotDevice . lorawanSettings ?. OTAAapplicationKey ? true : false ;
98+ this . OTAA = this . iotDevice . lorawanSettings ?. OTAAapplicationKey ? true : false ;
9799 } ) ;
98100 }
99101
@@ -106,14 +108,14 @@ export class FormBodyIotDevicesComponent implements OnInit, OnDestroy {
106108
107109 getServiceProfiles ( ) {
108110 this . serviceProfilesSubscription = this . serviceProfileService
109- . getMultiple ( ) . subscribe ( ( result : ServiceProfileResponseMany ) => {
111+ . getMultiple ( ) . subscribe ( ( result : ServiceProfileResponseMany ) => {
110112 this . serviceProfiles = result . result ;
111113 } ) ;
112114 }
113115
114116 getDeviceProfiles ( ) {
115117 this . devicesProfileSubscription = this . deviceProfileService
116- . getMultiple ( ) . subscribe ( ( result ) => {
118+ . getMultiple ( ) . subscribe ( ( result ) => {
117119 this . deviceProfiles = result . result ;
118120 } ) ;
119121 }
@@ -181,8 +183,8 @@ export class FormBodyIotDevicesComponent implements OnInit, OnDestroy {
181183 } else {
182184 this . errorFields . push ( err . property ) ;
183185 this . errorMessages = this . errorMessages . concat (
184- Object . values ( err . constraints )
185- ) ;
186+ Object . values ( err . constraints )
187+ ) ;
186188 }
187189 } ) ;
188190 }
0 commit comments