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;
}
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_DATE, i18n.get("header.createdDate"), 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 assignedDistributionSet;
private TargetIdName targetIdName;
private String assignedDistNameVersion;
@@ -249,6 +251,21 @@ public class ProxyTarget extends Target {
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
*/
@@ -297,4 +314,5 @@ public class ProxyTarget extends Target {
public void setStatus(final Status status) {
this.status = status;
}
}

View File

@@ -8,15 +8,23 @@
*/
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.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.PostConstruct;
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.ui.components.SPUIComponentProvider;
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 String ASSIGN_DIST_SET = "assignedDistributionSet";
private static final String INSTALL_DIST_SET = "installedDistributionSet";
/**
* Initialize the Action History Table.
*/
@@ -87,6 +99,7 @@ public class CreateOrUpdateFilterTable extends Table {
setId(SPUIComponetIdProvider.CUSTOM_FILTER_TARGET_TABLE_ID);
setSelectable(false);
eventBus.subscribe(this);
setItemDescriptionGenerator(new TooltipGenerator());
}
@PreDestroy
@@ -160,6 +173,9 @@ public class CreateOrUpdateFilterTable extends Table {
private void setCollapsibleColumns() {
setColumnCollapsed(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, 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.VAR_TARGET_STATUS, TargetUpdateStatus.class, null);
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() {
@@ -244,4 +263,58 @@ public class CreateOrUpdateFilterTable extends Table {
populateTableData();
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) {
prxyTarget.setInstalledDistributionSet(null);
prxyTarget.setAssignedDistributionSet(null);
} else {
final Target target = getTargetManagement().findTargetByControllerIDWithDetails(targ.getControllerId());
final DistributionSet installedDistributionSet = target.getTargetInfo().getInstalledDistributionSet();
prxyTarget.setInstalledDistNameVersion(HawkbitCommonUtil.getFormattedNameVersion(
installedDistributionSet.getName(), installedDistributionSet.getVersion()));
prxyTarget.setInstalledDistributionSet(installedDistributionSet);
final DistributionSet assignedDistributionSet = target.getAssignedDistributionSet();
prxyTarget.setAssignedDistNameVersion(HawkbitCommonUtil.getFormattedNameVersion(
assignedDistributionSet.getName(), assignedDistributionSet.getVersion()));
prxyTarget.setAssignedDistributionSet(assignedDistributionSet);
}

View File

@@ -8,6 +8,11 @@
*/
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.Collection;
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.SpPermissionChecker;
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.SoftwareModule;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
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 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
private transient TargetManagement targetManagement;
@@ -137,6 +147,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
addActionHandler(this);
actionSelectAll = new ShortcutAction(i18n.get("action.target.table.selectall"));
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() {
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;
import java.util.Set;
import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
import com.vaadin.server.FontAwesome;
@@ -19,123 +22,196 @@ import com.vaadin.server.FontAwesome;
*/
public class ProxyRollout extends Rollout {
private static final long serialVersionUID = 4539849939617681918L;
private static final long serialVersionUID = 4539849939617681918L;
private String distributionSetNameVersion;
private String distributionSetNameVersion;
private String createdDate;
private String createdDate;
private String modifiedDate;
private String modifiedDate;
private Long numberOfGroups;
private Long numberOfGroups;
private Boolean isActionRecieved = Boolean.FALSE;
private Boolean isActionRecieved = Boolean.FALSE;
private String totalTargetsCount;
private Boolean isRequiredMigrationStep = Boolean.FALSE;
private RolloutRendererData rolloutRendererData;
private String totalTargetsCount;
private RolloutRendererData rolloutRendererData;
public RolloutRendererData getRolloutRendererData() {
return rolloutRendererData;
}
private String discription;
public void setRolloutRendererData(RolloutRendererData rendererData) {
this.rolloutRendererData = rendererData;
}
private String type;
/**
* @return the distributionSetNameVersion
*/
public String getDistributionSetNameVersion() {
return distributionSetNameVersion;
}
private Set<SoftwareModule> swModules;
/**
* @param distributionSetNameVersion
* the distributionSetNameVersion to set
*/
public void setDistributionSetNameVersion(final String distributionSetNameVersion) {
this.distributionSetNameVersion = distributionSetNameVersion;
}
/**
* @return the isRequiredMigrationStep
*/
/**
* @return the numberOfGroups
*/
public Long getNumberOfGroups() {
return numberOfGroups;
}
public Boolean getIsRequiredMigrationStep() {
return isRequiredMigrationStep;
}
/**
* @param numberOfGroups
* the numberOfGroups to set
*/
public void setNumberOfGroups(final Long numberOfGroups) {
this.numberOfGroups = numberOfGroups;
}
/**
* @param isRequiredMigrationStep
* the isRequiredMigrationStep to set
*/
/**
* @return the createdDate
*/
public String getCreatedDate() {
return createdDate;
}
public void setIsRequiredMigrationStep(Boolean isRequiredMigrationStep) {
this.isRequiredMigrationStep = isRequiredMigrationStep;
}
/**
* @param createdDate
* the createdDate to set
*/
public void setCreatedDate(final String createdDate) {
this.createdDate = createdDate;
}
/**
* @return the discription
*/
/**
* @return the modifiedDate
*/
public String getModifiedDate() {
return modifiedDate;
}
public String getDiscription() {
return discription;
}
/**
* @param modifiedDate
* the modifiedDate to set
*/
public void setModifiedDate(final String modifiedDate) {
this.modifiedDate = modifiedDate;
}
/**
* @param discription
* the discription to set
*/
/**
* @return the isActionRecieved
*/
public Boolean getIsActionRecieved() {
return isActionRecieved;
}
public void setDiscription(String discription) {
this.discription = discription;
}
/**
* @param isActionRecieved
* the isActionRecieved to set
*/
public void setIsActionRecieved(final Boolean isActionRecieved) {
this.isActionRecieved = isActionRecieved;
}
/**
* @return the type
*/
public String getType() {
return type;
}
/**
* @return the totalTargetsCount
*/
public String getTotalTargetsCount() {
return totalTargetsCount;
}
/**
* @param type
* the type to set
*/
/**
* @param totalTargetsCount
* the totalTargetsCount to set
*/
public void setTotalTargetsCount(final String totalTargetsCount) {
this.totalTargetsCount = totalTargetsCount;
}
public void setType(String type) {
this.type = type;
}
public String getAction() {
return FontAwesome.CIRCLE_O.getHtml();
}
/**
*
* @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() {
return rolloutRendererData;
}
public void setRolloutRendererData(RolloutRendererData rendererData) {
this.rolloutRendererData = rendererData;
}
/**
* @return the distributionSetNameVersion
*/
public String getDistributionSetNameVersion() {
return distributionSetNameVersion;
}
/**
* @param distributionSetNameVersion
* the distributionSetNameVersion to set
*/
public void setDistributionSetNameVersion(final String distributionSetNameVersion) {
this.distributionSetNameVersion = distributionSetNameVersion;
}
/**
* @return the numberOfGroups
*/
public Long getNumberOfGroups() {
return numberOfGroups;
}
/**
* @param numberOfGroups
* the numberOfGroups to set
*/
public void setNumberOfGroups(final Long numberOfGroups) {
this.numberOfGroups = numberOfGroups;
}
/**
* @return the createdDate
*/
public String getCreatedDate() {
return createdDate;
}
/**
* @param createdDate
* the createdDate to set
*/
public void setCreatedDate(final String createdDate) {
this.createdDate = createdDate;
}
/**
* @return the modifiedDate
*/
public String getModifiedDate() {
return modifiedDate;
}
/**
* @param modifiedDate
* the modifiedDate to set
*/
public void setModifiedDate(final String modifiedDate) {
this.modifiedDate = modifiedDate;
}
/**
* @return the isActionRecieved
*/
public Boolean getIsActionRecieved() {
return isActionRecieved;
}
/**
* @param isActionRecieved
* the isActionRecieved to set
*/
public void setIsActionRecieved(final Boolean isActionRecieved) {
this.isActionRecieved = isActionRecieved;
}
/**
* @return the totalTargetsCount
*/
public String getTotalTargetsCount() {
return totalTargetsCount;
}
/**
* @param totalTargetsCount
* the totalTargetsCount to set
*/
public void setTotalTargetsCount(final String totalTargetsCount) {
this.totalTargetsCount = totalTargetsCount;
}
public String getAction() {
return FontAwesome.CIRCLE_O.getHtml();
}
}

View File

@@ -139,6 +139,11 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
proxyRollout.setTotalTargetCountStatus(totalTargetCountActionStatus);
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);
}
return proxyRolloutList;

View File

@@ -8,18 +8,25 @@
*/
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.Arrays;
import java.util.EnumMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import org.eclipse.hawkbit.eventbus.event.RolloutChangeEvent;
import org.eclipse.hawkbit.repository.RolloutManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.model.Rollout;
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.ui.common.grid.AbstractGrid;
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 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";
@Autowired
@@ -160,8 +173,11 @@ public class RolloutListGrid extends AbstractGrid {
protected void addContainerProperties() {
final LazyQueryContainer rolloutGridContainer = (LazyQueryContainer) getContainerDataSource();
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(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,
false);
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DIST_NAME_VERSION, String.class, null, false,
@@ -216,6 +232,9 @@ public class RolloutListGrid extends AbstractGrid {
@Override
protected void setColumnHeaderNames() {
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_NUMBER_OF_GROUPS).setHeaderCaption(i18n.get("header.numberofgroups"));
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<>();
columnList.add(ROLLOUT_RENDERER_DATA);
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_TOTAL_TARGETS_COUNT_STATUS);
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_BY);
columnsToBeHidden.add(SPUILabelDefinitions.VAR_DESC);
columnsToBeHidden.add(IS_REQUIRED_MIGRATION_STEP);
columnsToBeHidden.add(DS_TYPE);
columnsToBeHidden.add(SW_MODULES);
for (final Object propertyId : columnsToBeHidden) {
getColumn(propertyId).setHidden(true);
}
@@ -456,10 +481,49 @@ public class RolloutListGrid extends AbstractGrid {
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {
return DistributionBarHelper
.getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());
} else if (SPUILabelDefinitions.VAR_DIST_NAME_VERSION.equals(cell.getPropertyId())) {
return getDSDetails(cell.getItem());
}
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 {
PAUSE, RESUME, START, UPDATE
}
@@ -569,14 +633,14 @@ public class RolloutListGrid extends AbstractGrid {
@Override
public TotalTargetCountStatus convertToModel(final String value,
final Class<? extends TotalTargetCountStatus> targetType, final Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
throws com.vaadin.data.util.converter.Converter.ConversionException {
return null;
}
@Override
public String convertToPresentation(final TotalTargetCountStatus value,
final Class<? extends String> targetType, final Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
throws com.vaadin.data.util.converter.Converter.ConversionException {
return DistributionBarHelper.getDistributionBarAsHTMLString(value.getStatusTotalCountMap());
}

View File

@@ -22,6 +22,7 @@ import java.util.TimeZone;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.repository.SoftwareManagement;
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.RolloutGroup;
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 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 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_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.
*/
@@ -1037,6 +1046,10 @@ public final class HawkbitCommonUtil {
targetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_POLL_STATUS_TOOL_TIP, String.class, null,
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);
}
/**