Optional support for autoclose of deprecated actions (#585)
* Introduce action autoclose into repository. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Extended test. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fix typo. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Added checkbox to management ui. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fix Ui allignment. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fix item ID. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fix sonar issues. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * readibility. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -12,10 +12,10 @@ import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.security.SecurityTokenGenerator;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.AnonymousDownloadAuthenticationConfigurationItem;
|
||||
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.AuthenticationConfigurationItem;
|
||||
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.CertificateAuthenticationConfigurationItem;
|
||||
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.GatewaySecurityTokenAuthenticationConfigurationItem;
|
||||
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.TargetSecurityTokenAuthenticationConfigurationItem;
|
||||
import org.eclipse.hawkbit.ui.tenantconfiguration.generic.BooleanConfigurationItem;
|
||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.vaadin.ui.VerticalLayout;
|
||||
* View to configure the authentication mode.
|
||||
*/
|
||||
public class AuthenticationConfigurationView extends BaseConfigurationView
|
||||
implements ConfigurationGroup, ConfigurationItem.ConfigurationItemChangeListener, ValueChangeListener {
|
||||
implements ConfigurationItem.ConfigurationItemChangeListener, ValueChangeListener {
|
||||
|
||||
private static final String DIST_CHECKBOX_STYLE = "dist-checkbox-style";
|
||||
|
||||
@@ -55,7 +55,8 @@ public class AuthenticationConfigurationView extends BaseConfigurationView
|
||||
|
||||
private CheckBox downloadAnonymousCheckBox;
|
||||
|
||||
AuthenticationConfigurationView(final VaadinMessageSource i18n, final TenantConfigurationManagement tenantConfigurationManagement,
|
||||
AuthenticationConfigurationView(final VaadinMessageSource i18n,
|
||||
final TenantConfigurationManagement tenantConfigurationManagement,
|
||||
final SecurityTokenGenerator securityTokenGenerator) {
|
||||
this.i18n = i18n;
|
||||
this.certificateAuthenticationConfigurationItem = new CertificateAuthenticationConfigurationItem(
|
||||
@@ -161,7 +162,7 @@ public class AuthenticationConfigurationView extends BaseConfigurationView
|
||||
notifyConfigurationChanged();
|
||||
|
||||
final CheckBox checkBox = (CheckBox) event.getProperty();
|
||||
AuthenticationConfigurationItem configurationItem;
|
||||
BooleanConfigurationItem configurationItem;
|
||||
|
||||
if (gatewaySecTokenCheckBox.equals(checkBox)) {
|
||||
configurationItem = gatewaySecurityTokenAuthenticationConfigurationItem;
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.tenantconfiguration;
|
||||
|
||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.tenantconfiguration.generic.BooleanConfigurationItem;
|
||||
import org.eclipse.hawkbit.ui.tenantconfiguration.repository.ActionAutocloseConfigurationItem;
|
||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
|
||||
import com.vaadin.data.Property.ValueChangeEvent;
|
||||
import com.vaadin.data.Property.ValueChangeListener;
|
||||
import com.vaadin.ui.CheckBox;
|
||||
import com.vaadin.ui.GridLayout;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.Panel;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
|
||||
/**
|
||||
* View to configure the authentication mode.
|
||||
*/
|
||||
public class RepositoryConfigurationView extends BaseConfigurationView
|
||||
implements ConfigurationGroup, ConfigurationItem.ConfigurationItemChangeListener, ValueChangeListener {
|
||||
|
||||
private static final String DIST_CHECKBOX_STYLE = "dist-checkbox-style";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final VaadinMessageSource i18n;
|
||||
|
||||
private final ActionAutocloseConfigurationItem actionAutocloseConfigurationItem;
|
||||
|
||||
private CheckBox actionAutocloseCheckBox;
|
||||
|
||||
RepositoryConfigurationView(final VaadinMessageSource i18n,
|
||||
final TenantConfigurationManagement tenantConfigurationManagement) {
|
||||
this.i18n = i18n;
|
||||
this.actionAutocloseConfigurationItem = new ActionAutocloseConfigurationItem(tenantConfigurationManagement,
|
||||
i18n);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
|
||||
final Panel rootPanel = new Panel();
|
||||
rootPanel.setSizeFull();
|
||||
|
||||
rootPanel.addStyleName("config-panel");
|
||||
|
||||
final VerticalLayout vLayout = new VerticalLayout();
|
||||
vLayout.setMargin(true);
|
||||
vLayout.setSizeFull();
|
||||
|
||||
final Label headerDisSetType = new Label(i18n.getMessage("configuration.repository.title"));
|
||||
headerDisSetType.addStyleName("config-panel-header");
|
||||
vLayout.addComponent(headerDisSetType);
|
||||
|
||||
final GridLayout gridLayout = new GridLayout(2, 1);
|
||||
gridLayout.setSpacing(true);
|
||||
gridLayout.setImmediate(true);
|
||||
gridLayout.setColumnExpandRatio(1, 1.0F);
|
||||
gridLayout.setSizeFull();
|
||||
|
||||
actionAutocloseCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
|
||||
actionAutocloseCheckBox.setId(UIComponentIdProvider.REPOSITORY_ACTIONS_AUTOCLOSE_CHECKBOX);
|
||||
actionAutocloseCheckBox.setValue(actionAutocloseConfigurationItem.isConfigEnabled());
|
||||
actionAutocloseCheckBox.addValueChangeListener(this);
|
||||
actionAutocloseConfigurationItem.addChangeListener(this);
|
||||
gridLayout.addComponent(actionAutocloseCheckBox, 0, 0);
|
||||
gridLayout.addComponent(actionAutocloseConfigurationItem, 1, 0);
|
||||
|
||||
vLayout.addComponent(gridLayout);
|
||||
rootPanel.setContent(vLayout);
|
||||
setCompositionRoot(rootPanel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
actionAutocloseConfigurationItem.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
actionAutocloseConfigurationItem.undo();
|
||||
actionAutocloseCheckBox.setValue(actionAutocloseConfigurationItem.isConfigEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configurationHasChanged() {
|
||||
notifyConfigurationChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void valueChange(final ValueChangeEvent event) {
|
||||
|
||||
if (!(event.getProperty() instanceof CheckBox)) {
|
||||
return;
|
||||
}
|
||||
|
||||
notifyConfigurationChanged();
|
||||
|
||||
final CheckBox checkBox = (CheckBox) event.getProperty();
|
||||
BooleanConfigurationItem configurationItem;
|
||||
|
||||
if (actionAutocloseCheckBox.equals(checkBox)) {
|
||||
configurationItem = actionAutocloseConfigurationItem;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (checkBox.getValue()) {
|
||||
configurationItem.configEnable();
|
||||
} else {
|
||||
configurationItem.configDisable();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,8 @@ public class TenantConfigurationDashboardView extends CustomComponent implements
|
||||
|
||||
private final DefaultDistributionSetTypeLayout defaultDistributionSetTypeLayout;
|
||||
|
||||
private final RepositoryConfigurationView repositoryConfigurationView;
|
||||
|
||||
private final AuthenticationConfigurationView authenticationConfigurationView;
|
||||
|
||||
private final PollingConfigurationView pollingConfigurationView;
|
||||
@@ -87,6 +89,8 @@ public class TenantConfigurationDashboardView extends CustomComponent implements
|
||||
securityTokenGenerator);
|
||||
this.pollingConfigurationView = new PollingConfigurationView(i18n, controllerPollProperties,
|
||||
tenantConfigurationManagement);
|
||||
this.repositoryConfigurationView = new RepositoryConfigurationView(i18n, tenantConfigurationManagement);
|
||||
|
||||
this.i18n = i18n;
|
||||
this.uiProperties = uiProperties;
|
||||
this.uINotification = uINotification;
|
||||
@@ -100,6 +104,8 @@ public class TenantConfigurationDashboardView extends CustomComponent implements
|
||||
if (defaultDistributionSetTypeLayout.getComponentCount() > 0) {
|
||||
configurationViews.add(defaultDistributionSetTypeLayout);
|
||||
}
|
||||
configurationViews.add(repositoryConfigurationView);
|
||||
|
||||
configurationViews.add(authenticationConfigurationView);
|
||||
configurationViews.add(pollingConfigurationView);
|
||||
if (customConfigurationViews != null) {
|
||||
|
||||
@@ -10,13 +10,14 @@ package org.eclipse.hawkbit.ui.tenantconfiguration.authentication;
|
||||
|
||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.TenantConfigurationKey;
|
||||
import org.eclipse.hawkbit.ui.tenantconfiguration.generic.AbstractBooleanTenantConfigurationItem;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
|
||||
/**
|
||||
* This class represents the UI item for the anonymous download by in the
|
||||
* authentication configuration view.
|
||||
*/
|
||||
public class AnonymousDownloadAuthenticationConfigurationItem extends AbstractAuthenticationTenantConfigurationItem {
|
||||
public class AnonymousDownloadAuthenticationConfigurationItem extends AbstractBooleanTenantConfigurationItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.TenantConfigurationKey;
|
||||
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
|
||||
import org.eclipse.hawkbit.ui.tenantconfiguration.generic.AbstractBooleanTenantConfigurationItem;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
@@ -23,7 +24,7 @@ import com.vaadin.ui.VerticalLayout;
|
||||
* This class represents the UI item for the certificate authenticated by an
|
||||
* reverse proxy in the authentication configuration view.
|
||||
*/
|
||||
public class CertificateAuthenticationConfigurationItem extends AbstractAuthenticationTenantConfigurationItem {
|
||||
public class CertificateAuthenticationConfigurationItem extends AbstractBooleanTenantConfigurationItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.T
|
||||
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmall;
|
||||
import org.eclipse.hawkbit.ui.tenantconfiguration.generic.AbstractBooleanTenantConfigurationItem;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
|
||||
import com.vaadin.server.FontAwesome;
|
||||
@@ -28,7 +29,7 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
* This class represents the UI item for the gateway security token section in
|
||||
* the authentication configuration view.
|
||||
*/
|
||||
public class GatewaySecurityTokenAuthenticationConfigurationItem extends AbstractAuthenticationTenantConfigurationItem {
|
||||
public class GatewaySecurityTokenAuthenticationConfigurationItem extends AbstractBooleanTenantConfigurationItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -10,13 +10,14 @@ package org.eclipse.hawkbit.ui.tenantconfiguration.authentication;
|
||||
|
||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.TenantConfigurationKey;
|
||||
import org.eclipse.hawkbit.ui.tenantconfiguration.generic.AbstractBooleanTenantConfigurationItem;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
|
||||
/**
|
||||
* This class represents the UI item for the target security token section in
|
||||
* the authentication configuration view.
|
||||
*/
|
||||
public class TargetSecurityTokenAuthenticationConfigurationItem extends AbstractAuthenticationTenantConfigurationItem {
|
||||
public class TargetSecurityTokenAuthenticationConfigurationItem extends AbstractBooleanTenantConfigurationItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.tenantconfiguration.authentication;
|
||||
package org.eclipse.hawkbit.ui.tenantconfiguration.generic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -21,8 +21,8 @@ import com.vaadin.ui.VerticalLayout;
|
||||
/**
|
||||
* abstract authentication configuration item.
|
||||
*/
|
||||
abstract class AbstractAuthenticationTenantConfigurationItem extends VerticalLayout
|
||||
implements AuthenticationConfigurationItem {
|
||||
public abstract class AbstractBooleanTenantConfigurationItem extends VerticalLayout
|
||||
implements BooleanConfigurationItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -40,7 +40,7 @@ abstract class AbstractAuthenticationTenantConfigurationItem extends VerticalLay
|
||||
* the tenant configuration management to retrieve the
|
||||
* configuration value
|
||||
*/
|
||||
public AbstractAuthenticationTenantConfigurationItem(final String configurationKey,
|
||||
protected AbstractBooleanTenantConfigurationItem(final String configurationKey,
|
||||
final TenantConfigurationManagement tenantConfigurationManagement, final VaadinMessageSource i18n) {
|
||||
this.configurationKey = configurationKey;
|
||||
this.tenantConfigurationManagement = tenantConfigurationManagement;
|
||||
@@ -6,21 +6,15 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.tenantconfiguration.authentication;
|
||||
package org.eclipse.hawkbit.ui.tenantconfiguration.generic;
|
||||
|
||||
import org.eclipse.hawkbit.ui.tenantconfiguration.ConfigurationItem;
|
||||
|
||||
import com.vaadin.ui.Component;
|
||||
import org.eclipse.hawkbit.ui.tenantconfiguration.ConfigurationGroup;
|
||||
|
||||
/**
|
||||
* Interface to be implemented by any tenant specific configuration to show on
|
||||
* the UI.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public interface AuthenticationConfigurationItem extends Component, ConfigurationItem {
|
||||
public interface BooleanConfigurationItem extends ConfigurationGroup {
|
||||
|
||||
/**
|
||||
* @return {@code true} if configuration is enabled, otherwise {@code false}
|
||||
@@ -37,14 +31,4 @@ public interface AuthenticationConfigurationItem extends Component, Configuratio
|
||||
*/
|
||||
void configDisable();
|
||||
|
||||
/**
|
||||
* called to save the configuration.
|
||||
*/
|
||||
void save();
|
||||
|
||||
/**
|
||||
* called to rollback made changes.
|
||||
*/
|
||||
void undo();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.tenantconfiguration.repository;
|
||||
|
||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.TenantConfigurationKey;
|
||||
import org.eclipse.hawkbit.ui.tenantconfiguration.generic.AbstractBooleanTenantConfigurationItem;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
|
||||
/**
|
||||
* This class represents the UI item for the target security token section in
|
||||
* the authentication configuration view.
|
||||
*/
|
||||
public class ActionAutocloseConfigurationItem extends AbstractBooleanTenantConfigurationItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private boolean configurationEnabled;
|
||||
private boolean configurationEnabledChange;
|
||||
|
||||
public ActionAutocloseConfigurationItem(final TenantConfigurationManagement tenantConfigurationManagement,
|
||||
final VaadinMessageSource i18n) {
|
||||
super(TenantConfigurationKey.REPOSITORY_ACTIONS_AUTOCLOSE_ENABLED, tenantConfigurationManagement, i18n);
|
||||
|
||||
super.init("label.configuration.repository.autoclose.action");
|
||||
configurationEnabled = isConfigEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configEnable() {
|
||||
if (!configurationEnabled) {
|
||||
configurationEnabledChange = true;
|
||||
}
|
||||
configurationEnabled = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configDisable() {
|
||||
if (configurationEnabled) {
|
||||
configurationEnabledChange = true;
|
||||
}
|
||||
configurationEnabled = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
if (!configurationEnabledChange) {
|
||||
return;
|
||||
}
|
||||
getTenantConfigurationManagement().addOrUpdateConfiguration(getConfigurationKey(), configurationEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
configurationEnabledChange = false;
|
||||
configurationEnabled = getTenantConfigurationManagement()
|
||||
.getConfigurationValue(getConfigurationKey(), Boolean.class).getValue();
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
package org.eclipse.hawkbit.ui.utils;
|
||||
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.TenantConfigurationKey;
|
||||
|
||||
/**
|
||||
* Interface to provide the unchanged constants.
|
||||
*/
|
||||
@@ -1039,6 +1041,12 @@ public final class UIComponentIdProvider {
|
||||
*/
|
||||
public static final String ARTIFACT_DETAILS_HEADER_LABEL_ID = "artifact.details.header.caption";
|
||||
|
||||
/**
|
||||
* Configuration checkbox for
|
||||
* {@link TenantConfigurationKey#REPOSITORY_ACTIONS_AUTOCLOSE_ENABLED}.
|
||||
*/
|
||||
public static final String REPOSITORY_ACTIONS_AUTOCLOSE_CHECKBOX = "repositoryactionsautoclosecheckbox";
|
||||
|
||||
/**
|
||||
* /* Private Constructor.
|
||||
*/
|
||||
|
||||
@@ -194,6 +194,7 @@ label.tag.name = Tag name
|
||||
label.configuration.auth.header = Allow targets to authenticate via a certificate authenticated by an reverse proxy
|
||||
label.configuration.auth.gatewaytoken = Allow a gateway to authenticate and manage multiple targets through a gateway security token
|
||||
label.configuration.auth.targettoken = Allow targets to authenticate directly with their target security token
|
||||
label.configuration.repository.autoclose.action = Autoclose running actions with new Distribution Set assignment
|
||||
label.configuration.anonymous.download = Allow targets to download artifacts without security credentials
|
||||
label.unsupported.browser.ie=Sorry! current browser is not supported. Please use Internet Explorer 11 and above
|
||||
label.auto.assign.description=When an auto assign distribution set is selected, it will be automatically assigned to all targets that match the target filter.
|
||||
@@ -450,6 +451,7 @@ configuration.defaultdistributionset.select.label=Select the default Distributio
|
||||
configuration.savebutton.tooltip=Save Configurations
|
||||
configuration.cancellbutton.tooltip=Cancel Configurations
|
||||
configuration.authentication.title=Authentication Configuration
|
||||
configuration.repository.title=Repository Configuration
|
||||
configuration.polling.title=Polling Configuration
|
||||
configuration.polling.time=Polling Time
|
||||
configuration.polling.overduetime=Polling Overdue Time
|
||||
|
||||
Reference in New Issue
Block a user