Feature soft autoassignment (#789)

* Repository layer and database migration
* Changed target filter management to update auto assignment action type together with distribution set, extended mgmt API, adapted auto assign checker/scheduler, changed auto assign distribution set select table to combobox, added filter functionality (needs refactoring)
* Refactored auto assignment dialog window, added soft/forced option group, restructured action type option group layout
* Added forced icon to target filter table autoassignment cell for the forced auto assign actions
* First working draft of distribution set select combobox for auto assignment window
* Optimised filtering queries, added alphabetical sorting on distribution set name and version
* Refactoring of distribution bean query for lazy loading
* Distribution set combobox refactoring and comments
* Added verification of auto assign distribution set validity (completed, not deleted), exdended target filter query fields with auto assign action type field, added rsql filter tests, added repository layer tests
* Added mgmt API tests
* Changed target filter rest docu tests to include auto-assignment type
* Updated hawkbit docs with auto-assignment description
* Added debouncing to key and value input fields of metadata popup layout to get rid of unnecessary value change events, removed redundant set value call in common dialog window, minimizing the repaint components calls
* Fixed sonar findings
* Reverted changes of common dialog window validaton, setting the value of the field explicitly as before, until we rethink the whole concept of validaton mechanism
* Fixed review findings
* Removed rsql filtering by filter auto-assign action type, due to missing conversion of disallowed timeforced action type
* Small fix regarding usage of page request
* Updated sql script version for flyway
* Extended tests for soft deleted distribution sets for auto-assignment and filter string within distribution set specification builder

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch-si.com>
This commit is contained in:
Bondar Bogdan
2019-03-13 13:35:22 +01:00
committed by Stefan Behl
parent 185f88e19b
commit 664c467920
63 changed files with 1891 additions and 750 deletions

View File

@@ -62,33 +62,24 @@ import com.vaadin.ui.renderers.ClickableRenderer.RendererClickEvent;
*
*/
public abstract class AbstractMetadataPopupLayout<E extends NamedEntity, M extends MetaData> extends CustomComponent {
private static final long serialVersionUID = 1L;
private static final String DELETE_BUTTON = "DELETE_BUTTON";
private static final long serialVersionUID = -1491218218453167613L;
private static final int INPUT_DEBOUNCE_TIMEOUT = 250;
protected static final String VALUE = "value";
protected static final String KEY = "key";
protected static final int MAX_METADATA_QUERY = 500;
protected VaadinMessageSource i18n;
private final UINotification uiNotification;
protected transient EventBus.UIEventBus eventBus;
private TextField keyTextField;
private TextArea valueTextArea;
private Button addIcon;
private Grid metaDataGrid;
private Label headerCaption;
private CommonDialogWindow metadataWindow;
private E selectedEntity;
@@ -238,7 +229,8 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedEntity, M exten
final TextField keyField = new TextFieldBuilder(MetaData.KEY_MAX_SIZE).caption(i18n.getMessage("textfield.key"))
.required(true, i18n).id(UIComponentIdProvider.METADATA_KEY_FIELD_ID).buildTextComponent();
keyField.addTextChangeListener(this::onKeyChange);
keyField.setTextChangeEventMode(TextChangeEventMode.EAGER);
keyField.setTextChangeEventMode(TextChangeEventMode.LAZY);
keyField.setTextChangeTimeout(INPUT_DEBOUNCE_TIMEOUT);
keyField.setWidth("100%");
return keyField;
}
@@ -249,7 +241,8 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedEntity, M exten
valueTextArea.setSizeFull();
valueTextArea.setHeight(100, Unit.PERCENTAGE);
valueTextArea.addTextChangeListener(this::onValueChange);
valueTextArea.setTextChangeEventMode(TextChangeEventMode.EAGER);
valueTextArea.setTextChangeEventMode(TextChangeEventMode.LAZY);
valueTextArea.setTextChangeTimeout(INPUT_DEBOUNCE_TIMEOUT);
return valueTextArea;
}

View File

@@ -292,7 +292,7 @@ public class CommonDialogWindow extends Window {
if (field instanceof CheckBox && originalValue == null) {
originalValue = Boolean.FALSE;
}
final Object currentValue = getCurrentVaue(currentChangedComponent, newValue, field);
final Object currentValue = getCurrentValue(currentChangedComponent, newValue, field);
if (!Objects.equals(originalValue, currentValue)) {
return true;
@@ -301,7 +301,7 @@ public class CommonDialogWindow extends Window {
return false;
}
private static Object getCurrentVaue(final Component currentChangedComponent, final Object newValue,
private static Object getCurrentValue(final Component currentChangedComponent, final Object newValue,
final AbstractField<?> field) {
Object currentValue = field.getValue();
if (field instanceof Table) {
@@ -333,7 +333,7 @@ public class CommonDialogWindow extends Window {
requiredComponents.addAll(allComponents.stream().filter(this::hasNullValidator).collect(Collectors.toList()));
for (final AbstractField field : requiredComponents) {
Object value = getCurrentVaue(currentChangedComponent, newValue, field);
Object value = getCurrentValue(currentChangedComponent, newValue, field);
if (Set.class.equals(field.getType())) {
value = emptyToNull((Collection<?>) value);
@@ -343,10 +343,12 @@ public class CommonDialogWindow extends Window {
return false;
}
// We need to loop through the entire loop for validity testing.
// Otherwise the UI will only mark the
// first field with errors and then stop. If there are several
// fields with errors, this is bad.
// We need to loop through all of components for validity testing.
// Otherwise the UI will only mark the first field with errors and
// then stop. Setting the value is necessary because not all
// required input fields have empty string validator, but emptiness
// is checked during isValid() call. Setting the value could be
// redundant, check if it could be removed in the future.
field.setValue(value);
if (!field.isValid()) {
valid = false;

View File

@@ -64,7 +64,7 @@ public class TargetMetadataDetailsLayout extends AbstractMetadataDetailsLayout {
}
selectedTargetId = target.getId();
final List<TargetMetadata> targetMetadataList = targetManagement
.findMetaDataByControllerId(new PageRequest(0, MAX_METADATA_QUERY), target.getControllerId())
.findMetaDataByControllerId(PageRequest.of(0, MAX_METADATA_QUERY), target.getControllerId())
.getContent();
if (targetMetadataList != null && !targetMetadataList.isEmpty()) {
targetMetadataList.forEach(this::setMetadataProperties);

View File

@@ -8,6 +8,8 @@
*/
package org.eclipse.hawkbit.ui.components;
import org.eclipse.hawkbit.repository.model.Action.ActionType;
/**
*
*
@@ -15,7 +17,7 @@ package org.eclipse.hawkbit.ui.components;
*/
public class ProxyTargetFilter {
private static final long serialVersionUID = 6622060929679084419L;
private static final long serialVersionUID = 1L;
private String createdDate;
@@ -27,6 +29,7 @@ public class ProxyTargetFilter {
private String lastModifiedBy;
private String query;
private ProxyDistribution autoAssignDistributionSet;
private ActionType autoAssignActionType;
public String getCreatedDate() {
return createdDate;
@@ -95,7 +98,15 @@ public class ProxyTargetFilter {
return autoAssignDistributionSet;
}
public void setAutoAssignDistributionSet(ProxyDistribution autoAssignDistributionSet) {
public void setAutoAssignDistributionSet(final ProxyDistribution autoAssignDistributionSet) {
this.autoAssignDistributionSet = autoAssignDistributionSet;
}
public ActionType getAutoAssignActionType() {
return autoAssignActionType;
}
public void setAutoAssignActionType(final ActionType autoAssignActionType) {
this.autoAssignActionType = autoAssignActionType;
}
}

View File

@@ -8,14 +8,11 @@
*/
package org.eclipse.hawkbit.ui.distributions.dstable;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetFilter;
import org.eclipse.hawkbit.repository.model.DistributionSetFilter.DistributionSetFilterBuilder;
@@ -26,12 +23,15 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.util.StringUtils;
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
import com.vaadin.data.util.filter.SimpleStringFilter;
/**
* Manage Distributions table bean query.
*
@@ -42,6 +42,7 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
private Sort sort = new Sort(Direction.ASC, "id");
private String searchText;
private String filterString;
private transient DistributionSetManagement distributionSetManagement;
private transient Page<DistributionSet> firstPageDistributionSets;
@@ -59,6 +60,17 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
final Object[] sortPropertyIds, final boolean[] sortStates) {
super(definition, queryConfig, sortPropertyIds, sortStates);
init(definition, queryConfig, sortPropertyIds, sortStates);
}
private void init(final QueryDefinition definition, final Map<String, Object> queryConfig,
final Object[] sortPropertyIds, final boolean[] sortStates) {
populateDataFromQueryConfig(queryConfig);
setFilterString(definition);
setupSorting(sortPropertyIds, sortStates);
}
private void populateDataFromQueryConfig(final Map<String, Object> queryConfig) {
if (HawkbitCommonUtil.isNotNullOrEmpty(queryConfig)) {
searchText = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_TEXT);
if (!StringUtils.isEmpty(searchText)) {
@@ -72,13 +84,24 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
dsComplete = (Boolean) queryConfig.get(SPUIDefinitions.FILTER_BY_DS_COMPLETE);
}
}
}
private void setFilterString(final QueryDefinition definition) {
// if search text is set, we do not want to apply the filter
if (StringUtils.isEmpty(searchText)) {
filterString = definition.getFilters().stream().filter(SimpleStringFilter.class::isInstance)
.map(SimpleStringFilter.class::cast).map(SimpleStringFilter::getFilterString).findAny()
.orElse(null);
}
}
private void setupSorting(final Object[] sortPropertyIds, final boolean[] sortStates) {
if (sortStates != null && sortStates.length > 0) {
// Initialize sort
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[0]);
// Add sort
for (int distId = 1; distId < sortPropertyIds.length; distId++) {
sort.and(new Sort(sortStates[distId] ? Direction.ASC : Direction.DESC,
sort = sort.and(new Sort(sortStates[distId] ? Direction.ASC : Direction.DESC,
(String) sortPropertyIds[distId]));
}
}
@@ -93,18 +116,11 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
protected List<ProxyDistribution> loadBeans(final int startIndex, final int count) {
Page<DistributionSet> distBeans;
final List<ProxyDistribution> proxyDistributions = new ArrayList<>();
if (startIndex == 0 && firstPageDistributionSets != null) {
distBeans = firstPageDistributionSets;
} else if (StringUtils.isEmpty(searchText)) {
// if no search filters available
distBeans = getDistributionSetManagement()
.findByCompleted(new OffsetBasedPageRequest(startIndex, count, sort), dsComplete);
} else {
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
.setIsComplete(dsComplete).setSearchText(searchText).setSelectDSWithNoTag(Boolean.FALSE)
.setType(distributionSetType).build();
distBeans = getDistributionSetManagement().findByDistributionSetFilter(
PageRequest.of(startIndex / count, count, sort), distributionSetFilter);
distBeans = findDistBeans(PageRequest.of(startIndex / count, count, sort));
}
for (final DistributionSet distributionSet : distBeans) {
@@ -121,17 +137,7 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
@Override
public int size() {
if (StringUtils.isEmpty(searchText) && distributionSetType == null) {
// if no search filters available
firstPageDistributionSets = getDistributionSetManagement()
.findByCompleted(PageRequest.of(0, SPUIDefinitions.PAGE_SIZE, sort), dsComplete);
} else {
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
.setIsComplete(dsComplete).setSearchText(searchText).setSelectDSWithNoTag(Boolean.FALSE)
.setType(distributionSetType).build();
firstPageDistributionSets = getDistributionSetManagement().findByDistributionSetFilter(
PageRequest.of(0, SPUIDefinitions.PAGE_SIZE, sort), distributionSetFilter);
}
firstPageDistributionSets = findDistBeans(PageRequest.of(0, SPUIDefinitions.PAGE_SIZE, sort));
final long size = firstPageDistributionSets.getTotalElements();
if (size > Integer.MAX_VALUE) {
@@ -141,16 +147,23 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
return (int) size;
}
private Page<DistributionSet> findDistBeans(final Pageable pageable) {
if (StringUtils.isEmpty(filterString) && StringUtils.isEmpty(searchText) && distributionSetType == null) {
return getDistributionSetManagement().findByCompleted(pageable, dsComplete);
} else {
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder()
.setIsDeleted(Boolean.FALSE).setIsComplete(dsComplete).setSearchText(searchText)
.setFilterString(filterString).setSelectDSWithNoTag(Boolean.FALSE).setType(distributionSetType)
.build();
return getDistributionSetManagement().findByDistributionSetFilter(pageable, distributionSetFilter);
}
}
private DistributionSetManagement getDistributionSetManagement() {
if (distributionSetManagement == null) {
distributionSetManagement = SpringContextHelper.getBean(DistributionSetManagement.class);
}
return distributionSetManagement;
}
@SuppressWarnings("unchecked")
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
firstPageDistributionSets = (Page<DistributionSet>) in.readObject();
}
}

View File

@@ -0,0 +1,336 @@
/**
* Copyright (c) 2018 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.filtermanagement;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.eclipse.hawkbit.ui.distributions.dstable.ManageDistBeanQuery;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.springframework.util.StringUtils;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
import org.vaadin.addons.lazyquerycontainer.LazyQueryView;
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
import org.vaadin.addons.lazyquerycontainer.QueryView;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.data.Property;
import com.vaadin.shared.ui.combobox.FilteringMode;
import com.vaadin.ui.ComboBox;
/**
* Creates a combobox in order to select the distribution set for a target
* filter query auto assignment.
*/
public class DistributionSetSelectComboBox extends ComboBox {
private static final long serialVersionUID = 1L;
private final VaadinMessageSource i18n;
private String selectedValueCaption;
private Long previousValue;
private String lastFilterString;
DistributionSetSelectComboBox(final VaadinMessageSource i18n) {
super();
this.i18n = i18n;
init();
initDataSource();
}
private void init() {
setScrollToSelectedItem(false);
setNullSelectionAllowed(false);
setSizeFull();
setId(UIComponentIdProvider.DIST_SET_SELECT_COMBO_ID);
setCaption(i18n.getMessage(UIMessageIdProvider.HEADER_DISTRIBUTION_SET));
}
private void initDataSource() {
final Container container = createContainer();
container.addContainerProperty(SPUILabelDefinitions.VAR_NAME_VERSION, String.class, null);
setItemCaptionMode(ItemCaptionMode.PROPERTY);
setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME_VERSION);
setFilteringMode(FilteringMode.CONTAINS);
setContainerDataSource(container);
}
private static Container createContainer() {
final Map<String, Object> queryConfig = new HashMap<>();
queryConfig.put(SPUIDefinitions.FILTER_BY_DS_COMPLETE, Boolean.TRUE);
final BeanQueryFactory<ManageDistBeanQuery> distributionQF = new BeanQueryFactory<>(ManageDistBeanQuery.class);
distributionQF.setQueryConfiguration(queryConfig);
final LazyQueryDefinition distribtuinQD = new LazyQueryDefinition(false, SPUIDefinitions.PAGE_SIZE,
SPUILabelDefinitions.VAR_ID);
final QueryView distributionSetFilterLazyQueryView = new DistributionSetFilterQueryView(
new LazyQueryView(distribtuinQD, distributionQF));
distributionSetFilterLazyQueryView.sort(
new Object[] { SPUILabelDefinitions.VAR_NAME, SPUILabelDefinitions.VAR_VERSION },
new boolean[] { true, true });
return new LazyQueryContainer(distributionSetFilterLazyQueryView);
}
/**
* The custom QueryView implementation is only needed to modify the behavior
* when removing the filter (do not refresh the container). In all other
* cases the default LazyQueryView implementation is being reused.
*/
private static class DistributionSetFilterQueryView implements QueryView {
private final QueryView defaultQueryView;
DistributionSetFilterQueryView(final QueryView defaultQueryView) {
this.defaultQueryView = defaultQueryView;
}
@Override
public void addFilter(final Filter arg0) {
defaultQueryView.addFilter(arg0);
}
@Override
public int addItem() {
return defaultQueryView.addItem();
}
@Override
public void commit() {
defaultQueryView.commit();
}
@Override
public void discard() {
defaultQueryView.discard();
}
@Override
public List<Item> getAddedItems() {
return defaultQueryView.getAddedItems();
}
@Override
public Collection<Filter> getFilters() {
return defaultQueryView.getFilters();
}
@Override
public Item getItem(final int arg0) {
return defaultQueryView.getItem(arg0);
}
@Override
public List<?> getItemIdList() {
return defaultQueryView.getItemIdList();
}
@Override
public int getMaxCacheSize() {
return defaultQueryView.getMaxCacheSize();
}
@Override
public List<Item> getModifiedItems() {
return defaultQueryView.getModifiedItems();
}
@Override
public QueryDefinition getQueryDefinition() {
return defaultQueryView.getQueryDefinition();
}
@Override
public List<Item> getRemovedItems() {
return defaultQueryView.getRemovedItems();
}
@Override
public boolean isModified() {
return defaultQueryView.isModified();
}
@Override
public void refresh() {
defaultQueryView.refresh();
}
@Override
public void removeAllItems() {
defaultQueryView.removeAllItems();
}
/**
* Default implementation of the combobox removes the filter each time
* it builds the options during repaint. However, container should not
* be refreshed here (default LazyQueryView implementation), as this
* would clear all filtered cache entries following by multiple database
* queries.
*/
@Override
public void removeFilter(final Filter filter) {
defaultQueryView.getQueryDefinition().removeFilter(filter);
// no refresh here
}
@Override
public void removeFilters() {
defaultQueryView.removeFilters();
}
@Override
public void removeItem(final int arg0) {
defaultQueryView.removeItem(arg0);
}
@Override
public void setMaxCacheSize(final int arg0) {
defaultQueryView.setMaxCacheSize(arg0);
}
@Override
public int size() {
return defaultQueryView.size();
}
@Override
public void sort(final Object[] arg0, final boolean[] arg1) {
defaultQueryView.sort(arg0, arg1);
}
}
/**
* Overriden in order to get the selected distibution set's option caption
* (name:version) from container and preventing multiple calls by saving the
* selected Id.
*
* @param selectedItemId
* the Id of the selected distribution set
*/
@Override
public void setValue(final Object selectedItemId) {
if (selectedItemId != null) {
// Can happen during validation, leading to multiple database
// queries, in order to get the caption property
if (selectedItemId.equals(previousValue)) {
return;
}
selectedValueCaption = Optional.ofNullable(getContainerProperty(selectedItemId, getItemCaptionPropertyId()))
.map(Property::getValue).map(String.class::cast).orElse("");
}
super.setValue(selectedItemId);
previousValue = (Long) selectedItemId;
}
/**
* Overriden in order to return the caption for the selected distribution
* set from cache. Otherwise, it could lead to multiple database queries,
* trying to retrieve the caption from container, when it is not present in
* filtered options.
*
* @param itemId
* the Id of the selected distribution set
* @return the option caption (name:version) of the selected distribution
* set
*/
@Override
public String getItemCaption(final Object itemId) {
if (itemId != null && itemId.equals(getValue()) && !StringUtils.isEmpty(selectedValueCaption)) {
return selectedValueCaption;
}
return super.getItemCaption(itemId);
}
/**
* Overriden not to update the filter when the filterstring (value of
* combobox input) was not changed. Otherwise, it would lead to additional
* database requests during combobox page change while scrolling instead of
* retreiving items from container cache.
*
* @param filterString
* value of combobox input
* @param filteringMode
* the filtering mode (starts_with, contains)
* @return SimpleStringFilter to transfer filterstring in container
*/
@Override
protected Filter buildFilter(final String filterString, final FilteringMode filteringMode) {
if (filterStringIsNotChanged(filterString)) {
return null;
}
final Filter filter = super.buildFilter(filterString, filteringMode);
refreshContainerIfFilterStringBecomesEmpty(filterString);
lastFilterString = filterString;
return filter;
}
private boolean filterStringIsNotChanged(final String filterString) {
return !StringUtils.isEmpty(filterString) && !StringUtils.isEmpty(lastFilterString)
&& filterString.equals(lastFilterString);
}
private void refreshContainerIfFilterStringBecomesEmpty(final String filterString) {
if (StringUtils.isEmpty(filterString) && !StringUtils.isEmpty(lastFilterString)) {
refreshContainer();
}
}
/**
* Before setting the value of the selected distribution set we need to
* initialize the container and apply the right filter in order to limit the
* number of entities and save them in container cache. Otherwise, combobox
* will try to find the corresponding id from container, leading to multiple
* database queries.
*
* @param initialFilterString
* value of initial distribution set caption (name:version)
* @return the size of filtered options
*/
public int setInitialValueFilter(final String initialFilterString) {
final Filter filter = buildFilter(initialFilterString, getFilteringMode());
if (filter != null) {
final LazyQueryContainer container = (LazyQueryContainer) getContainerDataSource();
try {
container.addContainerFilter(filter);
return container.size();
} finally {
container.removeContainerFilter(filter);
}
}
return 0;
}
/**
* Refreshes the underlying container, clearing all the caches.
*/
public void refreshContainer() {
final LazyQueryContainer container = (LazyQueryContainer) getContainerDataSource();
container.refresh();
}
}

View File

@@ -1,158 +0,0 @@
/**
* 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.filtermanagement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.hawkbit.repository.event.remote.DistributionSetDeletedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreatedEvent;
import org.eclipse.hawkbit.ui.distributions.dstable.ManageDistBeanQuery;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.TableColumn;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.data.Container;
import com.vaadin.ui.Table;
import com.vaadin.ui.themes.ValoTheme;
/**
* Table for selecting a distribution set.
*/
public class DistributionSetSelectTable extends Table {
private static final long serialVersionUID = -4307487829435471759L;
private final VaadinMessageSource i18n;
private final ManageDistUIState manageDistUIState;
private Container container;
DistributionSetSelectTable(final VaadinMessageSource i18n, final UIEventBus eventBus,
final ManageDistUIState manageDistUIState) {
this.i18n = i18n;
this.manageDistUIState = manageDistUIState;
setStyleName("sp-table");
setSizeFull();
setSelectable(true);
setMultiSelect(false);
setImmediate(true);
addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES);
addStyleName(ValoTheme.TABLE_SMALL);
populateTableData();
setColumnCollapsingAllowed(false);
setColumnProperties();
setId(UIComponentIdProvider.DIST_SET_SELECT_TABLE_ID);
eventBus.subscribe(this);
}
@EventBusListenerMethod(scope = EventScope.UI)
void onEvents(final List<?> events) {
final Object firstEvent = events.get(0);
if (DistributionSetCreatedEvent.class.isInstance(firstEvent)
|| DistributionSetDeletedEvent.class.isInstance(firstEvent)) {
refreshDistributions();
}
}
private void populateTableData() {
container = createContainer();
addContainerproperties();
setContainerDataSource(container);
setColumnProperties();
}
protected Container createContainer() {
final Map<String, Object> queryConfiguration = prepareQueryConfigFilters();
final BeanQueryFactory<ManageDistBeanQuery> distributionQF = new BeanQueryFactory<>(ManageDistBeanQuery.class);
distributionQF.setQueryConfiguration(queryConfiguration);
return new LazyQueryContainer(
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_ID), distributionQF);
}
private void addContainerproperties() {
/* Create HierarchicalContainer container */
container.addContainerProperty(SPUILabelDefinitions.NAME, String.class, null);
container.addContainerProperty(SPUILabelDefinitions.VAR_VERSION, String.class, null);
}
private List<TableColumn> getVisbleColumns() {
final List<TableColumn> columnList = new ArrayList<>(2);
columnList.add(new TableColumn(SPUILabelDefinitions.NAME, i18n.getMessage("header.name"), 0.6F));
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.getMessage("header.version"), 0.4F));
return columnList;
}
private void setColumnProperties() {
setVisibleColumns(getVisbleColumns().stream().map(column -> {
setColumnHeader(column.getColumnPropertyId(), column.getColumnHeader());
setColumnExpandRatio(column.getColumnPropertyId(), column.getExpandRatio());
return column.getColumnPropertyId();
}).toArray());
}
private Map<String, Object> prepareQueryConfigFilters() {
final Map<String, Object> queryConfig = new HashMap<>();
manageDistUIState.getManageDistFilters().getSearchText()
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
if (null != manageDistUIState.getManageDistFilters().getClickedDistSetType()) {
queryConfig.put(SPUIDefinitions.FILTER_BY_DISTRIBUTION_SET_TYPE,
manageDistUIState.getManageDistFilters().getClickedDistSetType());
}
queryConfig.put(SPUIDefinitions.FILTER_BY_DS_COMPLETE, Boolean.TRUE);
return queryConfig;
}
private void refreshDistributions() {
final LazyQueryContainer dsContainer = (LazyQueryContainer) getContainerDataSource();
final int size = dsContainer.size();
if (size < SPUIDefinitions.MAX_TABLE_ENTRIES) {
refreshTablecontainer();
}
if (size != 0) {
setData(i18n.getMessage(UIMessageIdProvider.MESSAGE_DATA_AVAILABLE));
}
}
private Object getItemIdToSelect() {
return manageDistUIState.getSelectedDistributions().isEmpty() ? null
: manageDistUIState.getSelectedDistributions();
}
private void selectRow() {
setValue(getItemIdToSelect());
}
private void refreshTablecontainer() {
final LazyQueryContainer dsContainer = (LazyQueryContainer) getContainerDataSource();
dsContainer.refresh();
selectRow();
}
}

View File

@@ -8,27 +8,30 @@
*/
package org.eclipse.hawkbit.ui.filtermanagement;
import java.io.Serializable;
import java.util.function.Consumer;
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleNoBorderWithIcon;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
import org.eclipse.hawkbit.ui.management.miscs.AbstractActionTypeOptionGroupLayout.ActionTypeOption;
import org.eclipse.hawkbit.ui.management.miscs.ActionTypeOptionGroupAutoAssignmentLayout;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.data.Property;
import com.vaadin.server.FontAwesome;
import com.vaadin.server.Sizeable;
import com.vaadin.ui.Alignment;
@@ -44,59 +47,50 @@ import com.vaadin.ui.Window;
* Creates a dialog window to select the distribution set for a target filter
* query.
*/
public class DistributionSetSelectWindow
implements CommonDialogWindow.SaveDialogCloseListener, Property.ValueChangeListener {
private static final long serialVersionUID = 4752345414134989396L;
public class DistributionSetSelectWindow implements CommonDialogWindow.SaveDialogCloseListener {
private final VaadinMessageSource i18n;
private final DistributionSetSelectTable dsTable;
private final transient EventBus.UIEventBus eventBus;
private final transient TargetManagement targetManagement;
private final transient TargetFilterQueryManagement targetFilterQueryManagement;
private final UINotification notification;
private final EventBus.UIEventBus eventBus;
private final TargetManagement targetManagement;
private final TargetFilterQueryManagement targetFilterQueryManagement;
private CheckBox checkBox;
private ActionTypeOptionGroupAutoAssignmentLayout actionTypeOptionGroupLayout;
private DistributionSetSelectComboBox dsCombo;
private Long tfqId;
DistributionSetSelectWindow(final VaadinMessageSource i18n, final UIEventBus eventBus,
final TargetManagement targetManagement, final TargetFilterQueryManagement targetFilterQueryManagement,
final ManageDistUIState manageDistUIState) {
final UINotification notification, final TargetManagement targetManagement,
final TargetFilterQueryManagement targetFilterQueryManagement) {
this.i18n = i18n;
this.dsTable = new DistributionSetSelectTable(i18n, eventBus, manageDistUIState);
this.notification = notification;
this.eventBus = eventBus;
this.targetManagement = targetManagement;
this.targetFilterQueryManagement = targetFilterQueryManagement;
}
private VerticalLayout initView() {
final Label label = new Label(i18n.getMessage("label.auto.assign.description"));
final Label label = new Label(i18n.getMessage(UIMessageIdProvider.LABEL_AUTO_ASSIGNMENT_DESC));
checkBox = new CheckBox(i18n.getMessage("label.auto.assign.enable"));
checkBox = new CheckBox(i18n.getMessage(UIMessageIdProvider.LABEL_AUTO_ASSIGNMENT_ENABLE));
checkBox.setId(UIComponentIdProvider.DIST_SET_SELECT_ENABLE_ID);
checkBox.setImmediate(true);
checkBox.addValueChangeListener(this);
checkBox.addValueChangeListener(
event -> switchAutoAssignmentInputsVisibility((boolean) event.getProperty().getValue()));
setTableEnabled(false);
actionTypeOptionGroupLayout = new ActionTypeOptionGroupAutoAssignmentLayout(i18n);
dsCombo = new DistributionSetSelectComboBox(i18n);
final VerticalLayout verticalLayout = new VerticalLayout();
verticalLayout.addComponent(label);
verticalLayout.addComponent(checkBox);
verticalLayout.addComponent(dsTable);
verticalLayout.addComponent(actionTypeOptionGroupLayout);
verticalLayout.addComponent(dsCombo);
return verticalLayout;
}
private void setValue(final Long distSet) {
checkBox.setValue(distSet != null);
dsTable.setValue(distSet);
dsTable.setCurrentPageFirstItemId(distSet);
dsTable.setNullSelectionAllowed(false);
}
/**
* Shows a distribution set select window for the given target filter query
*
@@ -111,15 +105,13 @@ public class DistributionSetSelectWindow
final VerticalLayout verticalLayout = initView();
final DistributionSet distributionSet = tfq.getAutoAssignDistributionSet();
if (distributionSet != null) {
setValue(distributionSet.getId());
} else {
setValue(null);
}
final ActionType actionType = tfq.getAutoAssignActionType();
setInitialControlValues(distributionSet, actionType);
// build window after values are set to view elements
final CommonDialogWindow window = new WindowBuilder(SPUIDefinitions.CREATE_UPDATE_WINDOW)
.caption(i18n.getMessage("caption.select.auto.assign.dist")).content(verticalLayout)
.caption(i18n.getMessage(UIMessageIdProvider.CAPTION_SELECT_AUTO_ASSIGN_DS)).content(verticalLayout)
.layout(verticalLayout).i18n(i18n).saveDialogCloseListener(this).buildCommonDialogWindow();
window.setId(UIComponentIdProvider.DIST_SET_SELECT_WINDOW_ID);
@@ -128,25 +120,36 @@ public class DistributionSetSelectWindow
window.setVisible(true);
}
/**
* Is triggered when the checkbox value changes
*
* @param event
* change event
*/
@Override
public void valueChange(final Property.ValueChangeEvent event) {
if (checkBox.getValue()) {
setTableEnabled(true);
} else {
dsTable.select(null);
setTableEnabled(false);
private void setInitialControlValues(final DistributionSet distributionSet, final ActionType actionType) {
checkBox.setValue(distributionSet != null);
switchAutoAssignmentInputsVisibility(distributionSet != null);
final ActionTypeOption actionTypeToSet = ActionTypeOption.getOptionForActionType(actionType)
.orElse(ActionTypeOption.FORCED);
actionTypeOptionGroupLayout.getActionTypeOptionGroup().select(actionTypeToSet);
if (distributionSet != null) {
final String initialFilterString = HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(),
distributionSet.getVersion());
final int filteredSize = dsCombo.setInitialValueFilter(initialFilterString);
if (filteredSize <= 0) {
notification.displayValidationError(
i18n.getMessage(UIMessageIdProvider.MESSAGE_SELECTED_DS_NOT_FOUND, initialFilterString));
dsCombo.refreshContainer();
dsCombo.setValue(null);
return;
}
}
dsCombo.setValue(distributionSet != null ? distributionSet.getId() : null);
}
private void setTableEnabled(final boolean enabled) {
dsTable.setEnabled(enabled);
dsTable.setRequired(enabled);
private void switchAutoAssignmentInputsVisibility(final boolean autoAssignmentEnabled) {
actionTypeOptionGroupLayout.setVisible(autoAssignmentEnabled);
dsCombo.setVisible(autoAssignmentEnabled);
dsCombo.setEnabled(autoAssignmentEnabled);
dsCombo.setRequired(autoAssignmentEnabled);
}
/**
@@ -164,7 +167,7 @@ public class DistributionSetSelectWindow
}
private boolean isAutoAssignmentEnabledAndDistributionSetSelected() {
return checkBox.getValue() && dsTable.getValue() != null;
return checkBox.getValue() && dsCombo.getValue() != null;
}
private boolean isAutoAssignmentDisabled() {
@@ -177,38 +180,34 @@ public class DistributionSetSelectWindow
*/
@Override
public void saveOrUpdate() {
if (checkBox.getValue() && dsTable.getValue() != null) {
updateTargetFilterQueryDS(tfqId, (Long) dsTable.getValue());
if (checkBox.getValue() && dsCombo.getValue() != null) {
final ActionType autoAssignActionType = ((ActionTypeOption) actionTypeOptionGroupLayout
.getActionTypeOptionGroup().getValue()).getActionType();
updateTargetFilterQueryDS(tfqId, (Long) dsCombo.getValue(), autoAssignActionType);
} else if (!checkBox.getValue()) {
updateTargetFilterQueryDS(tfqId, null);
updateTargetFilterQueryDS(tfqId, null, null);
}
}
private void updateTargetFilterQueryDS(final Long targetFilterQueryId, final Long dsId) {
private void updateTargetFilterQueryDS(final Long targetFilterQueryId, final Long dsId,
final ActionType actionType) {
final TargetFilterQuery tfq = targetFilterQueryManagement.get(targetFilterQueryId)
.orElseThrow(() -> new EntityNotFoundException(TargetFilterQuery.class, targetFilterQueryId));
if (dsId != null) {
confirmWithConsequencesDialog(tfq, dsId);
confirmWithConsequencesDialog(tfq, dsId, actionType);
} else {
targetFilterQueryManagement.updateAutoAssignDS(targetFilterQueryId, null);
eventBus.publish(this, CustomFilterUIEvent.UPDATED_TARGET_FILTER_QUERY);
}
}
private void confirmWithConsequencesDialog(final TargetFilterQuery tfq, final Long dsId) {
final ConfirmConsequencesDialog dialog = new ConfirmConsequencesDialog(tfq, dsId, new ConfirmCallback() {
@Override
public void onConfirmResult(final boolean accepted) {
if (accepted) {
targetFilterQueryManagement.updateAutoAssignDS(tfq.getId(), dsId);
eventBus.publish(this, CustomFilterUIEvent.UPDATED_TARGET_FILTER_QUERY);
}
private void confirmWithConsequencesDialog(final TargetFilterQuery tfq, final Long dsId,
final ActionType actionType) {
final ConfirmConsequencesDialog dialog = new ConfirmConsequencesDialog(tfq, dsId, accepted -> {
if (accepted) {
targetFilterQueryManagement.updateAutoAssignDSWithActionType(tfq.getId(), dsId, actionType);
eventBus.publish(this, CustomFilterUIEvent.UPDATED_TARGET_FILTER_QUERY);
}
});
@@ -216,7 +215,6 @@ public class DistributionSetSelectWindow
UI.getCurrent().addWindow(dialog);
dialog.setVisible(true);
}
/**
@@ -224,26 +222,21 @@ public class DistributionSetSelectWindow
* the
*/
private class ConfirmConsequencesDialog extends Window implements Button.ClickListener {
private static final long serialVersionUID = 7738545414137389326L;
private static final long serialVersionUID = 1L;
private final TargetFilterQuery targetFilterQuery;
private final Long distributionSetId;
private Button okButton;
private final ConfirmCallback callback;
private final transient Consumer<Boolean> callback;
public ConfirmConsequencesDialog(final TargetFilterQuery targetFilterQuery, final Long dsId,
final ConfirmCallback callback) {
super(i18n.getMessage("caption.confirm.assign.consequences"));
final Consumer<Boolean> callback) {
super(i18n.getMessage(UIMessageIdProvider.CAPTION_CONFIRM_AUTO_ASSIGN_CONSEQUENCES));
this.callback = callback;
this.targetFilterQuery = targetFilterQuery;
this.distributionSetId = dsId;
init();
}
private void init() {
@@ -260,9 +253,11 @@ public class DistributionSetSelectWindow
targetFilterQuery.getQuery());
Label mainTextLabel;
if (targetsCount == 0) {
mainTextLabel = new Label(i18n.getMessage("message.confirm.assign.consequences.none"));
mainTextLabel = new Label(
i18n.getMessage(UIMessageIdProvider.MESSAGE_CONFIRM_AUTO_ASSIGN_CONSEQUENCES_NONE));
} else {
mainTextLabel = new Label(i18n.getMessage("message.confirm.assign.consequences.text", targetsCount));
mainTextLabel = new Label(i18n
.getMessage(UIMessageIdProvider.MESSAGE_CONFIRM_AUTO_ASSIGN_CONSEQUENCES_TEXT, targetsCount));
}
layout.addComponent(mainTextLabel);
@@ -273,7 +268,7 @@ public class DistributionSetSelectWindow
buttonsLayout.addStyleName("actionButtonsMargin");
layout.addComponent(buttonsLayout);
okButton = SPUIComponentProvider.getButton(UIComponentIdProvider.SAVE_BUTTON,
final Button okButton = SPUIComponentProvider.getButton(UIComponentIdProvider.SAVE_BUTTON,
i18n.getMessage(UIMessageIdProvider.BUTTON_OK), "", "", true, FontAwesome.SAVE,
SPUIButtonStyleNoBorderWithIcon.class);
okButton.setSizeUndefined();
@@ -292,24 +287,17 @@ public class DistributionSetSelectWindow
buttonsLayout.addComponent(cancelButton);
buttonsLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_LEFT);
buttonsLayout.setExpandRatio(cancelButton, 1.0F);
}
@Override
public void buttonClick(final Button.ClickEvent event) {
if (event.getButton().getId().equals(okButton.getId())) {
callback.onConfirmResult(true);
if (event.getButton().getId().equals(UIComponentIdProvider.SAVE_BUTTON)) {
callback.accept(true);
} else {
callback.onConfirmResult(false);
callback.accept(false);
}
close();
}
}
@FunctionalInterface
private interface ConfirmCallback extends Serializable {
void onConfirmResult(boolean accepted);
}
}

View File

@@ -17,7 +17,6 @@ import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.ui.AbstractHawkbitUI;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
import org.eclipse.hawkbit.ui.filtermanagement.footer.TargetFilterCountMessageLabel;
import org.eclipse.hawkbit.ui.filtermanagement.state.FilterManagementUIState;
@@ -68,11 +67,10 @@ public class FilterManagementView extends VerticalLayout implements View {
final FilterManagementUIState filterManagementUIState,
final TargetFilterQueryManagement targetFilterQueryManagement, final SpPermissionChecker permissionChecker,
final UINotification notification, final UiProperties uiProperties, final EntityFactory entityFactory,
final AutoCompleteTextFieldComponent queryTextField, final ManageDistUIState manageDistUIState,
final TargetManagement targetManagement) {
final AutoCompleteTextFieldComponent queryTextField, final TargetManagement targetManagement) {
this.targetFilterHeader = new TargetFilterHeader(eventBus, filterManagementUIState, permissionChecker, i18n);
this.targetFilterTable = new TargetFilterTable(i18n, notification, eventBus, filterManagementUIState,
targetFilterQueryManagement, manageDistUIState, targetManagement, permissionChecker);
targetFilterQueryManagement, targetManagement, permissionChecker);
this.createNewFilterHeader = new CreateOrUpdateFilterHeader(i18n, eventBus, filterManagementUIState,
targetFilterQueryManagement, permissionChecker, notification, uiProperties, entityFactory,
queryTextField);
@@ -113,10 +111,10 @@ public class FilterManagementView extends VerticalLayout implements View {
if (custFilterUIEvent == CustomFilterUIEvent.TARGET_FILTER_DETAIL_VIEW) {
viewTargetFilterDetailLayout();
} else if (custFilterUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK) {
this.getUI().access(() -> viewCreateTargetFilterLayout());
this.getUI().access(this::viewCreateTargetFilterLayout);
} else if (custFilterUIEvent == CustomFilterUIEvent.EXIT_CREATE_OR_UPDATE_FILTRER_VIEW
|| custFilterUIEvent == CustomFilterUIEvent.SHOW_FILTER_MANAGEMENT) {
UI.getCurrent().access(() -> viewListView());
UI.getCurrent().access(this::viewListView);
}
}

View File

@@ -104,6 +104,7 @@ public class TargetFilterBeanQuery extends AbstractBeanQuery<ProxyTargetFilter>
final DistributionSet distributionSet = tarFilterQuery.getAutoAssignDistributionSet();
if (distributionSet != null) {
proxyTarFilter.setAutoAssignDistributionSet(new ProxyDistribution(distributionSet));
proxyTarFilter.setAutoAssignActionType(tarFilterQuery.getAutoAssignActionType());
}
proxyTargetFilter.add(proxyTarFilter);
}

View File

@@ -16,12 +16,13 @@ import java.util.Map;
import org.eclipse.hawkbit.im.authentication.SpPermission;
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.ConfirmationDialog;
import org.eclipse.hawkbit.ui.components.ProxyDistribution;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleNoBorder;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleNoBorderWithIcon;
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
import org.eclipse.hawkbit.ui.filtermanagement.state.FilterManagementUIState;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
@@ -68,7 +69,7 @@ public class TargetFilterTable extends Table {
private final transient TargetFilterQueryManagement targetFilterQueryManagement;
private final DistributionSetSelectWindow dsSelectWindow;
private final transient DistributionSetSelectWindow dsSelectWindow;
private final SpPermissionChecker permChecker;
@@ -78,8 +79,8 @@ public class TargetFilterTable extends Table {
public TargetFilterTable(final VaadinMessageSource i18n, final UINotification notification,
final UIEventBus eventBus, final FilterManagementUIState filterManagementUIState,
final TargetFilterQueryManagement targetFilterQueryManagement, final ManageDistUIState manageDistUIState,
final TargetManagement targetManagement, final SpPermissionChecker permChecker) {
final TargetFilterQueryManagement targetFilterQueryManagement, final TargetManagement targetManagement,
final SpPermissionChecker permChecker) {
this.i18n = i18n;
this.notification = notification;
this.eventBus = eventBus;
@@ -87,8 +88,8 @@ public class TargetFilterTable extends Table {
this.targetFilterQueryManagement = targetFilterQueryManagement;
this.permChecker = permChecker;
this.dsSelectWindow = new DistributionSetSelectWindow(i18n, eventBus, targetManagement,
targetFilterQueryManagement, manageDistUIState);
this.dsSelectWindow = new DistributionSetSelectWindow(i18n, eventBus, notification, targetManagement,
targetFilterQueryManagement);
setStyleName("sp-table");
setSizeFull();
@@ -110,7 +111,7 @@ public class TargetFilterTable extends Table {
|| filterEvent == CustomFilterUIEvent.FILTER_BY_CUST_FILTER_TEXT_REMOVE
|| filterEvent == CustomFilterUIEvent.CREATE_TARGET_FILTER_QUERY
|| filterEvent == CustomFilterUIEvent.UPDATED_TARGET_FILTER_QUERY) {
UI.getCurrent().access(() -> refreshContainer());
UI.getCurrent().access(this::refreshContainer);
}
}
@@ -237,14 +238,25 @@ public class TargetFilterTable extends Table {
final Item row1 = getItem(itemId);
final ProxyDistribution distSet = (ProxyDistribution) row1
.getItemProperty(SPUILabelDefinitions.AUTO_ASSIGN_DISTRIBUTION_SET).getValue();
final ActionType actionType = (ActionType) row1.getItemProperty(SPUILabelDefinitions.AUTO_ASSIGN_ACTION_TYPE)
.getValue();
final String buttonId = "distSetButton";
Button updateIcon;
if (distSet == null) {
updateIcon = SPUIComponentProvider.getButton(buttonId, i18n.getMessage("button.no.auto.assignment"),
i18n.getMessage("button.auto.assignment.desc"), null, false, null, SPUIButtonStyleNoBorder.class);
updateIcon = SPUIComponentProvider.getButton(buttonId,
i18n.getMessage(UIMessageIdProvider.BUTTON_NO_AUTO_ASSIGNMENT),
i18n.getMessage(UIMessageIdProvider.BUTTON_AUTO_ASSIGNMENT_DESCRIPTION), null, false, null,
SPUIButtonStyleNoBorder.class);
} else {
updateIcon = SPUIComponentProvider.getButton(buttonId, distSet.getNameVersion(),
i18n.getMessage("button.auto.assignment.desc"), null, false, null, SPUIButtonStyleNoBorder.class);
updateIcon = actionType.equals(ActionType.FORCED)
? SPUIComponentProvider.getButton(buttonId, distSet.getNameVersion(),
i18n.getMessage(UIMessageIdProvider.BUTTON_AUTO_ASSIGNMENT_DESCRIPTION), null, false,
FontAwesome.BOLT, SPUIButtonStyleNoBorderWithIcon.class)
: SPUIComponentProvider.getButton(buttonId, distSet.getNameVersion(),
i18n.getMessage(UIMessageIdProvider.BUTTON_AUTO_ASSIGNMENT_DESCRIPTION), null, false, null,
SPUIButtonStyleNoBorder.class);
updateIcon.setSizeUndefined();
}
updateIcon.addClickListener(this::onClickOfDistributionSetButton);

View File

@@ -50,8 +50,8 @@ import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
import org.eclipse.hawkbit.ui.management.event.PinUnpinEvent;
import org.eclipse.hawkbit.ui.management.event.RefreshDistributionTableByFilterEvent;
import org.eclipse.hawkbit.ui.management.event.SaveActionWindowEvent;
import org.eclipse.hawkbit.ui.management.miscs.ActionTypeOptionGroupLayout;
import org.eclipse.hawkbit.ui.management.miscs.ActionTypeOptionGroupLayout.ActionTypeOption;
import org.eclipse.hawkbit.ui.management.miscs.AbstractActionTypeOptionGroupLayout.ActionTypeOption;
import org.eclipse.hawkbit.ui.management.miscs.ActionTypeOptionGroupAssignmentLayout;
import org.eclipse.hawkbit.ui.management.miscs.MaintenanceWindowLayout;
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
import org.eclipse.hawkbit.ui.management.targettable.TargetTable;
@@ -125,7 +125,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
private ConfirmationDialog confirmDialog;
private final ActionTypeOptionGroupLayout actionTypeOptionGroupLayout;
private final ActionTypeOptionGroupAssignmentLayout actionTypeOptionGroupLayout;
private final MaintenanceWindowLayout maintenanceWindowLayout;
@@ -145,7 +145,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
this.targetTagManagement = targetTagManagement;
this.distributionSetManagement = distributionSetManagement;
this.deploymentManagement = deploymentManagement;
this.actionTypeOptionGroupLayout = new ActionTypeOptionGroupLayout(i18n);
this.actionTypeOptionGroupLayout = new ActionTypeOptionGroupAssignmentLayout(i18n);
this.maintenanceWindowLayout = new MaintenanceWindowLayout(i18n);
this.uiProperties = uiProperties;
notAllowedMsg = i18n.getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED);
@@ -509,10 +509,10 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
Long distId;
List<TargetIdName> targetIdSetList;
List<TargetIdName> tempIdList;
final ActionType actionType = ((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout
.getActionTypeOptionGroup().getValue()).getActionType();
final long forcedTimeStamp = (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout
.getActionTypeOptionGroup().getValue()) == ActionTypeOption.AUTO_FORCED)
final ActionType actionType = ((ActionTypeOption) actionTypeOptionGroupLayout.getActionTypeOptionGroup()
.getValue()).getActionType();
final long forcedTimeStamp = (((ActionTypeOption) actionTypeOptionGroupLayout.getActionTypeOptionGroup()
.getValue()) == ActionTypeOption.AUTO_FORCED)
? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime()
: RepositoryModelConstants.NO_FORCE_TIME;

View File

@@ -0,0 +1,124 @@
/**
* 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.management.miscs;
import java.util.Arrays;
import java.util.Optional;
import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.vaadin.hene.flexibleoptiongroup.FlexibleOptionGroup;
import org.vaadin.hene.flexibleoptiongroup.FlexibleOptionGroupItemComponent;
import com.vaadin.server.FontAwesome;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
/**
* Action type option group abstract layout.
*/
public abstract class AbstractActionTypeOptionGroupLayout extends HorizontalLayout {
private static final long serialVersionUID = 1L;
protected static final String STYLE_DIST_WINDOW_ACTIONTYPE = "dist-window-actiontype";
private static final String STYLE_DIST_WINDOW_ACTIONTYPE_LAYOUT = "dist-window-actiontype-horz-layout";
protected final VaadinMessageSource i18n;
protected FlexibleOptionGroup actionTypeOptionGroup;
/**
* Constructor
*
* @param i18n
* VaadinMessageSource
*/
protected AbstractActionTypeOptionGroupLayout(final VaadinMessageSource i18n) {
this.i18n = i18n;
init();
}
private void init() {
createOptionGroup();
setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE_LAYOUT);
setSizeUndefined();
}
protected abstract void createOptionGroup();
protected void addForcedItemWithLabel() {
final FlexibleOptionGroupItemComponent forceItem = actionTypeOptionGroup
.getItemComponent(ActionTypeOption.FORCED);
forceItem.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE);
forceItem.setId(UIComponentIdProvider.SAVE_ACTION_RADIO_FORCED);
addComponent(forceItem);
final Label forceLabel = new Label();
forceLabel.setStyleName("statusIconPending");
forceLabel.setIcon(FontAwesome.BOLT);
forceLabel.setCaption(i18n.getMessage(UIMessageIdProvider.CAPTION_ACTION_FORCED));
forceLabel.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_FORCED_ITEM));
forceLabel.setStyleName("padding-right-style");
addComponent(forceLabel);
}
protected void addSoftItemWithLabel() {
final FlexibleOptionGroupItemComponent softItem = actionTypeOptionGroup.getItemComponent(ActionTypeOption.SOFT);
softItem.setId(UIComponentIdProvider.ACTION_DETAILS_SOFT_ID);
softItem.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE);
addComponent(softItem);
final Label softLabel = new Label();
softLabel.setSizeFull();
softLabel.setCaption(i18n.getMessage(UIMessageIdProvider.CAPTION_ACTION_SOFT));
softLabel.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_SOFT_ITEM));
softLabel.setStyleName("padding-right-style");
addComponent(softLabel);
}
/**
* To Set Default option for save.
*/
public void selectDefaultOption() {
actionTypeOptionGroup.select(ActionTypeOption.FORCED);
}
/**
* Enum which described the options for the action type
*
*/
public enum ActionTypeOption {
FORCED(ActionType.FORCED), SOFT(ActionType.SOFT), AUTO_FORCED(ActionType.TIMEFORCED);
private final ActionType actionType;
ActionTypeOption(final ActionType actionType) {
this.actionType = actionType;
}
public ActionType getActionType() {
return actionType;
}
/**
* Matches the action type to the option
*
* @param actionType
* the action type to get option for
* @return action type option if matches, otherwise empty Optional
*/
public static Optional<ActionTypeOption> getOptionForActionType(final ActionType actionType) {
return Arrays.stream(ActionTypeOption.values()).filter(option -> option.getActionType().equals(actionType))
.findFirst();
}
}
public FlexibleOptionGroup getActionTypeOptionGroup() {
return actionTypeOptionGroup;
}
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
* Copyright (c) 2019 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
@@ -12,7 +12,6 @@ import java.time.LocalDateTime;
import java.util.Date;
import java.util.TimeZone;
import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
@@ -26,23 +25,15 @@ import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.FontAwesome;
import com.vaadin.shared.ui.datefield.Resolution;
import com.vaadin.ui.DateField;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.themes.ValoTheme;
/**
* Action type option group layout.
* Action type option group layout for manual assignment.
*/
public class ActionTypeOptionGroupLayout extends HorizontalLayout {
public class ActionTypeOptionGroupAssignmentLayout extends AbstractActionTypeOptionGroupLayout {
private static final long serialVersionUID = 1L;
private static final String STYLE_DIST_WINDOW_ACTIONTYPE = "dist-window-actiontype";
private final VaadinMessageSource i18n;
private FlexibleOptionGroup actionTypeOptionGroup;
private DateField forcedTimeDateField;
/**
@@ -51,13 +42,9 @@ public class ActionTypeOptionGroupLayout extends HorizontalLayout {
* @param i18n
* VaadinMessageSource
*/
public ActionTypeOptionGroupLayout(final VaadinMessageSource i18n) {
this.i18n = i18n;
createOptionGroup();
public ActionTypeOptionGroupAssignmentLayout(final VaadinMessageSource i18n) {
super(i18n);
addValueChangeListener();
setStyleName("dist-window-actiontype-horz-layout");
setSizeUndefined();
}
private void addValueChangeListener() {
@@ -77,37 +64,20 @@ public class ActionTypeOptionGroupLayout extends HorizontalLayout {
});
}
private void createOptionGroup() {
@Override
protected void createOptionGroup() {
actionTypeOptionGroup = new FlexibleOptionGroup();
actionTypeOptionGroup.addItem(ActionTypeOption.SOFT);
actionTypeOptionGroup.addItem(ActionTypeOption.FORCED);
actionTypeOptionGroup.addItem(ActionTypeOption.AUTO_FORCED);
selectDefaultOption();
final FlexibleOptionGroupItemComponent forceItem = actionTypeOptionGroup
.getItemComponent(ActionTypeOption.FORCED);
forceItem.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE);
forceItem.setId(UIComponentIdProvider.SAVE_ACTION_RADIO_FORCED);
addComponent(forceItem);
final Label forceLabel = new Label();
forceLabel.setStyleName("statusIconPending");
forceLabel.setIcon(FontAwesome.BOLT);
forceLabel.setCaption(i18n.getMessage(UIMessageIdProvider.CAPTION_ACTION_FORCED));
forceLabel.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_FORCED_ITEM));
forceLabel.setStyleName("padding-right-style");
addComponent(forceLabel);
final FlexibleOptionGroupItemComponent softItem = actionTypeOptionGroup.getItemComponent(ActionTypeOption.SOFT);
softItem.setId(UIComponentIdProvider.ACTION_DETAILS_SOFT_ID);
softItem.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE);
addComponent(softItem);
final Label softLabel = new Label();
softLabel.setSizeFull();
softLabel.setCaption(i18n.getMessage(UIMessageIdProvider.CAPTION_ACTION_SOFT));
softLabel.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_SOFT_ITEM));
softLabel.setStyleName("padding-right-style");
addComponent(softLabel);
addForcedItemWithLabel();
addSoftItemWithLabel();
addAutoForceItemWithLabelAndDateField();
}
private void addAutoForceItemWithLabelAndDateField() {
final FlexibleOptionGroupItemComponent autoForceItem = actionTypeOptionGroup
.getItemComponent(ActionTypeOption.AUTO_FORCED);
autoForceItem.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE);
@@ -138,38 +108,7 @@ public class ActionTypeOptionGroupLayout extends HorizontalLayout {
addComponent(forcedTimeDateField);
}
/**
* To Set Default option for save.
*/
public void selectDefaultOption() {
actionTypeOptionGroup.select(ActionTypeOption.FORCED);
}
/**
* Enum which described the options for the action type
*
*/
public enum ActionTypeOption {
FORCED(ActionType.FORCED), SOFT(ActionType.SOFT), AUTO_FORCED(ActionType.TIMEFORCED);
private final ActionType actionType;
ActionTypeOption(final ActionType actionType) {
this.actionType = actionType;
}
public ActionType getActionType() {
return actionType;
}
}
public FlexibleOptionGroup getActionTypeOptionGroup() {
return actionTypeOptionGroup;
}
public DateField getForcedTimeDateField() {
return forcedTimeDateField;
}
}

View File

@@ -0,0 +1,40 @@
/**
* Copyright (c) 2019 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.management.miscs;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.vaadin.hene.flexibleoptiongroup.FlexibleOptionGroup;
/**
* Action type option group layout for auto assignment.
*/
public class ActionTypeOptionGroupAutoAssignmentLayout extends AbstractActionTypeOptionGroupLayout {
private static final long serialVersionUID = 1L;
/**
* Constructor
*
* @param i18n
* VaadinMessageSource
*/
public ActionTypeOptionGroupAutoAssignmentLayout(final VaadinMessageSource i18n) {
super(i18n);
}
@Override
protected void createOptionGroup() {
actionTypeOptionGroup = new FlexibleOptionGroup();
actionTypeOptionGroup.addItem(ActionTypeOption.SOFT);
actionTypeOptionGroup.addItem(ActionTypeOption.FORCED);
selectDefaultOption();
addForcedItemWithLabel();
addSoftItemWithLabel();
}
}

View File

@@ -66,7 +66,7 @@ public class TargetMetadataPopupLayout extends AbstractMetadataPopupLayout<Targe
@Override
protected List<MetaData> getMetadataList() {
return Collections.unmodifiableList(targetManagement
.findMetaDataByControllerId(new PageRequest(0, 500), getSelectedEntity().getControllerId())
.findMetaDataByControllerId(PageRequest.of(0, 500), getSelectedEntity().getControllerId())
.getContent());
}

View File

@@ -60,8 +60,8 @@ import org.eclipse.hawkbit.ui.management.event.TargetAddUpdateWindowEvent;
import org.eclipse.hawkbit.ui.management.event.TargetFilterEvent;
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
import org.eclipse.hawkbit.ui.management.miscs.ActionTypeOptionGroupLayout;
import org.eclipse.hawkbit.ui.management.miscs.ActionTypeOptionGroupLayout.ActionTypeOption;
import org.eclipse.hawkbit.ui.management.miscs.AbstractActionTypeOptionGroupLayout.ActionTypeOption;
import org.eclipse.hawkbit.ui.management.miscs.ActionTypeOptionGroupAssignmentLayout;
import org.eclipse.hawkbit.ui.management.miscs.MaintenanceWindowLayout;
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
import org.eclipse.hawkbit.ui.management.state.TargetTableFilters;
@@ -142,7 +142,7 @@ public class TargetTable extends AbstractTable<Target> {
private ConfirmationDialog confirmDialog;
private final ActionTypeOptionGroupLayout actionTypeOptionGroupLayout;
private final ActionTypeOptionGroupAssignmentLayout actionTypeOptionGroupLayout;
private final MaintenanceWindowLayout maintenanceWindowLayout;
@@ -159,7 +159,7 @@ public class TargetTable extends AbstractTable<Target> {
this.tagManagement = tagManagement;
this.deploymentManagement = deploymentManagement;
this.uiProperties = uiProperties;
this.actionTypeOptionGroupLayout = new ActionTypeOptionGroupLayout(i18n);
this.actionTypeOptionGroupLayout = new ActionTypeOptionGroupAssignmentLayout(i18n);
this.maintenanceWindowLayout = new MaintenanceWindowLayout(i18n);
setItemDescriptionGenerator(new AssignInstalledDSTooltipGenerator());
@@ -864,10 +864,10 @@ public class TargetTable extends AbstractTable<Target> {
Long distId;
List<TargetIdName> targetIdSetList;
List<TargetIdName> tempIdList;
final ActionType actionType = ((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout
.getActionTypeOptionGroup().getValue()).getActionType();
final long forcedTimeStamp = (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout
.getActionTypeOptionGroup().getValue()) == ActionTypeOption.AUTO_FORCED)
final ActionType actionType = ((ActionTypeOption) actionTypeOptionGroupLayout.getActionTypeOptionGroup()
.getValue()).getActionType();
final long forcedTimeStamp = (((ActionTypeOption) actionTypeOptionGroupLayout.getActionTypeOptionGroup()
.getValue()) == ActionTypeOption.AUTO_FORCED)
? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime()
: RepositoryModelConstants.NO_FORCE_TIME;

View File

@@ -48,8 +48,8 @@ import org.eclipse.hawkbit.ui.common.builder.TextAreaBuilder;
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
import org.eclipse.hawkbit.ui.filtermanagement.TargetFilterBeanQuery;
import org.eclipse.hawkbit.ui.management.miscs.ActionTypeOptionGroupLayout;
import org.eclipse.hawkbit.ui.management.miscs.ActionTypeOptionGroupLayout.ActionTypeOption;
import org.eclipse.hawkbit.ui.management.miscs.AbstractActionTypeOptionGroupLayout.ActionTypeOption;
import org.eclipse.hawkbit.ui.management.miscs.ActionTypeOptionGroupAssignmentLayout;
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
import org.eclipse.hawkbit.ui.rollout.groupschart.GroupsPieChart;
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
@@ -112,7 +112,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
private static final String DENY_BUTTON_LABEL = "button.deny";
private final ActionTypeOptionGroupLayout actionTypeOptionGroupLayout;
private final ActionTypeOptionGroupAssignmentLayout actionTypeOptionGroupLayout;
private final AutoStartOptionGroupLayout autoStartOptionGroupLayout;
@@ -190,7 +190,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
final VaadinMessageSource i18n, final UIEventBus eventBus,
final TargetFilterQueryManagement targetFilterQueryManagement,
final RolloutGroupManagement rolloutGroupManagement, final QuotaManagement quotaManagement) {
actionTypeOptionGroupLayout = new ActionTypeOptionGroupLayout(i18n);
actionTypeOptionGroupLayout = new ActionTypeOptionGroupAssignmentLayout(i18n);
autoStartOptionGroupLayout = new AutoStartOptionGroupLayout(i18n);
this.rolloutManagement = rolloutManagement;
this.rolloutGroupManagement = rolloutGroupManagement;
@@ -371,8 +371,8 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
private ActionType getActionType() {
return ((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout
.getActionTypeOptionGroup().getValue()).getActionType();
return ((ActionTypeOption) actionTypeOptionGroupLayout.getActionTypeOptionGroup().getValue())
.getActionType();
}
private AutoStartOptionGroupLayout.AutoStartOption getAutoStartOption() {
@@ -1078,8 +1078,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
private void setActionType(final Rollout rollout) {
for (final ActionTypeOptionGroupLayout.ActionTypeOption groupAction : ActionTypeOptionGroupLayout.ActionTypeOption
.values()) {
for (final ActionTypeOption groupAction : ActionTypeOption.values()) {
if (groupAction.getActionType() == rollout.getActionType()) {
actionTypeOptionGroupLayout.getActionTypeOptionGroup().setValue(groupAction);
final SimpleDateFormat format = new SimpleDateFormat(SPUIDefinitions.LAST_QUERY_DATE_FORMAT);

View File

@@ -133,6 +133,10 @@ public final class SPUILabelDefinitions {
* AUTO ASSIGN DISTRIBUTION SET ID
*/
public static final String AUTO_ASSIGN_DISTRIBUTION_SET = "autoAssignDistributionSet";
/**
* AUTO ASSIGN ACTION TYPE
*/
public static final String AUTO_ASSIGN_ACTION_TYPE = "autoAssignActionType";
/**
* ASSIGNED DISTRIBUTION Name and Version.
*/

View File

@@ -1179,9 +1179,9 @@ public final class UIComponentIdProvider {
public static final String FILTER_SEARCH_ICON_ID = "filter.search.icon";
/**
* Distribution set select table id
* Distribution set select combobox id
*/
public static final String DIST_SET_SELECT_TABLE_ID = "distribution.set.select.table";
public static final String DIST_SET_SELECT_COMBO_ID = "distribution.set.select.combo";
/**
* Distribution set select window id

View File

@@ -21,6 +21,12 @@ public final class UIMessageIdProvider {
public static final String BUTTON_SAVE = "button.save";
public static final String BUTTON_NO_AUTO_ASSIGNMENT = "button.no.auto.assignment";
public static final String BUTTON_AUTO_ASSIGNMENT_DESCRIPTION = "button.auto.assignment.desc";
public static final String HEADER_DISTRIBUTION_SET = "header.distributionset";
public static final String CAPTION_ACTION_FORCED = "label.action.forced";
public static final String CAPTION_ACTION_SOFT = "label.action.soft";
@@ -47,6 +53,10 @@ public final class UIMessageIdProvider {
public static final String CAPTION_ARTIFACT_DETAILS_OF = "caption.artifact.details.of";
public static final String CAPTION_SELECT_AUTO_ASSIGN_DS = "caption.select.auto.assign.dist";
public static final String CAPTION_CONFIRM_AUTO_ASSIGN_CONSEQUENCES = "caption.confirm.assign.consequences";
public static final String CAPTION_CONFIG_CREATE = "caption.config.create";
public static final String CAPTION_CONFIG_EDIT = "caption.config.edit";
@@ -59,6 +69,10 @@ public final class UIMessageIdProvider {
public static final String LABEL_CREATE_FILTER = "label.create.filter";
public static final String LABEL_AUTO_ASSIGNMENT_DESC = "label.auto.assign.description";
public static final String LABEL_AUTO_ASSIGNMENT_ENABLE = "label.auto.assign.enable";
public static final String MESSAGE_NO_DATA = "message.no.data";
public static final String MESSAGE_DATA_AVAILABLE = "message.data.available";
@@ -67,6 +81,12 @@ public final class UIMessageIdProvider {
public static final String MESSAGE_ACTION_NOT_ALLOWED = "message.action.not.allowed";
public static final String MESSAGE_SELECTED_DS_NOT_FOUND = "message.selected.distributionset.not.found";
public static final String MESSAGE_CONFIRM_AUTO_ASSIGN_CONSEQUENCES_NONE = "message.confirm.assign.consequences.none";
public static final String MESSAGE_CONFIRM_AUTO_ASSIGN_CONSEQUENCES_TEXT = "message.confirm.assign.consequences.text";
public static final String TOOLTIP_OVERDUE = "tooltip.overdue";
public static final String TOOLTIP_MAXIMIZE = "tooltip.maximize";

View File

@@ -228,7 +228,7 @@ label.target.controller.attrs = <b>Controller attributes</b>
label.target.attributes.update.pending = Update pending..
label.target.lastpolldate = Last poll :
label.tag.name = Tag name
label.configuration.auth.header = Allow targets to authenticate via a certificate authenticated by an reverse proxy
label.configuration.auth.header = Allow targets to authenticate via a certificate authenticated by a reverse proxy
label.configuration.auth.gatewaytoken = Allow a gateway to authenticate and manage multiple targets through a gateway security token
label.configuration.auth.targettoken = Allow targets to authenticate directly with their target security token
label.configuration.repository.autoclose.action = Autoclose running actions when a new distribution set is assigned
@@ -670,6 +670,7 @@ target.not.exists=Target {0} does not exists. Maybe the target was deleted.
targets.not.exists=Targets does not exists. Maybe the targets was deleted.
distributionsets.not.exists=Distribution sets do not exists. Maybe the sets were deleted.
message.selected.distributionset.not.found=Distribution set {0} does not exist in the repository, is incomplete or deleted. Please select a new one.
targettag.not.exists=Target tag {0} does not exists. Maybe the target tag was deleted.
caption.entity.target.tag = Target Tag