Refactor error message if software module assignment to distribution fails (#540)

* Refactor error message if sw module assignment to distribution fails

Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>

* Refactor message

Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
Melanie Retter
2017-06-20 07:55:31 +02:00
committed by Michael Hirsch
parent a25016dcaa
commit 3b5f12b7a4
2 changed files with 11 additions and 9 deletions

View File

@@ -93,7 +93,8 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
DistributionSetTable(final UIEventBus eventBus, final VaadinMessageSource i18n, final UINotification notification,
final SpPermissionChecker permissionChecker, final ManageDistUIState manageDistUIState,
final DistributionSetManagement distributionSetManagement, final SoftwareModuleManagement softwareManagement,
final DistributionSetManagement distributionSetManagement,
final SoftwareModuleManagement softwareManagement,
final DistributionsViewClientCriterion distributionsViewClientCriterion,
final TargetManagement targetManagement, final DsMetadataPopupLayout dsMetadataPopupLayout) {
super(eventBus, i18n, notification);
@@ -259,7 +260,8 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
final String name = (String) softwareItem.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
final String swVersion = (String) softwareItem.getItemProperty(SPUILabelDefinitions.VAR_VERSION).getValue();
final Optional<SoftwareModule> softwareModule = softwareModuleManagement.findSoftwareModuleById(softwareModuleId);
final Optional<SoftwareModule> softwareModule = softwareModuleManagement
.findSoftwareModuleById(softwareModuleId);
if (softwareModule.isPresent() && validSoftwareModule((Long) distId, softwareModule.get())) {
final SoftwareModuleIdName softwareModuleIdName = new SoftwareModuleIdName(softwareModuleId,
@@ -342,8 +344,8 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
if (ds.getModules().contains(sm)) {
/* Already has software module */
notification.displayValidationError(i18n.getMessage("message.software.dist.already.assigned",
HawkbitCommonUtil.concatStrings(":", ds.getName(), ds.getVersion()),
HawkbitCommonUtil.concatStrings(":", sm.getName(), sm.getVersion())));
HawkbitCommonUtil.concatStrings(":", sm.getName(), sm.getVersion()),
HawkbitCommonUtil.concatStrings(":", ds.getName(), ds.getVersion())));
return false;
}
@@ -351,7 +353,7 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
/* Invalid type of the software module */
notification.displayValidationError(i18n.getMessage("message.software.dist.type.notallowed",
HawkbitCommonUtil.concatStrings(":", sm.getName(), sm.getVersion()),
HawkbitCommonUtil.concatStrings(":", ds.getName(), ds.getVersion())));
HawkbitCommonUtil.concatStrings(":", ds.getName(), ds.getVersion()), sm.getType().getName()));
return false;
}
return true;

View File

@@ -402,11 +402,11 @@ label.drop.dist.delete.area = Drop here<br>to delete
label.no.tag.assigned = NO TAG
caption.assign.software.dist.accordion.tab = Assign Software Modules
message.software.assignment = {0} Software Module(s) Assignment(s) done
message.dist.inuse = {0} Distribution is already assigned to target
message.software.dist.already.assigned = {0} Distribution already has Software Module {1}
message.software.dist.type.notallowed = {0} Software Module type can not assign to Distribution {1}
message.dist.inuse = Distribution {0} is already assigned to target
message.software.dist.already.assigned = Software Module {0} is already assigned to Distribution {1}
message.software.dist.type.notallowed = Software Module {0} cannot be assigned, because Distribution {1} does not support the Software Module Type {2}
message.target.assigned = {0} is assigned to {1}
message.dist.type.delete = {0} DistributionType(s) Deleted successfully.
message.dist.type.delete = {0} Distribution Type(s) deleted successfully.
message.sw.module.type.delete = {0} Software Module Type(s) deleted successfully.
message.dist.type.discard.success = All Distribution Types are discarded successfully !
message.dist.discard.success = All Distributions are discarded successfully !