Commit 08e517a6ee3ab510c23b185d9f9b83cb4af3ea6e
Committed by
GitHub
1 parent
f96ea353
Improvement OTA package (#4698)
* Add validation ota package Software hasURL * Fixed show sort URL in OTA Package
Showing
3 changed files
with
3 additions
and
3 deletions
@@ -450,7 +450,7 @@ public class DeviceProfileServiceImpl extends AbstractEntityService implements D | @@ -450,7 +450,7 @@ public class DeviceProfileServiceImpl extends AbstractEntityService implements D | ||
450 | if (!software.getType().equals(OtaPackageType.SOFTWARE)) { | 450 | if (!software.getType().equals(OtaPackageType.SOFTWARE)) { |
451 | throw new DataValidationException("Can't assign software with type: " + software.getType()); | 451 | throw new DataValidationException("Can't assign software with type: " + software.getType()); |
452 | } | 452 | } |
453 | - if (software.getData() == null) { | 453 | + if (software.getData() == null && !software.hasUrl()) { |
454 | throw new DataValidationException("Can't assign software with empty data!"); | 454 | throw new DataValidationException("Can't assign software with empty data!"); |
455 | } | 455 | } |
456 | if (!software.getDeviceProfileId().equals(deviceProfile.getId())) { | 456 | if (!software.getDeviceProfileId().equals(deviceProfile.getId())) { |
@@ -732,7 +732,7 @@ public class DeviceServiceImpl extends AbstractEntityService implements DeviceSe | @@ -732,7 +732,7 @@ public class DeviceServiceImpl extends AbstractEntityService implements DeviceSe | ||
732 | if (!software.getType().equals(OtaPackageType.SOFTWARE)) { | 732 | if (!software.getType().equals(OtaPackageType.SOFTWARE)) { |
733 | throw new DataValidationException("Can't assign software with type: " + software.getType()); | 733 | throw new DataValidationException("Can't assign software with type: " + software.getType()); |
734 | } | 734 | } |
735 | - if (software.getData() == null) { | 735 | + if (software.getData() == null && !software.hasUrl()) { |
736 | throw new DataValidationException("Can't assign software with empty data!"); | 736 | throw new DataValidationException("Can't assign software with empty data!"); |
737 | } | 737 | } |
738 | if (!software.getDeviceProfileId().equals(device.getDeviceProfileId())) { | 738 | if (!software.getDeviceProfileId().equals(device.getDeviceProfileId())) { |
@@ -65,7 +65,7 @@ export class OtaUpdateTableConfigResolve implements Resolve<EntityTableConfig<Ot | @@ -65,7 +65,7 @@ export class OtaUpdateTableConfigResolve implements Resolve<EntityTableConfig<Ot | ||
65 | return this.translate.instant(OtaUpdateTypeTranslationMap.get(entity.type)); | 65 | return this.translate.instant(OtaUpdateTypeTranslationMap.get(entity.type)); |
66 | }), | 66 | }), |
67 | new EntityTableColumn<OtaPackageInfo>('url', 'ota-update.direct-url', '20%', entity => { | 67 | new EntityTableColumn<OtaPackageInfo>('url', 'ota-update.direct-url', '20%', entity => { |
68 | - return entity.url && entity.url.length > 20 ? `${entity.url.slice(0, 20)}…` : ''; | 68 | + return entity.url ? (entity.url.length > 20 ? `${entity.url.slice(0, 20)}…` : entity.url) : ''; |
69 | }, () => ({}), true, () => ({}), () => undefined, false, | 69 | }, () => ({}), true, () => ({}), () => undefined, false, |
70 | { | 70 | { |
71 | name: this.translate.instant('ota-update.copy-direct-url'), | 71 | name: this.translate.instant('ota-update.copy-direct-url'), |