Bug fixes:

Custom filter detail view : Using =IN= parameter throws 'Unsupported
operator' exception and breaks the UI
Custom filter search : type any query.Search never gets finished.
Alloe case insensitive search for IN paramters

Signed-off-by: asharani-murugesh <asharani.murugesh@in.bosch.com>
This commit is contained in:
asharani-murugesh
2016-02-11 13:32:07 +01:00
8 changed files with 63 additions and 42 deletions

View File

@@ -9,7 +9,6 @@
package org.eclipse.hawkbit.ui.filtermanagement;
import java.awt.event.FocusListener;
import java.util.concurrent.Executor;
import javax.annotation.PostConstruct;
@@ -156,8 +155,8 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
} else if (custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK) {
setUpCaptionLayout(true);
resetComponents();
} else if (custFUIEvent == CustomFilterUIEvent.TARGET_FILTER_STATUS_HIDE) {
this.getUI().access(() -> updateStatusIconAfterTablePopulated());
} else if (custFUIEvent == CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON) {
UI.getCurrent().access(() -> updateStatusIconAfterTablePopulated());
}
}
@@ -331,15 +330,20 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
validationIcon.addStyleName("show-status-label");
showValidationInProgress();
onQueryChange(event.getText());
executor.execute(new StatusCircledAsync());
executor.execute(new StatusCircledAsync(UI.getCurrent()));
}
});
}
class StatusCircledAsync implements Runnable {
@Override
private UI current;
public StatusCircledAsync(UI current) {
this.current = current;
}
@Override
public void run() {
UI.setCurrent(current);
eventBus.publish(this, CustomFilterUIEvent.FILTER_TARGET_BY_QUERY);
}
}

View File

@@ -101,7 +101,7 @@ public class CreateOrUpdateFilterTable extends Table {
|| custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK) {
UI.getCurrent().access(() -> populateTableData());
} else if (custFUIEvent == CustomFilterUIEvent.FILTER_TARGET_BY_QUERY) {
this.getUI().access(() -> onQuery());
UI.getCurrent().access(() -> onQuery());
}
}
@@ -112,7 +112,7 @@ public class CreateOrUpdateFilterTable extends Table {
filterManagementUIState.setFilterQueryValue(null);
} else {
filterManagementUIState.getTfQuery().ifPresent(
value -> filterManagementUIState.setFilterQueryValue(value.getQuery()));
value -> filterManagementUIState.setFilterQueryValue(value.getQuery().toLowerCase()));
}
}
@@ -244,6 +244,6 @@ public class CreateOrUpdateFilterTable extends Table {
private void onQuery() {
populateTableData();
eventBus.publish(this, CustomFilterUIEvent.TARGET_FILTER_STATUS_HIDE);
eventBus.publish(this, CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON);
}
}

View File

@@ -32,7 +32,8 @@ import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
import com.google.common.base.Strings;
/**
*
* Simple implementation of generics bean query which dynamically loads {@link ProxyTarget} batch
* of beans.
*
*/
public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
@@ -43,7 +44,6 @@ public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
private FilterManagementUIState filterManagementUIState;
private transient I18N i18N;
private String filterQuery;
private Boolean isInvalidFilterQuery;
/**
* Parametric Constructor.
@@ -63,7 +63,6 @@ public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
if (HawkbitCommonUtil.mapCheckStrKey(queryConfig)) {
filterQuery = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_QUERY);
isInvalidFilterQuery = (Boolean) queryConfig.get(SPUIDefinitions.FILTER_BY_INVALID_QUERY);
}
if (HawkbitCommonUtil.checkBolArray(sortStates)) {
// Initalize Sor
@@ -164,16 +163,11 @@ public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
*/
@Override
public int size() {
final long totSize = getTargetManagement().countTargetsAll();
long size;
long size=0;
if (!Strings.isNullOrEmpty(filterQuery)) {
size = getTargetManagement().countTargetByTargetFilterQuery(filterQuery);
} else if (getFilterManagementUIState().isCreateFilterViewDisplayed() || isInvalidFilterQuery) {
size = 0;
} else {
size = totSize;
}
getFilterManagementUIState().setTargetsCountAll(totSize);
getFilterManagementUIState().setTargetsCountAll(size);
if (size > SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES) {
getFilterManagementUIState().setTargetsTruncated(size - SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES);
size = SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES;

View File

@@ -15,5 +15,5 @@ package org.eclipse.hawkbit.ui.filtermanagement.event;
*
*/
public enum CustomFilterUIEvent {
FILTER_TARGET_BY_QUERY, FILTER_BY_CUST_FILTER_TEXT, FILTER_BY_CUST_FILTER_TEXT_REMOVE, CREATE_NEW_FILTER_CLICK, EXIT_CREATE_OR_UPDATE_FILTRER_VIEW, TARGET_FILTER_DETAIL_VIEW, TARGET_DETAILS_VIEW, CREATE_TARGET_FILTER_QUERY, UPDATED_TARGET_FILTER_QUERY, TARGET_FILTER_STATUS_HIDE
FILTER_TARGET_BY_QUERY, FILTER_BY_CUST_FILTER_TEXT, FILTER_BY_CUST_FILTER_TEXT_REMOVE, CREATE_NEW_FILTER_CLICK, EXIT_CREATE_OR_UPDATE_FILTRER_VIEW, TARGET_FILTER_DETAIL_VIEW, TARGET_DETAILS_VIEW, CREATE_TARGET_FILTER_QUERY, UPDATED_TARGET_FILTER_QUERY, UPDATE_TARGET_FILTER_SEARCH_ICON
}

View File

@@ -75,7 +75,7 @@ public class TargetFilterCountMessageLabel extends Label {
if (custFUIEvent == CustomFilterUIEvent.TARGET_DETAILS_VIEW
|| custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK
|| custFUIEvent == CustomFilterUIEvent.EXIT_CREATE_OR_UPDATE_FILTRER_VIEW
|| custFUIEvent == CustomFilterUIEvent.FILTER_TARGET_BY_QUERY) {
||custFUIEvent == CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON) {
UI.getCurrent().access(() -> displayTargetFilterMessage());
}
}
@@ -90,8 +90,7 @@ public class TargetFilterCountMessageLabel extends Label {
long totalTargets = 0;
if (filterManagementUIState.isCreateFilterViewDisplayed() || filterManagementUIState.isEditViewDisplayed()) {
if (null != filterManagementUIState.getFilterQueryValue()) {
totalTargets = targetManagement
.countTargetByTargetFilterQuery(filterManagementUIState.getFilterQueryValue());
totalTargets = filterManagementUIState.getTargetsCountAll().get();
}
final StringBuilder targetMessage = new StringBuilder(i18n.get("label.target.filtered.total"));
if (filterManagementUIState.getTargetsTruncated() != null) {

View File

@@ -344,22 +344,21 @@ 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() }));
return false;
} else {
if (existingDs == null) {
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;
}
/**