Improvement OTA package (#4698)

* Add validation ota package Software hasURL

* Fixed show sort URL in OTA Package
This commit is contained in:
Vladyslav 2021-06-07 18:37:39 +03:00 committed by GitHub
parent f96ea353f6
commit 08e517a6ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -450,7 +450,7 @@ public class DeviceProfileServiceImpl extends AbstractEntityService implements D
if (!software.getType().equals(OtaPackageType.SOFTWARE)) {
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!");
}
if (!software.getDeviceProfileId().equals(deviceProfile.getId())) {

View File

@ -732,7 +732,7 @@ public class DeviceServiceImpl extends AbstractEntityService implements DeviceSe
if (!software.getType().equals(OtaPackageType.SOFTWARE)) {
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!");
}
if (!software.getDeviceProfileId().equals(device.getDeviceProfileId())) {

View File

@ -65,7 +65,7 @@ export class OtaUpdateTableConfigResolve implements Resolve<EntityTableConfig<Ot
return this.translate.instant(OtaUpdateTypeTranslationMap.get(entity.type));
}),
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,
{
name: this.translate.instant('ota-update.copy-direct-url'),