From d8d026e9a1167749b6d9f4a0f22d6c2ba814a4e7 Mon Sep 17 00:00:00 2001 From: venu1278 Date: Thu, 28 Apr 2016 15:17:01 +0530 Subject: [PATCH] Displaying DistributionSet Details in Tooltip Signed-off-by: venu1278 --- .../ui/common/table/AbstractTable.java | 6 +- .../hawkbit/ui/components/ProxyTarget.java | 488 ++++--- .../CreateOrUpdateFilterTable.java | 448 +++--- .../targettable/TargetBeanQuery.java | 330 ++--- .../management/targettable/TargetTable.java | 109 +- .../ui/rollout/rollout/ProxyRollout.java | 317 +++-- .../ui/rollout/rollout/RolloutBeanQuery.java | 10 +- .../ui/rollout/rollout/RolloutListGrid.java | 1228 ++++++++--------- .../hawkbit/ui/utils/HawkbitCommonUtil.java | 6 +- 9 files changed, 1468 insertions(+), 1474 deletions(-) diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/table/AbstractTable.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/table/AbstractTable.java index 7e62eef1f..843d86ca3 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/table/AbstractTable.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/table/AbstractTable.java @@ -324,9 +324,9 @@ public abstract class AbstractTable extends Table { } 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)); + 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)); diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/ProxyTarget.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/ProxyTarget.java index 084890f87..9ac39616d 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/ProxyTarget.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/ProxyTarget.java @@ -10,11 +10,9 @@ package org.eclipse.hawkbit.ui.components; import java.net.URI; import java.security.SecureRandom; -import java.util.Set; import org.eclipse.hawkbit.repository.model.Action.Status; import org.eclipse.hawkbit.repository.model.DistributionSet; -import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.TargetIdName; import org.eclipse.hawkbit.repository.model.TargetUpdateStatus; @@ -28,293 +26,293 @@ import org.eclipse.hawkbit.repository.model.TargetUpdateStatus; * */ public class ProxyTarget extends Target { - private static final long serialVersionUID = -8891449133620645310L; - private String controllerId; - private URI address = null; - private Long lastTargetQuery = null; - private Long installationDate; + private static final long serialVersionUID = -8891449133620645310L; + private String controllerId; + private URI address = null; + private Long lastTargetQuery = null; + private Long installationDate; - private TargetUpdateStatus updateStatus = TargetUpdateStatus.UNKNOWN; + private TargetUpdateStatus updateStatus = TargetUpdateStatus.UNKNOWN; - private DistributionSet installedDistributionSet; + private DistributionSet installedDistributionSet; - private DistributionSet assignedDistributionSet; + private DistributionSet assignedDistributionSet; - private TargetIdName targetIdName; + private TargetIdName targetIdName; - private String assignedDistNameVersion; + private String assignedDistNameVersion; - private String installedDistNameVersion; + private String installedDistNameVersion; - private String pollStatusToolTip; + private String pollStatusToolTip; - private String createdByUser; + private String createdByUser; - private String createdDate; + private String createdDate; - private String lastModifiedDate; + private String lastModifiedDate; - private String modifiedByUser; + private String modifiedByUser; - private Status status; + private Status status; - /** - * @param controllerId - */ - public ProxyTarget() { - super(null); - final Integer generatedId = new SecureRandom().nextInt(Integer.MAX_VALUE) - Integer.MAX_VALUE; - targetIdName = new TargetIdName(generatedId, generatedId.toString(), generatedId.toString()); - } + /** + * @param controllerId + */ + public ProxyTarget() { + super(null); + final Integer generatedId = new SecureRandom().nextInt(Integer.MAX_VALUE) - Integer.MAX_VALUE; + targetIdName = new TargetIdName(generatedId, generatedId.toString(), generatedId.toString()); + } - /** - * @return the createdByUser - */ - public String getCreatedByUser() { - return createdByUser; - } + /** + * @return the createdByUser + */ + public String getCreatedByUser() { + return createdByUser; + } - /** - * @param createdByUser - * the createdByUser to set - */ - public void setCreatedByUser(final String createdByUser) { - this.createdByUser = createdByUser; - } + /** + * @param createdByUser + * the createdByUser to set + */ + public void setCreatedByUser(final String createdByUser) { + this.createdByUser = createdByUser; + } - /** - * @return the createdDate - */ - public String getCreatedDate() { - return createdDate; - } + /** + * @return the createdDate + */ + public String getCreatedDate() { + return createdDate; + } - /** - * @param createdDate - * the createdDate to set - */ - public void setCreatedDate(final String createdDate) { - this.createdDate = createdDate; - } + /** + * @param createdDate + * the createdDate to set + */ + public void setCreatedDate(final String createdDate) { + this.createdDate = createdDate; + } - /** - * @return the modifiedByUser - */ - public String getModifiedByUser() { - return modifiedByUser; - } + /** + * @return the modifiedByUser + */ + public String getModifiedByUser() { + return modifiedByUser; + } - /** - * @param modifiedByUser - * the modifiedByUser to set - */ - public void setModifiedByUser(final String modifiedByUser) { - this.modifiedByUser = modifiedByUser; - } + /** + * @param modifiedByUser + * the modifiedByUser to set + */ + public void setModifiedByUser(final String modifiedByUser) { + this.modifiedByUser = modifiedByUser; + } - /** - * @return the lastModifiedDate - */ - public String getLastModifiedDate() { - return lastModifiedDate; - } + /** + * @return the lastModifiedDate + */ + public String getLastModifiedDate() { + return lastModifiedDate; + } - /** - * @param lastModifiedDate - * the lastModifiedDate to set - */ - public void setLastModifiedDate(final String lastModifiedDate) { - this.lastModifiedDate = lastModifiedDate; - } + /** + * @param lastModifiedDate + * the lastModifiedDate to set + */ + public void setLastModifiedDate(final String lastModifiedDate) { + this.lastModifiedDate = lastModifiedDate; + } - /** - * @return the assignedDistNameVersion - */ - public String getAssignedDistNameVersion() { - return assignedDistNameVersion; - } + /** + * @return the assignedDistNameVersion + */ + public String getAssignedDistNameVersion() { + return assignedDistNameVersion; + } - /** - * @param assignedDistNameVersion - * the assignedDistNameVersion to set - */ - public void setAssignedDistNameVersion(final String assignedDistNameVersion) { - this.assignedDistNameVersion = assignedDistNameVersion; - } + /** + * @param assignedDistNameVersion + * the assignedDistNameVersion to set + */ + public void setAssignedDistNameVersion(final String assignedDistNameVersion) { + this.assignedDistNameVersion = assignedDistNameVersion; + } - /** - * @return the installedDistNameVersion - */ - public String getInstalledDistNameVersion() { - return installedDistNameVersion; - } + /** + * @return the installedDistNameVersion + */ + public String getInstalledDistNameVersion() { + return installedDistNameVersion; + } - /** - * @param installedDistNameVersion - * the installedDistNameVersion to set - */ - public void setInstalledDistNameVersion(final String installedDistNameVersion) { - this.installedDistNameVersion = installedDistNameVersion; - } + /** + * @param installedDistNameVersion + * the installedDistNameVersion to set + */ + public void setInstalledDistNameVersion(final String installedDistNameVersion) { + this.installedDistNameVersion = installedDistNameVersion; + } - /** - * GET - ID. - * - * @return String as ID. - */ - @Override - public String getControllerId() { - return controllerId; - } + /** + * GET - ID. + * + * @return String as ID. + */ + @Override + public String getControllerId() { + return controllerId; + } - /** - * SET - ID. - * - * @param controllerId - * as ID - */ - @Override - public void setControllerId(final String controllerId) { - this.controllerId = controllerId; - } + /** + * SET - ID. + * + * @param controllerId + * as ID + */ + @Override + public void setControllerId(final String controllerId) { + this.controllerId = controllerId; + } - /** - * @return the ipAddress - */ - public URI getAddress() { - return address; - } + /** + * @return the ipAddress + */ + public URI getAddress() { + return address; + } - /** - * @param ipAddress - * the ipAddress to set - */ - public void setAddress(final URI address) { - this.address = address; - } + /** + * @param ipAddress + * the ipAddress to set + */ + public void setAddress(final URI address) { + this.address = address; + } - /** - * @return the lastTargetQuery - */ - public Long getLastTargetQuery() { - return lastTargetQuery; - } + /** + * @return the lastTargetQuery + */ + public Long getLastTargetQuery() { + return lastTargetQuery; + } - /** - * @param lastTargetQuery - * the lastTargetQuery to set - */ - public void setLastTargetQuery(final Long lastTargetQuery) { - this.lastTargetQuery = lastTargetQuery; - } + /** + * @param lastTargetQuery + * the lastTargetQuery to set + */ + public void setLastTargetQuery(final Long lastTargetQuery) { + this.lastTargetQuery = lastTargetQuery; + } - /** - * @return the installationDate - */ - public Long getInstallationDate() { - return installationDate; - } + /** + * @return the installationDate + */ + public Long getInstallationDate() { + return installationDate; + } - /** - * @param installationDate - * the installationDate to set - */ - public void setInstallationDate(final Long installationDate) { - this.installationDate = installationDate; - } + /** + * @param installationDate + * the installationDate to set + */ + public void setInstallationDate(final Long installationDate) { + this.installationDate = installationDate; + } - /** - * @return the updateStatus - */ - public TargetUpdateStatus getUpdateStatus() { - return updateStatus; - } + /** + * @return the updateStatus + */ + public TargetUpdateStatus getUpdateStatus() { + return updateStatus; + } - /** - * @param updateStatus - * the updateStatus to set - */ - public void setUpdateStatus(final TargetUpdateStatus updateStatus) { - this.updateStatus = updateStatus; - } + /** + * @param updateStatus + * the updateStatus to set + */ + public void setUpdateStatus(final TargetUpdateStatus updateStatus) { + this.updateStatus = updateStatus; + } - /** - * @return the installedDistributionSet - */ - public DistributionSet getInstalledDistributionSet() { - return installedDistributionSet; - } + /** + * @return the installedDistributionSet + */ + public DistributionSet getInstalledDistributionSet() { + return installedDistributionSet; + } - /** - * @param installedDistributionSet - * the installedDistributionSet to set - */ - public void setInstalledDistributionSet(final DistributionSet installedDistributionSet) { - this.installedDistributionSet = installedDistributionSet; - } + /** + * @param installedDistributionSet + * the installedDistributionSet to set + */ + public void setInstalledDistributionSet(final DistributionSet installedDistributionSet) { + this.installedDistributionSet = installedDistributionSet; + } - /** - * @return the assignedDistributionSet - */ - public DistributionSet getAssignedDistributionSet() { - return assignedDistributionSet; - } + /** + * @return the assignedDistributionSet + */ + public DistributionSet getAssignedDistributionSet() { + return assignedDistributionSet; + } - /** - * @param assignedDistributionSet - * the assignedDistributionSet to set - */ - public void setAssignedDistributionSet(DistributionSet assignedDistributionSet) { - this.assignedDistributionSet = assignedDistributionSet; - } + /** + * @param assignedDistributionSet + * the assignedDistributionSet to set + */ + public void setAssignedDistributionSet(DistributionSet assignedDistributionSet) { + this.assignedDistributionSet = assignedDistributionSet; + } - /** - * @return the targetIdName - */ - @Override - public TargetIdName getTargetIdName() { - if (this.targetIdName == null) { - return super.getTargetIdName(); - } - return this.targetIdName; - } + /** + * @return the targetIdName + */ + @Override + public TargetIdName getTargetIdName() { + if (this.targetIdName == null) { + return super.getTargetIdName(); + } + return this.targetIdName; + } - /** - * @param targetIdName - * the targetIdName to set - */ - public void setTargetIdName(final TargetIdName targetIdName) { - this.targetIdName = targetIdName; - } + /** + * @param targetIdName + * the targetIdName to set + */ + public void setTargetIdName(final TargetIdName targetIdName) { + this.targetIdName = targetIdName; + } - /** - * @return the pollStatusToolTip - */ - public String getPollStatusToolTip() { - return pollStatusToolTip; - } + /** + * @return the pollStatusToolTip + */ + public String getPollStatusToolTip() { + return pollStatusToolTip; + } - /** - * @param pollStatusToolTip - * the pollStatusToolTip to set - */ - public void setPollStatusToolTip(final String pollStatusToolTip) { - this.pollStatusToolTip = pollStatusToolTip; - } + /** + * @param pollStatusToolTip + * the pollStatusToolTip to set + */ + public void setPollStatusToolTip(final String pollStatusToolTip) { + this.pollStatusToolTip = pollStatusToolTip; + } - /** - * @return the status - */ - public Status getStatus() { - return status; - } + /** + * @return the status + */ + public Status getStatus() { + return status; + } - /** - * @param status - * the status to set - */ - public void setStatus(final Status status) { - this.status = status; - } + /** + * @param status + * the status to set + */ + public void setStatus(final Status status) { + this.status = status; + } } diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/CreateOrUpdateFilterTable.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/CreateOrUpdateFilterTable.java index d067b388b..cf8a514d4 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/CreateOrUpdateFilterTable.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/CreateOrUpdateFilterTable.java @@ -57,259 +57,259 @@ import com.vaadin.ui.themes.ValoTheme; @ViewScope public class CreateOrUpdateFilterTable extends Table { - private static final long serialVersionUID = 6887304217281629713L; + private static final long serialVersionUID = 6887304217281629713L; - @Autowired - private I18N i18n; + @Autowired + private I18N i18n; - @Autowired - private transient EventBus.SessionEventBus eventBus; + @Autowired + private transient EventBus.SessionEventBus eventBus; - @Autowired - private FilterManagementUIState filterManagementUIState; + @Autowired + private FilterManagementUIState filterManagementUIState; - private LazyQueryContainer container; + private LazyQueryContainer container; - 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 ASSIGN_DIST_SET = "assignedDistributionSet"; - private static final String INSTALL_DIST_SET = "installedDistributionSet"; + private static final String INSTALL_DIST_SET = "installedDistributionSet"; - /** - * Initialize the Action History Table. - */ - @PostConstruct - public void init() { - setStyleName("sp-table"); - setSizeFull(); - setImmediate(true); - setHeight(100.0f, Unit.PERCENTAGE); - addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES); - addStyleName(ValoTheme.TABLE_SMALL); - setColumnCollapsingAllowed(true); - addCustomGeneratedColumns(); - restoreOnLoad(); - populateTableData(); - setId(SPUIComponetIdProvider.CUSTOM_FILTER_TARGET_TABLE_ID); - setSelectable(false); - eventBus.subscribe(this); - setItemDescriptionGenerator(new TooltipGenerator()); - } + /** + * Initialize the Action History Table. + */ + @PostConstruct + public void init() { + setStyleName("sp-table"); + setSizeFull(); + setImmediate(true); + setHeight(100.0f, Unit.PERCENTAGE); + addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES); + addStyleName(ValoTheme.TABLE_SMALL); + setColumnCollapsingAllowed(true); + addCustomGeneratedColumns(); + restoreOnLoad(); + populateTableData(); + setId(SPUIComponetIdProvider.CUSTOM_FILTER_TARGET_TABLE_ID); + setSelectable(false); + eventBus.subscribe(this); + setItemDescriptionGenerator(new TooltipGenerator()); + } - @PreDestroy - void destroy() { - eventBus.unsubscribe(this); - } + @PreDestroy + void destroy() { + eventBus.unsubscribe(this); + } - @EventBusListenerMethod(scope = EventScope.SESSION) - void onEvent(final CustomFilterUIEvent custFUIEvent) { - if (custFUIEvent == CustomFilterUIEvent.TARGET_DETAILS_VIEW - || custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK) { - UI.getCurrent().access(() -> populateTableData()); - } else if (custFUIEvent == CustomFilterUIEvent.FILTER_TARGET_BY_QUERY) { - UI.getCurrent().access(() -> onQuery()); - } - } + @EventBusListenerMethod(scope = EventScope.SESSION) + void onEvent(final CustomFilterUIEvent custFUIEvent) { + if (custFUIEvent == CustomFilterUIEvent.TARGET_DETAILS_VIEW + || custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK) { + UI.getCurrent().access(() -> populateTableData()); + } else if (custFUIEvent == CustomFilterUIEvent.FILTER_TARGET_BY_QUERY) { + UI.getCurrent().access(() -> onQuery()); + } + } - private void restoreOnLoad() { - if (filterManagementUIState.isCreateFilterViewDisplayed()) { - filterManagementUIState.setFilterQueryValue(null); - } else { - filterManagementUIState.getTfQuery() - .ifPresent(value -> filterManagementUIState.setFilterQueryValue(value.getQuery())); - } - } + private void restoreOnLoad() { + if (filterManagementUIState.isCreateFilterViewDisplayed()) { + filterManagementUIState.setFilterQueryValue(null); + } else { + filterManagementUIState.getTfQuery() + .ifPresent(value -> filterManagementUIState.setFilterQueryValue(value.getQuery())); + } + } - /** - * Create a empty HierarchicalContainer. - */ - private LazyQueryContainer createContainer() { - // ADD all the filters to the query config - final Map queryConfig = prepareQueryConfigFilters(); + /** + * Create a empty HierarchicalContainer. + */ + private LazyQueryContainer createContainer() { + // ADD all the filters to the query config + final Map queryConfig = prepareQueryConfigFilters(); - // Create TargetBeanQuery factory with the query config. - final BeanQueryFactory targetQF = new BeanQueryFactory<>(CustomTargetBeanQuery.class); - targetQF.setQueryConfiguration(queryConfig); + // Create TargetBeanQuery factory with the query config. + final BeanQueryFactory targetQF = new BeanQueryFactory<>(CustomTargetBeanQuery.class); + targetQF.setQueryConfiguration(queryConfig); - // create lazy query container with lazy defination and query - final LazyQueryContainer targetTableContainer = new LazyQueryContainer( - new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_CONT_ID_NAME), - targetQF); - targetTableContainer.getQueryView().getQueryDefinition().setMaxNestedPropertyDepth(PROPERTY_DEPT); + // create lazy query container with lazy defination and query + final LazyQueryContainer targetTableContainer = new LazyQueryContainer( + new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_CONT_ID_NAME), + targetQF); + targetTableContainer.getQueryView().getQueryDefinition().setMaxNestedPropertyDepth(PROPERTY_DEPT); - return targetTableContainer; + return targetTableContainer; - } + } - private Map prepareQueryConfigFilters() { - final Map queryConfig = new HashMap<>(); - if (!Strings.isNullOrEmpty(filterManagementUIState.getFilterQueryValue())) { - queryConfig.put(SPUIDefinitions.FILTER_BY_QUERY, filterManagementUIState.getFilterQueryValue()); - } - queryConfig.put(SPUIDefinitions.FILTER_BY_INVALID_QUERY, - filterManagementUIState.getIsFilterByInvalidFilterQuery()); - return queryConfig; - } + private Map prepareQueryConfigFilters() { + final Map queryConfig = new HashMap<>(); + if (!Strings.isNullOrEmpty(filterManagementUIState.getFilterQueryValue())) { + queryConfig.put(SPUIDefinitions.FILTER_BY_QUERY, filterManagementUIState.getFilterQueryValue()); + } + queryConfig.put(SPUIDefinitions.FILTER_BY_INVALID_QUERY, + filterManagementUIState.getIsFilterByInvalidFilterQuery()); + return queryConfig; + } - /** - * populate campaign data. - * - */ - public void populateTableData() { - container = createContainer(); - setContainerDataSource(container); - addContainerproperties(); - setColumnProperties(); - setPageLength(30); - setCollapsibleColumns(); - } + /** + * populate campaign data. + * + */ + public void populateTableData() { + container = createContainer(); + setContainerDataSource(container); + addContainerproperties(); + setColumnProperties(); + setPageLength(30); + setCollapsibleColumns(); + } - private void setCollapsibleColumns() { - setColumnCollapsed(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, true); - setColumnCollapsed(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, true); + 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); - } + setColumnCollapsed(ASSIGN_DIST_SET, true); + setColumnCollapsed(INSTALL_DIST_SET, true); + } - /** - * Create a empty HierarchicalContainer. - */ - private void addContainerproperties() { - /* Create HierarchicalContainer container */ - container.addContainerProperty(SPUILabelDefinitions.NAME, String.class, null); - container.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_BY, String.class, null); - container.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, Date.class, null); - container.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, String.class, null, false, true); - container.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, String.class, null, false, true); - container.addContainerProperty(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER, String.class, ""); - 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); + /** + * Create a empty HierarchicalContainer. + */ + private void addContainerproperties() { + /* Create HierarchicalContainer container */ + container.addContainerProperty(SPUILabelDefinitions.NAME, String.class, null); + container.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_BY, String.class, null); + container.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, Date.class, null); + container.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, String.class, null, false, true); + container.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, String.class, null, false, true); + container.addContainerProperty(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER, String.class, ""); + 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); - } + container.addContainerProperty(ASSIGN_DIST_SET, DistributionSet.class, null, false, true); + container.addContainerProperty(INSTALL_DIST_SET, DistributionSet.class, null, false, true); + } - private List getVisbleColumns() { - final List columnList = new ArrayList<>(); - columnList.add(new TableColumn(SPUILabelDefinitions.NAME, i18n.get("header.name"), 0.15f)); - 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)); - columnList.add( - new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.get("header.modifiedDate"), 0.1F)); - columnList.add(new TableColumn(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER, - i18n.get("header.assigned.ds"), 0.125F)); - columnList.add(new TableColumn(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER, - i18n.get("header.installed.ds"), 0.125F)); - columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.get("header.description"), 0.1F)); - columnList.add(new TableColumn(SPUILabelDefinitions.STATUS_ICON, i18n.get("header.status"), 0.1F)); - return columnList; - } + private List getVisbleColumns() { + final List columnList = new ArrayList<>(); + columnList.add(new TableColumn(SPUILabelDefinitions.NAME, i18n.get("header.name"), 0.15f)); + 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)); + columnList.add( + new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.get("header.modifiedDate"), 0.1F)); + columnList.add(new TableColumn(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER, + i18n.get("header.assigned.ds"), 0.125F)); + columnList.add(new TableColumn(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER, + i18n.get("header.installed.ds"), 0.125F)); + columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.get("header.description"), 0.1F)); + columnList.add(new TableColumn(SPUILabelDefinitions.STATUS_ICON, i18n.get("header.status"), 0.1F)); + return columnList; + } - private Component getStatusIcon(final Object itemId) { - final Item row1 = getItem(itemId); - final TargetUpdateStatus targetStatus = (TargetUpdateStatus) row1 - .getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).getValue(); - final Label label = SPUIComponentProvider.getLabel("", SPUILabelDefinitions.SP_LABEL_SIMPLE); - label.setContentMode(ContentMode.HTML); - if (targetStatus == TargetUpdateStatus.PENDING) { - label.setDescription("Pending"); - label.setStyleName("statusIconYellow"); - label.setValue(FontAwesome.ADJUST.getHtml()); - } else if (targetStatus == TargetUpdateStatus.REGISTERED) { - label.setDescription("Registered"); - label.setStyleName("statusIconLightBlue"); - label.setValue(FontAwesome.DOT_CIRCLE_O.getHtml()); - } else if (targetStatus == TargetUpdateStatus.ERROR) { - label.setDescription(i18n.get("label.error")); - label.setStyleName("statusIconRed"); - label.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml()); - } else if (targetStatus == TargetUpdateStatus.IN_SYNC) { - label.setStyleName("statusIconGreen"); - label.setDescription("In-Synch"); - label.setValue(FontAwesome.CHECK_CIRCLE.getHtml()); - } else if (targetStatus == TargetUpdateStatus.UNKNOWN) { - label.setStyleName("statusIconBlue"); - label.setDescription(i18n.get("label.unknown")); - label.setValue(FontAwesome.QUESTION_CIRCLE.getHtml()); - } - return label; - } + private Component getStatusIcon(final Object itemId) { + final Item row1 = getItem(itemId); + final TargetUpdateStatus targetStatus = (TargetUpdateStatus) row1 + .getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).getValue(); + final Label label = SPUIComponentProvider.getLabel("", SPUILabelDefinitions.SP_LABEL_SIMPLE); + label.setContentMode(ContentMode.HTML); + if (targetStatus == TargetUpdateStatus.PENDING) { + label.setDescription("Pending"); + label.setStyleName("statusIconYellow"); + label.setValue(FontAwesome.ADJUST.getHtml()); + } else if (targetStatus == TargetUpdateStatus.REGISTERED) { + label.setDescription("Registered"); + label.setStyleName("statusIconLightBlue"); + label.setValue(FontAwesome.DOT_CIRCLE_O.getHtml()); + } else if (targetStatus == TargetUpdateStatus.ERROR) { + label.setDescription(i18n.get("label.error")); + label.setStyleName("statusIconRed"); + label.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml()); + } else if (targetStatus == TargetUpdateStatus.IN_SYNC) { + label.setStyleName("statusIconGreen"); + label.setDescription("In-Synch"); + label.setValue(FontAwesome.CHECK_CIRCLE.getHtml()); + } else if (targetStatus == TargetUpdateStatus.UNKNOWN) { + label.setStyleName("statusIconBlue"); + label.setDescription(i18n.get("label.unknown")); + label.setValue(FontAwesome.QUESTION_CIRCLE.getHtml()); + } + return label; + } - private void setColumnProperties() { - final List columnList = getVisbleColumns(); - final List swColumnIds = new ArrayList<>(); - for (final TableColumn column : columnList) { - setColumnHeader(column.getColumnPropertyId(), column.getColumnHeader()); - setColumnExpandRatio(column.getColumnPropertyId(), column.getExpandRatio()); - swColumnIds.add(column.getColumnPropertyId()); - } - setVisibleColumns(swColumnIds.toArray()); - } + private void setColumnProperties() { + final List columnList = getVisbleColumns(); + final List swColumnIds = new ArrayList<>(); + for (final TableColumn column : columnList) { + setColumnHeader(column.getColumnPropertyId(), column.getColumnHeader()); + setColumnExpandRatio(column.getColumnPropertyId(), column.getExpandRatio()); + swColumnIds.add(column.getColumnPropertyId()); + } + setVisibleColumns(swColumnIds.toArray()); + } - protected void addCustomGeneratedColumns() { - addGeneratedColumn(SPUILabelDefinitions.STATUS_ICON, (source, itemId, columnId) -> getStatusIcon(itemId)); - } + protected void addCustomGeneratedColumns() { + addGeneratedColumn(SPUILabelDefinitions.STATUS_ICON, (source, itemId, columnId) -> getStatusIcon(itemId)); + } - private void onQuery() { - populateTableData(); - eventBus.publish(this, CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON); - } + private void onQuery() { + populateTableData(); + eventBus.publish(this, CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON); + } - public class TooltipGenerator implements ItemDescriptionGenerator { - private static final long serialVersionUID = 688730421728162456L; + public class TooltipGenerator implements ItemDescriptionGenerator { + private static final long serialVersionUID = 688730421728162456L; - @Override - public String generateDescription(Component source, Object itemId, 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; - } + @Override + public String generateDescription(Component source, Object itemId, 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) { - StringBuilder swModuleNames = new StringBuilder(); - StringBuilder swModuleVendors = new StringBuilder(); - final Set swModules = (Set)distributionSet.getModules(); - swModules.forEach(swModule -> { - swModuleNames.append(swModule.getName()); - swModuleNames.append(" , "); - swModuleVendors.append(swModule.getVendor()); - swModuleVendors.append(" , "); - }); - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("
    "); - stringBuilder.append("
  • "); - stringBuilder.append(" DistributionSet Description : ").append((String) distributionSet.getDescription()); - stringBuilder.append("
  • "); - stringBuilder.append("
  • "); - stringBuilder.append(" DistributionSet Type : ").append((distributionSet.getType()).getName()); - stringBuilder.append("
  • "); - stringBuilder.append("
  • "); - stringBuilder.append(" Required Migration step : ") - .append(distributionSet.isRequiredMigrationStep() ? "Yes" : "No"); - stringBuilder.append("
  • "); - stringBuilder.append("
  • "); - stringBuilder.append("SoftWare Modules : ").append(swModuleNames.toString()); - stringBuilder.append("
  • "); - stringBuilder.append("
  • "); - stringBuilder.append("Vendor(s) : ").append(swModuleVendors.toString()); - stringBuilder.append("
  • "); - - stringBuilder.append("
"); - return stringBuilder.toString(); - } + private String getDSDetails(final DistributionSet distributionSet) { + StringBuilder swModuleNames = new StringBuilder(); + StringBuilder swModuleVendors = new StringBuilder(); + final Set swModules = (Set) distributionSet.getModules(); + swModules.forEach(swModule -> { + swModuleNames.append(swModule.getName()); + swModuleNames.append(" , "); + swModuleVendors.append(swModule.getVendor()); + swModuleVendors.append(" , "); + }); + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("
    "); + stringBuilder.append("
  • "); + stringBuilder.append(" DistributionSet Description : ").append((String) distributionSet.getDescription()); + stringBuilder.append("
  • "); + stringBuilder.append("
  • "); + stringBuilder.append(" DistributionSet Type : ").append((distributionSet.getType()).getName()); + stringBuilder.append("
  • "); + stringBuilder.append("
  • "); + stringBuilder.append(" Required Migration step : ") + .append(distributionSet.isRequiredMigrationStep() ? "Yes" : "No"); + stringBuilder.append("
  • "); + stringBuilder.append("
  • "); + stringBuilder.append("SoftWare Modules : ").append(swModuleNames.toString()); + stringBuilder.append("
  • "); + stringBuilder.append("
  • "); + stringBuilder.append("Vendor(s) : ").append(swModuleVendors.toString()); + stringBuilder.append("
  • "); - } + stringBuilder.append("
"); + return stringBuilder.toString(); + } + + } } diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetBeanQuery.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetBeanQuery.java index 943efc262..d127b4198 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetBeanQuery.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetBeanQuery.java @@ -42,188 +42,188 @@ import com.google.common.base.Strings; * */ public class TargetBeanQuery extends AbstractBeanQuery { - private static final long serialVersionUID = -5645680058303167558L; - private Sort sort = new Sort(SPUIDefinitions.TARGET_TABLE_CREATE_AT_SORT_ORDER, "createdAt"); - private Collection status = null; - private String[] targetTags = null; - private Long distributionId = null; - private String searchText = null; - private Boolean noTagClicked = Boolean.FALSE; - private transient TargetManagement targetManagement; - private transient I18N i18N; - private Long pinnedDistId = null; - private TargetFilterQuery targetFilterQuery; - private ManagementUIState managementUIState; + private static final long serialVersionUID = -5645680058303167558L; + private Sort sort = new Sort(SPUIDefinitions.TARGET_TABLE_CREATE_AT_SORT_ORDER, "createdAt"); + private Collection status = null; + private String[] targetTags = null; + private Long distributionId = null; + private String searchText = null; + private Boolean noTagClicked = Boolean.FALSE; + private transient TargetManagement targetManagement; + private transient I18N i18N; + private Long pinnedDistId = null; + private TargetFilterQuery targetFilterQuery; + private ManagementUIState managementUIState; - /** - * Parametric Constructor. - * - * @param definition - * as Def - * @param queryConfig - * as Config - * @param sortIds - * as sort - * @param sortStates - * as Sort status - */ - public TargetBeanQuery(final QueryDefinition definition, final Map queryConfig, - final Object[] sortIds, final boolean[] sortStates) { - super(definition, queryConfig, sortIds, sortStates); + /** + * Parametric Constructor. + * + * @param definition + * as Def + * @param queryConfig + * as Config + * @param sortIds + * as sort + * @param sortStates + * as Sort status + */ + public TargetBeanQuery(final QueryDefinition definition, final Map queryConfig, + final Object[] sortIds, final boolean[] sortStates) { + super(definition, queryConfig, sortIds, sortStates); - if (HawkbitCommonUtil.mapCheckStrKey(queryConfig)) { - status = (Collection) queryConfig.get(SPUIDefinitions.FILTER_BY_STATUS); - targetTags = (String[]) queryConfig.get(SPUIDefinitions.FILTER_BY_TAG); - noTagClicked = (Boolean) queryConfig.get(SPUIDefinitions.FILTER_BY_NO_TAG); - distributionId = (Long) queryConfig.get(SPUIDefinitions.FILTER_BY_DISTRIBUTION); - searchText = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_TEXT); - targetFilterQuery = (TargetFilterQuery) queryConfig.get(SPUIDefinitions.FILTER_BY_TARGET_FILTER_QUERY); - if (!Strings.isNullOrEmpty(searchText)) { - searchText = String.format("%%%s%%", searchText); - } - pinnedDistId = (Long) queryConfig.get(SPUIDefinitions.ORDER_BY_DISTRIBUTION); - } + if (HawkbitCommonUtil.mapCheckStrKey(queryConfig)) { + status = (Collection) queryConfig.get(SPUIDefinitions.FILTER_BY_STATUS); + targetTags = (String[]) queryConfig.get(SPUIDefinitions.FILTER_BY_TAG); + noTagClicked = (Boolean) queryConfig.get(SPUIDefinitions.FILTER_BY_NO_TAG); + distributionId = (Long) queryConfig.get(SPUIDefinitions.FILTER_BY_DISTRIBUTION); + searchText = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_TEXT); + targetFilterQuery = (TargetFilterQuery) queryConfig.get(SPUIDefinitions.FILTER_BY_TARGET_FILTER_QUERY); + if (!Strings.isNullOrEmpty(searchText)) { + searchText = String.format("%%%s%%", searchText); + } + pinnedDistId = (Long) queryConfig.get(SPUIDefinitions.ORDER_BY_DISTRIBUTION); + } - if (HawkbitCommonUtil.checkBolArray(sortStates)) { - // Initalize Sor - sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortIds[0]); - // Add sort. - for (int targetId = 1; targetId < sortIds.length; targetId++) { - sort.and(new Sort(sortStates[targetId] ? Direction.ASC : Direction.DESC, (String) sortIds[targetId])); - } - } - } + if (HawkbitCommonUtil.checkBolArray(sortStates)) { + // Initalize Sor + sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortIds[0]); + // Add sort. + for (int targetId = 1; targetId < sortIds.length; targetId++) { + sort.and(new Sort(sortStates[targetId] ? Direction.ASC : Direction.DESC, (String) sortIds[targetId])); + } + } + } - @Override - protected ProxyTarget constructBean() { - return new ProxyTarget(); - } + @Override + protected ProxyTarget constructBean() { + return new ProxyTarget(); + } - @Override - protected List loadBeans(final int startIndex, final int count) { - Slice targetBeans; - final List proxyTargetBeans = new ArrayList<>(); - if (pinnedDistId != null) { - targetBeans = getTargetManagement().findTargetsAllOrderByLinkedDistributionSet( - new OffsetBasedPageRequest(startIndex, SPUIDefinitions.PAGE_SIZE, sort), pinnedDistId, - distributionId, status, searchText, noTagClicked, targetTags); - } else if (null != targetFilterQuery) { - targetBeans = getTargetManagement().findTargetsAll(targetFilterQuery, - new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort)); - } else if (!anyFilterSelected()) { - targetBeans = getTargetManagement().findTargetsAll( - new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort)); - } else { - targetBeans = getTargetManagement().findTargetByFilters( - new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort), status, - searchText, distributionId, noTagClicked, targetTags); - } - for (final Target targ : targetBeans) { - final ProxyTarget prxyTarget = new ProxyTarget(); - prxyTarget.setTargetIdName(targ.getTargetIdName()); - prxyTarget.setName(targ.getName()); - prxyTarget.setDescription(targ.getDescription()); - prxyTarget.setControllerId(targ.getControllerId()); - prxyTarget.setInstallationDate(targ.getTargetInfo().getInstallationDate()); - prxyTarget.setAddress(targ.getTargetInfo().getAddress()); - prxyTarget.setLastTargetQuery(targ.getTargetInfo().getLastTargetQuery()); - prxyTarget.setUpdateStatus(targ.getTargetInfo().getUpdateStatus()); - prxyTarget.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(targ.getLastModifiedAt())); - prxyTarget.setCreatedDate(SPDateTimeUtil.getFormattedDate(targ.getCreatedAt())); - prxyTarget.setCreatedAt(targ.getCreatedAt()); - prxyTarget.setCreatedByUser(UserDetailsFormatter.loadAndFormatCreatedBy(targ)); + @Override + protected List loadBeans(final int startIndex, final int count) { + Slice targetBeans; + final List proxyTargetBeans = new ArrayList<>(); + if (pinnedDistId != null) { + targetBeans = getTargetManagement().findTargetsAllOrderByLinkedDistributionSet( + new OffsetBasedPageRequest(startIndex, SPUIDefinitions.PAGE_SIZE, sort), pinnedDistId, + distributionId, status, searchText, noTagClicked, targetTags); + } else if (null != targetFilterQuery) { + targetBeans = getTargetManagement().findTargetsAll(targetFilterQuery, + new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort)); + } else if (!anyFilterSelected()) { + targetBeans = getTargetManagement().findTargetsAll( + new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort)); + } else { + targetBeans = getTargetManagement().findTargetByFilters( + new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort), status, + searchText, distributionId, noTagClicked, targetTags); + } + for (final Target targ : targetBeans) { + final ProxyTarget prxyTarget = new ProxyTarget(); + prxyTarget.setTargetIdName(targ.getTargetIdName()); + prxyTarget.setName(targ.getName()); + prxyTarget.setDescription(targ.getDescription()); + prxyTarget.setControllerId(targ.getControllerId()); + prxyTarget.setInstallationDate(targ.getTargetInfo().getInstallationDate()); + prxyTarget.setAddress(targ.getTargetInfo().getAddress()); + prxyTarget.setLastTargetQuery(targ.getTargetInfo().getLastTargetQuery()); + prxyTarget.setUpdateStatus(targ.getTargetInfo().getUpdateStatus()); + prxyTarget.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(targ.getLastModifiedAt())); + prxyTarget.setCreatedDate(SPDateTimeUtil.getFormattedDate(targ.getCreatedAt())); + prxyTarget.setCreatedAt(targ.getCreatedAt()); + prxyTarget.setCreatedByUser(UserDetailsFormatter.loadAndFormatCreatedBy(targ)); prxyTarget.setModifiedByUser(UserDetailsFormatter.loadAndFormatLastModifiedBy(targ)); - if (pinnedDistId == null) { - prxyTarget.setInstalledDistributionSet(null); - prxyTarget.setAssignedDistributionSet(null); + 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); - } + } 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); + } - prxyTarget.setUpdateStatus(targ.getTargetInfo().getUpdateStatus()); - prxyTarget.setLastTargetQuery(targ.getTargetInfo().getLastTargetQuery()); - prxyTarget.setTargetInfo(targ.getTargetInfo()); - prxyTarget.setPollStatusToolTip( - HawkbitCommonUtil.getPollStatusToolTip(prxyTarget.getTargetInfo().getPollStatus(), getI18N())); - proxyTargetBeans.add(prxyTarget); - } - return proxyTargetBeans; - } + prxyTarget.setUpdateStatus(targ.getTargetInfo().getUpdateStatus()); + prxyTarget.setLastTargetQuery(targ.getTargetInfo().getLastTargetQuery()); + prxyTarget.setTargetInfo(targ.getTargetInfo()); + prxyTarget.setPollStatusToolTip( + HawkbitCommonUtil.getPollStatusToolTip(prxyTarget.getTargetInfo().getPollStatus(), getI18N())); + proxyTargetBeans.add(prxyTarget); + } + return proxyTargetBeans; + } - private Boolean isTagSelected() { - if (targetTags == null && !noTagClicked) { - return false; - } - return true; - } + private Boolean isTagSelected() { + if (targetTags == null && !noTagClicked) { + return false; + } + return true; + } - @Override - protected void saveBeans(final List addedTargets, final List modifiedTargets, - final List removedTargets) { - // CRUD operations on Target will be done through repository methods - } + @Override + protected void saveBeans(final List addedTargets, final List modifiedTargets, + final List removedTargets) { + // CRUD operations on Target will be done through repository methods + } - private Boolean anyFilterSelected() { - if (status == null && distributionId == null && Strings.isNullOrEmpty(searchText) && !isTagSelected()) { - return false; - } - return true; - } + private Boolean anyFilterSelected() { + if (status == null && distributionId == null && Strings.isNullOrEmpty(searchText) && !isTagSelected()) { + return false; + } + return true; + } - @Override - public int size() { - final long totSize = getTargetManagement().countTargetsAll(); - long size; - if (null != targetFilterQuery) { - size = getTargetManagement().countTargetByTargetFilterQuery(targetFilterQuery); - } else if (!anyFilterSelected()) { - size = totSize; - } else { - size = getTargetManagement().countTargetByFilters(status, searchText, distributionId, noTagClicked, - targetTags); - } + @Override + public int size() { + final long totSize = getTargetManagement().countTargetsAll(); + long size; + if (null != targetFilterQuery) { + size = getTargetManagement().countTargetByTargetFilterQuery(targetFilterQuery); + } else if (!anyFilterSelected()) { + size = totSize; + } else { + size = getTargetManagement().countTargetByFilters(status, searchText, distributionId, noTagClicked, + targetTags); + } - final ManagementUIState tmpManagementUIState = getManagementUIState(); - tmpManagementUIState.setTargetsCountAll(totSize); - if (size > SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES) { - tmpManagementUIState.setTargetsTruncated(size - SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES); - size = SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES; - } else { - tmpManagementUIState.setTargetsTruncated(null); - } + final ManagementUIState tmpManagementUIState = getManagementUIState(); + tmpManagementUIState.setTargetsCountAll(totSize); + if (size > SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES) { + tmpManagementUIState.setTargetsTruncated(size - SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES); + size = SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES; + } else { + tmpManagementUIState.setTargetsTruncated(null); + } - return (int) size; - } + return (int) size; + } - private TargetManagement getTargetManagement() { - if (targetManagement == null) { - targetManagement = SpringContextHelper.getBean(TargetManagement.class); - } - return targetManagement; - } + private TargetManagement getTargetManagement() { + if (targetManagement == null) { + targetManagement = SpringContextHelper.getBean(TargetManagement.class); + } + return targetManagement; + } - private ManagementUIState getManagementUIState() { - if (managementUIState == null) { - managementUIState = SpringContextHelper.getBean(ManagementUIState.class); - } - return managementUIState; - } + private ManagementUIState getManagementUIState() { + if (managementUIState == null) { + managementUIState = SpringContextHelper.getBean(ManagementUIState.class); + } + return managementUIState; + } - private I18N getI18N() { - if (i18N == null) { - i18N = SpringContextHelper.getBean(I18N.class); - } - return i18N; - } + private I18N getI18N() { + if (i18N == null) { + i18N = SpringContextHelper.getBean(I18N.class); + } + return i18N; + } } diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetTable.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetTable.java index f119229b0..a1e759950 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetTable.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetTable.java @@ -43,7 +43,6 @@ import org.eclipse.hawkbit.ui.filter.target.CustomTargetFilter; import org.eclipse.hawkbit.ui.filter.target.TargetSearchTextFilter; import org.eclipse.hawkbit.ui.filter.target.TargetStatusFilter; import org.eclipse.hawkbit.ui.filter.target.TargetTagFilter; -import org.eclipse.hawkbit.ui.filtermanagement.CreateOrUpdateFilterTable.TooltipGenerator; import org.eclipse.hawkbit.ui.management.event.DragEvent; import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent; import org.eclipse.hawkbit.ui.management.event.ManagementViewAcceptCriteria; @@ -96,7 +95,6 @@ import com.vaadin.ui.Label; import com.vaadin.ui.Table; import com.vaadin.ui.UI; import com.vaadin.ui.themes.ValoTheme; -import com.vaadin.ui.AbstractSelect.ItemDescriptionGenerator; /** * Concrete implementation of Target table. @@ -113,9 +111,9 @@ public class TargetTable extends AbstractTable 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"; + + private static final String ASSIGN_DIST_SET = "assignedDistributionSet"; + private static final String INSTALL_DIST_SET = "installedDistributionSet"; @Autowired private transient TargetManagement targetManagement; @@ -1082,61 +1080,60 @@ public class TargetTable extends AbstractTable 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; + private static final long serialVersionUID = 688730421728162456L; - @Override - public String generateDescription(Component source, Object itemId, 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; - } + @Override + public String generateDescription(Component source, Object itemId, 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) { - StringBuilder swModuleNames = new StringBuilder(); - StringBuilder swModuleVendors = new StringBuilder(); - final Set swModules = (Set)distributionSet.getModules(); - swModules.forEach(swModule -> { - swModuleNames.append(swModule.getName()); - swModuleNames.append(" , "); - swModuleVendors.append(swModule.getVendor()); - swModuleVendors.append(" , "); - }); - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("
    "); - stringBuilder.append("
  • "); - stringBuilder.append(" DistributionSet Description : ").append((String) distributionSet.getDescription()); - stringBuilder.append("
  • "); - stringBuilder.append("
  • "); - stringBuilder.append(" DistributionSet Type : ").append((distributionSet.getType()).getName()); - stringBuilder.append("
  • "); - stringBuilder.append("
  • "); - stringBuilder.append(" Required Migration step : ") - .append(distributionSet.isRequiredMigrationStep() ? "Yes" : "No"); - stringBuilder.append("
  • "); - stringBuilder.append("
  • "); - stringBuilder.append("SoftWare Modules : ").append(swModuleNames.toString()); - stringBuilder.append("
  • "); - stringBuilder.append("
  • "); - stringBuilder.append("Vendor(s) : ").append(swModuleVendors.toString()); - stringBuilder.append("
  • "); - stringBuilder.append("
"); - return stringBuilder.toString(); - } - } + private String getDSDetails(final DistributionSet distributionSet) { + StringBuilder swModuleNames = new StringBuilder(); + StringBuilder swModuleVendors = new StringBuilder(); + final Set swModules = (Set) distributionSet.getModules(); + swModules.forEach(swModule -> { + swModuleNames.append(swModule.getName()); + swModuleNames.append(" , "); + swModuleVendors.append(swModule.getVendor()); + swModuleVendors.append(" , "); + }); + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("
    "); + stringBuilder.append("
  • "); + stringBuilder.append(" DistributionSet Description : ").append((String) distributionSet.getDescription()); + stringBuilder.append("
  • "); + stringBuilder.append("
  • "); + stringBuilder.append(" DistributionSet Type : ").append((distributionSet.getType()).getName()); + stringBuilder.append("
  • "); + stringBuilder.append("
  • "); + stringBuilder.append(" Required Migration step : ") + .append(distributionSet.isRequiredMigrationStep() ? "Yes" : "No"); + stringBuilder.append("
  • "); + stringBuilder.append("
  • "); + stringBuilder.append("SoftWare Modules : ").append(swModuleNames.toString()); + stringBuilder.append("
  • "); + stringBuilder.append("
  • "); + stringBuilder.append("Vendor(s) : ").append(swModuleVendors.toString()); + stringBuilder.append("
  • "); + stringBuilder.append("
"); + return stringBuilder.toString(); + } + } } \ No newline at end of file diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/ProxyRollout.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/ProxyRollout.java index a010a3ba4..04c6659a5 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/ProxyRollout.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/ProxyRollout.java @@ -22,197 +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 isRequiredMigrationStep = Boolean.FALSE; + private Boolean isActionRecieved = Boolean.FALSE; - private String totalTargetsCount; + private Boolean isRequiredMigrationStep = Boolean.FALSE; - private RolloutRendererData rolloutRendererData; - - private String discription; + private String totalTargetsCount; - private String type; - - private Set swModules; - - - - /** - * @return the isRequiredMigrationStep - */ + private RolloutRendererData rolloutRendererData; - public Boolean getIsRequiredMigrationStep() { - return isRequiredMigrationStep; - } + private String discription; - /** - * @param isRequiredMigrationStep - * the isRequiredMigrationStep to set - */ + private String type; - public void setIsRequiredMigrationStep(Boolean isRequiredMigrationStep) { - this.isRequiredMigrationStep = isRequiredMigrationStep; - } + private Set swModules; - - /** - * @return the discription - */ + /** + * @return the isRequiredMigrationStep + */ - public String getDiscription() { - return discription; - } + public Boolean getIsRequiredMigrationStep() { + return isRequiredMigrationStep; + } - /** - * @param discription - * the discription to set - */ + /** + * @param isRequiredMigrationStep + * the isRequiredMigrationStep to set + */ - public void setDiscription(String discription) { - this.discription = discription; - } + public void setIsRequiredMigrationStep(Boolean isRequiredMigrationStep) { + this.isRequiredMigrationStep = isRequiredMigrationStep; + } - /** - * @return the type - */ - public String getType() { - return type; - } + /** + * @return the discription + */ - /** - * @param type - * the type to set - */ + public String getDiscription() { + return discription; + } - public void setType(String type) { - this.type = type; - } - /** - * - * @return the Set of Software modules - */ - public Set getSwModules() { - return swModules; - } - /** - * @param swModules - * Set to set - */ - public void setSwModules(Set swModules) { - this.swModules = swModules; - } + /** + * @param discription + * the discription to set + */ - public RolloutRendererData getRolloutRendererData() { - return rolloutRendererData; - } + public void setDiscription(String discription) { + this.discription = discription; + } - public void setRolloutRendererData(RolloutRendererData rendererData) { - this.rolloutRendererData = rendererData; - } + /** + * @return the type + */ + public String getType() { + return type; + } - /** - * @return the distributionSetNameVersion - */ - public String getDistributionSetNameVersion() { - return distributionSetNameVersion; - } + /** + * @param type + * the type to set + */ - /** - * @param distributionSetNameVersion - * the distributionSetNameVersion to set - */ - public void setDistributionSetNameVersion(final String distributionSetNameVersion) { - this.distributionSetNameVersion = distributionSetNameVersion; - } + public void setType(String type) { + this.type = type; + } - /** - * @return the numberOfGroups - */ - public Long getNumberOfGroups() { - return numberOfGroups; - } + /** + * + * @return the Set of Software modules + */ + public Set getSwModules() { + return swModules; + } - /** - * @param numberOfGroups - * the numberOfGroups to set - */ - public void setNumberOfGroups(final Long numberOfGroups) { - this.numberOfGroups = numberOfGroups; - } + /** + * @param swModules + * Set to set + */ + public void setSwModules(Set swModules) { + this.swModules = swModules; + } - /** - * @return the createdDate - */ - public String getCreatedDate() { - return createdDate; - } + public RolloutRendererData getRolloutRendererData() { + return rolloutRendererData; + } - /** - * @param createdDate - * the createdDate to set - */ - public void setCreatedDate(final String createdDate) { - this.createdDate = createdDate; - } + public void setRolloutRendererData(RolloutRendererData rendererData) { + this.rolloutRendererData = rendererData; + } - /** - * @return the modifiedDate - */ - public String getModifiedDate() { - return modifiedDate; - } + /** + * @return the distributionSetNameVersion + */ + public String getDistributionSetNameVersion() { + return distributionSetNameVersion; + } - /** - * @param modifiedDate - * the modifiedDate to set - */ - public void setModifiedDate(final String modifiedDate) { - this.modifiedDate = modifiedDate; - } + /** + * @param distributionSetNameVersion + * the distributionSetNameVersion to set + */ + public void setDistributionSetNameVersion(final String distributionSetNameVersion) { + this.distributionSetNameVersion = distributionSetNameVersion; + } - /** - * @return the isActionRecieved - */ - public Boolean getIsActionRecieved() { - return isActionRecieved; - } + /** + * @return the numberOfGroups + */ + public Long getNumberOfGroups() { + return numberOfGroups; + } - /** - * @param isActionRecieved - * the isActionRecieved to set - */ - public void setIsActionRecieved(final Boolean isActionRecieved) { - this.isActionRecieved = isActionRecieved; - } + /** + * @param numberOfGroups + * the numberOfGroups to set + */ + public void setNumberOfGroups(final Long numberOfGroups) { + this.numberOfGroups = numberOfGroups; + } - /** - * @return the totalTargetsCount - */ - public String getTotalTargetsCount() { - return totalTargetsCount; - } + /** + * @return the createdDate + */ + public String getCreatedDate() { + return createdDate; + } - /** - * @param totalTargetsCount - * the totalTargetsCount to set - */ - public void setTotalTargetsCount(final String totalTargetsCount) { - this.totalTargetsCount = totalTargetsCount; - } + /** + * @param createdDate + * the createdDate to set + */ + public void setCreatedDate(final String createdDate) { + this.createdDate = createdDate; + } - public String getAction() { - return FontAwesome.CIRCLE_O.getHtml(); - } + /** + * @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(); + } } diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutBeanQuery.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutBeanQuery.java index 41f69acb1..8a9675564 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutBeanQuery.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutBeanQuery.java @@ -138,11 +138,11 @@ public class RolloutBeanQuery extends AbstractBeanQuery { final TotalTargetCountStatus totalTargetCountActionStatus = rollout.getTotalTargetCountStatus(); 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()); + + proxyRollout.setDescription(distributionSet.getDescription()); + proxyRollout.setType(distributionSet.getType().getName()); + proxyRollout.setIsRequiredMigrationStep(distributionSet.isRequiredMigrationStep()); + proxyRollout.setSwModules(distributionSet.getModules()); proxyRolloutList.add(proxyRollout); } diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutListGrid.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutListGrid.java index c68bbf700..1ad0bfc35 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutListGrid.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutListGrid.java @@ -70,619 +70,619 @@ import com.vaadin.ui.renderers.HtmlRenderer; @ViewScope public class RolloutListGrid extends AbstractGrid { - private static final long serialVersionUID = 4060904914954370524L; - - private static final String UPDATE_OPTION = "Update"; - - private static final String RESUME_OPTION = "Resume"; - - private static final String PAUSE_OPTION = "Pause"; - - 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 - private transient RolloutManagement rolloutManagement; - - @Autowired - private AddUpdateRolloutWindowLayout addUpdateRolloutWindow; - - @Autowired - private UINotification uiNotification; - - @Autowired - private transient RolloutUIState rolloutUIState; - - @Autowired - private transient SpPermissionChecker permissionChecker; - - private transient Map statusIconMap = new EnumMap<>(RolloutStatus.class); - - /** - * Handles the RolloutEvent to refresh Grid. - * - */ - @EventBusListenerMethod(scope = EventScope.SESSION) - void onEvent(final RolloutEvent event) { - switch (event) { - case FILTER_BY_TEXT: - case CREATE_ROLLOUT: - case UPDATE_ROLLOUT: - case SHOW_ROLLOUTS: - refreshGrid(); - break; - default: - return; - } - } - - /** - * Handles the RolloutChangeEvent to refresh the item in the grid. - * - * @param rolloutChangeEvent - * the event which contains the rollout which has been changed - */ - @SuppressWarnings("unchecked") - @EventBusListenerMethod(scope = EventScope.SESSION) - public void onEvent(final RolloutChangeEvent rolloutChangeEvent) { - if (!rolloutUIState.isShowRollOuts()) { - return; - } - final Rollout rollout = rolloutManagement.findRolloutWithDetailedStatus(rolloutChangeEvent.getRolloutId()); - final TotalTargetCountStatus totalTargetCountStatus = rollout.getTotalTargetCountStatus(); - final LazyQueryContainer rolloutContainer = (LazyQueryContainer) getContainerDataSource(); - final Item item = rolloutContainer.getItem(rolloutChangeEvent.getRolloutId()); - if (item == null) { - return; - } - item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).setValue(rollout.getStatus()); - item.getItemProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setValue(totalTargetCountStatus); - final Long groupCount = (Long) item.getItemProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).getValue(); - final int groupsCreated = rollout.getRolloutGroupsCreated(); - if (groupsCreated != 0) { - item.getItemProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setValue(Long.valueOf(groupsCreated)); - } else if (rollout.getRolloutGroups() != null && groupCount != rollout.getRolloutGroups().size()) { - item.getItemProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS) - .setValue(Long.valueOf(rollout.getRolloutGroups().size())); - } - item.getItemProperty(ROLLOUT_RENDERER_DATA) - .setValue(new RolloutRendererData(rollout.getName(), rollout.getStatus().toString())); - - } - - @Override - protected Container createContainer() { - final BeanQueryFactory rolloutQf = new BeanQueryFactory<>(RolloutBeanQuery.class); - return new LazyQueryContainer( - new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_ID), rolloutQf); - } - - @Override - 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, - false); - rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, String.class, null, false, - false); - - rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_DATE, String.class, null, false, - false); - rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_USER, String.class, null, false, - false); - rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_BY, String.class, null, false, - false); - rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS, Long.class, 0, false, - false); - rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS, String.class, "0", false, - false); - rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS, - TotalTargetCountStatus.class, null, false, false); - - rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.ACTION, String.class, - FontAwesome.CIRCLE_O.getHtml(), false, false); - - } - - @Override - protected void setColumnExpandRatio() { - - getColumn(ROLLOUT_RENDERER_DATA).setMinimumWidth(40); - getColumn(ROLLOUT_RENDERER_DATA).setMaximumWidth(150); - - getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).setMinimumWidth(40); - getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).setMaximumWidth(150); - - getColumn(SPUILabelDefinitions.VAR_STATUS).setMinimumWidth(75); - getColumn(SPUILabelDefinitions.VAR_STATUS).setMaximumWidth(75); - - getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMinimumWidth(40); - getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMaximumWidth(100); - - getColumn(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setMinimumWidth(40); - getColumn(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setMaximumWidth(100); - - getColumn(SPUILabelDefinitions.ACTION).setMinimumWidth(75); - getColumn(SPUILabelDefinitions.ACTION).setMaximumWidth(75); - - getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setMinimumWidth(280); - - setFrozenColumnCount(getColumns().size()); - } - - @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")); - getColumn(SPUILabelDefinitions.VAR_CREATED_DATE).setHeaderCaption(i18n.get("header.createdDate")); - getColumn(SPUILabelDefinitions.VAR_CREATED_USER).setHeaderCaption(i18n.get("header.createdBy")); - getColumn(SPUILabelDefinitions.VAR_MODIFIED_DATE).setHeaderCaption(i18n.get("header.modifiedDate")); - getColumn(SPUILabelDefinitions.VAR_MODIFIED_BY).setHeaderCaption(i18n.get("header.modifiedBy")); - getColumn(SPUILabelDefinitions.VAR_DESC).setHeaderCaption(i18n.get("header.description")); - getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS) - .setHeaderCaption(i18n.get("header.detail.status")); - getColumn(SPUILabelDefinitions.VAR_STATUS).setHeaderCaption(i18n.get("header.status")); - getColumn(SPUILabelDefinitions.ACTION).setHeaderCaption(i18n.get("upload.action")); - } - - @Override - protected String getGridId() { - return SPUIComponetIdProvider.ROLLOUT_LIST_GRID_ID; - } - - @Override - protected void setColumnProperties() { - final List 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); - columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS); - columnList.add(SPUILabelDefinitions.ACTION); - - columnList.add(SPUILabelDefinitions.VAR_CREATED_DATE); - columnList.add(SPUILabelDefinitions.VAR_CREATED_USER); - columnList.add(SPUILabelDefinitions.VAR_MODIFIED_DATE); - columnList.add(SPUILabelDefinitions.VAR_MODIFIED_BY); - columnList.add(SPUILabelDefinitions.VAR_DESC); - setColumnOrder(columnList.toArray()); - alignColumns(); - } - - @Override - protected void setHiddenColumns() { - final List columnsToBeHidden = new ArrayList<>(); - columnsToBeHidden.add(SPUILabelDefinitions.VAR_NAME); - columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_DATE); - columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_USER); - 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); - } - - } - - @Override - protected CellDescriptionGenerator getDescriptionGenerator() { - return cell -> getDescription(cell); - } - - @Override - protected void addColumnRenderes() { - getColumn(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setRenderer(new HtmlRenderer(), - new TotalTargetGroupsConverter()); - getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(new HtmlRenderer(), - new TotalTargetCountStatusConverter()); - - createRolloutStatusToFontMap(); - getColumn(SPUILabelDefinitions.VAR_STATUS).setRenderer(new HtmlLabelRenderer(), new RolloutStatusConverter()); - - getColumn(SPUILabelDefinitions.ACTION).setRenderer(new HtmlButtonRenderer(event -> onClickOfActionBtn(event))); - - final RolloutRenderer customObjectRenderer = new RolloutRenderer(RolloutRendererData.class); - customObjectRenderer.addClickListener(event -> onClickOfRolloutName(event)); - getColumn(ROLLOUT_RENDERER_DATA).setRenderer(customObjectRenderer); - - } - - private void createRolloutStatusToFontMap() { - statusIconMap.put(RolloutStatus.FINISHED, - new StatusFontIcon(FontAwesome.CHECK_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_GREEN)); - statusIconMap.put(RolloutStatus.PAUSED, - new StatusFontIcon(FontAwesome.PAUSE, SPUIStyleDefinitions.STATUS_ICON_BLUE)); - statusIconMap.put(RolloutStatus.RUNNING, new StatusFontIcon(null, SPUIStyleDefinitions.STATUS_SPINNER_YELLOW)); - statusIconMap.put(RolloutStatus.READY, - new StatusFontIcon(FontAwesome.DOT_CIRCLE_O, SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE)); - statusIconMap.put(RolloutStatus.STOPPED, - new StatusFontIcon(FontAwesome.STOP, SPUIStyleDefinitions.STATUS_ICON_RED)); - statusIconMap.put(RolloutStatus.CREATING, new StatusFontIcon(null, SPUIStyleDefinitions.STATUS_SPINNER_GREY)); - statusIconMap.put(RolloutStatus.STARTING, new StatusFontIcon(null, SPUIStyleDefinitions.STATUS_SPINNER_BLUE)); - statusIconMap.put(RolloutStatus.ERROR_CREATING, - new StatusFontIcon(FontAwesome.EXCLAMATION_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_RED)); - statusIconMap.put(RolloutStatus.ERROR_STARTING, - new StatusFontIcon(FontAwesome.EXCLAMATION_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_RED)); - } - - private void alignColumns() { - setCellStyleGenerator(new CellStyleGenerator() { - private static final long serialVersionUID = 5573570647129792429L; - - @Override - public String getStyle(final CellReference cellReference) { - final String[] coulmnNames = { SPUILabelDefinitions.VAR_STATUS, SPUILabelDefinitions.ACTION }; - if (Arrays.asList(coulmnNames).contains(cellReference.getPropertyId())) { - return "centeralign"; - } - return null; - } - }); - } - - private void onClickOfRolloutName(final RendererClickEvent event) { - rolloutUIState.setRolloutId((long) event.getItemId()); - final String rolloutName = (String) getContainerDataSource().getItem(event.getItemId()) - .getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue(); - rolloutUIState.setRolloutName(rolloutName); - final String ds = (String) getContainerDataSource().getItem(event.getItemId()) - .getItemProperty(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).getValue(); - rolloutUIState.setRolloutDistributionSet(ds); - eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUPS); - } - - private void onClickOfActionBtn(final RendererClickEvent event) { - final ContextMenu contextMenu = createContextMenu((Long) event.getItemId()); - contextMenu.setAsContextMenuOf((AbstractClientConnector) event.getComponent()); - contextMenu.open(event.getClientX(), event.getClientY()); - } - - private ContextMenu createContextMenu(final Long rolloutId) { - final ContextMenu context = new ContextMenu(); - context.addItemClickListener(event -> menuItemClicked(event)); - final Item row = getContainerDataSource().getItem(rolloutId); - final RolloutStatus rolloutStatus = (RolloutStatus) row.getItemProperty(SPUILabelDefinitions.VAR_STATUS) - .getValue(); - - switch (rolloutStatus) { - case READY: - final ContextMenuItem startItem = context.addItem(START_OPTION); - startItem.setData(new ContextMenuData(rolloutId, ACTION.START)); - break; - case RUNNING: - final ContextMenuItem pauseItem = context.addItem(PAUSE_OPTION); - pauseItem.setData(new ContextMenuData(rolloutId, ACTION.PAUSE)); - break; - case PAUSED: - final ContextMenuItem resumeItem = context.addItem(RESUME_OPTION); - resumeItem.setData(new ContextMenuData(rolloutId, ACTION.RESUME)); - break; - case STARTING: - case CREATING: - case ERROR_CREATING: - case ERROR_STARTING: - // do not provide any action on these statuses - return context; - default: - break; - } - getUpdateMenuItem(context, rolloutId); - return context; - } - - private void getUpdateMenuItem(final ContextMenu context, final Long rolloutId) { - // Add 'Update' option only if user has update permission - if (!permissionChecker.hasRolloutUpdatePermission()) { - return; - } - final ContextMenuItem cancelItem = context.addItem(UPDATE_OPTION); - cancelItem.setData(new ContextMenuData(rolloutId, ACTION.UPDATE)); - } - - private void menuItemClicked(final ContextMenuItemClickEvent event) { - final ContextMenuItem item = (ContextMenuItem) event.getSource(); - final ContextMenuData contextMenuData = (ContextMenuData) item.getData(); - final Item row = getContainerDataSource().getItem(contextMenuData.getRolloutId()); - final String rolloutName = (String) row.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue(); - switch (contextMenuData.getAction()) { - case PAUSE: - rolloutManagement.pauseRollout(rolloutManagement.findRolloutById(contextMenuData.getRolloutId())); - uiNotification.displaySuccess(i18n.get("message.rollout.paused", rolloutName)); - break; - case RESUME: - rolloutManagement.resumeRollout(rolloutManagement.findRolloutById(contextMenuData.getRolloutId())); - uiNotification.displaySuccess(i18n.get("message.rollout.resumed", rolloutName)); - break; - case START: - rolloutManagement.startRolloutAsync(rolloutManagement.findRolloutByName(rolloutName)); - uiNotification.displaySuccess(i18n.get("message.rollout.started", rolloutName)); - break; - case UPDATE: - onUpdate(contextMenuData); - break; - default: - break; - } - } - - private void onUpdate(final ContextMenuData contextMenuData) { - addUpdateRolloutWindow.populateData(contextMenuData.getRolloutId()); - final Window addTargetWindow = addUpdateRolloutWindow.getWindow(); - addTargetWindow.setCaption(i18n.get("caption.update.rollout")); - UI.getCurrent().addWindow(addTargetWindow); - addTargetWindow.setVisible(Boolean.TRUE); - } - - private void refreshGrid() { - ((LazyQueryContainer) getContainerDataSource()).refresh(); - } - - /** - * Generator to generate fontIcon by String. - */ - public final class FontIconGenerator extends PropertyValueGenerator { - - private static final long serialVersionUID = 2544026030795375748L; - private final FontAwesome fontIcon; - - public FontIconGenerator(final FontAwesome icon) { - this.fontIcon = icon; - } - - @Override - public String getValue(final Item item, final Object itemId, final Object propertyId) { - return fontIcon.getHtml(); - } - - @Override - public Class getType() { - return String.class; - } - } - - private String getDescription(final CellReference cell) { - if (SPUILabelDefinitions.VAR_STATUS.equals(cell.getPropertyId())) { - return cell.getProperty().getValue().toString().toLowerCase(); - } else if (SPUILabelDefinitions.ACTION.equals(cell.getPropertyId())) { - return SPUILabelDefinitions.ACTION.toLowerCase(); - } else if (ROLLOUT_RENDERER_DATA.equals(cell.getPropertyId())) { - return ((RolloutRendererData) cell.getProperty().getValue()).getName(); - } 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((Item) cell.getItem()); - } - return null; - } - - private String getDSDetails(final Item rolloutItem) { - StringBuilder swModuleNames = new StringBuilder(); - StringBuilder swModuleVendors = new StringBuilder(); - final Set swModules = (Set) rolloutItem.getItemProperty(SW_MODULES).getValue(); - swModules.forEach(swModule -> { - swModuleNames.append(swModule.getName()); - swModuleNames.append(" , "); - swModuleVendors.append(swModule.getVendor()); - swModuleVendors.append(" , "); - }); - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("
    "); - stringBuilder.append("
  • "); - stringBuilder.append(" DistributionSet Description : ") - .append((String) rolloutItem.getItemProperty(SPUILabelDefinitions.VAR_DESC).getValue()); - stringBuilder.append("
  • "); - stringBuilder.append("
  • "); - stringBuilder.append(" DistributionSet Type : ") - .append((String) rolloutItem.getItemProperty(DS_TYPE).getValue()); - stringBuilder.append("
  • "); - stringBuilder.append("
  • "); - stringBuilder.append("Required Migration step : ") - .append((boolean) rolloutItem.getItemProperty(IS_REQUIRED_MIGRATION_STEP).getValue() ? "Yes" : "No"); - stringBuilder.append("
  • "); - - stringBuilder.append("
  • "); - stringBuilder.append("SoftWare Modules : ").append(swModuleNames.toString()); - stringBuilder.append("
  • "); - - stringBuilder.append("
  • "); - stringBuilder.append("Vendor(s) : ").append(swModuleVendors.toString()); - stringBuilder.append("
  • "); - - stringBuilder.append("
"); - return stringBuilder.toString(); - } - - enum ACTION { - PAUSE, RESUME, START, UPDATE - } - - /** - * Represents data of context menu item. - * - */ - public static class ContextMenuData { - - private Long rolloutId; - - private ACTION action; - - /** - * Set rollout if and action. - * - * @param rolloutId - * id of rollout - * @param action - * user action {@link ACTION} - */ - public ContextMenuData(final Long rolloutId, final ACTION action) { - this.action = action; - this.rolloutId = rolloutId; - } - - /** - * @return the rolloutId - */ - public Long getRolloutId() { - return rolloutId; - } - - /** - * @param rolloutId - * the rolloutId to set - */ - public void setRolloutId(final Long rolloutId) { - this.rolloutId = rolloutId; - } - - /** - * @return the action - */ - public ACTION getAction() { - return action; - } - - /** - * @param action - * the action to set - */ - public void setAction(final ACTION action) { - this.action = action; - } - } - - /** - * - * Converter to convert {@link RolloutStatus} to string. - * - */ - class RolloutStatusConverter implements Converter { - - private static final long serialVersionUID = -1217685750825632678L; - - @Override - public RolloutStatus convertToModel(final String value, final Class targetType, - final Locale locale) { - return null; - } - - @Override - public String convertToPresentation(final RolloutStatus value, final Class targetType, - final Locale locale) { - return convertRolloutStatusToString(value); - } - - @Override - public Class getModelType() { - return RolloutStatus.class; - } - - @Override - public Class getPresentationType() { - return String.class; - } - - private String convertRolloutStatusToString(final RolloutStatus value) { - final StatusFontIcon statusFontIcon = statusIconMap.get(value); - final String codePoint = HawkbitCommonUtil.getCodePoint(statusFontIcon); - return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(), - SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID); - } - } - - /** - * Converter to convert {@link TotalTargetCountStatus} to formatted string - * with status and count details. - * - */ - class TotalTargetCountStatusConverter implements Converter { - - private static final long serialVersionUID = -5794528427855153924L; - - @Override - public TotalTargetCountStatus convertToModel(final String value, - final Class targetType, final Locale locale) - throws com.vaadin.data.util.converter.Converter.ConversionException { - return null; - } - - @Override - public String convertToPresentation(final TotalTargetCountStatus value, - final Class targetType, final Locale locale) - throws com.vaadin.data.util.converter.Converter.ConversionException { - return DistributionBarHelper.getDistributionBarAsHTMLString(value.getStatusTotalCountMap()); - } - - @Override - public Class getModelType() { - return TotalTargetCountStatus.class; - } - - @Override - public Class getPresentationType() { - return String.class; - } - } - - /** - * Converter to convert 0 to empty, if total target groups is zero. - * - */ - class TotalTargetGroupsConverter implements Converter { - - private static final long serialVersionUID = 6589305227035220369L; - - @Override - public Long convertToModel(final String value, final Class targetType, final Locale locale) - throws com.vaadin.data.util.converter.Converter.ConversionException { - return null; - } - - @Override - public String convertToPresentation(final Long value, final Class targetType, - final Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { - if (value == 0) { - return ""; - } - return value.toString(); - } - - @Override - public Class getModelType() { - return Long.class; - } - - @Override - public Class getPresentationType() { - return String.class; - } - - } + private static final long serialVersionUID = 4060904914954370524L; + + private static final String UPDATE_OPTION = "Update"; + + private static final String RESUME_OPTION = "Resume"; + + private static final String PAUSE_OPTION = "Pause"; + + 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 + private transient RolloutManagement rolloutManagement; + + @Autowired + private AddUpdateRolloutWindowLayout addUpdateRolloutWindow; + + @Autowired + private UINotification uiNotification; + + @Autowired + private transient RolloutUIState rolloutUIState; + + @Autowired + private transient SpPermissionChecker permissionChecker; + + private transient Map statusIconMap = new EnumMap<>(RolloutStatus.class); + + /** + * Handles the RolloutEvent to refresh Grid. + * + */ + @EventBusListenerMethod(scope = EventScope.SESSION) + void onEvent(final RolloutEvent event) { + switch (event) { + case FILTER_BY_TEXT: + case CREATE_ROLLOUT: + case UPDATE_ROLLOUT: + case SHOW_ROLLOUTS: + refreshGrid(); + break; + default: + return; + } + } + + /** + * Handles the RolloutChangeEvent to refresh the item in the grid. + * + * @param rolloutChangeEvent + * the event which contains the rollout which has been changed + */ + @SuppressWarnings("unchecked") + @EventBusListenerMethod(scope = EventScope.SESSION) + public void onEvent(final RolloutChangeEvent rolloutChangeEvent) { + if (!rolloutUIState.isShowRollOuts()) { + return; + } + final Rollout rollout = rolloutManagement.findRolloutWithDetailedStatus(rolloutChangeEvent.getRolloutId()); + final TotalTargetCountStatus totalTargetCountStatus = rollout.getTotalTargetCountStatus(); + final LazyQueryContainer rolloutContainer = (LazyQueryContainer) getContainerDataSource(); + final Item item = rolloutContainer.getItem(rolloutChangeEvent.getRolloutId()); + if (item == null) { + return; + } + item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).setValue(rollout.getStatus()); + item.getItemProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setValue(totalTargetCountStatus); + final Long groupCount = (Long) item.getItemProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).getValue(); + final int groupsCreated = rollout.getRolloutGroupsCreated(); + if (groupsCreated != 0) { + item.getItemProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setValue(Long.valueOf(groupsCreated)); + } else if (rollout.getRolloutGroups() != null && groupCount != rollout.getRolloutGroups().size()) { + item.getItemProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS) + .setValue(Long.valueOf(rollout.getRolloutGroups().size())); + } + item.getItemProperty(ROLLOUT_RENDERER_DATA) + .setValue(new RolloutRendererData(rollout.getName(), rollout.getStatus().toString())); + + } + + @Override + protected Container createContainer() { + final BeanQueryFactory rolloutQf = new BeanQueryFactory<>(RolloutBeanQuery.class); + return new LazyQueryContainer( + new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_ID), rolloutQf); + } + + @Override + 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, + false); + rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, String.class, null, false, + false); + + rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_DATE, String.class, null, false, + false); + rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_USER, String.class, null, false, + false); + rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_BY, String.class, null, false, + false); + rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS, Long.class, 0, false, + false); + rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS, String.class, "0", false, + false); + rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS, + TotalTargetCountStatus.class, null, false, false); + + rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.ACTION, String.class, + FontAwesome.CIRCLE_O.getHtml(), false, false); + + } + + @Override + protected void setColumnExpandRatio() { + + getColumn(ROLLOUT_RENDERER_DATA).setMinimumWidth(40); + getColumn(ROLLOUT_RENDERER_DATA).setMaximumWidth(150); + + getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).setMinimumWidth(40); + getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).setMaximumWidth(150); + + getColumn(SPUILabelDefinitions.VAR_STATUS).setMinimumWidth(75); + getColumn(SPUILabelDefinitions.VAR_STATUS).setMaximumWidth(75); + + getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMinimumWidth(40); + getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMaximumWidth(100); + + getColumn(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setMinimumWidth(40); + getColumn(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setMaximumWidth(100); + + getColumn(SPUILabelDefinitions.ACTION).setMinimumWidth(75); + getColumn(SPUILabelDefinitions.ACTION).setMaximumWidth(75); + + getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setMinimumWidth(280); + + setFrozenColumnCount(getColumns().size()); + } + + @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")); + getColumn(SPUILabelDefinitions.VAR_CREATED_DATE).setHeaderCaption(i18n.get("header.createdDate")); + getColumn(SPUILabelDefinitions.VAR_CREATED_USER).setHeaderCaption(i18n.get("header.createdBy")); + getColumn(SPUILabelDefinitions.VAR_MODIFIED_DATE).setHeaderCaption(i18n.get("header.modifiedDate")); + getColumn(SPUILabelDefinitions.VAR_MODIFIED_BY).setHeaderCaption(i18n.get("header.modifiedBy")); + getColumn(SPUILabelDefinitions.VAR_DESC).setHeaderCaption(i18n.get("header.description")); + getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS) + .setHeaderCaption(i18n.get("header.detail.status")); + getColumn(SPUILabelDefinitions.VAR_STATUS).setHeaderCaption(i18n.get("header.status")); + getColumn(SPUILabelDefinitions.ACTION).setHeaderCaption(i18n.get("upload.action")); + } + + @Override + protected String getGridId() { + return SPUIComponetIdProvider.ROLLOUT_LIST_GRID_ID; + } + + @Override + protected void setColumnProperties() { + final List 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); + columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS); + columnList.add(SPUILabelDefinitions.ACTION); + + columnList.add(SPUILabelDefinitions.VAR_CREATED_DATE); + columnList.add(SPUILabelDefinitions.VAR_CREATED_USER); + columnList.add(SPUILabelDefinitions.VAR_MODIFIED_DATE); + columnList.add(SPUILabelDefinitions.VAR_MODIFIED_BY); + columnList.add(SPUILabelDefinitions.VAR_DESC); + setColumnOrder(columnList.toArray()); + alignColumns(); + } + + @Override + protected void setHiddenColumns() { + final List columnsToBeHidden = new ArrayList<>(); + columnsToBeHidden.add(SPUILabelDefinitions.VAR_NAME); + columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_DATE); + columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_USER); + 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); + } + + } + + @Override + protected CellDescriptionGenerator getDescriptionGenerator() { + return cell -> getDescription(cell); + } + + @Override + protected void addColumnRenderes() { + getColumn(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setRenderer(new HtmlRenderer(), + new TotalTargetGroupsConverter()); + getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(new HtmlRenderer(), + new TotalTargetCountStatusConverter()); + + createRolloutStatusToFontMap(); + getColumn(SPUILabelDefinitions.VAR_STATUS).setRenderer(new HtmlLabelRenderer(), new RolloutStatusConverter()); + + getColumn(SPUILabelDefinitions.ACTION).setRenderer(new HtmlButtonRenderer(event -> onClickOfActionBtn(event))); + + final RolloutRenderer customObjectRenderer = new RolloutRenderer(RolloutRendererData.class); + customObjectRenderer.addClickListener(event -> onClickOfRolloutName(event)); + getColumn(ROLLOUT_RENDERER_DATA).setRenderer(customObjectRenderer); + + } + + private void createRolloutStatusToFontMap() { + statusIconMap.put(RolloutStatus.FINISHED, + new StatusFontIcon(FontAwesome.CHECK_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_GREEN)); + statusIconMap.put(RolloutStatus.PAUSED, + new StatusFontIcon(FontAwesome.PAUSE, SPUIStyleDefinitions.STATUS_ICON_BLUE)); + statusIconMap.put(RolloutStatus.RUNNING, new StatusFontIcon(null, SPUIStyleDefinitions.STATUS_SPINNER_YELLOW)); + statusIconMap.put(RolloutStatus.READY, + new StatusFontIcon(FontAwesome.DOT_CIRCLE_O, SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE)); + statusIconMap.put(RolloutStatus.STOPPED, + new StatusFontIcon(FontAwesome.STOP, SPUIStyleDefinitions.STATUS_ICON_RED)); + statusIconMap.put(RolloutStatus.CREATING, new StatusFontIcon(null, SPUIStyleDefinitions.STATUS_SPINNER_GREY)); + statusIconMap.put(RolloutStatus.STARTING, new StatusFontIcon(null, SPUIStyleDefinitions.STATUS_SPINNER_BLUE)); + statusIconMap.put(RolloutStatus.ERROR_CREATING, + new StatusFontIcon(FontAwesome.EXCLAMATION_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_RED)); + statusIconMap.put(RolloutStatus.ERROR_STARTING, + new StatusFontIcon(FontAwesome.EXCLAMATION_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_RED)); + } + + private void alignColumns() { + setCellStyleGenerator(new CellStyleGenerator() { + private static final long serialVersionUID = 5573570647129792429L; + + @Override + public String getStyle(final CellReference cellReference) { + final String[] coulmnNames = { SPUILabelDefinitions.VAR_STATUS, SPUILabelDefinitions.ACTION }; + if (Arrays.asList(coulmnNames).contains(cellReference.getPropertyId())) { + return "centeralign"; + } + return null; + } + }); + } + + private void onClickOfRolloutName(final RendererClickEvent event) { + rolloutUIState.setRolloutId((long) event.getItemId()); + final String rolloutName = (String) getContainerDataSource().getItem(event.getItemId()) + .getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue(); + rolloutUIState.setRolloutName(rolloutName); + final String ds = (String) getContainerDataSource().getItem(event.getItemId()) + .getItemProperty(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).getValue(); + rolloutUIState.setRolloutDistributionSet(ds); + eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUPS); + } + + private void onClickOfActionBtn(final RendererClickEvent event) { + final ContextMenu contextMenu = createContextMenu((Long) event.getItemId()); + contextMenu.setAsContextMenuOf((AbstractClientConnector) event.getComponent()); + contextMenu.open(event.getClientX(), event.getClientY()); + } + + private ContextMenu createContextMenu(final Long rolloutId) { + final ContextMenu context = new ContextMenu(); + context.addItemClickListener(event -> menuItemClicked(event)); + final Item row = getContainerDataSource().getItem(rolloutId); + final RolloutStatus rolloutStatus = (RolloutStatus) row.getItemProperty(SPUILabelDefinitions.VAR_STATUS) + .getValue(); + + switch (rolloutStatus) { + case READY: + final ContextMenuItem startItem = context.addItem(START_OPTION); + startItem.setData(new ContextMenuData(rolloutId, ACTION.START)); + break; + case RUNNING: + final ContextMenuItem pauseItem = context.addItem(PAUSE_OPTION); + pauseItem.setData(new ContextMenuData(rolloutId, ACTION.PAUSE)); + break; + case PAUSED: + final ContextMenuItem resumeItem = context.addItem(RESUME_OPTION); + resumeItem.setData(new ContextMenuData(rolloutId, ACTION.RESUME)); + break; + case STARTING: + case CREATING: + case ERROR_CREATING: + case ERROR_STARTING: + // do not provide any action on these statuses + return context; + default: + break; + } + getUpdateMenuItem(context, rolloutId); + return context; + } + + private void getUpdateMenuItem(final ContextMenu context, final Long rolloutId) { + // Add 'Update' option only if user has update permission + if (!permissionChecker.hasRolloutUpdatePermission()) { + return; + } + final ContextMenuItem cancelItem = context.addItem(UPDATE_OPTION); + cancelItem.setData(new ContextMenuData(rolloutId, ACTION.UPDATE)); + } + + private void menuItemClicked(final ContextMenuItemClickEvent event) { + final ContextMenuItem item = (ContextMenuItem) event.getSource(); + final ContextMenuData contextMenuData = (ContextMenuData) item.getData(); + final Item row = getContainerDataSource().getItem(contextMenuData.getRolloutId()); + final String rolloutName = (String) row.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue(); + switch (contextMenuData.getAction()) { + case PAUSE: + rolloutManagement.pauseRollout(rolloutManagement.findRolloutById(contextMenuData.getRolloutId())); + uiNotification.displaySuccess(i18n.get("message.rollout.paused", rolloutName)); + break; + case RESUME: + rolloutManagement.resumeRollout(rolloutManagement.findRolloutById(contextMenuData.getRolloutId())); + uiNotification.displaySuccess(i18n.get("message.rollout.resumed", rolloutName)); + break; + case START: + rolloutManagement.startRolloutAsync(rolloutManagement.findRolloutByName(rolloutName)); + uiNotification.displaySuccess(i18n.get("message.rollout.started", rolloutName)); + break; + case UPDATE: + onUpdate(contextMenuData); + break; + default: + break; + } + } + + private void onUpdate(final ContextMenuData contextMenuData) { + addUpdateRolloutWindow.populateData(contextMenuData.getRolloutId()); + final Window addTargetWindow = addUpdateRolloutWindow.getWindow(); + addTargetWindow.setCaption(i18n.get("caption.update.rollout")); + UI.getCurrent().addWindow(addTargetWindow); + addTargetWindow.setVisible(Boolean.TRUE); + } + + private void refreshGrid() { + ((LazyQueryContainer) getContainerDataSource()).refresh(); + } + + /** + * Generator to generate fontIcon by String. + */ + public final class FontIconGenerator extends PropertyValueGenerator { + + private static final long serialVersionUID = 2544026030795375748L; + private final FontAwesome fontIcon; + + public FontIconGenerator(final FontAwesome icon) { + this.fontIcon = icon; + } + + @Override + public String getValue(final Item item, final Object itemId, final Object propertyId) { + return fontIcon.getHtml(); + } + + @Override + public Class getType() { + return String.class; + } + } + + private String getDescription(final CellReference cell) { + if (SPUILabelDefinitions.VAR_STATUS.equals(cell.getPropertyId())) { + return cell.getProperty().getValue().toString().toLowerCase(); + } else if (SPUILabelDefinitions.ACTION.equals(cell.getPropertyId())) { + return SPUILabelDefinitions.ACTION.toLowerCase(); + } else if (ROLLOUT_RENDERER_DATA.equals(cell.getPropertyId())) { + return ((RolloutRendererData) cell.getProperty().getValue()).getName(); + } 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((Item) cell.getItem()); + } + return null; + } + + private String getDSDetails(final Item rolloutItem) { + StringBuilder swModuleNames = new StringBuilder(); + StringBuilder swModuleVendors = new StringBuilder(); + final Set swModules = (Set) rolloutItem.getItemProperty(SW_MODULES).getValue(); + swModules.forEach(swModule -> { + swModuleNames.append(swModule.getName()); + swModuleNames.append(" , "); + swModuleVendors.append(swModule.getVendor()); + swModuleVendors.append(" , "); + }); + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("
    "); + stringBuilder.append("
  • "); + stringBuilder.append(" DistributionSet Description : ") + .append((String) rolloutItem.getItemProperty(SPUILabelDefinitions.VAR_DESC).getValue()); + stringBuilder.append("
  • "); + stringBuilder.append("
  • "); + stringBuilder.append(" DistributionSet Type : ") + .append((String) rolloutItem.getItemProperty(DS_TYPE).getValue()); + stringBuilder.append("
  • "); + stringBuilder.append("
  • "); + stringBuilder.append("Required Migration step : ") + .append((boolean) rolloutItem.getItemProperty(IS_REQUIRED_MIGRATION_STEP).getValue() ? "Yes" : "No"); + stringBuilder.append("
  • "); + + stringBuilder.append("
  • "); + stringBuilder.append("SoftWare Modules : ").append(swModuleNames.toString()); + stringBuilder.append("
  • "); + + stringBuilder.append("
  • "); + stringBuilder.append("Vendor(s) : ").append(swModuleVendors.toString()); + stringBuilder.append("
  • "); + + stringBuilder.append("
"); + return stringBuilder.toString(); + } + + enum ACTION { + PAUSE, RESUME, START, UPDATE + } + + /** + * Represents data of context menu item. + * + */ + public static class ContextMenuData { + + private Long rolloutId; + + private ACTION action; + + /** + * Set rollout if and action. + * + * @param rolloutId + * id of rollout + * @param action + * user action {@link ACTION} + */ + public ContextMenuData(final Long rolloutId, final ACTION action) { + this.action = action; + this.rolloutId = rolloutId; + } + + /** + * @return the rolloutId + */ + public Long getRolloutId() { + return rolloutId; + } + + /** + * @param rolloutId + * the rolloutId to set + */ + public void setRolloutId(final Long rolloutId) { + this.rolloutId = rolloutId; + } + + /** + * @return the action + */ + public ACTION getAction() { + return action; + } + + /** + * @param action + * the action to set + */ + public void setAction(final ACTION action) { + this.action = action; + } + } + + /** + * + * Converter to convert {@link RolloutStatus} to string. + * + */ + class RolloutStatusConverter implements Converter { + + private static final long serialVersionUID = -1217685750825632678L; + + @Override + public RolloutStatus convertToModel(final String value, final Class targetType, + final Locale locale) { + return null; + } + + @Override + public String convertToPresentation(final RolloutStatus value, final Class targetType, + final Locale locale) { + return convertRolloutStatusToString(value); + } + + @Override + public Class getModelType() { + return RolloutStatus.class; + } + + @Override + public Class getPresentationType() { + return String.class; + } + + private String convertRolloutStatusToString(final RolloutStatus value) { + final StatusFontIcon statusFontIcon = statusIconMap.get(value); + final String codePoint = HawkbitCommonUtil.getCodePoint(statusFontIcon); + return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(), + SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID); + } + } + + /** + * Converter to convert {@link TotalTargetCountStatus} to formatted string + * with status and count details. + * + */ + class TotalTargetCountStatusConverter implements Converter { + + private static final long serialVersionUID = -5794528427855153924L; + + @Override + public TotalTargetCountStatus convertToModel(final String value, + final Class targetType, final Locale locale) + throws com.vaadin.data.util.converter.Converter.ConversionException { + return null; + } + + @Override + public String convertToPresentation(final TotalTargetCountStatus value, + final Class targetType, final Locale locale) + throws com.vaadin.data.util.converter.Converter.ConversionException { + return DistributionBarHelper.getDistributionBarAsHTMLString(value.getStatusTotalCountMap()); + } + + @Override + public Class getModelType() { + return TotalTargetCountStatus.class; + } + + @Override + public Class getPresentationType() { + return String.class; + } + } + + /** + * Converter to convert 0 to empty, if total target groups is zero. + * + */ + class TotalTargetGroupsConverter implements Converter { + + private static final long serialVersionUID = 6589305227035220369L; + + @Override + public Long convertToModel(final String value, final Class targetType, final Locale locale) + throws com.vaadin.data.util.converter.Converter.ConversionException { + return null; + } + + @Override + public String convertToPresentation(final Long value, final Class targetType, + final Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { + if (value == 0) { + return ""; + } + return value.toString(); + } + + @Override + public Class getModelType() { + return Long.class; + } + + @Override + public Class getPresentationType() { + return String.class; + } + + } } diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java index 46a76fb17..df4a1309e 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java @@ -103,9 +103,9 @@ public final class HawkbitCommonUtil { private static final String TARGET_TAG_DROP_REMOVE_SCRIPT = "var m = document.getElementById('show-filter-drop-hint'); if(m) { document.head.removeChild(m); } "; 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"; + private static final String INSTALL_DIST_SET = "installedDistributionSet"; /** * Define empty string. @@ -1041,7 +1041,7 @@ 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);