Commit 09ed69a568e11ffe853e63e0c110199b88995b7c

Authored by Igor Kulikov
Committed by GitHub
2 parents 4c4ec36b 3e28c960

Merge pull request #3885 from vvlladd28/bug/bulk-import/updated-type-device

UI: Fixed updated deviceProfile in bulk import devices
@@ -869,7 +869,7 @@ export class EntityService { @@ -869,7 +869,7 @@ export class EntityService {
869 return findEntityObservable.pipe( 869 return findEntityObservable.pipe(
870 mergeMap((entity) => { 870 mergeMap((entity) => {
871 const tasks: Observable<any>[] = []; 871 const tasks: Observable<any>[] = [];
872 - const result: Device | Asset = entity as (Device | Asset); 872 + const result: Device & Asset = entity as (Device | Asset);
873 const additionalInfo = result.additionalInfo || {}; 873 const additionalInfo = result.additionalInfo || {};
874 if (result.label !== entityData.label || 874 if (result.label !== entityData.label ||
875 result.type !== entityData.type || 875 result.type !== entityData.type ||
@@ -882,6 +882,9 @@ export class EntityService { @@ -882,6 +882,9 @@ export class EntityService {
882 if (result.id.entityType === EntityType.DEVICE) { 882 if (result.id.entityType === EntityType.DEVICE) {
883 result.additionalInfo.gateway = entityData.gateway; 883 result.additionalInfo.gateway = entityData.gateway;
884 } 884 }
  885 + if (result.id.entityType === EntityType.DEVICE && result.deviceProfileId) {
  886 + delete result.deviceProfileId;
  887 + }
885 switch (result.id.entityType) { 888 switch (result.id.entityType) {
886 case EntityType.DEVICE: 889 case EntityType.DEVICE:
887 tasks.push(this.deviceService.saveDevice(result, config)); 890 tasks.push(this.deviceService.saveDevice(result, config));