Feature target with target type in UI (#1178)
* Added the target type combo box to add or update Target in UI Signed-off-by: Anand kumar <anand.kumar@bosch-si.com> * Fixed NPE for empty target type Signed-off-by: Anand kumar <anand.kumar@bosch-si.com> * Added target type option to target bulk upload Signed-off-by: Anand kumar <anand.kumar@bosch-si.com> * Added Target type filter Signed-off-by: Anand kumar <anand.kumar@bosch-si.com> * Added Named entity mapper for target type UI Signed-off-by: Anand kumar <anand.kumar@bosch-si.com> * Fixed review comments Signed-off-by: Anand kumar <anand.kumar@bosch-si.com> * Fixed sonar issues for serialization Signed-off-by: Anand kumar <anand.kumar@bosch-si.com> * Fixed Review comments Signed-off-by: Anand kumar <anand.kumar@bosch-si.com> * Fixed Bulk upload target type combo box Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>
This commit is contained in:
@@ -56,7 +56,7 @@ public class SmWindowLayoutComponentBuilder {
|
||||
*/
|
||||
public ComboBox<ProxyTypeInfo> createSoftwareModuleTypeCombo(final Binder<ProxySoftwareModule> binder) {
|
||||
return FormComponentBuilder
|
||||
.createTypeCombo(binder, smTypeDataProvider, i18n, UIComponentIdProvider.SW_MODULE_TYPE).getComponent();
|
||||
.createTypeCombo(binder, smTypeDataProvider, i18n, UIComponentIdProvider.SW_MODULE_TYPE, true).getComponent();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.ui.common.builder;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.TargetType;
|
||||
import org.eclipse.hawkbit.repository.model.Type;
|
||||
import org.eclipse.hawkbit.ui.common.data.aware.ActionTypeAware;
|
||||
import org.eclipse.hawkbit.ui.common.data.aware.DescriptionAware;
|
||||
@@ -22,6 +23,7 @@ import org.eclipse.hawkbit.ui.common.data.aware.VersionAware;
|
||||
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.providers.TargetTypeDataProvider;
|
||||
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;
|
||||
@@ -326,15 +328,18 @@ public final class FormComponentBuilder {
|
||||
*/
|
||||
public static <T extends TypeInfoAware> BoundComponent<ComboBox<ProxyTypeInfo>> createTypeCombo(
|
||||
final Binder<T> binder, final AbstractProxyDataProvider<ProxyTypeInfo, ?, String> dataProvider,
|
||||
final VaadinMessageSource i18n, final String componentId) {
|
||||
final VaadinMessageSource i18n, final String componentId, final boolean isRequired) {
|
||||
final ComboBox<ProxyTypeInfo> typeCombo = SPUIComponentProvider.getComboBox(componentId,
|
||||
i18n.getMessage(CAPTION_TYPE), i18n.getMessage(CAPTION_TYPE), i18n.getMessage(CAPTION_TYPE), false,
|
||||
ProxyTypeInfo::getName, dataProvider);
|
||||
i18n.getMessage(CAPTION_TYPE), i18n.getMessage(CAPTION_TYPE), i18n.getMessage(CAPTION_TYPE), !isRequired,
|
||||
ProxyTypeInfo::getName, dataProvider.withConvertedFilter(filterString -> filterString.trim() + "%"));
|
||||
|
||||
final Binding<T, ProxyTypeInfo> binding = binder.forField(typeCombo)
|
||||
.asRequired(i18n.getMessage("message.error.typeRequired"))
|
||||
.bind(TypeInfoAware::getTypeInfo, TypeInfoAware::setTypeInfo);
|
||||
final BindingBuilder<T, ProxyTypeInfo> bindingBuilder = binder.forField(typeCombo);
|
||||
|
||||
if (isRequired){
|
||||
bindingBuilder.asRequired(i18n.getMessage("message.error.typeRequired"));
|
||||
}
|
||||
|
||||
final Binding<T, ProxyTypeInfo> binding = bindingBuilder.bind(TypeInfoAware::getTypeInfo, TypeInfoAware::setTypeInfo);
|
||||
return new BoundComponent<>(typeCombo, binding);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,9 @@ import java.util.TimeZone;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.PollStatus;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetType;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTarget;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTypeInfo;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
@@ -49,6 +51,10 @@ public class TargetToProxyTargetMapper extends AbstractNamedEntityToProxyNamedEn
|
||||
proxyTarget.setPollStatusToolTip(getPollStatusToolTip(target.getPollStatus()));
|
||||
proxyTarget.setSecurityToken(target.getSecurityToken());
|
||||
proxyTarget.setRequestAttributes(target.isRequestControllerAttributes());
|
||||
if (target.getTargetType() != null){
|
||||
TargetType type = target.getTargetType();
|
||||
proxyTarget.setTypeInfo(new ProxyTypeInfo(type.getId(), type.getName()));
|
||||
}
|
||||
|
||||
return proxyTarget;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) 2021 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.mappers;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.TargetType;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTypeInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* Use to map {@link NamedEntity} to {@link ProxyTypeInfo}
|
||||
*
|
||||
*/
|
||||
public class TargetTypeToTypeInfoMapper implements IdentifiableEntityToProxyIdentifiableEntityMapper<ProxyTypeInfo, TargetType> {
|
||||
|
||||
@Override
|
||||
public ProxyTypeInfo map(TargetType entity) {
|
||||
return new ProxyTypeInfo(entity.getId(), entity.getName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Copyright (c) 2021 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.providers;
|
||||
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.model.TargetType;
|
||||
import org.eclipse.hawkbit.ui.common.data.mappers.IdentifiableEntityToProxyIdentifiableEntityMapper;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyIdentifiableEntity;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Data provider for {@link TargetTypeManagement}, which dynamically loads a
|
||||
* batch of {@link TargetType} entities from backend and maps them to
|
||||
* corresponding output type.
|
||||
*
|
||||
* @param <T>
|
||||
* output type
|
||||
*/
|
||||
public class TargetTypeDataProvider<T extends ProxyIdentifiableEntity>
|
||||
extends AbstractProxyDataProvider<T, TargetType, String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final transient TargetTypeManagement targetTypeManagement;
|
||||
|
||||
public TargetTypeDataProvider(final TargetTypeManagement targetTypeManagement, IdentifiableEntityToProxyIdentifiableEntityMapper<T, TargetType> mapper) {
|
||||
super(mapper, Sort.by(Direction.ASC, "name"));
|
||||
this.targetTypeManagement = targetTypeManagement;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Page<TargetType> loadBackendEntities(PageRequest pageRequest, String filter) {
|
||||
if (!StringUtils.isEmpty(filter)){
|
||||
return targetTypeManagement.findByName(pageRequest, filter);
|
||||
}
|
||||
return targetTypeManagement.findAll(pageRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected long sizeInBackEnd(PageRequest pageRequest, String filter) {
|
||||
return loadBackendEntities(PageRequest.of(0, 1), filter).getTotalElements();
|
||||
}
|
||||
}
|
||||
@@ -13,16 +13,18 @@ import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.ui.common.data.aware.DescriptionAware;
|
||||
import org.eclipse.hawkbit.ui.common.data.aware.DsIdAware;
|
||||
import org.eclipse.hawkbit.ui.common.data.aware.TypeInfoAware;
|
||||
|
||||
/**
|
||||
* Proxy entity representing rollout popup window bean.
|
||||
*/
|
||||
public class ProxyBulkUploadWindow implements Serializable, DescriptionAware, DsIdAware {
|
||||
public class ProxyBulkUploadWindow implements Serializable, DescriptionAware, DsIdAware, TypeInfoAware {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private ProxyDistributionSetInfo dsInfo;
|
||||
private Map<Long, String> tagIdsWithNameToAssign;
|
||||
private String description;
|
||||
private ProxyTypeInfo typeInfo;
|
||||
|
||||
/**
|
||||
* Gets the distribution set info
|
||||
@@ -84,4 +86,14 @@ public class ProxyBulkUploadWindow implements Serializable, DescriptionAware, Ds
|
||||
public void setDescription(final String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTypeInfo(ProxyTypeInfo typeInfo) {
|
||||
this.typeInfo = typeInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProxyTypeInfo getTypeInfo() {
|
||||
return typeInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,11 +13,12 @@ import java.net.URI;
|
||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
import org.eclipse.hawkbit.ui.common.data.aware.TypeInfoAware;
|
||||
|
||||
/**
|
||||
* Proxy for {@link Target}.
|
||||
*/
|
||||
public class ProxyTarget extends ProxyNamedEntity {
|
||||
public class ProxyTarget extends ProxyNamedEntity implements TypeInfoAware {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -39,6 +40,8 @@ public class ProxyTarget extends ProxyNamedEntity {
|
||||
|
||||
private boolean isRequestAttributes;
|
||||
|
||||
private ProxyTypeInfo typeInfo;
|
||||
|
||||
/**
|
||||
* Gets the controllerId
|
||||
*
|
||||
@@ -206,4 +209,14 @@ public class ProxyTarget extends ProxyNamedEntity {
|
||||
public void setRequestAttributes(final boolean isRequestAttributes) {
|
||||
this.isRequestAttributes = isRequestAttributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTypeInfo(ProxyTypeInfo typeInfo) {
|
||||
this.typeInfo = typeInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProxyTypeInfo getTypeInfo() {
|
||||
return typeInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,19 @@ public class ProxyTypeInfo extends ProxyIdentifiableEntity {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param id
|
||||
* type ID
|
||||
* @param name
|
||||
* type name
|
||||
*/
|
||||
public ProxyTypeInfo(final Long id, final String name) {
|
||||
super(id);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class DsWindowLayoutComponentBuilder {
|
||||
*/
|
||||
public ComboBox<ProxyTypeInfo> createDistributionSetTypeCombo(final Binder<ProxyDistributionSet> binder) {
|
||||
return FormComponentBuilder
|
||||
.createTypeCombo(binder, dsTypeDataProvider, i18n, UIComponentIdProvider.DIST_ADD_DISTSETTYPE)
|
||||
.createTypeCombo(binder, dsTypeDataProvider, i18n, UIComponentIdProvider.DIST_ADD_DISTSETTYPE, true)
|
||||
.getComponent();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.eclipse.hawkbit.repository.SystemManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||
import org.eclipse.hawkbit.ui.AbstractHawkbitUI;
|
||||
@@ -92,7 +93,7 @@ public class DeploymentView extends AbstractEventListenersAwareView implements B
|
||||
final DistributionSetTypeManagement distributionSetTypeManagement,
|
||||
final DistributionSetInvalidationManagement dsInvalidationManagement,
|
||||
final TargetManagement targetManagement, final EntityFactory entityFactory, final UiProperties uiProperties,
|
||||
final TargetTagManagement targetTagManagement,
|
||||
final TargetTagManagement targetTagManagement, final TargetTypeManagement targetTypeManagement,
|
||||
final DistributionSetTagManagement distributionSetTagManagement,
|
||||
final TargetFilterQueryManagement targetFilterQueryManagement, final SystemManagement systemManagement,
|
||||
final TenantConfigurationManagement configManagement,
|
||||
@@ -109,7 +110,7 @@ public class DeploymentView extends AbstractEventListenersAwareView implements B
|
||||
targetFilterQueryManagement, targetTagManagement, targetManagement,
|
||||
managementUIState.getTargetTagFilterLayoutUiState());
|
||||
|
||||
this.targetGridLayout = new TargetGridLayout(uiDependencies, targetManagement, deploymentManagement,
|
||||
this.targetGridLayout = new TargetGridLayout(uiDependencies, targetManagement, targetTypeManagement, deploymentManagement,
|
||||
uiProperties, targetTagManagement, distributionSetManagement, uiExecutor, configManagement,
|
||||
targetManagementStateDataSupplier, systemSecurityContext,
|
||||
managementUIState.getTargetTagFilterLayoutUiState(), managementUIState.getTargetGridLayoutUiState(),
|
||||
|
||||
@@ -360,7 +360,8 @@ public class BulkUploadHandler implements SucceededListener, FailedListener, Rec
|
||||
private void addNewTarget(final String controllerId, final String name) {
|
||||
try {
|
||||
targetManagement.create(entityFactory.target().create().controllerId(controllerId).name(name)
|
||||
.description(bulkUploadInputs.getDescription()));
|
||||
.description(bulkUploadInputs.getDescription())
|
||||
.targetType(bulkUploadInputs.getTypeInfo() != null ? bulkUploadInputs.getTypeInfo().getId() : null));
|
||||
|
||||
provisionedControllerIds.add(controllerId);
|
||||
} catch (final EntityAlreadyExistsException ex) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement;
|
||||
import org.eclipse.hawkbit.ui.UiProperties;
|
||||
import org.eclipse.hawkbit.ui.common.CommonUiDependencies;
|
||||
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
|
||||
@@ -31,6 +32,7 @@ public class BulkUploadWindowBuilder {
|
||||
private final Executor uiExecutor;
|
||||
private final TargetManagement targetManagement;
|
||||
private final DeploymentManagement deploymentManagement;
|
||||
private final TargetTypeManagement targetTypeManagement;
|
||||
private final TargetTagManagement tagManagement;
|
||||
private final DistributionSetManagement distributionSetManagement;
|
||||
private final CommonUiDependencies uiDependencies;
|
||||
@@ -50,6 +52,8 @@ public class BulkUploadWindowBuilder {
|
||||
* Executor
|
||||
* @param targetManagement
|
||||
* TargetManagement
|
||||
* @param targetTypeManagement
|
||||
* TargetTypeManagement
|
||||
* @param deploymentManagement
|
||||
* DeploymentManagement
|
||||
* @param tagManagement
|
||||
@@ -61,13 +65,14 @@ public class BulkUploadWindowBuilder {
|
||||
*/
|
||||
public BulkUploadWindowBuilder(final CommonUiDependencies uiDependencies, final UiProperties uiproperties,
|
||||
final Executor uiExecutor, final TargetManagement targetManagement,
|
||||
final DeploymentManagement deploymentManagement, final TargetTagManagement tagManagement,
|
||||
final DeploymentManagement deploymentManagement, final TargetTypeManagement targetTypeManagement, final TargetTagManagement tagManagement,
|
||||
final DistributionSetManagement distributionSetManagement,
|
||||
final TargetBulkUploadUiState targetBulkUploadUiState) {
|
||||
this.uiDependencies = uiDependencies;
|
||||
this.uiproperties = uiproperties;
|
||||
this.uiExecutor = uiExecutor;
|
||||
this.targetManagement = targetManagement;
|
||||
this.targetTypeManagement = targetTypeManagement;
|
||||
this.deploymentManagement = deploymentManagement;
|
||||
this.tagManagement = tagManagement;
|
||||
this.distributionSetManagement = distributionSetManagement;
|
||||
@@ -80,7 +85,7 @@ public class BulkUploadWindowBuilder {
|
||||
public Window getWindowForTargetBulkUpload() {
|
||||
if (!targetBulkUploadUiState.isInProgress() || targetBulkUpdateWindowLayout == null) {
|
||||
targetBulkUpdateWindowLayout = new TargetBulkUpdateWindowLayout(uiDependencies, targetManagement,
|
||||
deploymentManagement, tagManagement, distributionSetManagement, uiproperties, uiExecutor,
|
||||
deploymentManagement, targetTypeManagement, tagManagement, distributionSetManagement, uiproperties, uiExecutor,
|
||||
targetBulkUploadUiState);
|
||||
targetBulkUpdateWindowLayout.clearUiState();
|
||||
}
|
||||
@@ -108,7 +113,7 @@ public class BulkUploadWindowBuilder {
|
||||
*/
|
||||
public void restoreState() {
|
||||
targetBulkUpdateWindowLayout = new TargetBulkUpdateWindowLayout(uiDependencies, targetManagement,
|
||||
deploymentManagement, tagManagement, distributionSetManagement, uiproperties, uiExecutor,
|
||||
deploymentManagement, targetTypeManagement, tagManagement, distributionSetManagement, uiproperties, uiExecutor,
|
||||
targetBulkUploadUiState);
|
||||
targetBulkUpdateWindowLayout.restoreComponentsValue();
|
||||
}
|
||||
|
||||
@@ -9,12 +9,16 @@
|
||||
package org.eclipse.hawkbit.ui.management.bulkupload;
|
||||
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement;
|
||||
import org.eclipse.hawkbit.ui.common.builder.BoundComponent;
|
||||
import org.eclipse.hawkbit.ui.common.builder.FormComponentBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.data.mappers.DistributionSetToProxyDistributionMapper;
|
||||
import org.eclipse.hawkbit.ui.common.data.mappers.TargetTypeToTypeInfoMapper;
|
||||
import org.eclipse.hawkbit.ui.common.data.providers.DistributionSetStatelessDataProvider;
|
||||
import org.eclipse.hawkbit.ui.common.data.providers.TargetTypeDataProvider;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyBulkUploadWindow;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyDistributionSet;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTypeInfo;
|
||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
|
||||
@@ -30,6 +34,8 @@ public final class BulkUploadWindowLayoutComponentBuilder {
|
||||
private final VaadinMessageSource i18n;
|
||||
private final DistributionSetStatelessDataProvider distributionSetDataProvider;
|
||||
|
||||
private final TargetTypeDataProvider<ProxyTypeInfo> targetTypeDataProvider;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -37,11 +43,17 @@ public final class BulkUploadWindowLayoutComponentBuilder {
|
||||
* i18n
|
||||
* @param distributionSetManagement
|
||||
* to build DistributionSet ComboBox
|
||||
* @param targetTypeManagement
|
||||
* TargetTypeManagement
|
||||
*/
|
||||
public BulkUploadWindowLayoutComponentBuilder(final VaadinMessageSource i18n,
|
||||
final DistributionSetManagement distributionSetManagement) {
|
||||
final DistributionSetManagement distributionSetManagement,
|
||||
final TargetTypeManagement targetTypeManagement) {
|
||||
this.i18n = i18n;
|
||||
|
||||
this.targetTypeDataProvider = new TargetTypeDataProvider<>(
|
||||
targetTypeManagement, new TargetTypeToTypeInfoMapper());
|
||||
|
||||
this.distributionSetDataProvider = new DistributionSetStatelessDataProvider(distributionSetManagement,
|
||||
new DistributionSetToProxyDistributionMapper());
|
||||
}
|
||||
@@ -66,6 +78,21 @@ public final class BulkUploadWindowLayoutComponentBuilder {
|
||||
return comboBox;
|
||||
}
|
||||
|
||||
/**
|
||||
* create optional Target Type ComboBox
|
||||
*
|
||||
* @param binder
|
||||
* binder the input will be bound to
|
||||
* @return ComboBox
|
||||
*/
|
||||
public ComboBox<ProxyTypeInfo> createTargetTypeCombo(final Binder<ProxyBulkUploadWindow> binder) {
|
||||
final BoundComponent<ComboBox<ProxyTypeInfo>> boundComboBox = FormComponentBuilder
|
||||
.createTypeCombo(binder, targetTypeDataProvider, i18n, UIComponentIdProvider.TARGET_ADD_TARGETTYPE, false);
|
||||
final ComboBox<ProxyTypeInfo> comboBox = boundComboBox.getComponent();
|
||||
comboBox.setSizeFull();
|
||||
return comboBox;
|
||||
}
|
||||
|
||||
/**
|
||||
* create description field
|
||||
*
|
||||
|
||||
@@ -16,12 +16,14 @@ import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement;
|
||||
import org.eclipse.hawkbit.ui.UiProperties;
|
||||
import org.eclipse.hawkbit.ui.common.CommonUiDependencies;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyBulkUploadWindow;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyDistributionSet;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTag;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTarget;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTypeInfo;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleNoBorder;
|
||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||
@@ -59,6 +61,8 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
|
||||
private final TargetBulkUploadUiState targetBulkUploadUiState;
|
||||
|
||||
private final ComboBox<ProxyDistributionSet> dsCombo;
|
||||
private final ComboBox<ProxyTypeInfo> targetTypeCombo;
|
||||
|
||||
private final transient TargetBulkTokenTags tagsComponent;
|
||||
private final TextArea descTextArea;
|
||||
private final ProgressBar progressBar;
|
||||
@@ -83,6 +87,8 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
|
||||
* DeploymentManagement
|
||||
* @param tagManagement
|
||||
* TargetTagManagement
|
||||
* @param targetTypeManagement
|
||||
* TargetTypeManagement
|
||||
* @param distributionSetManagement
|
||||
* DistributionSetManagement
|
||||
* @param uiproperties
|
||||
@@ -93,19 +99,19 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
|
||||
* TargetBulkUploadUiState
|
||||
*/
|
||||
public TargetBulkUpdateWindowLayout(final CommonUiDependencies uiDependencies, final TargetManagement targetManagement,
|
||||
final DeploymentManagement deploymentManagement, final TargetTagManagement tagManagement,
|
||||
final DistributionSetManagement distributionSetManagement, final UiProperties uiproperties,
|
||||
final Executor uiExecutor, final TargetBulkUploadUiState targetBulkUploadUiState) {
|
||||
final DeploymentManagement deploymentManagement, final TargetTypeManagement targetTypeManagement, final TargetTagManagement tagManagement,
|
||||
final DistributionSetManagement distributionSetManagement, final UiProperties uiproperties,
|
||||
final Executor uiExecutor, final TargetBulkUploadUiState targetBulkUploadUiState) {
|
||||
this.i18n = uiDependencies.getI18n();
|
||||
this.uinotification = uiDependencies.getUiNotification();
|
||||
this.targetBulkUploadUiState = targetBulkUploadUiState;
|
||||
this.binder = new Binder<>();
|
||||
|
||||
final BulkUploadWindowLayoutComponentBuilder componentBuilder = new BulkUploadWindowLayoutComponentBuilder(i18n,
|
||||
distributionSetManagement);
|
||||
distributionSetManagement, targetTypeManagement);
|
||||
|
||||
this.dsCombo = componentBuilder.createDistributionSetCombo(binder);
|
||||
|
||||
this.targetTypeCombo = componentBuilder.createTargetTypeCombo(binder);
|
||||
this.tagsComponent = new TargetBulkTokenTags(uiDependencies, tagManagement);
|
||||
|
||||
this.descTextArea = componentBuilder.createDescriptionField(binder);
|
||||
@@ -144,6 +150,7 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
|
||||
private ProxyBulkUploadWindow getBulkUploadInputsBean() {
|
||||
final ProxyBulkUploadWindow bean = new ProxyBulkUploadWindow();
|
||||
bean.setDistributionSetInfo(binder.getBean().getDistributionSetInfo());
|
||||
bean.setTypeInfo(binder.getBean().getTypeInfo());
|
||||
bean.setTagIdsWithNameToAssign(getTagIdsWithNameToAssign());
|
||||
bean.setDescription(binder.getBean().getDescription());
|
||||
|
||||
@@ -240,7 +247,7 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
|
||||
inputsLayout.setSpacing(true);
|
||||
inputsLayout.setWidth("400px");
|
||||
|
||||
inputsLayout.addComponents(dsCombo, tagsLayout, descTextArea, progressBar, targetsCountLabel, uploaderLayout);
|
||||
inputsLayout.addComponents(dsCombo, targetTypeCombo, tagsLayout, descTextArea, progressBar, targetsCountLabel, uploaderLayout);
|
||||
|
||||
final VerticalLayout mainLayout = new VerticalLayout();
|
||||
mainLayout.setMargin(false);
|
||||
@@ -257,6 +264,7 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
|
||||
*/
|
||||
public void onStartOfUpload() {
|
||||
targetBulkUploadUiState.setDsInfo(binder.getBean().getDistributionSetInfo());
|
||||
targetBulkUploadUiState.setTypeInfo(binder.getBean().getTypeInfo());
|
||||
targetBulkUploadUiState.setTagIdsWithNameToAssign(getTagIdsWithNameToAssign());
|
||||
targetBulkUploadUiState.setDescription(binder.getBean().getDescription());
|
||||
|
||||
@@ -351,6 +359,7 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
|
||||
|
||||
private void changeInputsState(final boolean enabled) {
|
||||
dsCombo.setEnabled(enabled);
|
||||
targetTypeCombo.setEnabled(enabled);
|
||||
tagsComponent.getTagPanel().setEnabled(enabled);
|
||||
descTextArea.setEnabled(enabled);
|
||||
uploadButton.setEnabled(enabled);
|
||||
@@ -365,6 +374,7 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
|
||||
*/
|
||||
public void clearUiState() {
|
||||
targetBulkUploadUiState.setDsInfo(null);
|
||||
targetBulkUploadUiState.setTypeInfo(null);
|
||||
targetBulkUploadUiState.getTagIdsWithNameToAssign().clear();
|
||||
targetBulkUploadUiState.setDescription(null);
|
||||
}
|
||||
@@ -375,6 +385,7 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
|
||||
public void restoreComponentsValue() {
|
||||
final ProxyBulkUploadWindow bulkUploadInputsToRestore = new ProxyBulkUploadWindow();
|
||||
bulkUploadInputsToRestore.setDistributionSetInfo(targetBulkUploadUiState.getDsInfo());
|
||||
bulkUploadInputsToRestore.setTypeInfo(targetBulkUploadUiState.getTypeInfo());
|
||||
bulkUploadInputsToRestore.setDescription(targetBulkUploadUiState.getDescription());
|
||||
bulkUploadInputsToRestore.setTagIdsWithNameToAssign(targetBulkUploadUiState.getTagIdsWithNameToAssign());
|
||||
|
||||
|
||||
@@ -8,13 +8,14 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.management.bulkupload;
|
||||
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyDistributionSetInfo;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTypeInfo;
|
||||
import org.eclipse.hawkbit.ui.common.event.BulkUploadEventPayload;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyDistributionSetInfo;
|
||||
import org.eclipse.hawkbit.ui.common.event.BulkUploadEventPayload;
|
||||
|
||||
/**
|
||||
* Target bulk upload ui state
|
||||
*/
|
||||
@@ -26,6 +27,7 @@ public class TargetBulkUploadUiState implements Serializable {
|
||||
private ProxyDistributionSetInfo dsInfo;
|
||||
private final Map<Long, String> tagIdsWithNameToAssign = new HashMap<>();
|
||||
private String description;
|
||||
private ProxyTypeInfo proxyTypeInfo;
|
||||
|
||||
/**
|
||||
* @return true whe upload in progress else false
|
||||
@@ -96,6 +98,14 @@ public class TargetBulkUploadUiState implements Serializable {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setTypeInfo(ProxyTypeInfo typeInfo) {
|
||||
this.proxyTypeInfo = typeInfo;
|
||||
}
|
||||
|
||||
public ProxyTypeInfo getTypeInfo() {
|
||||
return proxyTypeInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates state on bulk upload events
|
||||
*
|
||||
|
||||
@@ -75,7 +75,8 @@ public class AddTargetWindowController
|
||||
@Override
|
||||
protected Target persistEntityInRepository(final ProxyTarget entity) {
|
||||
return targetManagement.create(getEntityFactory().target().create().controllerId(entity.getControllerId())
|
||||
.name(entity.getName()).description(entity.getDescription()));
|
||||
.name(entity.getName()).description(entity.getDescription())
|
||||
.targetType(entity.getTypeInfo() != null ? entity.getTypeInfo().getId() : null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -103,6 +103,8 @@ public class TargetDetails extends AbstractGridDetailsLayout<ProxyTarget> {
|
||||
return Arrays.asList(
|
||||
new ProxyKeyValueDetails(UIComponentIdProvider.TARGET_CONTROLLER_ID, i18n.getMessage("label.target.id"),
|
||||
entity.getControllerId()),
|
||||
new ProxyKeyValueDetails(UIComponentIdProvider.TARGET_TYPE_ID, i18n.getMessage("label.target.type"),
|
||||
entity.getTypeInfo() != null ? entity.getTypeInfo().getName() : ""),
|
||||
new ProxyKeyValueDetails(UIComponentIdProvider.TARGET_LAST_QUERY_DT,
|
||||
i18n.getMessage("label.target.lastpolldate"),
|
||||
SPDateTimeUtil.getFormattedDate(entity.getLastTargetQuery())),
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||
import org.eclipse.hawkbit.ui.UiProperties;
|
||||
@@ -78,6 +79,8 @@ public class TargetGridLayout extends AbstractGridComponentLayout {
|
||||
* {@link CommonUiDependencies}
|
||||
* @param targetManagement
|
||||
* TargetManagement
|
||||
* @param targetTypeManagement
|
||||
* TargetTypeManagement
|
||||
* @param deploymentManagement
|
||||
* DeploymentManagement
|
||||
* @param uiProperties
|
||||
@@ -104,21 +107,22 @@ public class TargetGridLayout extends AbstractGridComponentLayout {
|
||||
* DistributionGridLayoutUiState
|
||||
*/
|
||||
public TargetGridLayout(final CommonUiDependencies uiDependencies, final TargetManagement targetManagement,
|
||||
final DeploymentManagement deploymentManagement, final UiProperties uiProperties,
|
||||
final TargetTagManagement targetTagManagement, final DistributionSetManagement distributionSetManagement,
|
||||
final Executor uiExecutor, final TenantConfigurationManagement configManagement,
|
||||
final TargetManagementStateDataSupplier targetManagementStateDataSupplier,
|
||||
final SystemSecurityContext systemSecurityContext,
|
||||
final TargetTagFilterLayoutUiState targetTagFilterLayoutUiState,
|
||||
final TargetGridLayoutUiState targetGridLayoutUiState,
|
||||
final TargetBulkUploadUiState targetBulkUploadUiState,
|
||||
final DistributionGridLayoutUiState distributionGridLayoutUiState) {
|
||||
final TargetWindowBuilder targetWindowBuilder = new TargetWindowBuilder(uiDependencies, targetManagement,
|
||||
final TargetTypeManagement targetTypeManagement,
|
||||
final DeploymentManagement deploymentManagement, final UiProperties uiProperties,
|
||||
final TargetTagManagement targetTagManagement, final DistributionSetManagement distributionSetManagement,
|
||||
final Executor uiExecutor, final TenantConfigurationManagement configManagement,
|
||||
final TargetManagementStateDataSupplier targetManagementStateDataSupplier,
|
||||
final SystemSecurityContext systemSecurityContext,
|
||||
final TargetTagFilterLayoutUiState targetTagFilterLayoutUiState,
|
||||
final TargetGridLayoutUiState targetGridLayoutUiState,
|
||||
final TargetBulkUploadUiState targetBulkUploadUiState,
|
||||
final DistributionGridLayoutUiState distributionGridLayoutUiState) {
|
||||
final TargetWindowBuilder targetWindowBuilder = new TargetWindowBuilder(uiDependencies, targetManagement, targetTypeManagement,
|
||||
EventView.DEPLOYMENT);
|
||||
final TargetMetaDataWindowBuilder targetMetaDataWindowBuilder = new TargetMetaDataWindowBuilder(uiDependencies,
|
||||
targetManagement);
|
||||
final BulkUploadWindowBuilder bulkUploadWindowBuilder = new BulkUploadWindowBuilder(uiDependencies,
|
||||
uiProperties, uiExecutor, targetManagement, deploymentManagement, targetTagManagement,
|
||||
uiProperties, uiExecutor, targetManagement, deploymentManagement, targetTypeManagement, targetTagManagement,
|
||||
distributionSetManagement, targetBulkUploadUiState);
|
||||
|
||||
this.targetGridHeader = new TargetGridHeader(uiDependencies, targetWindowBuilder, bulkUploadWindowBuilder,
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
package org.eclipse.hawkbit.ui.management.targettable;
|
||||
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement;
|
||||
import org.eclipse.hawkbit.ui.common.AbstractEntityWindowBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.CommonUiDependencies;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTarget;
|
||||
@@ -24,6 +25,8 @@ public class TargetWindowBuilder extends AbstractEntityWindowBuilder<ProxyTarget
|
||||
|
||||
private final TargetManagement targetManagement;
|
||||
|
||||
private final TargetTypeManagement targetTypeManagement;
|
||||
|
||||
private final EventView view;
|
||||
|
||||
/**
|
||||
@@ -33,15 +36,17 @@ public class TargetWindowBuilder extends AbstractEntityWindowBuilder<ProxyTarget
|
||||
* {@link CommonUiDependencies}
|
||||
* @param targetManagement
|
||||
* TargetManagement
|
||||
* @param targetTypeManagement
|
||||
* TargetTypeManagement
|
||||
* @param view
|
||||
* EventView
|
||||
*/
|
||||
public TargetWindowBuilder(final CommonUiDependencies uiDependencies, final TargetManagement targetManagement,
|
||||
final EventView view) {
|
||||
final TargetTypeManagement targetTypeManagement, final EventView view) {
|
||||
super(uiDependencies);
|
||||
|
||||
this.targetManagement = targetManagement;
|
||||
|
||||
this.targetTypeManagement = targetTypeManagement;
|
||||
this.view = view;
|
||||
}
|
||||
|
||||
@@ -53,13 +58,13 @@ public class TargetWindowBuilder extends AbstractEntityWindowBuilder<ProxyTarget
|
||||
@Override
|
||||
public Window getWindowForAdd() {
|
||||
return getWindowForNewEntity(
|
||||
new AddTargetWindowController(uiDependencies, targetManagement, new TargetWindowLayout(getI18n()), view));
|
||||
new AddTargetWindowController(uiDependencies, targetManagement, new TargetWindowLayout(getI18n(), targetTypeManagement), view));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Window getWindowForUpdate(final ProxyTarget proxyTarget) {
|
||||
return getWindowForEntity(proxyTarget,
|
||||
new UpdateTargetWindowController(uiDependencies, targetManagement, new TargetWindowLayout(getI18n())));
|
||||
new UpdateTargetWindowController(uiDependencies, targetManagement, new TargetWindowLayout(getI18n(), targetTypeManagement)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,15 +8,19 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.management.targettable;
|
||||
|
||||
import org.eclipse.hawkbit.ui.common.AbstractEntityWindowLayout;
|
||||
import org.eclipse.hawkbit.ui.common.builder.BoundComponent;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTarget;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
|
||||
import com.vaadin.ui.ComboBox;
|
||||
import com.vaadin.ui.ComponentContainer;
|
||||
import com.vaadin.ui.FormLayout;
|
||||
import com.vaadin.ui.TextArea;
|
||||
import com.vaadin.ui.TextField;
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement;
|
||||
import org.eclipse.hawkbit.ui.common.AbstractEntityWindowLayout;
|
||||
import org.eclipse.hawkbit.ui.common.builder.BoundComponent;
|
||||
import org.eclipse.hawkbit.ui.common.data.mappers.TargetTypeToTypeInfoMapper;
|
||||
import org.eclipse.hawkbit.ui.common.data.providers.TargetTypeDataProvider;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTarget;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTypeInfo;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
|
||||
/**
|
||||
* Target add/update window layout.
|
||||
@@ -27,6 +31,7 @@ public class TargetWindowLayout extends AbstractEntityWindowLayout<ProxyTarget>
|
||||
private final TextField targetControllerId;
|
||||
private final BoundComponent<TextField> targetName;
|
||||
private final TextArea targetDescription;
|
||||
private final BoundComponent<ComboBox<ProxyTypeInfo>> targetTypeCombo;
|
||||
|
||||
/**
|
||||
* Constructor for AbstractTagWindowLayout
|
||||
@@ -34,13 +39,17 @@ public class TargetWindowLayout extends AbstractEntityWindowLayout<ProxyTarget>
|
||||
* @param i18n
|
||||
* I18N
|
||||
*/
|
||||
public TargetWindowLayout(final VaadinMessageSource i18n) {
|
||||
public TargetWindowLayout(final VaadinMessageSource i18n, final TargetTypeManagement targetTypeManagement) {
|
||||
super();
|
||||
this.targetComponentBuilder = new TargetWindowLayoutComponentBuilder(i18n);
|
||||
|
||||
this.targetControllerId = targetComponentBuilder.createControllerIdField(binder);
|
||||
this.targetName = targetComponentBuilder.createNameField(binder);
|
||||
this.targetDescription = targetComponentBuilder.createDescriptionField(binder);
|
||||
|
||||
TargetTypeDataProvider<ProxyTypeInfo> targetTypeDataProvider = new TargetTypeDataProvider<>(
|
||||
targetTypeManagement, new TargetTypeToTypeInfoMapper());
|
||||
this.targetTypeCombo = targetComponentBuilder.createTargetTypeCombo(binder, targetTypeDataProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,6 +63,7 @@ public class TargetWindowLayout extends AbstractEntityWindowLayout<ProxyTarget>
|
||||
targetWindowLayout.addComponent(targetControllerId);
|
||||
targetControllerId.focus();
|
||||
targetWindowLayout.addComponent(targetName.getComponent());
|
||||
targetWindowLayout.addComponent(targetTypeCombo.getComponent());
|
||||
targetWindowLayout.addComponent(targetDescription);
|
||||
return targetWindowLayout;
|
||||
}
|
||||
@@ -77,4 +87,5 @@ public class TargetWindowLayout extends AbstractEntityWindowLayout<ProxyTarget>
|
||||
public void setNameRequired(boolean isNameRequired) {
|
||||
targetName.setRequired(isNameRequired);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,19 +8,21 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.management.targettable;
|
||||
|
||||
import com.vaadin.data.Binder;
|
||||
import com.vaadin.data.validator.RegexpValidator;
|
||||
import com.vaadin.ui.ComboBox;
|
||||
import com.vaadin.ui.TextArea;
|
||||
import com.vaadin.ui.TextField;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.ui.common.builder.BoundComponent;
|
||||
import org.eclipse.hawkbit.ui.common.builder.FormComponentBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.data.providers.TargetTypeDataProvider;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTarget;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTypeInfo;
|
||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
|
||||
import com.vaadin.data.Binder;
|
||||
import com.vaadin.data.validator.RegexpValidator;
|
||||
import com.vaadin.ui.TextArea;
|
||||
import com.vaadin.ui.TextField;
|
||||
|
||||
/**
|
||||
* Builder for target window layout component
|
||||
*/
|
||||
@@ -84,4 +86,18 @@ public class TargetWindowLayoutComponentBuilder {
|
||||
.getComponent();
|
||||
}
|
||||
|
||||
/**
|
||||
* create target type combo
|
||||
*
|
||||
* @param binder
|
||||
* binder the input will be bound to
|
||||
* @param targetTypeDataProvider
|
||||
* TargetTypeDataProvider
|
||||
* @return input component
|
||||
*/
|
||||
public BoundComponent<ComboBox<ProxyTypeInfo>> createTargetTypeCombo(final Binder<ProxyTarget> binder, TargetTypeDataProvider<ProxyTypeInfo> targetTypeDataProvider) {
|
||||
return FormComponentBuilder
|
||||
.createTypeCombo(binder, targetTypeDataProvider, i18n, UIComponentIdProvider.TARGET_ADD_TARGETTYPE, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ public class UpdateTargetWindowController
|
||||
target.setControllerId(proxyEntity.getControllerId());
|
||||
target.setName(proxyEntity.getName());
|
||||
target.setDescription(proxyEntity.getDescription());
|
||||
target.setTypeInfo(proxyEntity.getTypeInfo());
|
||||
|
||||
controllerIdBeforeEdit = proxyEntity.getControllerId();
|
||||
|
||||
@@ -76,9 +77,17 @@ public class UpdateTargetWindowController
|
||||
@Override
|
||||
protected Target persistEntityInRepository(final ProxyTarget entity) {
|
||||
final TargetUpdate targetUpdate = getEntityFactory().target().update(entity.getControllerId())
|
||||
.name(entity.getName()).description(entity.getDescription());
|
||||
.name(entity.getName()).description(entity.getDescription())
|
||||
.targetType(entity.getTypeInfo() != null ? entity.getTypeInfo().getId() : null);
|
||||
|
||||
return targetManagement.update(targetUpdate);
|
||||
Target updatedTarget = targetManagement.update(targetUpdate);
|
||||
|
||||
// Un-assigning target type needs another DB request to update the target type value to Null
|
||||
if (entity.getTypeInfo() == null){
|
||||
return targetManagement.unAssignType(entity.getControllerId());
|
||||
}
|
||||
|
||||
return updatedTarget;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -330,6 +330,11 @@ public final class UIComponentIdProvider {
|
||||
*/
|
||||
public static final String TARGET_TABLE_POLLING_STATUS_LABEL_ID = "target.table.poll.statusId";
|
||||
|
||||
/**
|
||||
* ID-Target.targetType.
|
||||
*/
|
||||
public static final String TARGET_ADD_TARGETTYPE = "target.add.targettype";
|
||||
|
||||
/**
|
||||
* Action history table active-state label Id.
|
||||
*/
|
||||
@@ -719,6 +724,11 @@ public final class UIComponentIdProvider {
|
||||
*/
|
||||
public static final String TARGET_CONTROLLER_ID = "target.controller.id";
|
||||
|
||||
/**
|
||||
* Id of target type Id label in target details.
|
||||
*/
|
||||
public static final String TARGET_TYPE_ID = "target.type.id";
|
||||
|
||||
/**
|
||||
* Id of created at label in details.
|
||||
*/
|
||||
|
||||
@@ -224,6 +224,7 @@ label.filter.custom = Custom
|
||||
label.target.filter.truncated={0} targets has been truncated in the list due the target size limit of {1}, use filters to reduce the targets to be shown
|
||||
label.unknown = Unknown
|
||||
label.target.id = Controller Id
|
||||
label.target.type = Target type
|
||||
label.target.ip = Controller IP
|
||||
label.target.security.token = Security token
|
||||
label.filter.by.status = Filter by Status
|
||||
|
||||
Reference in New Issue
Block a user