Commit 08e517a6ee3ab510c23b185d9f9b83cb4af3ea6e

Authored by Vladyslav
Committed by GitHub
1 parent f96ea353

Improvement OTA package (#4698)

* Add validation ota package Software hasURL

* Fixed show sort URL in OTA Package
... ... @@ -450,7 +450,7 @@ public class DeviceProfileServiceImpl extends AbstractEntityService implements D
450 450 if (!software.getType().equals(OtaPackageType.SOFTWARE)) {
451 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 454 throw new DataValidationException("Can't assign software with empty data!");
455 455 }
456 456 if (!software.getDeviceProfileId().equals(deviceProfile.getId())) {
... ...
... ... @@ -732,7 +732,7 @@ public class DeviceServiceImpl extends AbstractEntityService implements DeviceSe
732 732 if (!software.getType().equals(OtaPackageType.SOFTWARE)) {
733 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 736 throw new DataValidationException("Can't assign software with empty data!");
737 737 }
738 738 if (!software.getDeviceProfileId().equals(device.getDeviceProfileId())) {
... ...
... ... @@ -65,7 +65,7 @@ export class OtaUpdateTableConfigResolve implements Resolve<EntityTableConfig<Ot
65 65 return this.translate.instant(OtaUpdateTypeTranslationMap.get(entity.type));
66 66 }),
67 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 69 }, () => ({}), true, () => ({}), () => undefined, false,
70 70 {
71 71 name: this.translate.instant('ota-update.copy-direct-url'),
... ...