Fix combobox initial selection (#1012)

* extended TargetFilterQueryAware interface with target filter name to fix the combobox initial selection rendering issue

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* introduced ProxyTargetFilterQueryInfo for consistency and usage of binder convertor, adapted code

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* removed ProxyIdNameVersion in favour of ProxyDistributionSetInfo, adapted usage

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* changed DsIdAware to use ProxyDistributionSetInfo in order to fix the initial combobox selection, adapted corresponding usages

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* changed ProxySystemConfigWindow to use the ProxyTypeInfo for fixing the initial selection of Ds type, adapted code

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>
This commit is contained in:
Bondar Bogdan
2020-09-22 12:02:37 +02:00
committed by GitHub
parent 30d5df59bd
commit 16ce6f35bf
36 changed files with 558 additions and 451 deletions

View File

@@ -19,11 +19,13 @@ import org.eclipse.hawkbit.ui.common.data.aware.StartOptionAware;
import org.eclipse.hawkbit.ui.common.data.aware.TargetFilterQueryAware;
import org.eclipse.hawkbit.ui.common.data.aware.TypeInfoAware;
import org.eclipse.hawkbit.ui.common.data.aware.VersionAware;
import org.eclipse.hawkbit.ui.common.data.providers.DistributionSetStatelessDataProvider;
import org.eclipse.hawkbit.ui.common.data.providers.AbstractProxyDataProvider;
import org.eclipse.hawkbit.ui.common.data.providers.DistributionSetStatelessDataProvider;
import org.eclipse.hawkbit.ui.common.data.providers.TargetFilterQueryDataProvider;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyDistributionSet;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyDistributionSetInfo;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTargetFilterQuery;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTargetFilterQueryInfo;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyType;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTypeInfo;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
@@ -240,24 +242,21 @@ public final class FormComponentBuilder {
i18n.getMessage(UIMessageIdProvider.HEADER_DISTRIBUTION_SET), i18n.getMessage(PROMPT_DISTRIBUTION_SET),
i18n.getMessage(PROMPT_DISTRIBUTION_SET), false, ProxyDistributionSet::getNameVersion, dataProvider);
final Binding<T, Long> binding = binder.forField(dsComboBox)
final Binding<T, ProxyDistributionSetInfo> binding = binder.forField(dsComboBox)
.asRequired(i18n.getMessage(UIMessageIdProvider.MESSAGE_ERROR_DISTRIBUTIONSET_REQUIRED))
.withConverter(ds -> {
if (ds == null) {
return null;
}
return ds.getId();
}, dsId -> {
if (dsId == null) {
return ds.getInfo();
}, dsInfo -> {
if (dsInfo == null) {
return null;
}
final ProxyDistributionSet ds = new ProxyDistributionSet();
ds.setId(dsId);
return ds;
}).bind(DsIdAware::getDistributionSetId, DsIdAware::setDistributionSetId);
return ProxyDistributionSet.of(dsInfo);
}).bind(DsIdAware::getDistributionSetInfo, DsIdAware::setDistributionSetInfo);
return new BoundComponent<>(dsComboBox, binding);
}
@@ -293,20 +292,19 @@ public final class FormComponentBuilder {
bindingBuilder.withValidator(validator);
}
final Binding<T, ProxyTargetFilterQuery> binding = bindingBuilder.bind(tfqAwareBean -> {
if (tfqAwareBean.getTargetFilterId() == null) {
final Binding<T, ProxyTargetFilterQueryInfo> binding = bindingBuilder.withConverter(tfq -> {
if (tfq == null) {
return null;
}
final ProxyTargetFilterQuery filter = new ProxyTargetFilterQuery();
filter.setId(tfqAwareBean.getTargetFilterId());
filter.setQuery(tfqAwareBean.getTargetFilterQuery());
return tfq.getInfo();
}, tfqInfo -> {
if (tfqInfo == null) {
return null;
}
return filter;
}, (tfqAwareBean, filter) -> {
tfqAwareBean.setTargetFilterId(filter != null ? filter.getId() : null);
tfqAwareBean.setTargetFilterQuery(filter != null ? filter.getQuery() : null);
});
return ProxyTargetFilterQuery.of(tfqInfo);
}).bind(TargetFilterQueryAware::getTargetFilterQueryInfo, TargetFilterQueryAware::setTargetFilterQueryInfo);
return new BoundComponent<>(tfqCombo, binding);
}

View File

@@ -8,11 +8,13 @@
*/
package org.eclipse.hawkbit.ui.common.data.aware;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyDistributionSetInfo;
/**
* Element provides a distribution set id
* Element provides a distribution set info
*/
public interface DsIdAware {
void setDistributionSetId(Long id);
void setDistributionSetInfo(ProxyDistributionSetInfo dsInfo);
Long getDistributionSetId();
ProxyDistributionSetInfo getDistributionSetInfo();
}

View File

@@ -8,15 +8,13 @@
*/
package org.eclipse.hawkbit.ui.common.data.aware;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTargetFilterQueryInfo;
/**
* Element is used for target filter query combobox
*/
public interface TargetFilterQueryAware {
void setTargetFilterId(Long id);
void setTargetFilterQueryInfo(ProxyTargetFilterQueryInfo tfqInfo);
Long getTargetFilterId();
void setTargetFilterQuery(String query);
String getTargetFilterQuery();
ProxyTargetFilterQueryInfo getTargetFilterQueryInfo();
}

View File

@@ -16,6 +16,7 @@ import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
import org.eclipse.hawkbit.repository.model.RolloutGroup;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyAdvancedRolloutGroup;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTargetFilterQueryInfo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.util.StringUtils;
@@ -32,7 +33,7 @@ public class RolloutGroupToAdvancedDefinitionMapper {
* Constructor for RolloutGroupToAdvancedDefinitionMapper
*
* @param targetFilterQueryManagement
* TargetFilterQueryManagement
* TargetFilterQueryManagement
*/
public RolloutGroupToAdvancedDefinitionMapper(final TargetFilterQueryManagement targetFilterQueryManagement) {
this.targetFilterQueryManagement = targetFilterQueryManagement;
@@ -42,7 +43,7 @@ public class RolloutGroupToAdvancedDefinitionMapper {
* Map advanced Rollout Group
*
* @param rolloutGroup
* RolloutGroup
* RolloutGroup
*
* @return ProxyAdvancedRolloutGroup
*/
@@ -57,7 +58,9 @@ public class RolloutGroupToAdvancedDefinitionMapper {
final Page<TargetFilterQuery> filterQueries = targetFilterQueryManagement.findByQuery(PageRequest.of(0, 1),
groupTargetFilterQuery);
if (filterQueries.getTotalElements() == 1) {
advancedGroupRow.setTargetFilterId(filterQueries.getContent().get(0).getId());
final TargetFilterQuery tfq = filterQueries.getContent().get(0);
advancedGroupRow.setTargetFilterQueryInfo(
new ProxyTargetFilterQueryInfo(tfq.getId(), tfq.getName(), tfq.getQuery()));
}
}
@@ -72,11 +75,11 @@ public class RolloutGroupToAdvancedDefinitionMapper {
* Fetch rollout group data from the backend
*
* @param rolloutId
* Rollout id
* Rollout id
* @param rolloutGroupManagement
* RolloutGroupManagement
* RolloutGroupManagement
* @param pageCount
* Total page count
* Total page count
*
* @return List of advance rollout group
*/

View File

@@ -10,8 +10,8 @@ package org.eclipse.hawkbit.ui.common.data.mappers;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyDistributionSetInfo;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyRollout;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
/**
* Maps {@link Rollout} entities, fetched from backend, to the
@@ -37,11 +37,8 @@ public class RolloutToProxyRolloutMapper extends AbstractNamedEntityToProxyNamed
mapNamedEntityAttributes(rollout, proxyRollout);
final DistributionSet distributionSet = rollout.getDistributionSet();
proxyRollout.setDistributionSetNameVersion(
HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(), distributionSet.getVersion()));
proxyRollout.setDistributionSetId(distributionSet.getId());
final DistributionSet ds = rollout.getDistributionSet();
proxyRollout.setDsInfo(new ProxyDistributionSetInfo(ds.getId(), ds.getName(), ds.getVersion()));
proxyRollout
.setNumberOfGroups(rollout.getRolloutGroupsCreated() > 0 ? rollout.getRolloutGroupsCreated() : null);
proxyRollout.setForcedTime(rollout.getForcedTime() > 0 ? rollout.getForcedTime() : null);

View File

@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.ui.common.data.mappers;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyIdNameVersion;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyDistributionSetInfo;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTargetFilterQuery;
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
@@ -37,7 +37,7 @@ public class TargetFilterQueryToProxyTargetFilterMapper
final DistributionSet distributionSet = targetFilterQuery.getAutoAssignDistributionSet();
if (distributionSet != null) {
proxyTargetFilter.setAutoAssignmentEnabled(true);
proxyTargetFilter.setAutoAssignDsIdNameVersion(new ProxyIdNameVersion(distributionSet.getId(),
proxyTargetFilter.setDistributionSetInfo(new ProxyDistributionSetInfo(distributionSet.getId(),
distributionSet.getName(), distributionSet.getVersion()));
proxyTargetFilter.setAutoAssignActionType(targetFilterQuery.getAutoAssignActionType());
}

View File

@@ -20,8 +20,7 @@ public class ProxyAdvancedRolloutGroup implements Serializable, TargetFilterQuer
private static final long serialVersionUID = 1L;
private String groupName;
private String targetFilterQuery;
private Long targetFilterId;
private ProxyTargetFilterQueryInfo targetFilterInfo;
private Float targetPercentage;
private String triggerThresholdPercentage;
private String errorThresholdPercentage;
@@ -40,30 +39,32 @@ public class ProxyAdvancedRolloutGroup implements Serializable, TargetFilterQuer
* Sets the groupName
*
* @param groupName
* name of the group
* name of the group
*/
public void setGroupName(final String groupName) {
this.groupName = groupName;
}
@Override
public ProxyTargetFilterQueryInfo getTargetFilterQueryInfo() {
return targetFilterInfo;
}
@Override
public void setTargetFilterQueryInfo(final ProxyTargetFilterQueryInfo tfqInfo) {
this.targetFilterInfo = tfqInfo;
}
public String getTargetFilterQuery() {
return targetFilterQuery;
return targetFilterInfo != null ? targetFilterInfo.getQuery() : null;
}
@Override
public void setTargetFilterQuery(final String targetFilterQuery) {
this.targetFilterQuery = targetFilterQuery;
}
@Override
public Long getTargetFilterId() {
return targetFilterId;
}
@Override
public void setTargetFilterId(final Long targetFilterId) {
this.targetFilterId = targetFilterId;
if (targetFilterInfo != null) {
targetFilterInfo.setQuery(targetFilterQuery);
} else {
targetFilterInfo = new ProxyTargetFilterQueryInfo(null, null, targetFilterQuery);
}
}
/**
@@ -79,7 +80,7 @@ public class ProxyAdvancedRolloutGroup implements Serializable, TargetFilterQuer
* Sets the targetPercentage
*
* @param targetPercentage
* percentage of the target
* percentage of the target
*/
public void setTargetPercentage(final Float targetPercentage) {
this.targetPercentage = targetPercentage;
@@ -98,7 +99,7 @@ public class ProxyAdvancedRolloutGroup implements Serializable, TargetFilterQuer
* Sets the triggerThresholdPercentage
*
* @param triggerThresholdPercentage
* percentage of the triggerThreshold
* percentage of the triggerThreshold
*/
public void setTriggerThresholdPercentage(final String triggerThresholdPercentage) {
this.triggerThresholdPercentage = triggerThresholdPercentage;
@@ -117,7 +118,7 @@ public class ProxyAdvancedRolloutGroup implements Serializable, TargetFilterQuer
* Sets the errorThresholdPercentage
*
* @param errorThresholdPercentage
* percentage of the errorThreshold
* percentage of the errorThreshold
*/
public void setErrorThresholdPercentage(final String errorThresholdPercentage) {
this.errorThresholdPercentage = errorThresholdPercentage;

View File

@@ -20,27 +20,29 @@ import org.eclipse.hawkbit.ui.common.data.aware.DsIdAware;
public class ProxyBulkUploadWindow implements Serializable, DescriptionAware, DsIdAware {
private static final long serialVersionUID = 1L;
private Long distributionSetId;
private ProxyDistributionSetInfo dsInfo;
private Map<Long, String> tagIdsWithNameToAssign;
private String description;
/**
* Gets the distributionSetId
* Gets the distribution set info
*
* @return distributionSetId
* @return dsInfo
*/
public Long getDistributionSetId() {
return distributionSetId;
@Override
public ProxyDistributionSetInfo getDistributionSetInfo() {
return dsInfo;
}
/**
* Sets the distributionSetId
* Sets the distribution set info
*
* @param distributionSetId
* Id of distribution set
* @param dsInfo
* Info of distribution set
*/
public void setDistributionSetId(final Long distributionSetId) {
this.distributionSetId = distributionSetId;
@Override
public void setDistributionSetInfo(final ProxyDistributionSetInfo dsInfo) {
this.dsInfo = dsInfo;
}
/**
@@ -56,7 +58,7 @@ public class ProxyBulkUploadWindow implements Serializable, DescriptionAware, Ds
* Sets the tagIdsWithNameToAssign
*
* @param tagIdsWithNameToAssign
* list of tagIds WithNameToAssign
* list of tagIds WithNameToAssign
*/
public void setTagIdsWithNameToAssign(final Map<Long, String> tagIdsWithNameToAssign) {
this.tagIdsWithNameToAssign = tagIdsWithNameToAssign;
@@ -67,6 +69,7 @@ public class ProxyBulkUploadWindow implements Serializable, DescriptionAware, Ds
*
* @return description
*/
@Override
public String getDescription() {
return description;
}
@@ -75,8 +78,9 @@ public class ProxyBulkUploadWindow implements Serializable, DescriptionAware, Ds
* Sets the description
*
* @param description
* entity description
* entity description
*/
@Override
public void setDescription(final String description) {
this.description = description;
}

View File

@@ -128,17 +128,18 @@ public class ProxyDistributionSet extends ProxyNamedEntity implements VersionAwa
/**
* Sets the Id, name and version of distribution set
*
* @param dsIdNameVersion
* ProxyIdNameVersion
* @param dsInfo
* ProxyDistributionSetInfo
*
* @return proxy of distribution set
*/
public ProxyDistributionSet of(final ProxyIdNameVersion dsIdNameVersion) {
public static ProxyDistributionSet of(final ProxyDistributionSetInfo dsInfo) {
final ProxyDistributionSet ds = new ProxyDistributionSet();
ds.setId(dsIdNameVersion.getId());
ds.setName(dsIdNameVersion.getName());
ds.setVersion(dsIdNameVersion.getVersion());
ds.setId(dsInfo.getId());
ds.setName(dsInfo.getName());
ds.setVersion(dsInfo.getVersion());
ds.setNameVersion(dsInfo.getNameVersion());
return ds;
}
@@ -148,7 +149,7 @@ public class ProxyDistributionSet extends ProxyNamedEntity implements VersionAwa
*
* @return proxy of Id, Name and version
*/
public ProxyIdNameVersion getIdNameVersion() {
return new ProxyIdNameVersion(getId(), getName(), getVersion());
public ProxyDistributionSetInfo getInfo() {
return new ProxyDistributionSetInfo(getId(), getName(), getVersion());
}
}

View File

@@ -0,0 +1,96 @@
/**
* Copyright (c) 2020 Bosch.IO 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.common.data.proxies;
import java.util.Objects;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
/**
* Holds information about a distribution set
*/
public class ProxyDistributionSetInfo extends ProxyIdentifiableEntity {
private static final long serialVersionUID = 1L;
private String name;
private String version;
private String nameVersion;
/**
* Constructor
*/
public ProxyDistributionSetInfo() {
super();
}
/**
* Constructor
*
* @param id
* distribution set ID
* @param name
* distribution set name
* @param version
* distribution set version
*/
public ProxyDistributionSetInfo(final Long id, final String name, final String version) {
super(id);
this.name = name;
this.version = version;
this.nameVersion = HawkbitCommonUtil.getFormattedNameVersion(name, version);
}
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
public String getVersion() {
return version;
}
public void setVersion(final String version) {
this.version = version;
}
public String getNameVersion() {
return nameVersion;
}
public void setNameVersion(final String nameVersion) {
this.nameVersion = nameVersion;
}
@Override
public int hashCode() {
// nameVersion is ignored because it is a composition of name and
// version
return Objects.hash(getId(), getName(), getVersion());
}
@Override
public boolean equals(final Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final ProxyDistributionSetInfo other = (ProxyDistributionSetInfo) obj;
// nameVersion is ignored because it is a composition of name and
// version
return Objects.equals(this.getId(), other.getId()) && Objects.equals(this.getName(), other.getName())
&& Objects.equals(this.getVersion(), other.getVersion());
}
}

View File

@@ -1,75 +0,0 @@
/**
* Copyright (c) 2020 Bosch.IO 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.common.data.proxies;
/**
* Represent a data transfer object for the ui with id, name and version.
*/
public class ProxyIdNameVersion extends ProxyIdentifiableEntity {
private static final long serialVersionUID = 1L;
private String name;
private String version;
/**
* Constructor.
*
* @param id
* the id
* @param name
* the name
* @param version
* the version
*
*/
public ProxyIdNameVersion(final Long id, final String name, final String version) {
super(id);
this.name = name;
this.version = version;
}
/**
* Gets the name
*
* @return name
*/
public String getName() {
return name;
}
/**
* Sets the name
*
* @param name
* Name of entity
*/
public void setName(final String name) {
this.name = name;
}
/**
* Gets the version
*
* @return version
*/
public String getVersion() {
return version;
}
/**
* Sets the version
*
* @param version
* Version of entity
*/
public void setVersion(final String version) {
this.version = version;
}
}

View File

@@ -22,7 +22,7 @@ public class ProxyRollout extends ProxyNamedEntity {
private static final long serialVersionUID = 1L;
private String distributionSetNameVersion;
private ProxyDistributionSetInfo dsInfo;
private Integer numberOfGroups;
@@ -44,10 +44,8 @@ public class ProxyRollout extends ProxyNamedEntity {
private ActionType actionType;
private Long distributionSetId;
/**
* Constructor
* Constructor
*/
public ProxyRollout() {
}
@@ -56,12 +54,24 @@ public class ProxyRollout extends ProxyNamedEntity {
* Constructor for ProxyRollout
*
* @param id
* Rollout entity Id
* Rollout entity Id
*/
public ProxyRollout(final Long id) {
super(id);
}
public ProxyDistributionSetInfo getDsInfo() {
return dsInfo;
}
public void setDsInfo(final ProxyDistributionSetInfo dsInfo) {
this.dsInfo = dsInfo;
}
public String getDsNameVersion() {
return dsInfo != null ? dsInfo.getNameVersion() : null;
}
/**
* Gets the rollout actionType
*
@@ -75,30 +85,12 @@ public class ProxyRollout extends ProxyNamedEntity {
* Sets the actionType
*
* @param actionType
* Rollout actionType
* Rollout actionType
*/
public void setActionType(final ActionType actionType) {
this.actionType = actionType;
}
/**
* Get the distributionSetNameVersion
*
* @return distributionSetNameVersion
*/
public String getDistributionSetNameVersion() {
return distributionSetNameVersion;
}
/**
* Sets the distributionSetNameVersion
* @param distributionSetNameVersion
* Name and version of distribution set
*/
public void setDistributionSetNameVersion(final String distributionSetNameVersion) {
this.distributionSetNameVersion = distributionSetNameVersion;
}
/**
* Gets the numberOfGroups
*
@@ -112,7 +104,7 @@ public class ProxyRollout extends ProxyNamedEntity {
* Sets the numberOfGroups
*
* @param numberOfGroups
* Number of rollout groups
* Number of rollout groups
*/
public void setNumberOfGroups(final Integer numberOfGroups) {
this.numberOfGroups = numberOfGroups;
@@ -131,7 +123,7 @@ public class ProxyRollout extends ProxyNamedEntity {
* Sets the forcedTime
*
* @param forcedTime
* Forced time
* Forced time
*/
public void setForcedTime(final Long forcedTime) {
this.forcedTime = forcedTime;
@@ -150,7 +142,7 @@ public class ProxyRollout extends ProxyNamedEntity {
* Sets the rollout status
*
* @param status
* Rollout current status
* Rollout current status
*/
public void setStatus(final RolloutStatus status) {
this.status = status;
@@ -169,7 +161,7 @@ public class ProxyRollout extends ProxyNamedEntity {
* Sets the approvalDecidedBy
*
* @param approvalDecidedBy
* approval DecidedBy for rollout
* approval DecidedBy for rollout
*/
public void setApprovalDecidedBy(final String approvalDecidedBy) {
this.approvalDecidedBy = approvalDecidedBy;
@@ -188,7 +180,7 @@ public class ProxyRollout extends ProxyNamedEntity {
* Sets the approvalRemark
*
* @param approvalRemark
* Remark for approval
* Remark for approval
*/
public void setApprovalRemark(final String approvalRemark) {
this.approvalRemark = approvalRemark;
@@ -207,7 +199,7 @@ public class ProxyRollout extends ProxyNamedEntity {
* Sets the targetFilterQuery
*
* @param targetFilterQuery
* Target filter query
* Target filter query
*/
public void setTargetFilterQuery(final String targetFilterQuery) {
this.targetFilterQuery = targetFilterQuery;
@@ -226,7 +218,7 @@ public class ProxyRollout extends ProxyNamedEntity {
* Sets the totalTargets
*
* @param totalTargets
* Total targets
* Total targets
*/
public void setTotalTargets(final long totalTargets) {
this.totalTargets = totalTargets;
@@ -245,31 +237,12 @@ public class ProxyRollout extends ProxyNamedEntity {
* Sets the startAt
*
* @param startAt
* time rollout starts at
* time rollout starts at
*/
public void setStartAt(final Long startAt) {
this.startAt = startAt;
}
/**
* Gets the Id of distribution set
*
* @return distributionSetId
*/
public Long getDistributionSetId() {
return distributionSetId;
}
/**
* Sets the distributionSetId
*
* @param distributionSetId
* Id of distribution set
*/
public void setDistributionSetId(final Long distributionSetId) {
this.distributionSetId = distributionSetId;
}
/**
* Gets the total count of all the rollout status
*
@@ -283,7 +256,7 @@ public class ProxyRollout extends ProxyNamedEntity {
* Sets the statusTotalCountMap
*
* @param statusTotalCountMap
* total count of all the rollout status
* total count of all the rollout status
*/
public void setStatusTotalCountMap(final Map<Status, Long> statusTotalCountMap) {
this.statusTotalCountMap = statusTotalCountMap;

View File

@@ -28,9 +28,8 @@ public class ProxyRolloutForm implements Serializable, NameAware, DsIdAware, Tar
private Long id;
private String name;
private Long distributionSetId;
private Long targetFilterId;
private String targetFilterQuery;
private ProxyTargetFilterQueryInfo targetFilterInfo;
private ProxyDistributionSetInfo dsInfo;
private String description;
private ActionType actionType;
private Long forcedTime;
@@ -39,6 +38,7 @@ public class ProxyRolloutForm implements Serializable, NameAware, DsIdAware, Tar
/**
* Gets the rollout form id
*
* @return id
*/
public Long getId() {
@@ -49,7 +49,7 @@ public class ProxyRolloutForm implements Serializable, NameAware, DsIdAware, Tar
* Sets the form id
*
* @param id
* rollout form id
* rollout form id
*/
public void setId(final Long id) {
this.id = id;
@@ -66,33 +66,35 @@ public class ProxyRolloutForm implements Serializable, NameAware, DsIdAware, Tar
}
@Override
public Long getDistributionSetId() {
return distributionSetId;
public ProxyTargetFilterQueryInfo getTargetFilterQueryInfo() {
return targetFilterInfo;
}
@Override
public void setDistributionSetId(final Long distributionSetId) {
this.distributionSetId = distributionSetId;
public void setTargetFilterQueryInfo(final ProxyTargetFilterQueryInfo tfqInfo) {
this.targetFilterInfo = tfqInfo;
}
@Override
public Long getTargetFilterId() {
return targetFilterId;
}
@Override
public void setTargetFilterId(final Long targetFilterId) {
this.targetFilterId = targetFilterId;
}
@Override
public String getTargetFilterQuery() {
return targetFilterQuery;
return targetFilterInfo != null ? targetFilterInfo.getQuery() : null;
}
public void setTargetFilterQuery(final String targetFilterQuery) {
if (targetFilterInfo != null) {
targetFilterInfo.setQuery(targetFilterQuery);
} else {
targetFilterInfo = new ProxyTargetFilterQueryInfo(null, null, targetFilterQuery);
}
}
@Override
public void setTargetFilterQuery(final String targetFilterQuery) {
this.targetFilterQuery = targetFilterQuery;
public ProxyDistributionSetInfo getDistributionSetInfo() {
return dsInfo;
}
@Override
public void setDistributionSetInfo(final ProxyDistributionSetInfo dsInfo) {
this.dsInfo = dsInfo;
}
@Override

View File

@@ -52,8 +52,8 @@ public class ProxyRolloutWindow implements Serializable {
setActionType(rollout.getActionType());
setStartAt(rollout.getStartAt());
setForcedTime(rollout.getForcedTime());
setDistributionSetId(rollout.getDistributionSetId());
setTargetFilterQuery(rollout.getTargetFilterQuery());
setDistributionSetInfo(rollout.getDsInfo());
setNumberOfGroups(rollout.getNumberOfGroups());
}
@@ -186,25 +186,6 @@ public class ProxyRolloutWindow implements Serializable {
rolloutApproval.setApprovalRemark(approvalRemark);
}
/**
* Gets the rollout form targetFilterQuery
*
* @return targetFilterQuery
*/
public String getTargetFilterQuery() {
return rolloutForm.getTargetFilterQuery();
}
/**
* Sets the targetFilterQuery
*
* @param targetFilterQuery
* Rollout form target filter query
*/
public void setTargetFilterQuery(final String targetFilterQuery) {
rolloutForm.setTargetFilterQuery(targetFilterQuery);
}
/**
* Gets the time rollout start time
*
@@ -224,40 +205,59 @@ public class ProxyRolloutWindow implements Serializable {
rolloutForm.setStartAt(startAt);
}
/**
* @return Rollout form targetFilter Info
*/
public ProxyTargetFilterQueryInfo getTargetFilterInfo() {
return rolloutForm.getTargetFilterQueryInfo();
}
/**
* Sets the targetFilter Info
*
* @param tfqInfo
* Info of rollout form targetFilter
*/
public void setTargetFilterInfo(final ProxyTargetFilterQueryInfo tfqInfo) {
rolloutForm.setTargetFilterQueryInfo(tfqInfo);
}
/**
* Gets the rollout form targetFilterQuery
*
* @return targetFilterQuery
*/
public String getTargetFilterQuery() {
return rolloutForm.getTargetFilterQuery();
}
/**
* Sets the targetFilterQuery
*
* @param targetFilterQuery
* Rollout form target filter query
*/
public void setTargetFilterQuery(final String targetFilterQuery) {
rolloutForm.setTargetFilterQuery(targetFilterQuery);
}
/**
* Gets the Id of rollout form distribution set
*
* @return distributionSetId
*/
public Long getDistributionSetId() {
return rolloutForm.getDistributionSetId();
return rolloutForm.getDistributionSetInfo() != null ? rolloutForm.getDistributionSetInfo().getId() : null;
}
/**
* Sets the distributionSetId
* Sets the distribution set info
*
* @param distributionSetId
* Id of rollout form distribution set
* @param dsInfo
* Info of rollout form distribution set
*/
public void setDistributionSetId(final Long distributionSetId) {
rolloutForm.setDistributionSetId(distributionSetId);
}
/**
* @return Rollout form targetFilter id
*/
public Long getTargetFilterId() {
return rolloutForm.getTargetFilterId();
}
/**
* Sets the targetFilterId
*
* @param targetFilterId
* Id of rollout form targetFilter
*/
public void setTargetFilterId(final Long targetFilterId) {
rolloutForm.setTargetFilterId(targetFilterId);
public void setDistributionSetInfo(final ProxyDistributionSetInfo dsInfo) {
rolloutForm.setDistributionSetInfo(dsInfo);
}
/**

View File

@@ -23,7 +23,7 @@ public class ProxySystemConfigWindow implements Serializable {
private Long id;
private String name;
private String description;
private Long distributionSetTypeId;
private ProxyTypeInfo dsTypeInfo;
private Long repositoryConfigId;
private Long rolloutConfigId;
private Long caRootAuthorityId;
@@ -222,23 +222,12 @@ public class ProxySystemConfigWindow implements Serializable {
this.description = description;
}
/**
* Gets the id of distributionSetType
*
* @return distributionSetTypeId
*/
public Long getDistributionSetTypeId() {
return distributionSetTypeId;
public ProxyTypeInfo getDsTypeInfo() {
return dsTypeInfo;
}
/**
* Sets the distributionSetTypeId
*
* @param distributionSetTypeId
* System config window distributionSetTypeId
*/
public void setDistributionSetTypeId(final Long distributionSetTypeId) {
this.distributionSetTypeId = distributionSetTypeId;
public void setDsTypeInfo(final ProxyTypeInfo dsTypeInfo) {
this.dsTypeInfo = dsTypeInfo;
}
/**

View File

@@ -22,7 +22,7 @@ public class ProxyTargetFilterQuery extends ProxyNamedEntity implements DsIdAwar
private boolean isAutoAssignmentEnabled;
private ProxyIdNameVersion autoAssignDsIdNameVersion;
private ProxyDistributionSetInfo autoAssignDsInfo;
private ActionType autoAssignActionType;
@@ -36,7 +36,7 @@ public class ProxyTargetFilterQuery extends ProxyNamedEntity implements DsIdAwar
* Constructor for ProxyTargetFilterQuery
*
* @param id
* Target filter query id
* Target filter query id
*/
public ProxyTargetFilterQuery(final Long id) {
super(id);
@@ -55,7 +55,7 @@ public class ProxyTargetFilterQuery extends ProxyNamedEntity implements DsIdAwar
* Sets the query
*
* @param query
* Target filter query
* Target filter query
*/
public void setQuery(final String query) {
this.query = query;
@@ -74,7 +74,7 @@ public class ProxyTargetFilterQuery extends ProxyNamedEntity implements DsIdAwar
* Sets the autoAssignActionType
*
* @param autoAssignActionType
* ActionType
* ActionType
*/
public void setAutoAssignActionType(final ActionType autoAssignActionType) {
this.autoAssignActionType = autoAssignActionType;
@@ -102,35 +102,50 @@ public class ProxyTargetFilterQuery extends ProxyNamedEntity implements DsIdAwar
}
/**
* Gets the autoAssign Distribution set IdNameVersion
* Gets the autoAssign Distribution set Info
*
* @return autoAssignDsIdNameVersion
* @return ProxyDistributionSetInfo
*/
public ProxyIdNameVersion getAutoAssignDsIdNameVersion() {
return autoAssignDsIdNameVersion;
@Override
public ProxyDistributionSetInfo getDistributionSetInfo() {
return autoAssignDsInfo;
}
/**
* Sets the securityToken
* Sets the autoAssign Distribution set Info
*
* @param autoAssignDsIdNameVersion
* Target filter autoAssign Distribution set IdNameVersion
* @param dsInfo
* Target filter autoAssign Distribution set Info
*/
public void setAutoAssignDsIdNameVersion(final ProxyIdNameVersion autoAssignDsIdNameVersion) {
this.autoAssignDsIdNameVersion = autoAssignDsIdNameVersion;
@Override
public void setDistributionSetInfo(final ProxyDistributionSetInfo dsInfo) {
this.autoAssignDsInfo = dsInfo;
}
@Override
public void setDistributionSetId(final Long id) {
if (autoAssignDsIdNameVersion != null) {
autoAssignDsIdNameVersion.setId(id);
} else {
autoAssignDsIdNameVersion = new ProxyIdNameVersion(id, null, null);
}
/**
* Sets the Id, name and query of target filter query
*
* @param tfqInfo
* ProxyTargetFilterQuery
*
* @return proxy of target filter query
*/
public static ProxyTargetFilterQuery of(final ProxyTargetFilterQueryInfo tfqInfo) {
final ProxyTargetFilterQuery tfq = new ProxyTargetFilterQuery();
tfq.setId(tfqInfo.getId());
tfq.setName(tfqInfo.getName());
tfq.setQuery(tfqInfo.getQuery());
return tfq;
}
@Override
public Long getDistributionSetId() {
return autoAssignDsIdNameVersion != null ? autoAssignDsIdNameVersion.getId() : null;
/**
* Gets the Id, name and query of target filter query
*
* @return proxy of Id, Name and query
*/
public ProxyTargetFilterQueryInfo getInfo() {
return new ProxyTargetFilterQueryInfo(getId(), getName(), getQuery());
}
}

View File

@@ -0,0 +1,78 @@
/**
* Copyright (c) 2020 Bosch.IO 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.common.data.proxies;
import java.util.Objects;
/**
* Holds information about a target filter query
*/
public class ProxyTargetFilterQueryInfo extends ProxyIdentifiableEntity {
private static final long serialVersionUID = 1L;
private String name;
private String query;
/**
* Constructor
*/
public ProxyTargetFilterQueryInfo() {
super();
}
/**
* Constructor
*
* @param id
* target filter ID
* @param name
* target filter name
* @param query
* target filter query
*/
public ProxyTargetFilterQueryInfo(final Long id, final String name, final String query) {
super(id);
this.name = name;
this.query = query;
}
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
public String getQuery() {
return query;
}
public void setQuery(final String query) {
this.query = query;
}
@Override
public int hashCode() {
return Objects.hash(getId(), getName(), getQuery());
}
@Override
public boolean equals(final Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final ProxyTargetFilterQueryInfo other = (ProxyTargetFilterQueryInfo) obj;
return Objects.equals(this.getId(), other.getId()) && Objects.equals(this.getName(), other.getName())
&& Objects.equals(this.getQuery(), other.getQuery());
}
}

View File

@@ -47,20 +47,11 @@ public class ProxyType extends ProxyFilterButton {
return key;
}
/**
* Gets the key and name
*
* @return keyAndName
*/
public String getKeyAndName() {
return key + " (" + getName() + ")";
}
/**
* Sets the key
*
* @param key
* Entity key
* Entity key
*/
public void setKey(final String key) {
this.key = key;
@@ -121,7 +112,7 @@ public class ProxyType extends ProxyFilterButton {
* Sets the smTypeAssign
*
* @param smTypeAssign
* Software module type assign
* Software module type assign
*/
public void setSmTypeAssign(final SmTypeAssign smTypeAssign) {
this.smTypeAssign = smTypeAssign;
@@ -140,7 +131,7 @@ public class ProxyType extends ProxyFilterButton {
* Sets the selectedSmTypes
*
* @param selectedSmTypes
* Selected software module types
* Selected software module types
*/
public void setSelectedSmTypes(final Set<ProxyType> selectedSmTypes) {
this.selectedSmTypes = selectedSmTypes;
@@ -159,7 +150,7 @@ public class ProxyType extends ProxyFilterButton {
* Sets the maxAssignments
*
* @param maxAssignments
* Entity maxAssignments
* Entity maxAssignments
*/
public void setMaxAssignments(final int maxAssignments) {
this.maxAssignments = maxAssignments;

View File

@@ -30,9 +30,9 @@ public class ProxyTypeInfo extends ProxyIdentifiableEntity {
* Constructor
*
* @param id
* type name
* @param name
* type ID
* @param name
* type name
* @param key
* type key
*/
@@ -58,6 +58,15 @@ public class ProxyTypeInfo extends ProxyIdentifiableEntity {
this.key = key;
}
/**
* Gets the key and name
*
* @return keyAndName
*/
public String getKeyAndName() {
return key + " (" + getName() + ")";
}
@Override
public int hashCode() {
return Objects.hash(getId(), getName(), getKey());

View File

@@ -25,7 +25,6 @@ import org.eclipse.hawkbit.ui.common.layout.listener.EntityDraggingListener;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleNoBorder;
import org.eclipse.hawkbit.ui.management.targettable.TargetGridLayoutUiState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUITargetDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
@@ -170,7 +169,7 @@ public class DistributionSetFilterDropAreaSupport implements HeaderSupport {
currentDsFilterInfo.removeAllComponents();
currentDsFilterInfo.setSizeUndefined();
targetGridLayoutUiState.setFilterDsIdNameVersion(null);
targetGridLayoutUiState.setFilterDsInfo(null);
}
private static String sanitizeDsNameVersion(final String dsNameAndVersion) {
@@ -182,7 +181,7 @@ public class DistributionSetFilterDropAreaSupport implements HeaderSupport {
}
private void updateUiState(final ProxyDistributionSet ds) {
targetGridLayoutUiState.setFilterDsIdNameVersion(ds.getIdNameVersion());
targetGridLayoutUiState.setFilterDsInfo(ds.getInfo());
}
private void addDropStylingListener() {
@@ -204,11 +203,8 @@ public class DistributionSetFilterDropAreaSupport implements HeaderSupport {
@Override
public void restoreState() {
if (targetGridLayoutUiState.getFilterDsIdNameVersion() != null) {
final String dsNameVersion = HawkbitCommonUtil.getFormattedNameVersion(
targetGridLayoutUiState.getFilterDsIdNameVersion().getName(),
targetGridLayoutUiState.getFilterDsIdNameVersion().getVersion());
addDsFilterDropAreaTextField(dsNameVersion);
if (targetGridLayoutUiState.getFilterDsInfo() != null) {
addDsFilterDropAreaTextField(targetGridLayoutUiState.getFilterDsInfo().getNameVersion());
}
}

View File

@@ -16,6 +16,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.vaadin.data.provider.DataProvider;
import com.vaadin.data.provider.ListDataProvider;
import com.vaadin.icons.VaadinIcons;
import com.vaadin.server.ExternalResource;
import com.vaadin.server.Resource;
@@ -187,7 +188,7 @@ public final class SPUIComponentProvider {
}
/**
* Create generic combobox.
* Create generic combobox with backend data provider.
*
* @param id
* id of the combobox
@@ -209,6 +210,16 @@ public final class SPUIComponentProvider {
public static <T> ComboBox<T> getComboBox(final String id, final String caption, final String description,
final String placeholder, final boolean isEmptySelectionAllowed,
final ItemCaptionGenerator<T> itemCaptionGenerator, final DataProvider<T, String> dataProvider) {
final ComboBox<T> comboBox = getComboBox(id, caption, description, placeholder, isEmptySelectionAllowed,
itemCaptionGenerator);
comboBox.setDataProvider(dataProvider);
return comboBox;
}
private static <T> ComboBox<T> getComboBox(final String id, final String caption, final String description,
final String placeholder, final boolean isEmptySelectionAllowed,
final ItemCaptionGenerator<T> itemCaptionGenerator) {
final ComboBox<T> comboBox = new ComboBox<>();
comboBox.setId(id);
comboBox.setCaption(caption);
@@ -218,6 +229,35 @@ public final class SPUIComponentProvider {
comboBox.setEmptySelectionAllowed(isEmptySelectionAllowed);
comboBox.setItemCaptionGenerator(itemCaptionGenerator);
return comboBox;
}
/**
* Create generic combobox with list in-memory data provider.
*
* @param id
* id of the combobox
* @param caption
* caption of the combobox
* @param description
* description of the combobox
* @param placeholder
* placeholder of the combobox
* @param isEmptySelectionAllowed
* flag for empty selection enabled
* @param itemCaptionGenerator
* generator fot item captions
* @param dataProvider
* provides data/items
*
* @return generic ComboBox
*/
public static <T> ComboBox<T> getComboBox(final String id, final String caption, final String description,
final String placeholder, final boolean isEmptySelectionAllowed,
final ItemCaptionGenerator<T> itemCaptionGenerator, final ListDataProvider<T> dataProvider) {
final ComboBox<T> comboBox = getComboBox(id, caption, description, placeholder, isEmptySelectionAllowed,
itemCaptionGenerator);
comboBox.setDataProvider(dataProvider);
return comboBox;

View File

@@ -47,19 +47,19 @@ public class AutoAssignmentWindowController
* Constructor for AutoAssignmentWindowController
*
* @param i18n
* VaadinMessageSource
* VaadinMessageSource
* @param entityFactory
* EntityFactory
* EntityFactory
* @param eventBus
* UIEventBus
* UIEventBus
* @param uiNotification
* UINotification
* UINotification
* @param targetManagement
* TargetManagement
* TargetManagement
* @param targetFilterQueryManagement
* TargetFilterQueryManagement
* TargetFilterQueryManagement
* @param layout
* AutoAssignmentWindowLayout
* AutoAssignmentWindowLayout
*/
public AutoAssignmentWindowController(final VaadinMessageSource i18n, final UIEventBus eventBus,
final UINotification uiNotification, final EntityFactory entityFactory,
@@ -88,14 +88,14 @@ public class AutoAssignmentWindowController
autoAssignmentFilter.setId(proxyEntity.getId());
autoAssignmentFilter.setQuery(proxyEntity.getQuery());
if (proxyEntity.getAutoAssignDsIdNameVersion() != null) {
if (proxyEntity.getDistributionSetInfo() != null) {
autoAssignmentFilter.setAutoAssignmentEnabled(true);
autoAssignmentFilter.setAutoAssignActionType(proxyEntity.getAutoAssignActionType());
autoAssignmentFilter.setAutoAssignDsIdNameVersion(proxyEntity.getAutoAssignDsIdNameVersion());
autoAssignmentFilter.setDistributionSetInfo(proxyEntity.getDistributionSetInfo());
} else {
autoAssignmentFilter.setAutoAssignmentEnabled(false);
autoAssignmentFilter.setAutoAssignActionType(ActionType.FORCED);
autoAssignmentFilter.setAutoAssignDsIdNameVersion(null);
autoAssignmentFilter.setDistributionSetInfo(null);
}
return autoAssignmentFilter;
@@ -108,8 +108,8 @@ public class AutoAssignmentWindowController
@Override
protected void persistEntity(final ProxyTargetFilterQuery entity) {
if (entity.isAutoAssignmentEnabled() && entity.getAutoAssignDsIdNameVersion() != null) {
final Long autoAssignDsId = entity.getAutoAssignDsIdNameVersion().getId();
if (entity.isAutoAssignmentEnabled() && entity.getDistributionSetInfo() != null) {
final Long autoAssignDsId = entity.getDistributionSetInfo().getId();
final Long targetsForAutoAssignmentCount = targetManagement.countByRsqlAndNonDS(autoAssignDsId,
entity.getQuery());
@@ -155,7 +155,7 @@ public class AutoAssignmentWindowController
@Override
protected boolean isEntityValid(final ProxyTargetFilterQuery entity) {
if (entity.isAutoAssignmentEnabled()
&& (entity.getAutoAssignActionType() == null || entity.getAutoAssignDsIdNameVersion() == null)) {
&& (entity.getAutoAssignActionType() == null || entity.getDistributionSetInfo() == null)) {
uiNotification.displayValidationError(
i18n.getMessage(UIMessageIdProvider.MESSAGE_AUTOASSIGN_CREATE_ERROR_MISSINGELEMENTS));
return false;

View File

@@ -18,7 +18,6 @@ import org.eclipse.hawkbit.ui.common.builder.GridComponentBuilder;
import org.eclipse.hawkbit.ui.common.builder.StatusIconBuilder.ActionTypeIconSupplier;
import org.eclipse.hawkbit.ui.common.data.mappers.TargetFilterQueryToProxyTargetFilterMapper;
import org.eclipse.hawkbit.ui.common.data.providers.TargetFilterQueryDataProvider;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyIdNameVersion;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyIdentifiableEntity;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTargetFilterQuery;
import org.eclipse.hawkbit.ui.common.event.CommandTopics;
@@ -33,7 +32,6 @@ import org.eclipse.hawkbit.ui.common.grid.AbstractGrid;
import org.eclipse.hawkbit.ui.common.grid.support.DeleteSupport;
import org.eclipse.hawkbit.ui.common.grid.support.FilterSupport;
import org.eclipse.hawkbit.ui.filtermanagement.state.TargetFilterGridLayoutUiState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
@@ -185,6 +183,24 @@ public class TargetFilterGrid extends AbstractGrid<ProxyTargetFilterQuery, Strin
new ShowFormEventPayload<ProxyTargetFilterQuery>(FormType.EDIT, targetFilter, EventView.TARGET_FILTER));
}
private Button buildAutoAssignmentLink(final ProxyTargetFilterQuery targetFilter) {
final String caption;
if (targetFilter.isAutoAssignmentEnabled() && targetFilter.getDistributionSetInfo() != null) {
caption = targetFilter.getDistributionSetInfo().getNameVersion();
} else {
caption = i18n.getMessage(UIMessageIdProvider.BUTTON_NO_AUTO_ASSIGNMENT);
}
final Button link = GridComponentBuilder.buildLink(targetFilter, "distSetButton", caption,
permissionChecker.hasReadRepositoryPermission(),
clickEvent -> onClickOfAutoAssignmentLink(targetFilter));
final String description = i18n.getMessage(UIMessageIdProvider.BUTTON_AUTO_ASSIGNMENT_DESCRIPTION);
link.setDescription(description);
return link;
}
private void onClickOfAutoAssignmentLink(final ProxyTargetFilterQuery targetFilter) {
if (permissionChecker.hasReadRepositoryPermission()) {
final Window autoAssignmentWindow = autoAssignmentWindowBuilder.getWindowForAutoAssignment(targetFilter);
@@ -199,24 +215,4 @@ public class TargetFilterGrid extends AbstractGrid<ProxyTargetFilterQuery, Strin
i18n.getMessage("message.permission.insufficient", SpPermission.READ_REPOSITORY));
}
}
private Button buildAutoAssignmentLink(final ProxyTargetFilterQuery targetFilter) {
final String caption;
if (targetFilter.isAutoAssignmentEnabled()) {
final ProxyIdNameVersion autoAssignDsIdNameVersion = targetFilter.getAutoAssignDsIdNameVersion();
caption = HawkbitCommonUtil.getFormattedNameVersion(autoAssignDsIdNameVersion.getName(),
autoAssignDsIdNameVersion.getVersion());
} else {
caption = i18n.getMessage(UIMessageIdProvider.BUTTON_NO_AUTO_ASSIGNMENT);
}
final Button link = GridComponentBuilder.buildLink(targetFilter, "distSetButton", caption,
permissionChecker.hasReadRepositoryPermission(),
clickEvent -> onClickOfAutoAssignmentLink(targetFilter));
final String description = i18n.getMessage(UIMessageIdProvider.BUTTON_AUTO_ASSIGNMENT_DESCRIPTION);
link.setDescription(description);
return link;
}
}

View File

@@ -168,9 +168,9 @@ public class BulkUploadHandler implements SucceededListener, FailedListener, Rec
* Constructor for UploadAsync
*
* @param vaadinSession
* VaadinSession
* VaadinSession
* @param vaadinUI
* UI
* UI
*/
public UploadAsync(final VaadinSession vaadinSession, final UI vaadinUI) {
this.vaadinSession = vaadinSession;
@@ -296,7 +296,7 @@ public class BulkUploadHandler implements SucceededListener, FailedListener, Rec
private String saveAllAssignments() {
final ActionType actionType = ActionType.FORCED;
final long forcedTimeStamp = new Date().getTime();
final Long dsId = bulkUploadInputs.getDistributionSetId();
final Long dsId = bulkUploadInputs.getDistributionSetInfo().getId();
if (!distributionSetManagement.get(dsId).isPresent()) {
return i18n.getMessage("message.bulk.upload.assignment.failed");
@@ -342,7 +342,7 @@ public class BulkUploadHandler implements SucceededListener, FailedListener, Rec
}
private boolean isDsSelected() {
return bulkUploadInputs.getDistributionSetId() != null;
return bulkUploadInputs.getDistributionSetInfo() != null;
}
private boolean areTargetsCreatedSuccessfully() {

View File

@@ -156,7 +156,7 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
private ProxyBulkUploadWindow getBulkUploadInputsBean() {
final ProxyBulkUploadWindow bean = new ProxyBulkUploadWindow();
bean.setDistributionSetId(binder.getBean().getDistributionSetId());
bean.setDistributionSetInfo(binder.getBean().getDistributionSetInfo());
bean.setTagIdsWithNameToAssign(getTagIdsWithNameToAssign());
bean.setDescription(binder.getBean().getDescription());
@@ -269,7 +269,7 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
* Actions once start of upload
*/
public void onStartOfUpload() {
targetBulkUploadUiState.setDsId(binder.getBean().getDistributionSetId());
targetBulkUploadUiState.setDsInfo(binder.getBean().getDistributionSetInfo());
targetBulkUploadUiState.setTagIdsWithNameToAssign(getTagIdsWithNameToAssign());
targetBulkUploadUiState.setDescription(binder.getBean().getDescription());
@@ -377,7 +377,7 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
* Reset target bulk upload ui state
*/
public void clearUiState() {
targetBulkUploadUiState.setDsId(null);
targetBulkUploadUiState.setDsInfo(null);
targetBulkUploadUiState.getTagIdsWithNameToAssign().clear();
targetBulkUploadUiState.setDescription(null);
}
@@ -387,7 +387,7 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
*/
public void restoreComponentsValue() {
final ProxyBulkUploadWindow bulkUploadInputsToRestore = new ProxyBulkUploadWindow();
bulkUploadInputsToRestore.setDistributionSetId(targetBulkUploadUiState.getDsId());
bulkUploadInputsToRestore.setDistributionSetInfo(targetBulkUploadUiState.getDsInfo());
bulkUploadInputsToRestore.setDescription(targetBulkUploadUiState.getDescription());
bulkUploadInputsToRestore.setTagIdsWithNameToAssign(targetBulkUploadUiState.getTagIdsWithNameToAssign());

View File

@@ -12,6 +12,8 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyDistributionSetInfo;
/**
* Target bulk upload ui state
*/
@@ -20,7 +22,7 @@ public class TargetBulkUploadUiState implements Serializable {
private boolean isInProgress;
private Long dsId;
private ProxyDistributionSetInfo dsInfo;
private final Map<Long, String> tagIdsWithNameToAssign = new HashMap<>();
private String description;
@@ -35,27 +37,27 @@ public class TargetBulkUploadUiState implements Serializable {
* Sets the upload progress
*
* @param isInProgress
* boolean
* boolean
*/
public void setInProgress(final boolean isInProgress) {
this.isInProgress = isInProgress;
}
/**
* @return Distribution set id
* @return Distribution set info
*/
public Long getDsId() {
return dsId;
public ProxyDistributionSetInfo getDsInfo() {
return dsInfo;
}
/**
* Sets the distribution set id
* Sets the distribution set info
*
* @param dsId
* Id
* @param dsInfo
* Info of distribution set
*/
public void setDsId(final Long dsId) {
this.dsId = dsId;
public void setDsInfo(final ProxyDistributionSetInfo dsInfo) {
this.dsInfo = dsInfo;
}
/**
@@ -69,7 +71,7 @@ public class TargetBulkUploadUiState implements Serializable {
* Sets the Tag ids with name
*
* @param tagIdsWithNameToAssign
* Tag ids with name
* Tag ids with name
*/
public void setTagIdsWithNameToAssign(final Map<Long, String> tagIdsWithNameToAssign) {
this.tagIdsWithNameToAssign.clear();
@@ -87,7 +89,7 @@ public class TargetBulkUploadUiState implements Serializable {
* Sets the description of target bulk upload
*
* @param description
* Description
* Description
*/
public void setDescription(final String description) {
this.description = description;

View File

@@ -273,8 +273,7 @@ public class TargetGrid extends AbstractGrid<ProxyTarget, TargetManagementFilter
getFilterSupport().addMapping(FilterType.QUERY, TargetManagementFilterParams::setTargetFilterQueryId,
targetTagFilterLayoutUiState.getClickedTargetFilterQueryId());
getFilterSupport().addMapping(FilterType.DISTRIBUTION, TargetManagementFilterParams::setDistributionId,
targetGridLayoutUiState.getFilterDsIdNameVersion() != null
? targetGridLayoutUiState.getFilterDsIdNameVersion().getId()
targetGridLayoutUiState.getFilterDsInfo() != null ? targetGridLayoutUiState.getFilterDsInfo().getId()
: null);
}

View File

@@ -151,7 +151,7 @@ public class TargetGridHeader extends AbstractEntityGridHeader {
bulkUploadWindowBuilder.restoreState();
}
if (targetGridLayoutUiState.getFilterDsIdNameVersion() != null) {
if (targetGridLayoutUiState.getFilterDsInfo() != null) {
distributionSetFilterDropAreaSupport.restoreState();
}
}
@@ -198,7 +198,7 @@ public class TargetGridHeader extends AbstractEntityGridHeader {
* Perform tasks on bulk upload state
*
* @param eventPayload
* BulkUploadEventPayload
* BulkUploadEventPayload
*/
public void onBulkUploadChanged(final BulkUploadEventPayload eventPayload) {
bulkUploadWindowBuilder.getLayout()

View File

@@ -8,7 +8,7 @@
*/
package org.eclipse.hawkbit.ui.management.targettable;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyIdNameVersion;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyDistributionSetInfo;
import org.eclipse.hawkbit.ui.common.state.GridLayoutUiState;
/**
@@ -19,7 +19,7 @@ public class TargetGridLayoutUiState extends GridLayoutUiState {
private Long pinnedTargetId;
private String pinnedControllerId;
private ProxyIdNameVersion filterDsIdNameVersion;
private ProxyDistributionSetInfo filterDsInfo;
/**
* @return Pinned controller id
@@ -32,7 +32,7 @@ public class TargetGridLayoutUiState extends GridLayoutUiState {
* Sets the pinned controller id
*
* @param pinnedControllerId
* Id
* Id
*/
public void setPinnedControllerId(final String pinnedControllerId) {
this.pinnedControllerId = pinnedControllerId;
@@ -49,7 +49,7 @@ public class TargetGridLayoutUiState extends GridLayoutUiState {
* Sets the pinned target id
*
* @param pinnedTargetId
* Id
* Id
*/
public void setPinnedTargetId(final Long pinnedTargetId) {
this.pinnedTargetId = pinnedTargetId;
@@ -58,17 +58,17 @@ public class TargetGridLayoutUiState extends GridLayoutUiState {
/**
* @return filter distribution set id name and version
*/
public ProxyIdNameVersion getFilterDsIdNameVersion() {
return filterDsIdNameVersion;
public ProxyDistributionSetInfo getFilterDsInfo() {
return filterDsInfo;
}
/**
* Sets the filter distribution set id name and version
*
* @param filterDsIdNameVersion
* ProxyIdNameVersion
* @param dsInfo
* ProxyDistributionSetInfo
*/
public void setFilterDsIdNameVersion(final ProxyIdNameVersion filterDsIdNameVersion) {
this.filterDsIdNameVersion = filterDsIdNameVersion;
public void setFilterDsInfo(final ProxyDistributionSetInfo dsInfo) {
this.filterDsInfo = dsInfo;
}
}

View File

@@ -268,7 +268,7 @@ public class RolloutGrid extends AbstractGrid<ProxyRollout, String> {
GridComponentBuilder.addDescriptionColumn(this, i18n, DESC_ID).setHidable(true).setHidden(true);
GridComponentBuilder.addColumn(this, ProxyRollout::getDistributionSetNameVersion).setId(DIST_NAME_VERSION_ID)
GridComponentBuilder.addColumn(this, ProxyRollout::getDsNameVersion).setId(DIST_NAME_VERSION_ID)
.setCaption(i18n.getMessage("header.distributionset")).setHidable(true).setExpandRatio(2);
GridComponentBuilder

View File

@@ -20,6 +20,7 @@ import org.eclipse.hawkbit.ui.common.data.proxies.ProxyAdvancedRolloutGroup;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyRollout;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyRolloutWindow;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyRolloutWindow.GroupDefinitionMode;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTargetFilterQueryInfo;
import org.eclipse.hawkbit.ui.rollout.window.RolloutWindowDependencies;
import org.eclipse.hawkbit.ui.rollout.window.components.AutoStartOptionGroupLayout.AutoStartOption;
import org.eclipse.hawkbit.ui.rollout.window.layouts.AddRolloutWindowLayout;
@@ -87,7 +88,9 @@ public class CopyRolloutWindowController extends AddRolloutWindowController {
final Page<TargetFilterQuery> filterQueries = targetFilterQueryManagement.findByQuery(PageRequest.of(0, 1),
proxyRolloutWindow.getTargetFilterQuery());
if (filterQueries.getTotalElements() > 0) {
proxyRolloutWindow.setTargetFilterId(filterQueries.getContent().get(0).getId());
final TargetFilterQuery tfq = filterQueries.getContent().get(0);
proxyRolloutWindow
.setTargetFilterInfo(new ProxyTargetFilterQueryInfo(tfq.getId(), tfq.getName(), tfq.getQuery()));
}
}

View File

@@ -10,12 +10,13 @@ package org.eclipse.hawkbit.ui.tenantconfiguration;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
import org.eclipse.hawkbit.ui.common.data.mappers.TypeToProxyTypeMapper;
import org.eclipse.hawkbit.ui.common.data.mappers.TypeToTypeInfoMapper;
import org.eclipse.hawkbit.ui.common.data.providers.DistributionSetTypeDataProvider;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxySystemConfigWindow;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyType;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTypeInfo;
import org.eclipse.hawkbit.ui.tenantconfiguration.window.SystemConfigWindowDependencies;
import org.eclipse.hawkbit.ui.tenantconfiguration.window.SystemConfigWindowLayoutComponentBuilder;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
@@ -41,7 +42,7 @@ public class DefaultDistributionSetTypeLayout extends CustomComponent {
private final SpPermissionChecker permissionChecker;
private Long currentDefaultDistSetTypeId;
private ComboBox<ProxyType> dsSetTypeComboBox = new ComboBox<>();
private ComboBox<ProxyTypeInfo> dsSetTypeComboBox;
private final Binder<ProxySystemConfigWindow> binder;
private final transient SystemConfigWindowLayoutComponentBuilder builder;
private Label changeIcon;
@@ -52,8 +53,8 @@ public class DefaultDistributionSetTypeLayout extends CustomComponent {
this.i18n = i18n;
this.permissionChecker = permChecker;
this.binder = binder;
final DistributionSetTypeDataProvider<ProxyType> dataProvider = new DistributionSetTypeDataProvider<>(
dsTypeManagement, new TypeToProxyTypeMapper<>());
final DistributionSetTypeDataProvider<ProxyTypeInfo> dataProvider = new DistributionSetTypeDataProvider<>(
dsTypeManagement, new TypeToTypeInfoMapper<DistributionSetType>());
final SystemConfigWindowDependencies dependencies = new SystemConfigWindowDependencies(systemManagement, i18n,
permChecker, dsTypeManagement, dataProvider);
this.builder = new SystemConfigWindowLayoutComponentBuilder(dependencies);
@@ -105,7 +106,7 @@ public class DefaultDistributionSetTypeLayout extends CustomComponent {
}
private Long getCurrentDistributionSetTypeId() {
return binder.getBean().getDistributionSetTypeId();
return binder.getBean().getDsTypeInfo().getId();
}
/**
@@ -113,7 +114,7 @@ public class DefaultDistributionSetTypeLayout extends CustomComponent {
*
* @param event
*/
private void selectDistributionSetTypeValue(final HasValue.ValueChangeEvent<ProxyType> event) {
private void selectDistributionSetTypeValue(final HasValue.ValueChangeEvent<ProxyTypeInfo> event) {
changeIcon.setVisible(!event.getValue().getId().equals(currentDefaultDistSetTypeId));
}

View File

@@ -28,6 +28,7 @@ import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.TenantConfigurationValue;
import org.eclipse.hawkbit.security.SecurityTokenGenerator;
import org.eclipse.hawkbit.tenancy.configuration.DurationHelper;
@@ -35,6 +36,7 @@ import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.T
import org.eclipse.hawkbit.ui.AbstractHawkbitUI;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.common.data.mappers.TypeToTypeInfoMapper;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxySystemConfigWindow;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleNoBorder;
@@ -169,7 +171,8 @@ public class TenantConfigurationDashboardView extends CustomComponent implements
private ProxySystemConfigWindow populateAndGetSystemConfig() {
final ProxySystemConfigWindow configBean = new ProxySystemConfigWindow();
configBean.setDistributionSetTypeId(systemManagement.getTenantMetadata().getDefaultDsType().getId());
configBean.setDsTypeInfo(new TypeToTypeInfoMapper<DistributionSetType>()
.map(systemManagement.getTenantMetadata().getDefaultDsType()));
configBean.setRolloutApproval(readConfigOption(TenantConfigurationKey.ROLLOUT_APPROVAL_ENABLED));
configBean.setActionAutoclose(readConfigOption(TenantConfigurationKey.REPOSITORY_ACTIONS_AUTOCLOSE_ENABLED));
configBean.setMultiAssignments(readConfigOption(TenantConfigurationKey.MULTI_ASSIGNMENTS_ENABLED));
@@ -263,7 +266,7 @@ public class TenantConfigurationDashboardView extends CustomComponent implements
private void saveSystemConfigBean() {
final ProxySystemConfigWindow configWindowBean = binder.getBean();
systemManagement.updateTenantMetadata(configWindowBean.getDistributionSetTypeId());
systemManagement.updateTenantMetadata(configWindowBean.getDsTypeInfo().getId());
writeConfigOption(TenantConfigurationKey.ROLLOUT_APPROVAL_ENABLED, configWindowBean.isRolloutApproval());
writeConfigOption(TenantConfigurationKey.ACTION_CLEANUP_ENABLED, configWindowBean.isActionAutocleanup());
writeConfigOption(TenantConfigurationKey.AUTHENTICATION_MODE_TARGET_SECURITY_TOKEN_ENABLED,

View File

@@ -25,6 +25,7 @@ import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import com.vaadin.data.Binder;
import com.vaadin.data.ValidationResult;
import com.vaadin.data.provider.DataProvider;
import com.vaadin.data.validator.IntegerRangeValidator;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.HorizontalLayout;
@@ -77,14 +78,12 @@ public class ActionAutoCleanupConfigurationItem extends VerticalLayout {
container.setSpacing(false);
container.setMargin(false);
final HorizontalLayout row1 = newHorizontalLayout();
actionStatusCombobox = new ComboBox<>();
actionStatusCombobox.setDescription("label.combobox.action.status.options");
actionStatusCombobox.setId(UIComponentIdProvider.SYSTEM_CONFIGURATION_ACTION_CLEANUP_ACTION_TYPES);
actionStatusCombobox = SPUIComponentProvider.getComboBox(
UIComponentIdProvider.SYSTEM_CONFIGURATION_ACTION_CLEANUP_ACTION_TYPES, null, null, null, false,
ActionStatusOption::getName, DataProvider.ofCollection(ACTION_STATUS_OPTIONS));
actionStatusCombobox.removeStyleName(ValoTheme.COMBOBOX_SMALL);
actionStatusCombobox.addStyleName(ValoTheme.COMBOBOX_TINY);
actionStatusCombobox.setWidth(200.0F, Unit.PIXELS);
actionStatusCombobox.setEmptySelectionAllowed(false);
actionStatusCombobox.setItems(ACTION_STATUS_OPTIONS);
actionStatusCombobox.setItemCaptionGenerator(ActionStatusOption::getName);
binder.bind(actionStatusCombobox, ProxySystemConfigWindow::getActionCleanupStatus,
ProxySystemConfigWindow::setActionCleanupStatus);
actionExpiryInput = new TextFieldBuilder(TenantConfiguration.VALUE_MAX_SIZE).buildTextComponent();

View File

@@ -12,7 +12,7 @@ import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.data.providers.DistributionSetTypeDataProvider;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyType;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTypeInfo;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
/**
@@ -24,7 +24,7 @@ public class SystemConfigWindowDependencies {
private final VaadinMessageSource i18n;
private final SpPermissionChecker permissionChecker;
private final DistributionSetTypeManagement distributionSetTypeManagement;
private final DistributionSetTypeDataProvider<ProxyType> distributionSetTypeDataProvider;
private final DistributionSetTypeDataProvider<ProxyTypeInfo> distributionSetTypeDataProvider;
/**
* Constructor for VaadinMessageSource
@@ -43,7 +43,7 @@ public class SystemConfigWindowDependencies {
public SystemConfigWindowDependencies(final SystemManagement systemManagement, final VaadinMessageSource i18n,
final SpPermissionChecker permissionChecker,
final DistributionSetTypeManagement distributionSetTypeManagement,
final DistributionSetTypeDataProvider<ProxyType> distributionSetTypeDataProvider) {
final DistributionSetTypeDataProvider<ProxyTypeInfo> distributionSetTypeDataProvider) {
this.systemManagement = systemManagement;
this.i18n = i18n;
this.permissionChecker = permissionChecker;
@@ -82,7 +82,7 @@ public class SystemConfigWindowDependencies {
/**
* @return Distribution set type data provider
*/
public DistributionSetTypeDataProvider<ProxyType> getDistributionSetTypeDataProvider() {
public DistributionSetTypeDataProvider<ProxyTypeInfo> getDistributionSetTypeDataProvider() {
return distributionSetTypeDataProvider;
}
}

View File

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.ui.tenantconfiguration.window;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxySystemConfigWindow;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyType;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTypeInfo;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
@@ -42,32 +42,18 @@ public class SystemConfigWindowLayoutComponentBuilder {
*
* @return Distribution set type combo box
*/
public ComboBox<ProxyType> createDistributionSetTypeCombo(final Binder<ProxySystemConfigWindow> binder) {
final ComboBox<ProxyType> distributionSetType = SPUIComponentProvider.getComboBox(
public ComboBox<ProxyTypeInfo> createDistributionSetTypeCombo(final Binder<ProxySystemConfigWindow> binder) {
final ComboBox<ProxyTypeInfo> dsTypeCombo = SPUIComponentProvider.getComboBox(
UIComponentIdProvider.SYSTEM_CONFIGURATION_DEFAULTDIS_COMBOBOX, null,
dependencies.getI18n().getMessage("caption.type"), null, false, ProxyType::getKeyAndName,
dependencies.getI18n().getMessage("caption.type"), null, false, ProxyTypeInfo::getKeyAndName,
dependencies.getDistributionSetTypeDataProvider());
distributionSetType.removeStyleName(ValoTheme.COMBOBOX_SMALL);
distributionSetType.addStyleName(ValoTheme.COMBOBOX_TINY);
distributionSetType.setWidth(330.0F, Unit.PIXELS);
dsTypeCombo.removeStyleName(ValoTheme.COMBOBOX_SMALL);
dsTypeCombo.addStyleName(ValoTheme.COMBOBOX_TINY);
dsTypeCombo.setWidth(330.0F, Unit.PIXELS);
binder.forField(distributionSetType).withConverter(dstType -> {
if (dstType == null) {
return null;
}
binder.forField(dsTypeCombo).bind(ProxySystemConfigWindow::getDsTypeInfo,
ProxySystemConfigWindow::setDsTypeInfo);
return dstType.getId();
}, dstTypeId -> {
if (dstTypeId == null) {
return null;
}
final ProxyType dstType = new ProxyType();
dstType.setId(dstTypeId);
return dstType;
}).bind(ProxySystemConfigWindow::getDistributionSetTypeId, ProxySystemConfigWindow::setDistributionSetTypeId);
return distributionSetType;
return dsTypeCombo;
}
}