MECS-1454: Minor_improvements_in_search_filter_New
Signed-off-by: venu1278 <venugopal.boodidadinne@in.bosch.com>
This commit is contained in:
@@ -8,6 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.filtermanagement;
|
package org.eclipse.hawkbit.ui.filtermanagement;
|
||||||
|
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.PreDestroy;
|
import javax.annotation.PreDestroy;
|
||||||
|
|
||||||
@@ -16,7 +18,6 @@ import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
|||||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIButton;
|
import org.eclipse.hawkbit.ui.components.SPUIButton;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmall;
|
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||||
import org.eclipse.hawkbit.ui.documentation.DocumentationPageLink;
|
import org.eclipse.hawkbit.ui.documentation.DocumentationPageLink;
|
||||||
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
|
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
|
||||||
@@ -25,6 +26,7 @@ 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.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
@@ -83,6 +85,8 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UINotification notification;
|
private UINotification notification;
|
||||||
|
|
||||||
|
private transient Executor executor;
|
||||||
|
|
||||||
private Label headerCaption;
|
private Label headerCaption;
|
||||||
|
|
||||||
private TextField queryTextField;
|
private TextField queryTextField;
|
||||||
@@ -113,7 +117,9 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
|
|
||||||
private LayoutClickListener nameLayoutClickListner;
|
private LayoutClickListener nameLayoutClickListner;
|
||||||
|
|
||||||
private Button targetFilterStatusButton;
|
private Label targetFilterStatusLabel;
|
||||||
|
|
||||||
|
private String newFilterQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the Campaign Status History Header.
|
* Initialize the Campaign Status History Header.
|
||||||
@@ -126,6 +132,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
restoreOnLoad();
|
restoreOnLoad();
|
||||||
setUpCaptionLayout(filterManagementUIState.isCreateFilterViewDisplayed());
|
setUpCaptionLayout(filterManagementUIState.isCreateFilterViewDisplayed());
|
||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
|
executor = (Executor) SpringContextHelper.getBean("uiExecutor");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -150,6 +157,8 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
} else if (custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK) {
|
} else if (custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK) {
|
||||||
setUpCaptionLayout(true);
|
setUpCaptionLayout(true);
|
||||||
resetComponents();
|
resetComponents();
|
||||||
|
} else if (custFUIEvent == CustomFilterUIEvent.TARGET_FILTER_STATUS_HIDE) {
|
||||||
|
this.getUI().access(() -> targetFilterStatusLabel.setVisible(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -194,31 +203,22 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
nameTextField = createNameTextField();
|
nameTextField = createNameTextField();
|
||||||
nameTextField.setWidth(380, Unit.PIXELS);
|
nameTextField.setWidth(380, Unit.PIXELS);
|
||||||
|
|
||||||
|
targetFilterStatusLabel = new Label();
|
||||||
|
targetFilterStatusLabel.addStyleName(SPUIStyleDefinitions.TARGET_FILTER_SEARCH_PROGRESS_INDICATOR_STYLE);
|
||||||
|
targetFilterStatusLabel.setVisible(false);
|
||||||
|
targetFilterStatusLabel.setImmediate(true);
|
||||||
|
|
||||||
queryTextField = createSearchField();
|
queryTextField = createSearchField();
|
||||||
addSearchLisenter();
|
addSearchLisenter();
|
||||||
|
|
||||||
validationIcon = createStatusIcon();
|
validationIcon = createStatusIcon();
|
||||||
saveButton = createSaveButton();
|
saveButton = createSaveButton();
|
||||||
|
|
||||||
targetFilterStatusButton = createTargetFilterStatusButton();
|
|
||||||
|
|
||||||
helpLink = DocumentationPageLink.TARGET_FILTER_VIEW.getLink();
|
helpLink = DocumentationPageLink.TARGET_FILTER_VIEW.getLink();
|
||||||
|
|
||||||
closeIcon = createSearchResetIcon();
|
closeIcon = createSearchResetIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Button createTargetFilterStatusButton() {
|
|
||||||
targetFilterStatusButton = SPUIComponentProvider.getButton(SPUIComponetIdProvider.TARGET_FILTER_STATUS_BUTTON,
|
|
||||||
"", "", "", false, null, SPUIButtonStyleSmall.class);
|
|
||||||
targetFilterStatusButton.addStyleName(SPUIStyleDefinitions.BULK_UPLOAD_PROGRESS_INDICATOR_STYLE);
|
|
||||||
targetFilterStatusButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
|
|
||||||
targetFilterStatusButton.setWidth("100px");
|
|
||||||
targetFilterStatusButton.setHtmlContentAllowed(true);
|
|
||||||
targetFilterStatusButton.setVisible(false);
|
|
||||||
targetFilterStatusButton.setImmediate(true);
|
|
||||||
return targetFilterStatusButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -299,9 +299,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
final HorizontalLayout iconLayout = new HorizontalLayout();
|
final HorizontalLayout iconLayout = new HorizontalLayout();
|
||||||
iconLayout.setSizeUndefined();
|
iconLayout.setSizeUndefined();
|
||||||
iconLayout.setSpacing(false);
|
iconLayout.setSpacing(false);
|
||||||
iconLayout.setStyleName(SPUIStyleDefinitions.TARGET_FILTER_SEARCH_PROGRESS_INDICATOR_STYLE);
|
iconLayout.addComponents(helpLink, saveButton);
|
||||||
iconLayout.addComponents(helpLink, saveButton, targetFilterStatusButton);
|
|
||||||
iconLayout.setComponentAlignment(targetFilterStatusButton, Alignment.MIDDLE_CENTER);
|
|
||||||
|
|
||||||
final HorizontalLayout queryLayout = new HorizontalLayout();
|
final HorizontalLayout queryLayout = new HorizontalLayout();
|
||||||
queryLayout.setSizeUndefined();
|
queryLayout.setSizeUndefined();
|
||||||
@@ -329,22 +327,50 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
|
|
||||||
private void addSearchLisenter() {
|
private void addSearchLisenter() {
|
||||||
queryTextField.addTextChangeListener(new TextChangeListener() {
|
queryTextField.addTextChangeListener(new TextChangeListener() {
|
||||||
|
private static final long serialVersionUID = -6668604418942689391L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void textChange(final TextChangeEvent event) {
|
public void textChange(final TextChangeEvent event) {
|
||||||
enableTargetFilterStatusButton();
|
newFilterQuery = event.getText();
|
||||||
updateTargetFilterStatusToProgressIndicator();
|
executor.execute(new StatusCircledAsync(event));
|
||||||
onQueryChange(event.getText());
|
|
||||||
eventBus.publish(this, CustomFilterUIEvent.FILTER_TARGET_BY_QUERY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class StatusCircledAsync implements Runnable {
|
||||||
|
final TextChangeEvent event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
public StatusCircledAsync(final TextChangeEvent event) {
|
||||||
|
this.event = event;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
processQueryChange();
|
||||||
|
eventBus.publish(this, CustomFilterUIEvent.FILTER_TARGET_BY_QUERY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processQueryChange() {
|
||||||
|
this.getUI().access(() -> {
|
||||||
|
targetFilterStatusLabel.setVisible(true);
|
||||||
|
onQueryChange(newFilterQuery);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void onQueryChange(final String text) {
|
private void onQueryChange(final String text) {
|
||||||
boolean validationFailed = false;
|
boolean validationFailed = false;
|
||||||
if (!Strings.isNullOrEmpty(text)) {
|
if (!Strings.isNullOrEmpty(text)) {
|
||||||
final String input = text.toLowerCase();
|
final String input = text.toLowerCase();
|
||||||
searchLayout.addComponentAsFirst(validationIcon);
|
searchLayout.addComponentAsFirst(targetFilterStatusLabel);
|
||||||
|
searchLayout.setComponentAlignment(targetFilterStatusLabel, Alignment.MIDDLE_CENTER);
|
||||||
|
searchLayout.addComponent(validationIcon, 2);
|
||||||
final ValidationResult validationResult = FilterQueryValidation.getExpectedTokens(input);
|
final ValidationResult validationResult = FilterQueryValidation.getExpectedTokens(input);
|
||||||
if (!validationResult.getIsValidationFailed()) {
|
if (!validationResult.getIsValidationFailed()) {
|
||||||
showValidationSuccesIcon();
|
showValidationSuccesIcon();
|
||||||
@@ -366,8 +392,9 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void enableDisableSaveButton(final boolean validationFailed, final String query) {
|
private void enableDisableSaveButton(final boolean validationFailed, final String query) {
|
||||||
if (validationFailed || (isNameAndQueryEmpty(nameTextField.getValue(), query)
|
if (validationFailed
|
||||||
|| (query.equals(oldFilterQuery) && nameTextField.getValue().equals(oldFilterName)))) {
|
|| (isNameAndQueryEmpty(nameTextField.getValue(), query) || (query.equals(oldFilterQuery) && nameTextField
|
||||||
|
.getValue().equals(oldFilterName)))) {
|
||||||
saveButton.setEnabled(false);
|
saveButton.setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
if (hasSavePermission()) {
|
if (hasSavePermission()) {
|
||||||
@@ -468,8 +495,8 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
targetFilterQuery.setName(nameTextField.getValue());
|
targetFilterQuery.setName(nameTextField.getValue());
|
||||||
targetFilterQuery.setQuery(queryTextField.getValue());
|
targetFilterQuery.setQuery(queryTextField.getValue());
|
||||||
targetFilterQueryManagement.createTargetFilterQuery(targetFilterQuery);
|
targetFilterQueryManagement.createTargetFilterQuery(targetFilterQuery);
|
||||||
notification.displaySuccess(
|
notification.displaySuccess(i18n.get("message.create.filter.success",
|
||||||
i18n.get("message.create.filter.success", new Object[] { targetFilterQuery.getName() }));
|
new Object[] { targetFilterQuery.getName() }));
|
||||||
eventBus.publish(this, CustomFilterUIEvent.CREATE_TARGET_FILTER_QUERY);
|
eventBus.publish(this, CustomFilterUIEvent.CREATE_TARGET_FILTER_QUERY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,20 +544,4 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void enableTargetFilterStatusButton() {
|
|
||||||
targetFilterStatusButton.setVisible(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void updateTargetFilterStatusToComplete() {
|
|
||||||
targetFilterStatusButton.removeStyleName(SPUIStyleDefinitions.BULK_UPLOAD_PROGRESS_INDICATOR_STYLE);
|
|
||||||
targetFilterStatusButton.setVisible(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void updateTargetFilterStatusToProgressIndicator() {
|
|
||||||
targetFilterStatusButton.addStyleName(SPUIStyleDefinitions.BULK_UPLOAD_PROGRESS_INDICATOR_STYLE);
|
|
||||||
targetFilterStatusButton.setIcon(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import com.vaadin.spring.annotation.ViewScope;
|
|||||||
import com.vaadin.ui.Component;
|
import com.vaadin.ui.Component;
|
||||||
import com.vaadin.ui.Label;
|
import com.vaadin.ui.Label;
|
||||||
import com.vaadin.ui.Table;
|
import com.vaadin.ui.Table;
|
||||||
|
import com.vaadin.ui.UI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -63,9 +64,6 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private FilterManagementUIState filterManagementUIState;
|
private FilterManagementUIState filterManagementUIState;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CreateOrUpdateFilterHeader createOrUpdateFilterHeader;
|
|
||||||
|
|
||||||
private LazyQueryContainer container;
|
private LazyQueryContainer container;
|
||||||
|
|
||||||
private static final int PROPERTY_DEPT = 3;
|
private static final int PROPERTY_DEPT = 3;
|
||||||
@@ -82,7 +80,20 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
populateTableData();
|
populateTableData();
|
||||||
setStyleName("sp-table");
|
setStyleName("sp-table");
|
||||||
setId(SPUIComponetIdProvider.CUSTOM_FILTER_TARGET_TABLE_ID);
|
setId(SPUIComponetIdProvider.CUSTOM_FILTER_TARGET_TABLE_ID);
|
||||||
|
setSelectable(false);
|
||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
|
addItemSetChangeListener(new ItemSetChangeListener() {
|
||||||
|
private static final long serialVersionUID = 9006291573733911656L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void containerItemSetChange(final com.vaadin.data.Container.ItemSetChangeEvent event) {
|
||||||
|
if (size() > 0) {
|
||||||
|
eventBus.publish(this, CustomFilterUIEvent.TARGET_FILTER_STATUS_HIDE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreDestroy
|
@PreDestroy
|
||||||
@@ -92,10 +103,12 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final CustomFilterUIEvent custFUIEvent) {
|
void onEvent(final CustomFilterUIEvent custFUIEvent) {
|
||||||
if (custFUIEvent == CustomFilterUIEvent.FILTER_TARGET_BY_QUERY
|
if (custFUIEvent == CustomFilterUIEvent.TARGET_DETAILS_VIEW
|
||||||
|| custFUIEvent == CustomFilterUIEvent.TARGET_DETAILS_VIEW
|
|
||||||
|| custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK) {
|
|| custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK) {
|
||||||
populateTableData();
|
UI.getCurrent().access(() -> populateTableData());
|
||||||
|
} else if (custFUIEvent == CustomFilterUIEvent.FILTER_TARGET_BY_QUERY) {
|
||||||
|
this.getUI().access(() -> populateTableData());
|
||||||
|
eventBus.publish(this, CustomFilterUIEvent.TARGET_FILTER_STATUS_HIDE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,15 +162,6 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
setColumnProperties();
|
setColumnProperties();
|
||||||
setPageLength(30);
|
setPageLength(30);
|
||||||
setCollapsibleColumns();
|
setCollapsibleColumns();
|
||||||
this.addValueChangeListener(new ValueChangeListener() {
|
|
||||||
private static final long serialVersionUID = 1236358037766785663L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void valueChange(final com.vaadin.data.Property.ValueChangeEvent event) {
|
|
||||||
createOrUpdateFilterHeader.updateTargetFilterStatusToComplete();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ public class FilterManagementView extends VerticalLayout implements View {
|
|||||||
setSizeFull();
|
setSizeFull();
|
||||||
setSpacing(false);
|
setSpacing(false);
|
||||||
setMargin(false);
|
setMargin(false);
|
||||||
addStyleName("table-layout");
|
|
||||||
if (filterManagementUIState.isCreateFilterViewDisplayed()) {
|
if (filterManagementUIState.isCreateFilterViewDisplayed()) {
|
||||||
viewCreateTargetFilterLayout();
|
viewCreateTargetFilterLayout();
|
||||||
} else if (filterManagementUIState.isEditViewDisplayed()) {
|
} else if (filterManagementUIState.isEditViewDisplayed()) {
|
||||||
@@ -96,8 +95,9 @@ public class FilterManagementView extends VerticalLayout implements View {
|
|||||||
void onEvent(final CustomFilterUIEvent custFilterUIEvent) {
|
void onEvent(final CustomFilterUIEvent custFilterUIEvent) {
|
||||||
if (custFilterUIEvent == CustomFilterUIEvent.TARGET_FILTER_DETAIL_VIEW) {
|
if (custFilterUIEvent == CustomFilterUIEvent.TARGET_FILTER_DETAIL_VIEW) {
|
||||||
viewTargetFilterDetailLayout();
|
viewTargetFilterDetailLayout();
|
||||||
} else if (custFilterUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK) {
|
} else if (custFilterUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK
|
||||||
UI.getCurrent().access(() -> viewCreateTargetFilterLayout());
|
|| custFilterUIEvent == CustomFilterUIEvent.FILTER_TARGET_BY_QUERY) {
|
||||||
|
this.getUI().access(() -> viewCreateTargetFilterLayout());
|
||||||
} else if (custFilterUIEvent == CustomFilterUIEvent.EXIT_CREATE_OR_UPDATE_FILTRER_VIEW) {
|
} else if (custFilterUIEvent == CustomFilterUIEvent.EXIT_CREATE_OR_UPDATE_FILTRER_VIEW) {
|
||||||
UI.getCurrent().access(() -> viewListView());
|
UI.getCurrent().access(() -> viewListView());
|
||||||
}
|
}
|
||||||
@@ -137,10 +137,17 @@ public class FilterManagementView extends VerticalLayout implements View {
|
|||||||
|
|
||||||
private void viewListView() {
|
private void viewListView() {
|
||||||
removeAllComponents();
|
removeAllComponents();
|
||||||
addComponents(targetFilterHeader, targetFilterTable);
|
final VerticalLayout tableHeaderLayout = new VerticalLayout();
|
||||||
setComponentAlignment(targetFilterHeader, Alignment.TOP_LEFT);
|
tableHeaderLayout.setSizeFull();
|
||||||
setComponentAlignment(targetFilterTable, Alignment.TOP_LEFT);
|
tableHeaderLayout.setSpacing(false);
|
||||||
setExpandRatio(targetFilterTable, 1.0f);
|
tableHeaderLayout.setMargin(false);
|
||||||
|
tableHeaderLayout.setStyleName("table-layout");
|
||||||
|
tableHeaderLayout.addComponent(targetFilterHeader);
|
||||||
|
tableHeaderLayout.setComponentAlignment(targetFilterHeader, Alignment.TOP_CENTER);
|
||||||
|
tableHeaderLayout.addComponent(targetFilterTable);
|
||||||
|
tableHeaderLayout.setComponentAlignment(targetFilterTable, Alignment.TOP_CENTER);
|
||||||
|
tableHeaderLayout.setExpandRatio(targetFilterTable, 1.0f);
|
||||||
|
addComponent(tableHeaderLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
private HorizontalLayout addTargetFilterMessageLabel() {
|
private HorizontalLayout addTargetFilterMessageLabel() {
|
||||||
|
|||||||
@@ -103,14 +103,12 @@ public class TargetFilterTable extends Table {
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final CustomFilterUIEvent filterEvent) {
|
void onEvent(final CustomFilterUIEvent filterEvent) {
|
||||||
UI.getCurrent().access(() -> {
|
if (filterEvent == CustomFilterUIEvent.FILTER_BY_CUST_FILTER_TEXT
|
||||||
if (filterEvent == CustomFilterUIEvent.FILTER_BY_CUST_FILTER_TEXT
|
|| filterEvent == CustomFilterUIEvent.FILTER_BY_CUST_FILTER_TEXT_REMOVE
|
||||||
|| filterEvent == CustomFilterUIEvent.FILTER_BY_CUST_FILTER_TEXT_REMOVE
|
|| filterEvent == CustomFilterUIEvent.CREATE_TARGET_FILTER_QUERY
|
||||||
|| filterEvent == CustomFilterUIEvent.CREATE_TARGET_FILTER_QUERY
|
|| filterEvent == CustomFilterUIEvent.UPDATED_TARGET_FILTER_QUERY) {
|
||||||
|| filterEvent == CustomFilterUIEvent.UPDATED_TARGET_FILTER_QUERY) {
|
UI.getCurrent().access(() -> refreshContainer());
|
||||||
refreshContainer();
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -125,8 +123,8 @@ public class TargetFilterTable extends Table {
|
|||||||
|
|
||||||
targetQF.setQueryConfiguration(queryConfig);
|
targetQF.setQueryConfiguration(queryConfig);
|
||||||
// create lazy query container with lazy defination and query
|
// create lazy query container with lazy defination and query
|
||||||
final LazyQueryContainer targetFilterContainer = new LazyQueryContainer(
|
final LazyQueryContainer targetFilterContainer = new LazyQueryContainer(new LazyQueryDefinition(true,
|
||||||
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_ID), targetQF);
|
SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_ID), targetQF);
|
||||||
targetFilterContainer.getQueryView().getQueryDefinition().setMaxNestedPropertyDepth(PROPERTY_DEPT);
|
targetFilterContainer.getQueryView().getQueryDefinition().setMaxNestedPropertyDepth(PROPERTY_DEPT);
|
||||||
|
|
||||||
return targetFilterContainer;
|
return targetFilterContainer;
|
||||||
@@ -135,8 +133,8 @@ public class TargetFilterTable extends Table {
|
|||||||
|
|
||||||
private Map<String, Object> prepareQueryConfigFilters() {
|
private Map<String, Object> prepareQueryConfigFilters() {
|
||||||
final Map<String, Object> queryConfig = new HashMap<String, Object>();
|
final Map<String, Object> queryConfig = new HashMap<String, Object>();
|
||||||
filterManagementUIState.getCustomFilterSearchText()
|
filterManagementUIState.getCustomFilterSearchText().ifPresent(
|
||||||
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||||
return queryConfig;
|
return queryConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,8 +203,8 @@ public class TargetFilterTable extends Table {
|
|||||||
* of the deleted custom filter.
|
* of the deleted custom filter.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
notification.displaySuccess(
|
notification.displaySuccess(i18n.get("message.delete.filter.success",
|
||||||
i18n.get("message.delete.filter.success", new Object[] { deletedFilterName }));
|
new Object[] { deletedFilterName }));
|
||||||
refreshContainer();
|
refreshContainer();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,5 +15,5 @@ package org.eclipse.hawkbit.ui.filtermanagement.event;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public enum CustomFilterUIEvent {
|
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,
|
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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import javax.annotation.PostConstruct;
|
|||||||
import javax.annotation.PreDestroy;
|
import javax.annotation.PreDestroy;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
import org.eclipse.hawkbit.ui.filtermanagement.CreateOrUpdateFilterTable;
|
|
||||||
import org.eclipse.hawkbit.ui.filtermanagement.TargetFilterTable;
|
|
||||||
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.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
@@ -44,12 +42,6 @@ public class TargetFilterCountMessageLabel extends Label {
|
|||||||
|
|
||||||
private static final long serialVersionUID = -7188528790042766877L;
|
private static final long serialVersionUID = -7188528790042766877L;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CreateOrUpdateFilterTable createNewFilterTable;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TargetFilterTable targetFilterTable;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FilterManagementUIState filterManagementUIState;
|
private FilterManagementUIState filterManagementUIState;
|
||||||
|
|
||||||
@@ -95,12 +87,10 @@ public class TargetFilterCountMessageLabel extends Label {
|
|||||||
|
|
||||||
private void displayTargetFilterMessage() {
|
private void displayTargetFilterMessage() {
|
||||||
long totalTargets = 0;
|
long totalTargets = 0;
|
||||||
long shownTargets = 0;
|
|
||||||
if (filterManagementUIState.isCreateFilterViewDisplayed() || filterManagementUIState.isEditViewDisplayed()) {
|
if (filterManagementUIState.isCreateFilterViewDisplayed() || filterManagementUIState.isEditViewDisplayed()) {
|
||||||
if (null != filterManagementUIState.getFilterQueryValue()) {
|
if (null != filterManagementUIState.getFilterQueryValue()) {
|
||||||
totalTargets = targetManagement.countTargetByTargetFilterQuery(filterManagementUIState
|
totalTargets = targetManagement.countTargetByTargetFilterQuery(filterManagementUIState
|
||||||
.getFilterQueryValue());
|
.getFilterQueryValue());
|
||||||
shownTargets = createNewFilterTable.size();
|
|
||||||
}
|
}
|
||||||
final StringBuilder targetMessage = new StringBuilder(i18n.get("label.target.filtered.total"));
|
final StringBuilder targetMessage = new StringBuilder(i18n.get("label.target.filtered.total"));
|
||||||
if (filterManagementUIState.getTargetsTruncated() != null) {
|
if (filterManagementUIState.getTargetsTruncated() != null) {
|
||||||
@@ -115,32 +105,16 @@ public class TargetFilterCountMessageLabel extends Label {
|
|||||||
}
|
}
|
||||||
targetMessage.append(totalTargets);
|
targetMessage.append(totalTargets);
|
||||||
targetMessage.append(HawkbitCommonUtil.SP_STRING_SPACE);
|
targetMessage.append(HawkbitCommonUtil.SP_STRING_SPACE);
|
||||||
|
targetMessage.append(i18n.get("label.filter.shown"));
|
||||||
if (totalTargets > SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES) {
|
if (totalTargets > SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES) {
|
||||||
targetMessage.append(i18n.get("label.filter.shown"));
|
|
||||||
targetMessage.append(SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES);
|
targetMessage.append(SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES);
|
||||||
} else {
|
} else {
|
||||||
targetMessage.append(HawkbitCommonUtil.SP_STRING_SPACE);
|
targetMessage.append(HawkbitCommonUtil.SP_STRING_SPACE);
|
||||||
targetMessage.append(i18n.get("label.filter.shown"));
|
targetMessage.append(totalTargets);
|
||||||
targetMessage.append(shownTargets);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setCaption(targetMessage.toString());
|
setCaption(targetMessage.toString());
|
||||||
} else {
|
|
||||||
final StringBuilder tarFilterMessage = new StringBuilder(i18n.get("label.custom.filter.target.count"));
|
|
||||||
createMsgLable(targetFilterTable.size(), tarFilterMessage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createMsgLable(final long totalCount, final StringBuilder message) {
|
|
||||||
message.append(totalCount);
|
|
||||||
message.append(HawkbitCommonUtil.SP_STRING_SPACE);
|
|
||||||
if (totalCount > SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES) {
|
|
||||||
message.append(i18n.get("label.filter.shown"));
|
|
||||||
message.append(SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES);
|
|
||||||
}
|
|
||||||
message.append(HawkbitCommonUtil.SP_STRING_SPACE);
|
|
||||||
setCaption(message.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ public final class SPUIStyleDefinitions {
|
|||||||
/**
|
/**
|
||||||
* Target filter search progress indicator style.
|
* Target filter search progress indicator style.
|
||||||
*/
|
*/
|
||||||
public static final String TARGET_FILTER_SEARCH_PROGRESS_INDICATOR_STYLE = "target-filter-search-layout";
|
public static final String TARGET_FILTER_SEARCH_PROGRESS_INDICATOR_STYLE = "target-filter-spinner";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
|||||||
@@ -87,7 +87,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.footer-layout , .target-filter-search-layout{
|
.footer-layout{
|
||||||
.app-loading {
|
.app-loading {
|
||||||
background-position: bottom;
|
background-position: bottom;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
|
|||||||
@@ -41,5 +41,13 @@
|
|||||||
box-shadow:none !important;
|
box-shadow:none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.target-filter-spinner{
|
||||||
|
@include valo-spinner(
|
||||||
|
$size: $v-font-size--small,
|
||||||
|
$color: $bosch-color-light-blue
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user