fix_assigned_installed_ds_tooltip_gliches
Signed-off-by: venu1278 <venugopal.boodidadinne@in.bosch.com>
This commit is contained in:
@@ -323,10 +323,6 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
|
|||||||
return columnList;
|
return columnList;
|
||||||
}
|
}
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.2F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.2F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER,
|
|
||||||
i18n.get("header.assigned.ds"), 0.1F));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER,
|
|
||||||
i18n.get("header.installed.ds"), 0.1F));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_BY, i18n.get("header.createdBy"), 0.1F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_BY, i18n.get("header.createdBy"), 0.1F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.1F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.1F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.1F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.1F));
|
||||||
|
|||||||
@@ -8,27 +8,22 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.filtermanagement;
|
package org.eclipse.hawkbit.ui.filtermanagement;
|
||||||
|
|
||||||
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_LI_CLOSE_TAG;
|
|
||||||
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_LI_OPEN_TAG;
|
|
||||||
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_UL_CLOSE_TAG;
|
|
||||||
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_UL_OPEN_TAG;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.PreDestroy;
|
import javax.annotation.PreDestroy;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
|
||||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
|
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.filtermanagement.state.FilterManagementUIState;
|
import org.eclipse.hawkbit.ui.filtermanagement.state.FilterManagementUIState;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.AssignInstalledDSTooltipGenerator;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
@@ -99,7 +94,7 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
setId(SPUIComponetIdProvider.CUSTOM_FILTER_TARGET_TABLE_ID);
|
setId(SPUIComponetIdProvider.CUSTOM_FILTER_TARGET_TABLE_ID);
|
||||||
setSelectable(false);
|
setSelectable(false);
|
||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
setItemDescriptionGenerator(new TooltipGenerator());
|
setItemDescriptionGenerator(new AssignInstalledDSTooltipGenerator());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreDestroy
|
@PreDestroy
|
||||||
@@ -188,13 +183,13 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
container.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, Date.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_BY, String.class, null, false, true);
|
||||||
container.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, 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_TARGET_STATUS, TargetUpdateStatus.class, null);
|
||||||
container.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, "", false, true);
|
container.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, "", false, true);
|
||||||
|
|
||||||
container.addContainerProperty(ASSIGN_DIST_SET, DistributionSet.class, null, false, true);
|
container.addContainerProperty(ASSIGN_DIST_SET, DistributionSet.class, null, false, true);
|
||||||
container.addContainerProperty(INSTALL_DIST_SET, DistributionSet.class, null, false, true);
|
container.addContainerProperty(INSTALL_DIST_SET, DistributionSet.class, null, false, true);
|
||||||
|
container.addContainerProperty(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER, String.class, "");
|
||||||
|
container.addContainerProperty(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER, String.class, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<TableColumn> getVisbleColumns() {
|
private List<TableColumn> getVisbleColumns() {
|
||||||
@@ -205,12 +200,12 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.1F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.1F));
|
||||||
columnList.add(
|
columnList.add(
|
||||||
new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.get("header.modifiedDate"), 0.1F));
|
new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.get("header.modifiedDate"), 0.1F));
|
||||||
|
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));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER,
|
columnList.add(new TableColumn(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER,
|
||||||
i18n.get("header.assigned.ds"), 0.125F));
|
i18n.get("header.assigned.ds"), 0.125F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER,
|
columnList.add(new TableColumn(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER,
|
||||||
i18n.get("header.installed.ds"), 0.125F));
|
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;
|
return columnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,58 +258,5 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
populateTableData();
|
populateTableData();
|
||||||
eventBus.publish(this, CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON);
|
eventBus.publish(this, CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TooltipGenerator implements ItemDescriptionGenerator {
|
|
||||||
private static final long serialVersionUID = 688730421728162456L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String generateDescription(final Component source, final Object itemId, final Object propertyId) {
|
|
||||||
final DistributionSet distributionSet;
|
|
||||||
final Item item = getItem(itemId);
|
|
||||||
if (propertyId != null) {
|
|
||||||
if (propertyId.equals(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER)) {
|
|
||||||
distributionSet = (DistributionSet) item.getItemProperty(ASSIGN_DIST_SET).getValue();
|
|
||||||
return getDSDetails(distributionSet);
|
|
||||||
} else if (propertyId.equals(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER)) {
|
|
||||||
distributionSet = (DistributionSet) item.getItemProperty(INSTALL_DIST_SET).getValue();
|
|
||||||
return getDSDetails(distributionSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getDSDetails(final DistributionSet distributionSet) {
|
|
||||||
final StringBuilder swModuleNames = new StringBuilder();
|
|
||||||
final StringBuilder swModuleVendors = new StringBuilder();
|
|
||||||
final Set<SoftwareModule> swModules = distributionSet.getModules();
|
|
||||||
swModules.forEach(swModule -> {
|
|
||||||
swModuleNames.append(swModule.getName());
|
|
||||||
swModuleNames.append(" , ");
|
|
||||||
swModuleVendors.append(swModule.getVendor());
|
|
||||||
swModuleVendors.append(" , ");
|
|
||||||
});
|
|
||||||
final StringBuilder stringBuilder = new StringBuilder();
|
|
||||||
stringBuilder.append(HTML_UL_OPEN_TAG);
|
|
||||||
stringBuilder.append(HTML_LI_OPEN_TAG);
|
|
||||||
stringBuilder.append(" DistributionSet Description : ").append(distributionSet.getDescription());
|
|
||||||
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
|
||||||
stringBuilder.append(HTML_LI_OPEN_TAG);
|
|
||||||
stringBuilder.append(" DistributionSet Type : ").append((distributionSet.getType()).getName());
|
|
||||||
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
|
||||||
stringBuilder.append(HTML_LI_OPEN_TAG);
|
|
||||||
stringBuilder.append(" Required Migration step : ")
|
|
||||||
.append(distributionSet.isRequiredMigrationStep() ? "Yes" : "No");
|
|
||||||
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
|
||||||
stringBuilder.append(HTML_LI_OPEN_TAG);
|
|
||||||
stringBuilder.append("SoftWare Modules : ").append(swModuleNames.toString());
|
|
||||||
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
|
||||||
stringBuilder.append(HTML_LI_OPEN_TAG);
|
|
||||||
stringBuilder.append("Vendor(s) : ").append(swModuleVendors.toString());
|
|
||||||
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
|
||||||
|
|
||||||
stringBuilder.append(HTML_UL_CLOSE_TAG);
|
|
||||||
return stringBuilder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.management.targettable;
|
package org.eclipse.hawkbit.ui.management.targettable;
|
||||||
|
|
||||||
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_LI_CLOSE_TAG;
|
|
||||||
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_LI_OPEN_TAG;
|
|
||||||
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_UL_CLOSE_TAG;
|
|
||||||
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_UL_OPEN_TAG;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -59,6 +54,7 @@ import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
|||||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.management.state.TargetTableFilters;
|
import org.eclipse.hawkbit.ui.management.state.TargetTableFilters;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.AssignInstalledDSTooltipGenerator;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
@@ -117,9 +113,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
|
|||||||
private static final int PROPERTY_DEPT = 3;
|
private static final int PROPERTY_DEPT = 3;
|
||||||
private static final String ACTION_NOT_ALLOWED_MSG = "message.action.not.allowed";
|
private static final String ACTION_NOT_ALLOWED_MSG = "message.action.not.allowed";
|
||||||
|
|
||||||
private static final String ASSIGN_DIST_SET = "assignedDistributionSet";
|
|
||||||
private static final String INSTALL_DIST_SET = "installedDistributionSet";
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient TargetManagement targetManagement;
|
private transient TargetManagement targetManagement;
|
||||||
|
|
||||||
@@ -147,7 +141,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
|
|||||||
addActionHandler(this);
|
addActionHandler(this);
|
||||||
actionSelectAll = new ShortcutAction(i18n.get("action.target.table.selectall"));
|
actionSelectAll = new ShortcutAction(i18n.get("action.target.table.selectall"));
|
||||||
actionUnSelectAll = new ShortcutAction(i18n.get("action.target.table.clear"));
|
actionUnSelectAll = new ShortcutAction(i18n.get("action.target.table.clear"));
|
||||||
setItemDescriptionGenerator(new TooltipGenerator());
|
setItemDescriptionGenerator(new AssignInstalledDSTooltipGenerator());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -341,6 +335,11 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
|
|||||||
if (!isMaximized()) {
|
if (!isMaximized()) {
|
||||||
columnList.add(new TableColumn(SPUIDefinitions.TARGET_STATUS_POLL_TIME, "", 0.0F));
|
columnList.add(new TableColumn(SPUIDefinitions.TARGET_STATUS_POLL_TIME, "", 0.0F));
|
||||||
columnList.add(new TableColumn(SPUIDefinitions.TARGET_STATUS_PIN_TOGGLE_ICON, "", 0.0F));
|
columnList.add(new TableColumn(SPUIDefinitions.TARGET_STATUS_PIN_TOGGLE_ICON, "", 0.0F));
|
||||||
|
}else{
|
||||||
|
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));
|
||||||
}
|
}
|
||||||
return columnList;
|
return columnList;
|
||||||
|
|
||||||
@@ -1085,60 +1084,4 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
|
|||||||
private boolean isFilteredByTags() {
|
private boolean isFilteredByTags() {
|
||||||
return !managementUIState.getTargetTableFilters().getClickedTargetTags().isEmpty();
|
return !managementUIState.getTargetTableFilters().getClickedTargetTags().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* tooltip for assignedDS and installedDS
|
|
||||||
*/
|
|
||||||
|
|
||||||
protected class TooltipGenerator implements ItemDescriptionGenerator {
|
|
||||||
private static final long serialVersionUID = 688730421728162456L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String generateDescription(final Component source, final Object itemId, final Object propertyId) {
|
|
||||||
final DistributionSet distributionSet;
|
|
||||||
final Item item = getItem(itemId);
|
|
||||||
if (propertyId != null) {
|
|
||||||
if (propertyId.equals(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER)) {
|
|
||||||
distributionSet = (DistributionSet) item.getItemProperty(ASSIGN_DIST_SET).getValue();
|
|
||||||
return getDSDetails(distributionSet);
|
|
||||||
} else if (propertyId.equals(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER)) {
|
|
||||||
distributionSet = (DistributionSet) item.getItemProperty(INSTALL_DIST_SET).getValue();
|
|
||||||
return getDSDetails(distributionSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getDSDetails(final DistributionSet distributionSet) {
|
|
||||||
final StringBuilder swModuleNames = new StringBuilder();
|
|
||||||
final StringBuilder swModuleVendors = new StringBuilder();
|
|
||||||
final Set<SoftwareModule> swModules = distributionSet.getModules();
|
|
||||||
swModules.forEach(swModule -> {
|
|
||||||
swModuleNames.append(swModule.getName());
|
|
||||||
swModuleNames.append(" , ");
|
|
||||||
swModuleVendors.append(swModule.getVendor());
|
|
||||||
swModuleVendors.append(" , ");
|
|
||||||
});
|
|
||||||
final StringBuilder stringBuilder = new StringBuilder();
|
|
||||||
stringBuilder.append(HTML_UL_OPEN_TAG);
|
|
||||||
stringBuilder.append(HTML_LI_OPEN_TAG);
|
|
||||||
stringBuilder.append(" DistributionSet Description : ").append(distributionSet.getDescription());
|
|
||||||
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
|
||||||
stringBuilder.append(HTML_LI_OPEN_TAG);
|
|
||||||
stringBuilder.append(" DistributionSet Type : ").append((distributionSet.getType()).getName());
|
|
||||||
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
|
||||||
stringBuilder.append(HTML_LI_OPEN_TAG);
|
|
||||||
stringBuilder.append(" Required Migration step : ")
|
|
||||||
.append(distributionSet.isRequiredMigrationStep() ? "Yes" : "No");
|
|
||||||
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
|
||||||
stringBuilder.append(HTML_LI_OPEN_TAG);
|
|
||||||
stringBuilder.append("SoftWare Modules : ").append(swModuleNames.toString());
|
|
||||||
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
|
||||||
stringBuilder.append(HTML_LI_OPEN_TAG);
|
|
||||||
stringBuilder.append("Vendor(s) : ").append(swModuleVendors.toString());
|
|
||||||
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
|
||||||
stringBuilder.append(HTML_UL_CLOSE_TAG);
|
|
||||||
return stringBuilder.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.eclipse.hawkbit.ui.utils;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
|
|
||||||
|
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_LI_CLOSE_TAG;
|
||||||
|
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_LI_OPEN_TAG;
|
||||||
|
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_UL_CLOSE_TAG;
|
||||||
|
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_UL_OPEN_TAG;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.vaadin.data.Item;
|
||||||
|
import com.vaadin.ui.AbstractSelect.ItemDescriptionGenerator;
|
||||||
|
import com.vaadin.ui.Component;
|
||||||
|
import com.vaadin.ui.Table;
|
||||||
|
|
||||||
|
public class AssignInstalledDSTooltipGenerator implements ItemDescriptionGenerator {
|
||||||
|
private static final long serialVersionUID = 688730421728162456L;
|
||||||
|
|
||||||
|
private static final String ASSIGN_DIST_SET = "assignedDistributionSet";
|
||||||
|
private static final String INSTALL_DIST_SET = "installedDistributionSet";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String generateDescription(final Component source, final Object itemId, final Object propertyId) {
|
||||||
|
final DistributionSet distributionSet;
|
||||||
|
final Item item = ((Table)source).getItem(itemId);
|
||||||
|
if (propertyId != null) {
|
||||||
|
if (propertyId.equals(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER)) {
|
||||||
|
distributionSet = (DistributionSet) item.getItemProperty(ASSIGN_DIST_SET).getValue();
|
||||||
|
return getDSDetails(distributionSet);
|
||||||
|
} else if (propertyId.equals(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER)) {
|
||||||
|
distributionSet = (DistributionSet) item.getItemProperty(INSTALL_DIST_SET).getValue();
|
||||||
|
return getDSDetails(distributionSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getDSDetails(final DistributionSet distributionSet) {
|
||||||
|
final StringBuilder swModuleNames = new StringBuilder();
|
||||||
|
final StringBuilder swModuleVendors = new StringBuilder();
|
||||||
|
final Set<SoftwareModule> swModules = distributionSet.getModules();
|
||||||
|
swModules.forEach(swModule -> {
|
||||||
|
swModuleNames.append(swModule.getName());
|
||||||
|
swModuleNames.append(" , ");
|
||||||
|
swModuleVendors.append(swModule.getVendor());
|
||||||
|
swModuleVendors.append(" , ");
|
||||||
|
});
|
||||||
|
final StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
stringBuilder.append(HTML_UL_OPEN_TAG);
|
||||||
|
stringBuilder.append(HTML_LI_OPEN_TAG);
|
||||||
|
stringBuilder.append(" DistributionSet Description : ").append(distributionSet.getDescription());
|
||||||
|
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
||||||
|
stringBuilder.append(HTML_LI_OPEN_TAG);
|
||||||
|
stringBuilder.append(" DistributionSet Type : ").append((distributionSet.getType()).getName());
|
||||||
|
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
||||||
|
stringBuilder.append(HTML_LI_OPEN_TAG);
|
||||||
|
stringBuilder.append(" Required Migration step : ")
|
||||||
|
.append(distributionSet.isRequiredMigrationStep() ? "Yes" : "No");
|
||||||
|
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
||||||
|
stringBuilder.append(HTML_LI_OPEN_TAG);
|
||||||
|
stringBuilder.append("SoftWare Modules : ").append(swModuleNames.toString());
|
||||||
|
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
||||||
|
stringBuilder.append(HTML_LI_OPEN_TAG);
|
||||||
|
stringBuilder.append("Vendor(s) : ").append(swModuleVendors.toString());
|
||||||
|
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
||||||
|
stringBuilder.append(HTML_UL_CLOSE_TAG);
|
||||||
|
return stringBuilder.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user