Formatted the code
This commit is contained in:
@@ -174,7 +174,8 @@ public class SoftwareModuleDetailsTable extends Table {
|
|||||||
final Item saveTblitem = getContainerDataSource().addItem(swModType.getName());
|
final Item saveTblitem = getContainerDataSource().addItem(swModType.getName());
|
||||||
final Label mandatoryLabel = createMandatoryLabel(isMandatory);
|
final Label mandatoryLabel = createMandatoryLabel(isMandatory);
|
||||||
final Label typeName = HawkbitCommonUtil.getFormatedLabel(swModType.getName());
|
final Label typeName = HawkbitCommonUtil.getFormatedLabel(swModType.getName());
|
||||||
final VerticalLayout verticalLayout = createSoftModuleLayout(swModType,distributionSet, alreadyAssignedSwModules);
|
final VerticalLayout verticalLayout = createSoftModuleLayout(swModType, distributionSet,
|
||||||
|
alreadyAssignedSwModules);
|
||||||
|
|
||||||
saveTblitem.getItemProperty(SOFT_TYPE_MANDATORY).setValue(mandatoryLabel);
|
saveTblitem.getItemProperty(SOFT_TYPE_MANDATORY).setValue(mandatoryLabel);
|
||||||
saveTblitem.getItemProperty(SOFT_TYPE_NAME).setValue(typeName);
|
saveTblitem.getItemProperty(SOFT_TYPE_NAME).setValue(typeName);
|
||||||
@@ -184,7 +185,7 @@ public class SoftwareModuleDetailsTable extends Table {
|
|||||||
|
|
||||||
private void unassignSW(final ClickEvent event, final DistributionSet distributionSet,
|
private void unassignSW(final ClickEvent event, final DistributionSet distributionSet,
|
||||||
final Set<SoftwareModule> alreadyAssignedSwModules) {
|
final Set<SoftwareModule> alreadyAssignedSwModules) {
|
||||||
final SoftwareModule unAssignedSw = getSoftwareModule(event.getButton().getId(),alreadyAssignedSwModules);
|
final SoftwareModule unAssignedSw = getSoftwareModule(event.getButton().getId(), alreadyAssignedSwModules);
|
||||||
final DistributionSet newDistributionSet = distributionSetManagement.unassignSoftwareModule(distributionSet,
|
final DistributionSet newDistributionSet = distributionSetManagement.unassignSoftwareModule(distributionSet,
|
||||||
unAssignedSw);
|
unAssignedSw);
|
||||||
manageDistUIState.setLastSelectedEntity(DistributionSetIdName.generate(newDistributionSet));
|
manageDistUIState.setLastSelectedEntity(DistributionSetIdName.generate(newDistributionSet));
|
||||||
@@ -204,34 +205,36 @@ public class SoftwareModuleDetailsTable extends Table {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private VerticalLayout createSoftModuleLayout(final SoftwareModuleType swModType,
|
||||||
private VerticalLayout createSoftModuleLayout(final SoftwareModuleType swModType,DistributionSet distributionSet, Set<SoftwareModule> alreadyAssignedSwModules){
|
final DistributionSet distributionSet, final Set<SoftwareModule> alreadyAssignedSwModules) {
|
||||||
VerticalLayout verticalLayout = new VerticalLayout();
|
final VerticalLayout verticalLayout = new VerticalLayout();
|
||||||
for (final SoftwareModule sw : alreadyAssignedSwModules) {
|
for (final SoftwareModule sw : alreadyAssignedSwModules) {
|
||||||
if (swModType.getKey().equals(sw.getType().getKey())) {
|
if (swModType.getKey().equals(sw.getType().getKey())) {
|
||||||
HorizontalLayout horizontalLayout = new HorizontalLayout();
|
final HorizontalLayout horizontalLayout = new HorizontalLayout();
|
||||||
horizontalLayout.setSizeFull();
|
horizontalLayout.setSizeFull();
|
||||||
final Label softwareModule = HawkbitCommonUtil.getFormatedLabel(HawkbitCommonUtil.SP_STRING_EMPTY);
|
final Label softwareModule = HawkbitCommonUtil.getFormatedLabel(HawkbitCommonUtil.SP_STRING_EMPTY);
|
||||||
final Button reassignSoftModule = SPUIComponentProvider.getButton(sw.getName(), "", "", "", true,
|
final Button reassignSoftModule = SPUIComponentProvider.getButton(sw.getName(), "", "", "", true,
|
||||||
FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class);
|
FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class);
|
||||||
reassignSoftModule.addClickListener(event -> unassignSW(event, distributionSet, alreadyAssignedSwModules));
|
reassignSoftModule
|
||||||
String softwareModNameVersion = HawkbitCommonUtil.getFormattedNameVersion(sw.getName(), sw.getVersion());
|
.addClickListener(event -> unassignSW(event, distributionSet, alreadyAssignedSwModules));
|
||||||
|
final String softwareModNameVersion = HawkbitCommonUtil.getFormattedNameVersion(sw.getName(),
|
||||||
|
sw.getVersion());
|
||||||
softwareModule.setValue(softwareModNameVersion);
|
softwareModule.setValue(softwareModNameVersion);
|
||||||
softwareModule.setDescription(softwareModNameVersion);
|
softwareModule.setDescription(softwareModNameVersion);
|
||||||
softwareModule.setId(sw.getName()+"-label");
|
softwareModule.setId(sw.getName() + "-label");
|
||||||
horizontalLayout.addComponent(softwareModule);
|
horizontalLayout.addComponent(softwareModule);
|
||||||
horizontalLayout.setExpandRatio(softwareModule, 1f);
|
horizontalLayout.setExpandRatio(softwareModule, 1f);
|
||||||
if (isUnassignSoftModAllowed && permissionChecker.hasUpdateDistributionPermission() && !isTargetAssigned
|
if (isUnassignSoftModAllowed && permissionChecker.hasUpdateDistributionPermission() && !isTargetAssigned
|
||||||
&& (isSoftModAvaiableForSoftType(alreadyAssignedSwModules, swModType))) {
|
&& (isSoftModAvaiableForSoftType(alreadyAssignedSwModules, swModType))) {
|
||||||
horizontalLayout.addComponent(reassignSoftModule);
|
horizontalLayout.addComponent(reassignSoftModule);
|
||||||
}
|
}
|
||||||
verticalLayout.addComponent(horizontalLayout);
|
verticalLayout.addComponent(horizontalLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return verticalLayout;
|
return verticalLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -148,8 +148,7 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
|||||||
for (final Map.Entry<String, StringBuilder> entry : assignedSWModule.entrySet()) {
|
for (final Map.Entry<String, StringBuilder> entry : assignedSWModule.entrySet()) {
|
||||||
item = softwareModuleTable.getContainerDataSource().getItem(entry.getKey());
|
item = softwareModuleTable.getContainerDataSource().getItem(entry.getKey());
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
item.getItemProperty(SOFT_MODULE)
|
item.getItemProperty(SOFT_MODULE).setValue(createSoftModuleLayout(entry.getValue().toString()));
|
||||||
.setValue(createSoftModuleLayout(entry.getValue().toString()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,7 +163,7 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
|||||||
reassignSoftModule.setEnabled(false);
|
reassignSoftModule.setEnabled(false);
|
||||||
return reassignSoftModule;
|
return reassignSoftModule;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getUnsavedAssigedSwModule(final String name, final String version) {
|
private String getUnsavedAssigedSwModule(final String name, final String version) {
|
||||||
@@ -205,26 +204,25 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
|||||||
for (final Map.Entry<String, StringBuilder> entry : assignedSWModule.entrySet()) {
|
for (final Map.Entry<String, StringBuilder> entry : assignedSWModule.entrySet()) {
|
||||||
final Item item = softwareModuleTable.getContainerDataSource().getItem(entry.getKey());
|
final Item item = softwareModuleTable.getContainerDataSource().getItem(entry.getKey());
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
item.getItemProperty(SOFT_MODULE)
|
item.getItemProperty(SOFT_MODULE).setValue(createSoftModuleLayout(entry.getValue().toString()));
|
||||||
.setValue(createSoftModuleLayout(entry.getValue().toString()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private VerticalLayout createSoftModuleLayout(String softwareModuleName){
|
private VerticalLayout createSoftModuleLayout(final String softwareModuleName) {
|
||||||
VerticalLayout verticalLayout = new VerticalLayout();
|
final VerticalLayout verticalLayout = new VerticalLayout();
|
||||||
HorizontalLayout horizontalLayout = new HorizontalLayout();
|
final HorizontalLayout horizontalLayout = new HorizontalLayout();
|
||||||
horizontalLayout.setSizeFull();
|
horizontalLayout.setSizeFull();
|
||||||
final Label softwareModule = HawkbitCommonUtil.getFormatedLabel(HawkbitCommonUtil.SP_STRING_EMPTY);
|
final Label softwareModule = HawkbitCommonUtil.getFormatedLabel(HawkbitCommonUtil.SP_STRING_EMPTY);
|
||||||
final Button reassignSoftModule = assignSoftModuleButton(softwareModuleName);
|
final Button reassignSoftModule = assignSoftModuleButton(softwareModuleName);
|
||||||
softwareModule.setValue(softwareModuleName);
|
softwareModule.setValue(softwareModuleName);
|
||||||
softwareModule.setDescription(softwareModuleName);
|
softwareModule.setDescription(softwareModuleName);
|
||||||
softwareModule.setId(softwareModuleName+"-label");
|
softwareModule.setId(softwareModuleName + "-label");
|
||||||
horizontalLayout.addComponent(softwareModule);
|
horizontalLayout.addComponent(softwareModule);
|
||||||
horizontalLayout.setExpandRatio(softwareModule, 1f);
|
horizontalLayout.setExpandRatio(softwareModule, 1f);
|
||||||
horizontalLayout.addComponent(reassignSoftModule);
|
horizontalLayout.addComponent(reassignSoftModule);
|
||||||
verticalLayout.addComponent(horizontalLayout);
|
verticalLayout.addComponent(horizontalLayout);
|
||||||
return verticalLayout;
|
return verticalLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
private VerticalLayout createSoftwareModuleTab() {
|
private VerticalLayout createSoftwareModuleTab() {
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ public final class SPUIDefinitions {
|
|||||||
* New Create Update option group id.
|
* New Create Update option group id.
|
||||||
*/
|
*/
|
||||||
public static final String CREATE_OPTION_GROUP_DISTRIBUTION_SET_TYPE_ID = "create.option.group.dist.set.type.id";
|
public static final String CREATE_OPTION_GROUP_DISTRIBUTION_SET_TYPE_ID = "create.option.group.dist.set.type.id";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign option group id(Firmware/Software).
|
* Assign option group id(Firmware/Software).
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user