diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleTableHeader.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleTableHeader.java index 93d217e4c..d5629775c 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleTableHeader.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleTableHeader.java @@ -53,17 +53,17 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader { @Override protected String getHeaderCaption() { - return i18n.get("upload.swModuleTable.header"); + return softwareHeaderCaption; } @Override protected String getSearchBoxId() { - return SPUIComponentIdProvider.SW_MODULE_SEARCH_TEXT_FIELD; + return softwareSerachBoxId; } @Override protected String getSearchRestIconId() { - return SPUIComponentIdProvider.SW_MODULE_SEARCH_RESET_ICON; + return softwareSearchResetIcon; } @Override diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/upload/UploadStatusInfoWindow.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/upload/UploadStatusInfoWindow.java index 9b7473e5a..108e09a22 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/upload/UploadStatusInfoWindow.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/upload/UploadStatusInfoWindow.java @@ -332,6 +332,7 @@ public class UploadStatusInfoWindow extends Window { restoreState(); } + @SuppressWarnings("unchecked") private void uploadRecevied(final String filename, final SoftwareModule softwareModule) { final Item item = uploads.addItem(getItemid(filename, softwareModule)); if (item != null) { diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/table/AbstractTableHeader.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/table/AbstractTableHeader.java index e11d4e7d2..4e48b3eb7 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/table/AbstractTableHeader.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/table/AbstractTableHeader.java @@ -19,6 +19,7 @@ import org.eclipse.hawkbit.ui.components.SPUIComponentProvider; import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder; import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil; import org.eclipse.hawkbit.ui.utils.I18N; +import org.eclipse.hawkbit.ui.utils.SPUIComponentIdProvider; import org.eclipse.hawkbit.ui.utils.SPUIDefinitions; import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions; import org.springframework.beans.factory.annotation.Autowired; @@ -68,6 +69,13 @@ public abstract class AbstractTableHeader extends VerticalLayout { private Button bulkUploadIcon; + protected String distributionHeaderCaption; + protected String softwareHeaderCaption; + protected String distributionSearchBoxId; + protected String softwareSerachBoxId; + protected String distributionSearchResetIcon; + protected String softwareSearchResetIcon; + /** * Initialze components. */ @@ -85,6 +93,12 @@ public abstract class AbstractTableHeader extends VerticalLayout { } private void createComponents() { + distributionHeaderCaption = i18n.get("header.dist.table"); + softwareHeaderCaption = i18n.get("upload.swModuleTable.header"); + distributionSearchBoxId = SPUIComponentIdProvider.DIST_SEARCH_TEXTFIELD; + softwareSerachBoxId = SPUIComponentIdProvider.SW_MODULE_SEARCH_TEXT_FIELD; + distributionSearchResetIcon = SPUIComponentIdProvider.DIST_SEARCH_ICON; + softwareSearchResetIcon = SPUIComponentIdProvider.SW_MODULE_SEARCH_RESET_ICON; headerCaption = createHeaderCaption(); searchField = new TextFieldBuilder(getSearchBoxId()).createSearchField(event -> searchBy(event.getText())); @@ -514,4 +528,4 @@ public abstract class AbstractTableHeader extends VerticalLayout { protected abstract Boolean isBulkUploadAllowed(); -} +} \ No newline at end of file diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/dstable/DistributionSetTableHeader.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/dstable/DistributionSetTableHeader.java index 8f392101f..e4f62ced0 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/dstable/DistributionSetTableHeader.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/dstable/DistributionSetTableHeader.java @@ -52,17 +52,17 @@ public class DistributionSetTableHeader extends AbstractTableHeader { @Override protected String getHeaderCaption() { - return i18n.get("header.dist.table"); + return distributionHeaderCaption; } @Override protected String getSearchBoxId() { - return SPUIComponentIdProvider.DIST_SEARCH_TEXTFIELD; + return distributionSearchBoxId; } @Override protected String getSearchRestIconId() { - return SPUIComponentIdProvider.DIST_SEARCH_ICON; + return distributionSearchResetIcon; } @Override diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/smtable/SwModuleTableHeader.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/smtable/SwModuleTableHeader.java index 89772bb1b..4dba93be1 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/smtable/SwModuleTableHeader.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/smtable/SwModuleTableHeader.java @@ -52,17 +52,17 @@ public class SwModuleTableHeader extends AbstractTableHeader { @Override protected String getHeaderCaption() { - return i18n.get("upload.swModuleTable.header"); + return softwareHeaderCaption; } @Override protected String getSearchBoxId() { - return SPUIComponentIdProvider.SW_MODULE_SEARCH_TEXT_FIELD; + return softwareSerachBoxId; } @Override protected String getSearchRestIconId() { - return SPUIComponentIdProvider.SW_MODULE_SEARCH_RESET_ICON; + return softwareSearchResetIcon; } @Override diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionTable.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionTable.java index e4313dd80..9bb993662 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionTable.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionTable.java @@ -139,9 +139,9 @@ public class DistributionTable extends AbstractNamedVersionTable e.getId().equals(ds.getId())).findFirst() .isPresent(); - if ((ds.isComplete() && !dsVisible)) { + if (ds.isComplete() && !dsVisible) { refreshDistributions(); - } else if ((!ds.isComplete() && dsVisible)) { + } else if (!ds.isComplete() && dsVisible) { refreshDistributions(); if (ds.getId().equals(managementUIState.getLastSelectedDsIdName().getId())) { managementUIState.setLastSelectedDistribution(null); diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionTableHeader.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionTableHeader.java index 0e63ddb95..e90eeece6 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionTableHeader.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionTableHeader.java @@ -54,17 +54,17 @@ public class DistributionTableHeader extends AbstractTableHeader { @Override protected String getHeaderCaption() { - return i18n.get("header.dist.table"); + return distributionHeaderCaption; } @Override protected String getSearchBoxId() { - return SPUIComponentIdProvider.DIST_SEARCH_TEXTFIELD; + return distributionSearchBoxId; } @Override protected String getSearchRestIconId() { - return SPUIComponentIdProvider.DIST_SEARCH_ICON; + return distributionSearchResetIcon; } @Override 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 85f35c1d7..148714989 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 @@ -105,9 +105,7 @@ public class TargetTable extends AbstractTable { private static final Logger LOG = LoggerFactory.getLogger(TargetTable.class); private static final String TARGET_PINNED = "targetPinned"; - private static final long serialVersionUID = -2300392868806614568L; - private static final int PROPERTY_DEPT = 3; private static final String ACTION_NOT_ALLOWED_MSG = "message.action.not.allowed"; @@ -127,7 +125,6 @@ public class TargetTable extends AbstractTable { private ManagementViewAcceptCriteria managementViewAcceptCriteria; private Button targetPinnedBtn; - private Boolean isTargetPinned = Boolean.FALSE; @Override @@ -234,17 +231,14 @@ public class TargetTable extends AbstractTable { protected Container 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<>(TargetBeanQuery.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); - return targetTableContainer; } @@ -339,7 +333,6 @@ public class TargetTable extends AbstractTable { shouldRefreshTargets = true; } } - if (shouldRefreshTargets) { refreshOnDelete(); } else { 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 c4146cdb9..dd0a8934d 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 @@ -1,6 +1,5 @@ /** * 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 @@ -49,7 +48,6 @@ import com.vaadin.ui.UI; * Common util class. */ public final class HawkbitCommonUtil { - /** * Define spaced string. */ @@ -58,21 +56,17 @@ public final class HawkbitCommonUtil { * Define empty string. */ public static final String SP_STRING_EMPTY = ""; - /** * Html span. */ public static final String SPAN_CLOSE = ""; - public static final String HTML_LI_CLOSE_TAG = ""; public static final String HTML_LI_OPEN_TAG = "
  • "; public static final String HTML_UL_CLOSE_TAG = ""; public static final String HTML_UL_OPEN_TAG = "
      "; private static final String JS_DRAG_COUNT_REM_CHILD = " if(x) { document.head.removeChild(x); } "; - public static final String DIV_DESCRIPTION_START = "

      "; - public static final String DIV_DESCRIPTION_END = "

      "; private static final String DRAG_COUNT_ELEMENT = "var x = document.getElementById('sp-drag-count'); "; @@ -119,7 +113,7 @@ public final class HawkbitCommonUtil { /** * Trim the text and convert into null in case of empty string. - * + * * @param text * as text to be trimed * @return null if the text is null or if the text is blank, text.trim() if @@ -136,7 +130,7 @@ public final class HawkbitCommonUtil { /** * Concatenate the given text all the string arguments with the given * delimiter. - * + * * @param delimiter * the delimiter text to be used while concatenation. * @param texts @@ -162,7 +156,7 @@ public final class HawkbitCommonUtil { /** * Returns the input text within html bold tag ... - * + * * @param text * is the text to be converted in to Bold * @return null if the input text param is null returns text with ... @@ -181,7 +175,7 @@ public final class HawkbitCommonUtil { /** * Get target label Id. - * + * * @param controllerId * as String * @return String as label name @@ -192,7 +186,7 @@ public final class HawkbitCommonUtil { /** * Get distribution table cell id. - * + * * @param name * distribution name * @param version @@ -205,7 +199,7 @@ public final class HawkbitCommonUtil { /** * Get software module label id. - * + * * @param name * software module name * @param version @@ -218,7 +212,7 @@ public final class HawkbitCommonUtil { /** * Get label with software module name and description. - * + * * @param name * software module name * @param desc @@ -233,7 +227,7 @@ public final class HawkbitCommonUtil { /** * Get Label for Artifact Details. - * + * * @param name * @return */ @@ -245,7 +239,7 @@ public final class HawkbitCommonUtil { /** * Get Label for Artifact Details. - * + * * @param caption * as caption of the details * @param name @@ -260,7 +254,7 @@ public final class HawkbitCommonUtil { /** * Get Label for Action History Details. - * + * * @param name * @return */ @@ -272,7 +266,7 @@ public final class HawkbitCommonUtil { /** * Get tool tip for Poll status. - * + * * @param pollStatus * @param i18N * @return @@ -290,7 +284,7 @@ public final class HawkbitCommonUtil { /** * Null check for text. - * + * * @param orgText * text to be formatted * @return String formatted text @@ -302,7 +296,7 @@ public final class HawkbitCommonUtil { /** * Find extra height required to increase by all the components to utilize * the full height of browser for the responsive UI. - * + * * @param newBrowserHeight * as current browser height. * @return extra height required to increase. @@ -314,7 +308,7 @@ public final class HawkbitCommonUtil { /** * Find required extra height of software module. - * + * * @param newBrowserHeight * new browser height * @return float heigth of software module table @@ -354,8 +348,6 @@ public final class HawkbitCommonUtil { } /** - * - * * @param newBrowserHeight * new browser height * @param minPopupHeight @@ -401,7 +393,7 @@ public final class HawkbitCommonUtil { /** * Get target table width based on screen width. - * + * * @param newBrowserWidth * new browser width. * @param minTargetTableLength @@ -553,8 +545,8 @@ public final class HawkbitCommonUtil { } /** -Duplicate check - Unique Key. - * + * Duplicate check - Unique Key. + * * @param name * as string * @param version @@ -635,11 +627,9 @@ Duplicate check - Unique Key. final int assignedCount = result.getAssigned(); final int alreadyAssignedCount = result.getAlreadyAssigned(); final int unassignedCount = result.getUnassigned(); - if (assignedCount == 1) { formMsg.append(i18n.get("message.target.assigned.one", new Object[] { result.getAssignedEntity().get(0).getName(), tagName })).append("
      "); - } else if (assignedCount > 1) { formMsg.append(i18n.get("message.target.assigned.many", new Object[] { assignedCount, tagName })) .append("
      "); @@ -650,11 +640,9 @@ Duplicate check - Unique Key. formMsg.append(alreadyAssigned).append("
      "); } } - if (unassignedCount == 1) { formMsg.append(i18n.get("message.target.unassigned.one", new Object[] { result.getUnassignedEntity().get(0).getName(), tagName })).append("
      "); - } else if (unassignedCount > 1) { formMsg.append(i18n.get("message.target.unassigned.many", new Object[] { unassignedCount, tagName })) .append("
      "); @@ -679,7 +667,6 @@ Duplicate check - Unique Key. } /** - * * Create lazy query container for DS type. * * @param queryFactory