From 96bf5a8293964e43a05be04476515016242e29d9 Mon Sep 17 00:00:00 2001 From: Michael Hirsch Date: Wed, 10 Feb 2016 12:42:37 +0100 Subject: [PATCH 1/6] fixing newly created bug by trying to simplify if-statement with commit a4e1ae7ac8317625f1a4ce391ffbaee5fc9344d8 Signed-off-by: Michael Hirsch --- .../DistributionAddUpdateWindowLayout.java | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java index 256a04926..dfdbcd9de 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java @@ -344,21 +344,22 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout { private boolean duplicateCheck(final String name, final String version) { final DistributionSet existingDs = distributionSetManagement.findDistributionSetByNameAndVersion(name, version); + /* + * Distribution should not exists with the same name & version. Display + * error message, when the "existingDs" is not null and it is add window + * (or) when the "existingDs" is not null and it is edit window and the + * distribution Id of the edit window is different then the "existingDs" + */ + if (existingDs != null && !existingDs.getId().equals(editDistId)) { + distNameTextField.addStyleName("v-textfield-error"); + distVersionTextField.addStyleName("v-textfield-error"); + notificationMessage.displayValidationError( + i18n.get("message.duplicate.dist", new Object[] { existingDs.getName(), existingDs.getVersion() })); - if (existingDs == null) { + return false; + } else { return true; } - - if (editDistribution && !existingDs.getId().equals(editDistId)) { - return true; - } - - distNameTextField.addStyleName("v-textfield-error"); - distVersionTextField.addStyleName("v-textfield-error"); - notificationMessage.displayValidationError( - i18n.get("message.duplicate.dist", new Object[] { existingDs.getName(), existingDs.getVersion() })); - - return false; } /** From 6a93b158548f4ecb81996bd8e69ec7d3e1d196b5 Mon Sep 17 00:00:00 2001 From: Michael Hirsch Date: Wed, 10 Feb 2016 12:43:54 +0100 Subject: [PATCH 2/6] fixing newly created bug by trying to simplify if-statement with commit a4e1ae7ac8317625f1a4ce391ffbaee5fc9344d8 Signed-off-by: Michael Hirsch --- .../DistributionAddUpdateWindowLayout.java | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java index 256a04926..dfdbcd9de 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java @@ -344,21 +344,22 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout { private boolean duplicateCheck(final String name, final String version) { final DistributionSet existingDs = distributionSetManagement.findDistributionSetByNameAndVersion(name, version); + /* + * Distribution should not exists with the same name & version. Display + * error message, when the "existingDs" is not null and it is add window + * (or) when the "existingDs" is not null and it is edit window and the + * distribution Id of the edit window is different then the "existingDs" + */ + if (existingDs != null && !existingDs.getId().equals(editDistId)) { + distNameTextField.addStyleName("v-textfield-error"); + distVersionTextField.addStyleName("v-textfield-error"); + notificationMessage.displayValidationError( + i18n.get("message.duplicate.dist", new Object[] { existingDs.getName(), existingDs.getVersion() })); - if (existingDs == null) { + return false; + } else { return true; } - - if (editDistribution && !existingDs.getId().equals(editDistId)) { - return true; - } - - distNameTextField.addStyleName("v-textfield-error"); - distVersionTextField.addStyleName("v-textfield-error"); - notificationMessage.displayValidationError( - i18n.get("message.duplicate.dist", new Object[] { existingDs.getName(), existingDs.getVersion() })); - - return false; } /** From 19fb5332ef77aacd1553305bcb5dfc68b2499aba Mon Sep 17 00:00:00 2001 From: Michael Hirsch Date: Thu, 11 Feb 2016 17:07:18 +0100 Subject: [PATCH 3/6] fix accessing the UI thread when updating the total target label Signed-off-by: Michael Hirsch --- .../footer/TargetFilterCountMessageLabel.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/footer/TargetFilterCountMessageLabel.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/footer/TargetFilterCountMessageLabel.java index 1c8382223..9267d7d29 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/footer/TargetFilterCountMessageLabel.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/footer/TargetFilterCountMessageLabel.java @@ -71,11 +71,11 @@ public class TargetFilterCountMessageLabel extends Label { @EventBusListenerMethod(scope = EventScope.SESSION) void onEvent(final CustomFilterUIEvent custFUIEvent) { - if (custFUIEvent == CustomFilterUIEvent.FILTER_TARGET_BY_QUERY - || custFUIEvent == CustomFilterUIEvent.TARGET_DETAILS_VIEW + if (custFUIEvent == CustomFilterUIEvent.TARGET_DETAILS_VIEW || custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK - || custFUIEvent == CustomFilterUIEvent.EXIT_CREATE_OR_UPDATE_FILTRER_VIEW) { - displayTargetFilterMessage(); + || custFUIEvent == CustomFilterUIEvent.EXIT_CREATE_OR_UPDATE_FILTRER_VIEW + || custFUIEvent == CustomFilterUIEvent.FILTER_TARGET_BY_QUERY) { + this.getUI().access(() -> displayTargetFilterMessage()); } } @@ -89,8 +89,8 @@ public class TargetFilterCountMessageLabel extends Label { long totalTargets = 0; if (filterManagementUIState.isCreateFilterViewDisplayed() || filterManagementUIState.isEditViewDisplayed()) { if (null != filterManagementUIState.getFilterQueryValue()) { - totalTargets = targetManagement.countTargetByTargetFilterQuery(filterManagementUIState - .getFilterQueryValue()); + totalTargets = targetManagement + .countTargetByTargetFilterQuery(filterManagementUIState.getFilterQueryValue()); } final StringBuilder targetMessage = new StringBuilder(i18n.get("label.target.filtered.total")); if (filterManagementUIState.getTargetsTruncated() != null) { From d8a0a7f8e432a254cc5bc2a7ecd8ec890231d986 Mon Sep 17 00:00:00 2001 From: Michael Hirsch Date: Thu, 11 Feb 2016 19:53:06 +0100 Subject: [PATCH 4/6] fix accessing the with this causes NPE use UI.getCurrent Signed-off-by: Michael Hirsch --- .../filtermanagement/footer/TargetFilterCountMessageLabel.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/footer/TargetFilterCountMessageLabel.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/footer/TargetFilterCountMessageLabel.java index 9267d7d29..febb0c5b4 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/footer/TargetFilterCountMessageLabel.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/footer/TargetFilterCountMessageLabel.java @@ -29,6 +29,7 @@ import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.spring.annotation.SpringComponent; import com.vaadin.spring.annotation.ViewScope; import com.vaadin.ui.Label; +import com.vaadin.ui.UI; /** * @author Venugopal Boodidadinne(RBEI/BSJ) @@ -75,7 +76,7 @@ public class TargetFilterCountMessageLabel extends Label { || custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK || custFUIEvent == CustomFilterUIEvent.EXIT_CREATE_OR_UPDATE_FILTRER_VIEW || custFUIEvent == CustomFilterUIEvent.FILTER_TARGET_BY_QUERY) { - this.getUI().access(() -> displayTargetFilterMessage()); + UI.getCurrent().access(() -> displayTargetFilterMessage()); } } From b30375e9e6d046e2e4f38bd9620d3ce14e24397b Mon Sep 17 00:00:00 2001 From: Michael Hirsch Date: Fri, 12 Feb 2016 12:36:12 +0100 Subject: [PATCH 5/6] fix count select statement join is wrong Signed-off-by: Michael Hirsch --- .../eclipse/hawkbit/repository/RolloutGroupManagement.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/RolloutGroupManagement.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/RolloutGroupManagement.java index e98439b57..54ff37e87 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/RolloutGroupManagement.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/RolloutGroupManagement.java @@ -245,8 +245,9 @@ public class RolloutGroupManagement { JoinType.LEFT); final Root countQueryFrom = countQuery.distinct(true).from(RolloutTargetGroup.class); - countQuery - .select(cb.count(countQueryFrom.join(RolloutTargetGroup_.target).join(Target_.actions, JoinType.LEFT))) + countQueryFrom.join(RolloutTargetGroup_.target); + countQueryFrom.join(RolloutTargetGroup_.actions, JoinType.LEFT); + countQuery.select(cb.count(countQueryFrom)) .where(cb.equal(countQueryFrom.get(RolloutTargetGroup_.rolloutGroup), rolloutGroup)); final Long totalCount = entityManager.createQuery(countQuery).getSingleResult(); From e2927acfca50775afaf67a6f41b7b858892a795f Mon Sep 17 00:00:00 2001 From: Michael Hirsch Date: Fri, 12 Feb 2016 13:18:55 +0100 Subject: [PATCH 6/6] reduce logging from info to debug when checking rollout Signed-off-by: Michael Hirsch --- .../java/org/eclipse/hawkbit/repository/RolloutManagement.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/RolloutManagement.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/RolloutManagement.java index 0d3bc62c6..1573048ec 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/RolloutManagement.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/RolloutManagement.java @@ -552,7 +552,7 @@ public class RolloutManagement { if (updated == 0) { // nothing to check, maybe another instance already checked in // between - LOGGER.info("No rolloutcheck necessary for current scheduled check {}, next check at {}", lastCheck, + LOGGER.debug("No rolloutcheck necessary for current scheduled check {}, next check at {}", lastCheck, lastCheck + delayBetweenChecks); return; }