Skip to content

Commit 7e281f7

Browse files
author
Allan Asp Christensen
committed
Org added til iotdevice
1 parent bca9223 commit 7e281f7

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/app/shared/form/form-body-iot-devices/form-body-iot-devices.component.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { ServiceProfile, ServiceProfileResponseMany } from 'src/app/profiles/ser
1616
import { ServiceProfileService } from '../../services/service-profile.service';
1717
import { DeviceProfile } from 'src/app/profiles/device-profiles/device-profile.model';
1818
import { 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

Comments
 (0)