Merge pull request #151 from bsinno/Displaying-DistributionSet-Details-Tooltip

Displaying DistributionSet Details in Tooltip
This commit is contained in:
Michael Hirsch
2016-04-28 17:11:37 +02:00
9 changed files with 422 additions and 97 deletions

View File

@@ -323,6 +323,10 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
return columnList; return columnList;
} }
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.2F)); columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.2F));
columnList.add(new TableColumn(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER,
i18n.get("header.assigned.ds"), 0.1F));
columnList.add(new TableColumn(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER,
i18n.get("header.installed.ds"), 0.1F));
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_BY, i18n.get("header.createdBy"), 0.1F)); columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_BY, i18n.get("header.createdBy"), 0.1F));
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.1F)); columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.1F));
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.1F)); columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.1F));

View File

@@ -36,6 +36,8 @@ public class ProxyTarget extends Target {
private DistributionSet installedDistributionSet; private DistributionSet installedDistributionSet;
private DistributionSet assignedDistributionSet;
private TargetIdName targetIdName; private TargetIdName targetIdName;
private String assignedDistNameVersion; private String assignedDistNameVersion;
@@ -249,6 +251,21 @@ public class ProxyTarget extends Target {
this.installedDistributionSet = installedDistributionSet; this.installedDistributionSet = installedDistributionSet;
} }
/**
* @return the assignedDistributionSet
*/
public DistributionSet getAssignedDistributionSet() {
return assignedDistributionSet;
}
/**
* @param assignedDistributionSet
* the assignedDistributionSet to set
*/
public void setAssignedDistributionSet(DistributionSet assignedDistributionSet) {
this.assignedDistributionSet = assignedDistributionSet;
}
/** /**
* @return the targetIdName * @return the targetIdName
*/ */
@@ -297,4 +314,5 @@ public class ProxyTarget extends Target {
public void setStatus(final Status status) { public void setStatus(final Status status) {
this.status = status; this.status = status;
} }
} }

View File

@@ -8,15 +8,23 @@
*/ */
package org.eclipse.hawkbit.ui.filtermanagement; package org.eclipse.hawkbit.ui.filtermanagement;
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_LI_CLOSE_TAG;
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_LI_OPEN_TAG;
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_UL_CLOSE_TAG;
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_UL_OPEN_TAG;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy; import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus; import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider; import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent; import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
@@ -69,6 +77,10 @@ public class CreateOrUpdateFilterTable extends Table {
private static final int PROPERTY_DEPT = 3; private static final int PROPERTY_DEPT = 3;
private static final String ASSIGN_DIST_SET = "assignedDistributionSet";
private static final String INSTALL_DIST_SET = "installedDistributionSet";
/** /**
* Initialize the Action History Table. * Initialize the Action History Table.
*/ */
@@ -87,6 +99,7 @@ public class CreateOrUpdateFilterTable extends Table {
setId(SPUIComponetIdProvider.CUSTOM_FILTER_TARGET_TABLE_ID); setId(SPUIComponetIdProvider.CUSTOM_FILTER_TARGET_TABLE_ID);
setSelectable(false); setSelectable(false);
eventBus.subscribe(this); eventBus.subscribe(this);
setItemDescriptionGenerator(new TooltipGenerator());
} }
@PreDestroy @PreDestroy
@@ -160,6 +173,9 @@ public class CreateOrUpdateFilterTable extends Table {
private void setCollapsibleColumns() { private void setCollapsibleColumns() {
setColumnCollapsed(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, true); setColumnCollapsed(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, true);
setColumnCollapsed(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, true); setColumnCollapsed(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, true);
setColumnCollapsed(ASSIGN_DIST_SET, true);
setColumnCollapsed(INSTALL_DIST_SET, true);
} }
/** /**
@@ -176,6 +192,9 @@ public class CreateOrUpdateFilterTable extends Table {
container.addContainerProperty(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER, String.class, null); container.addContainerProperty(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER, String.class, null);
container.addContainerProperty(SPUILabelDefinitions.VAR_TARGET_STATUS, TargetUpdateStatus.class, null); container.addContainerProperty(SPUILabelDefinitions.VAR_TARGET_STATUS, TargetUpdateStatus.class, null);
container.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, "", false, true); container.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, "", false, true);
container.addContainerProperty(ASSIGN_DIST_SET, DistributionSet.class, null, false, true);
container.addContainerProperty(INSTALL_DIST_SET, DistributionSet.class, null, false, true);
} }
private List<TableColumn> getVisbleColumns() { private List<TableColumn> getVisbleColumns() {
@@ -244,4 +263,58 @@ public class CreateOrUpdateFilterTable extends Table {
populateTableData(); populateTableData();
eventBus.publish(this, CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON); eventBus.publish(this, CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON);
} }
public class TooltipGenerator implements ItemDescriptionGenerator {
private static final long serialVersionUID = 688730421728162456L;
@Override
public String generateDescription(final Component source, final Object itemId, final Object propertyId) {
final DistributionSet distributionSet;
final Item item = getItem(itemId);
if (propertyId != null) {
if (propertyId.equals(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER)) {
distributionSet = (DistributionSet) item.getItemProperty(ASSIGN_DIST_SET).getValue();
return getDSDetails(distributionSet);
} else if (propertyId.equals(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER)) {
distributionSet = (DistributionSet) item.getItemProperty(INSTALL_DIST_SET).getValue();
return getDSDetails(distributionSet);
}
}
return null;
}
private String getDSDetails(final DistributionSet distributionSet) {
final StringBuilder swModuleNames = new StringBuilder();
final StringBuilder swModuleVendors = new StringBuilder();
final Set<SoftwareModule> swModules = distributionSet.getModules();
swModules.forEach(swModule -> {
swModuleNames.append(swModule.getName());
swModuleNames.append(" , ");
swModuleVendors.append(swModule.getVendor());
swModuleVendors.append(" , ");
});
final StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(HTML_UL_OPEN_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append(" DistributionSet Description : ").append(distributionSet.getDescription());
stringBuilder.append(HTML_LI_CLOSE_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append(" DistributionSet Type : ").append((distributionSet.getType()).getName());
stringBuilder.append(HTML_LI_CLOSE_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append(" Required Migration step : ")
.append(distributionSet.isRequiredMigrationStep() ? "Yes" : "No");
stringBuilder.append(HTML_LI_CLOSE_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append("SoftWare Modules : ").append(swModuleNames.toString());
stringBuilder.append(HTML_LI_CLOSE_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append("Vendor(s) : ").append(swModuleVendors.toString());
stringBuilder.append(HTML_LI_CLOSE_TAG);
stringBuilder.append(HTML_UL_CLOSE_TAG);
return stringBuilder.toString();
}
}
} }

View File

@@ -137,11 +137,16 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
if (pinnedDistId == null) { if (pinnedDistId == null) {
prxyTarget.setInstalledDistributionSet(null); prxyTarget.setInstalledDistributionSet(null);
prxyTarget.setAssignedDistributionSet(null); prxyTarget.setAssignedDistributionSet(null);
} else { } else {
final Target target = getTargetManagement().findTargetByControllerIDWithDetails(targ.getControllerId()); final Target target = getTargetManagement().findTargetByControllerIDWithDetails(targ.getControllerId());
final DistributionSet installedDistributionSet = target.getTargetInfo().getInstalledDistributionSet(); final DistributionSet installedDistributionSet = target.getTargetInfo().getInstalledDistributionSet();
prxyTarget.setInstalledDistNameVersion(HawkbitCommonUtil.getFormattedNameVersion(
installedDistributionSet.getName(), installedDistributionSet.getVersion()));
prxyTarget.setInstalledDistributionSet(installedDistributionSet); prxyTarget.setInstalledDistributionSet(installedDistributionSet);
final DistributionSet assignedDistributionSet = target.getAssignedDistributionSet(); final DistributionSet assignedDistributionSet = target.getAssignedDistributionSet();
prxyTarget.setAssignedDistNameVersion(HawkbitCommonUtil.getFormattedNameVersion(
assignedDistributionSet.getName(), assignedDistributionSet.getVersion()));
prxyTarget.setAssignedDistributionSet(assignedDistributionSet); prxyTarget.setAssignedDistributionSet(assignedDistributionSet);
} }

View File

@@ -8,6 +8,11 @@
*/ */
package org.eclipse.hawkbit.ui.management.targettable; package org.eclipse.hawkbit.ui.management.targettable;
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_LI_CLOSE_TAG;
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_LI_OPEN_TAG;
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_UL_CLOSE_TAG;
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_UL_OPEN_TAG;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@@ -24,7 +29,9 @@ import org.eclipse.hawkbit.eventbus.event.TargetInfoUpdateEvent;
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest; import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.SpPermissionChecker; import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TargetManagement; import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName; import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery; import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
import org.eclipse.hawkbit.repository.model.TargetIdName; import org.eclipse.hawkbit.repository.model.TargetIdName;
@@ -110,6 +117,9 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
private static final int PROPERTY_DEPT = 3; private static final int PROPERTY_DEPT = 3;
private static final String ACTION_NOT_ALLOWED_MSG = "message.action.not.allowed"; private static final String ACTION_NOT_ALLOWED_MSG = "message.action.not.allowed";
private static final String ASSIGN_DIST_SET = "assignedDistributionSet";
private static final String INSTALL_DIST_SET = "installedDistributionSet";
@Autowired @Autowired
private transient TargetManagement targetManagement; private transient TargetManagement targetManagement;
@@ -137,6 +147,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
addActionHandler(this); addActionHandler(this);
actionSelectAll = new ShortcutAction(i18n.get("action.target.table.selectall")); actionSelectAll = new ShortcutAction(i18n.get("action.target.table.selectall"));
actionUnSelectAll = new ShortcutAction(i18n.get("action.target.table.clear")); actionUnSelectAll = new ShortcutAction(i18n.get("action.target.table.clear"));
setItemDescriptionGenerator(new TooltipGenerator());
} }
/** /**
@@ -1074,4 +1085,60 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
private boolean isFilteredByTags() { private boolean isFilteredByTags() {
return !managementUIState.getTargetTableFilters().getClickedTargetTags().isEmpty(); return !managementUIState.getTargetTableFilters().getClickedTargetTags().isEmpty();
} }
/**
* tooltip for assignedDS and installedDS
*/
protected class TooltipGenerator implements ItemDescriptionGenerator {
private static final long serialVersionUID = 688730421728162456L;
@Override
public String generateDescription(final Component source, final Object itemId, final Object propertyId) {
final DistributionSet distributionSet;
final Item item = getItem(itemId);
if (propertyId != null) {
if (propertyId.equals(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER)) {
distributionSet = (DistributionSet) item.getItemProperty(ASSIGN_DIST_SET).getValue();
return getDSDetails(distributionSet);
} else if (propertyId.equals(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER)) {
distributionSet = (DistributionSet) item.getItemProperty(INSTALL_DIST_SET).getValue();
return getDSDetails(distributionSet);
}
}
return null;
}
private String getDSDetails(final DistributionSet distributionSet) {
final StringBuilder swModuleNames = new StringBuilder();
final StringBuilder swModuleVendors = new StringBuilder();
final Set<SoftwareModule> swModules = distributionSet.getModules();
swModules.forEach(swModule -> {
swModuleNames.append(swModule.getName());
swModuleNames.append(" , ");
swModuleVendors.append(swModule.getVendor());
swModuleVendors.append(" , ");
});
final StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(HTML_UL_OPEN_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append(" DistributionSet Description : ").append(distributionSet.getDescription());
stringBuilder.append(HTML_LI_CLOSE_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append(" DistributionSet Type : ").append((distributionSet.getType()).getName());
stringBuilder.append(HTML_LI_CLOSE_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append(" Required Migration step : ")
.append(distributionSet.isRequiredMigrationStep() ? "Yes" : "No");
stringBuilder.append(HTML_LI_CLOSE_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append("SoftWare Modules : ").append(swModuleNames.toString());
stringBuilder.append(HTML_LI_CLOSE_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append("Vendor(s) : ").append(swModuleVendors.toString());
stringBuilder.append(HTML_LI_CLOSE_TAG);
stringBuilder.append(HTML_UL_CLOSE_TAG);
return stringBuilder.toString();
}
}
} }

View File

@@ -8,7 +8,10 @@
*/ */
package org.eclipse.hawkbit.ui.rollout.rollout; package org.eclipse.hawkbit.ui.rollout.rollout;
import java.util.Set;
import org.eclipse.hawkbit.repository.model.Rollout; import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData; import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
import com.vaadin.server.FontAwesome; import com.vaadin.server.FontAwesome;
@@ -31,10 +34,83 @@ public class ProxyRollout extends Rollout {
private Boolean isActionRecieved = Boolean.FALSE; private Boolean isActionRecieved = Boolean.FALSE;
private Boolean isRequiredMigrationStep = Boolean.FALSE;
private String totalTargetsCount; private String totalTargetsCount;
private RolloutRendererData rolloutRendererData; private RolloutRendererData rolloutRendererData;
private String discription;
private String type;
private Set<SoftwareModule> swModules;
/**
* @return the isRequiredMigrationStep
*/
public Boolean getIsRequiredMigrationStep() {
return isRequiredMigrationStep;
}
/**
* @param isRequiredMigrationStep
* the isRequiredMigrationStep to set
*/
public void setIsRequiredMigrationStep(Boolean isRequiredMigrationStep) {
this.isRequiredMigrationStep = isRequiredMigrationStep;
}
/**
* @return the discription
*/
public String getDiscription() {
return discription;
}
/**
* @param discription
* the discription to set
*/
public void setDiscription(String discription) {
this.discription = discription;
}
/**
* @return the type
*/
public String getType() {
return type;
}
/**
* @param type
* the type to set
*/
public void setType(String type) {
this.type = type;
}
/**
*
* @return the Set of Software modules
*/
public Set<SoftwareModule> getSwModules() {
return swModules;
}
/**
* @param swModules
* Set<SoftwareModule> to set
*/
public void setSwModules(Set<SoftwareModule> swModules) {
this.swModules = swModules;
}
public RolloutRendererData getRolloutRendererData() { public RolloutRendererData getRolloutRendererData() {
return rolloutRendererData; return rolloutRendererData;

View File

@@ -139,6 +139,11 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
proxyRollout.setTotalTargetCountStatus(totalTargetCountActionStatus); proxyRollout.setTotalTargetCountStatus(totalTargetCountActionStatus);
proxyRollout.setTotalTargetsCount(String.valueOf(rollout.getTotalTargets())); proxyRollout.setTotalTargetsCount(String.valueOf(rollout.getTotalTargets()));
proxyRollout.setDescription(distributionSet.getDescription());
proxyRollout.setType(distributionSet.getType().getName());
proxyRollout.setIsRequiredMigrationStep(distributionSet.isRequiredMigrationStep());
proxyRollout.setSwModules(distributionSet.getModules());
proxyRolloutList.add(proxyRollout); proxyRolloutList.add(proxyRollout);
} }
return proxyRolloutList; return proxyRolloutList;

View File

@@ -8,18 +8,25 @@
*/ */
package org.eclipse.hawkbit.ui.rollout.rollout; package org.eclipse.hawkbit.ui.rollout.rollout;
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_LI_CLOSE_TAG;
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_LI_OPEN_TAG;
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_UL_CLOSE_TAG;
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_UL_OPEN_TAG;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set;
import org.eclipse.hawkbit.eventbus.event.RolloutChangeEvent; import org.eclipse.hawkbit.eventbus.event.RolloutChangeEvent;
import org.eclipse.hawkbit.repository.RolloutManagement; import org.eclipse.hawkbit.repository.RolloutManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker; import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.model.Rollout; import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus; import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus; import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
import org.eclipse.hawkbit.ui.common.grid.AbstractGrid; import org.eclipse.hawkbit.ui.common.grid.AbstractGrid;
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData; import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
@@ -78,6 +85,12 @@ public class RolloutListGrid extends AbstractGrid {
private static final String START_OPTION = "Start"; private static final String START_OPTION = "Start";
private static final String DS_TYPE = "type";
private static final String SW_MODULES = "swModules";
private static final String IS_REQUIRED_MIGRATION_STEP = "isRequiredMigrationStep";
private static final String ROLLOUT_RENDERER_DATA = "rolloutRendererData"; private static final String ROLLOUT_RENDERER_DATA = "rolloutRendererData";
@Autowired @Autowired
@@ -160,8 +173,11 @@ public class RolloutListGrid extends AbstractGrid {
protected void addContainerProperties() { protected void addContainerProperties() {
final LazyQueryContainer rolloutGridContainer = (LazyQueryContainer) getContainerDataSource(); final LazyQueryContainer rolloutGridContainer = (LazyQueryContainer) getContainerDataSource();
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false); rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false);
rolloutGridContainer.addContainerProperty(DS_TYPE, String.class, null, false, false);
rolloutGridContainer.addContainerProperty(SW_MODULES, Set.class, null, false, false);
rolloutGridContainer.addContainerProperty(ROLLOUT_RENDERER_DATA, RolloutRendererData.class, null, false, false); rolloutGridContainer.addContainerProperty(ROLLOUT_RENDERER_DATA, RolloutRendererData.class, null, false, false);
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false); rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false);
rolloutGridContainer.addContainerProperty(IS_REQUIRED_MIGRATION_STEP, boolean.class, null, false, false);
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutStatus.class, null, false, rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutStatus.class, null, false,
false); false);
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DIST_NAME_VERSION, String.class, null, false, rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DIST_NAME_VERSION, String.class, null, false,
@@ -216,6 +232,9 @@ public class RolloutListGrid extends AbstractGrid {
@Override @Override
protected void setColumnHeaderNames() { protected void setColumnHeaderNames() {
getColumn(ROLLOUT_RENDERER_DATA).setHeaderCaption(i18n.get("header.name")); getColumn(ROLLOUT_RENDERER_DATA).setHeaderCaption(i18n.get("header.name"));
getColumn(DS_TYPE).setHeaderCaption("Type");
getColumn(SW_MODULES).setHeaderCaption("swModules");
getColumn(IS_REQUIRED_MIGRATION_STEP).setHeaderCaption("IsRequiredMigrationStep");
getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).setHeaderCaption(i18n.get("header.distributionset")); getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).setHeaderCaption(i18n.get("header.distributionset"));
getColumn(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setHeaderCaption(i18n.get("header.numberofgroups")); getColumn(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setHeaderCaption(i18n.get("header.numberofgroups"));
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setHeaderCaption(i18n.get("header.total.targets")); getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setHeaderCaption(i18n.get("header.total.targets"));
@@ -240,6 +259,9 @@ public class RolloutListGrid extends AbstractGrid {
final List<Object> columnList = new ArrayList<>(); final List<Object> columnList = new ArrayList<>();
columnList.add(ROLLOUT_RENDERER_DATA); columnList.add(ROLLOUT_RENDERER_DATA);
columnList.add(SPUILabelDefinitions.VAR_DIST_NAME_VERSION); columnList.add(SPUILabelDefinitions.VAR_DIST_NAME_VERSION);
columnList.add(DS_TYPE);
columnList.add(SW_MODULES);
columnList.add(IS_REQUIRED_MIGRATION_STEP);
columnList.add(SPUILabelDefinitions.VAR_STATUS); columnList.add(SPUILabelDefinitions.VAR_STATUS);
columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS); columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS);
columnList.add(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS); columnList.add(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS);
@@ -264,6 +286,9 @@ public class RolloutListGrid extends AbstractGrid {
columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_DATE); columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_DATE);
columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_BY); columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_BY);
columnsToBeHidden.add(SPUILabelDefinitions.VAR_DESC); columnsToBeHidden.add(SPUILabelDefinitions.VAR_DESC);
columnsToBeHidden.add(IS_REQUIRED_MIGRATION_STEP);
columnsToBeHidden.add(DS_TYPE);
columnsToBeHidden.add(SW_MODULES);
for (final Object propertyId : columnsToBeHidden) { for (final Object propertyId : columnsToBeHidden) {
getColumn(propertyId).setHidden(true); getColumn(propertyId).setHidden(true);
} }
@@ -456,10 +481,49 @@ public class RolloutListGrid extends AbstractGrid {
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) { } else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {
return DistributionBarHelper return DistributionBarHelper
.getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap()); .getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());
} else if (SPUILabelDefinitions.VAR_DIST_NAME_VERSION.equals(cell.getPropertyId())) {
return getDSDetails(cell.getItem());
} }
return null; return null;
} }
private String getDSDetails(final Item rolloutItem) {
final StringBuilder swModuleNames = new StringBuilder();
final StringBuilder swModuleVendors = new StringBuilder();
final Set<SoftwareModule> swModules = (Set<SoftwareModule>) rolloutItem.getItemProperty(SW_MODULES).getValue();
swModules.forEach(swModule -> {
swModuleNames.append(swModule.getName());
swModuleNames.append(" , ");
swModuleVendors.append(swModule.getVendor());
swModuleVendors.append(" , ");
});
final StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(HTML_UL_OPEN_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append(" DistributionSet Description : ")
.append((String) rolloutItem.getItemProperty(SPUILabelDefinitions.VAR_DESC).getValue());
stringBuilder.append(HTML_LI_CLOSE_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append(" DistributionSet Type : ")
.append((String) rolloutItem.getItemProperty(DS_TYPE).getValue());
stringBuilder.append(HTML_LI_CLOSE_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append("Required Migration step : ")
.append((boolean) rolloutItem.getItemProperty(IS_REQUIRED_MIGRATION_STEP).getValue() ? "Yes" : "No");
stringBuilder.append(HTML_LI_CLOSE_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append("SoftWare Modules : ").append(swModuleNames.toString());
stringBuilder.append(HTML_LI_CLOSE_TAG);
stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append("Vendor(s) : ").append(swModuleVendors.toString());
stringBuilder.append(HTML_LI_CLOSE_TAG);
stringBuilder.append(HTML_UL_CLOSE_TAG);
return stringBuilder.toString();
}
enum ACTION { enum ACTION {
PAUSE, RESUME, START, UPDATE PAUSE, RESUME, START, UPDATE
} }

View File

@@ -22,6 +22,7 @@ import java.util.TimeZone;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.repository.SoftwareManagement; import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.AssignmentResult; import org.eclipse.hawkbit.repository.model.AssignmentResult;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.NamedEntity; import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.RolloutGroup; import org.eclipse.hawkbit.repository.model.RolloutGroup;
import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModule;
@@ -72,6 +73,11 @@ public final class HawkbitCommonUtil {
*/ */
public static final String SPAN_CLOSE = "</span>"; public static final String SPAN_CLOSE = "</span>";
public static final String HTML_LI_CLOSE_TAG = "</li>";
public static final String HTML_LI_OPEN_TAG = "<li>";
public static final String HTML_UL_CLOSE_TAG = "</ul>";
public static final String HTML_UL_OPEN_TAG = "<ul>";
private static final Logger LOG = LoggerFactory.getLogger(HawkbitCommonUtil.class); private static final Logger LOG = LoggerFactory.getLogger(HawkbitCommonUtil.class);
private static final String JS_DRAG_COUNT_REM_CHILD = " if(x) { document.head.removeChild(x); } "; private static final String JS_DRAG_COUNT_REM_CHILD = " if(x) { document.head.removeChild(x); } ";
@@ -103,6 +109,9 @@ public final class HawkbitCommonUtil {
private static final String DELETE_DROP_CREATE_SCRIPT = "var q = document.getElementById('show-delete-drop-hint'); if(q) { } else { showDeleteDrop = document.createElement('style'); showDeleteDrop.id=\"show-delete-drop-hint\"; document.head.appendChild(showDeleteDrop); }"; private static final String DELETE_DROP_CREATE_SCRIPT = "var q = document.getElementById('show-delete-drop-hint'); if(q) { } else { showDeleteDrop = document.createElement('style'); showDeleteDrop.id=\"show-delete-drop-hint\"; document.head.appendChild(showDeleteDrop); }";
private static final String DELETE_TAG_DROP_REMOVE_SCRIPT = "var o = document.getElementById('show-delete-drop-hint'); if(o) { document.head.removeChild(o); } "; private static final String DELETE_TAG_DROP_REMOVE_SCRIPT = "var o = document.getElementById('show-delete-drop-hint'); if(o) { document.head.removeChild(o); } ";
private static final String ASSIGN_DIST_SET = "assignedDistributionSet";
private static final String INSTALL_DIST_SET = "installedDistributionSet";
/** /**
* Define empty string. * Define empty string.
*/ */
@@ -1037,6 +1046,10 @@ public final class HawkbitCommonUtil {
targetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_POLL_STATUS_TOOL_TIP, String.class, null, targetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_POLL_STATUS_TOOL_TIP, String.class, null,
false, true); false, true);
targetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, "", false, true); targetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, "", false, true);
targetTableContainer.addContainerProperty(ASSIGN_DIST_SET, DistributionSet.class, null, false, true);
targetTableContainer.addContainerProperty(INSTALL_DIST_SET, DistributionSet.class, null, false, true);
} }
/** /**