Browse Source

Improvement OTA package (#4698)

* Add validation ota package Software hasURL

* Fixed show sort URL in OTA Package
pull/4705/head
Vladyslav 5 years ago
committed by GitHub
parent
commit
08e517a6ee
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      dao/src/main/java/org/thingsboard/server/dao/device/DeviceProfileServiceImpl.java
  2. 2
      dao/src/main/java/org/thingsboard/server/dao/device/DeviceServiceImpl.java
  3. 2
      ui-ngx/src/app/modules/home/pages/ota-update/ota-update-table-config.resolve.ts

2
dao/src/main/java/org/thingsboard/server/dao/device/DeviceProfileServiceImpl.java

@ -450,7 +450,7 @@ public class DeviceProfileServiceImpl extends AbstractEntityService implements D
if (!software.getType().equals(OtaPackageType.SOFTWARE)) { if (!software.getType().equals(OtaPackageType.SOFTWARE)) {
throw new DataValidationException("Can't assign software with type: " + software.getType()); throw new DataValidationException("Can't assign software with type: " + software.getType());
} }
if (software.getData() == null) { if (software.getData() == null && !software.hasUrl()) {
throw new DataValidationException("Can't assign software with empty data!"); throw new DataValidationException("Can't assign software with empty data!");
} }
if (!software.getDeviceProfileId().equals(deviceProfile.getId())) { if (!software.getDeviceProfileId().equals(deviceProfile.getId())) {

2
dao/src/main/java/org/thingsboard/server/dao/device/DeviceServiceImpl.java

@ -732,7 +732,7 @@ public class DeviceServiceImpl extends AbstractEntityService implements DeviceSe
if (!software.getType().equals(OtaPackageType.SOFTWARE)) { if (!software.getType().equals(OtaPackageType.SOFTWARE)) {
throw new DataValidationException("Can't assign software with type: " + software.getType()); throw new DataValidationException("Can't assign software with type: " + software.getType());
} }
if (software.getData() == null) { if (software.getData() == null && !software.hasUrl()) {
throw new DataValidationException("Can't assign software with empty data!"); throw new DataValidationException("Can't assign software with empty data!");
} }
if (!software.getDeviceProfileId().equals(device.getDeviceProfileId())) { if (!software.getDeviceProfileId().equals(device.getDeviceProfileId())) {

2
ui-ngx/src/app/modules/home/pages/ota-update/ota-update-table-config.resolve.ts

@ -65,7 +65,7 @@ export class OtaUpdateTableConfigResolve implements Resolve<EntityTableConfig<Ot
return this.translate.instant(OtaUpdateTypeTranslationMap.get(entity.type)); return this.translate.instant(OtaUpdateTypeTranslationMap.get(entity.type));
}), }),
new EntityTableColumn<OtaPackageInfo>('url', 'ota-update.direct-url', '20%', entity => { new EntityTableColumn<OtaPackageInfo>('url', 'ota-update.direct-url', '20%', entity => {
return entity.url && entity.url.length > 20 ? `${entity.url.slice(0, 20)}…` : ''; return entity.url ? (entity.url.length > 20 ? `${entity.url.slice(0, 20)}…` : entity.url) : '';
}, () => ({}), true, () => ({}), () => undefined, false, }, () => ({}), true, () => ({}), () => undefined, false,
{ {
name: this.translate.instant('ota-update.copy-direct-url'), name: this.translate.instant('ota-update.copy-direct-url'),

Loading…
Cancel
Save