Refactoring of Authentification UI
* modified AuthentificationUI to use same Interface as Polling Configuration UI * renaming of Interface "ConfigurationElement" -> "ConfigurationItem" Signed-off-by: Nonnenmacher Fabian <fabian.nonnenmacher@bosch-si.com>
This commit is contained in:
committed by
Nonnenmacher Fabian
parent
3f451537cf
commit
4675ebf22c
@@ -11,10 +11,10 @@ package org.eclipse.hawkbit.ui.tenantconfiguration;
|
|||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.AuthenticationConfigurationItem;
|
||||||
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.CertificateAuthenticationConfigurationItem;
|
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.CertificateAuthenticationConfigurationItem;
|
||||||
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.GatewaySecurityTokenAuthenticationConfigurationItem;
|
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.GatewaySecurityTokenAuthenticationConfigurationItem;
|
||||||
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.TargetSecurityTokenAuthenticationConfigurationItem;
|
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.TargetSecurityTokenAuthenticationConfigurationItem;
|
||||||
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.TenantConfigurationItem;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ import com.vaadin.ui.VerticalLayout;
|
|||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
public class AuthenticationConfigurationView extends BaseConfigurationView
|
public class AuthenticationConfigurationView extends BaseConfigurationView
|
||||||
implements ConfigurationGroup, TenantConfigurationItem.TenantConfigurationChangeListener, ValueChangeListener {
|
implements ConfigurationGroup, ConfigurationItem.ConfigurationItemChangeListener, ValueChangeListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -95,14 +95,14 @@ public class AuthenticationConfigurationView extends BaseConfigurationView
|
|||||||
certificateAuthCheckbox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
|
certificateAuthCheckbox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
|
||||||
certificateAuthCheckbox.setValue(certificateAuthenticationConfigurationItem.isConfigEnabled());
|
certificateAuthCheckbox.setValue(certificateAuthenticationConfigurationItem.isConfigEnabled());
|
||||||
certificateAuthCheckbox.addValueChangeListener(this);
|
certificateAuthCheckbox.addValueChangeListener(this);
|
||||||
certificateAuthenticationConfigurationItem.addConfigurationChangeListener(this);
|
certificateAuthenticationConfigurationItem.addChangeListener(this);
|
||||||
gridLayout.addComponent(certificateAuthCheckbox, 0, 0);
|
gridLayout.addComponent(certificateAuthCheckbox, 0, 0);
|
||||||
gridLayout.addComponent(certificateAuthenticationConfigurationItem, 1, 0);
|
gridLayout.addComponent(certificateAuthenticationConfigurationItem, 1, 0);
|
||||||
|
|
||||||
targetSecTokenCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
|
targetSecTokenCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
|
||||||
targetSecTokenCheckBox.setValue(targetSecurityTokenAuthenticationConfigurationItem.isConfigEnabled());
|
targetSecTokenCheckBox.setValue(targetSecurityTokenAuthenticationConfigurationItem.isConfigEnabled());
|
||||||
targetSecTokenCheckBox.addValueChangeListener(this);
|
targetSecTokenCheckBox.addValueChangeListener(this);
|
||||||
targetSecurityTokenAuthenticationConfigurationItem.addConfigurationChangeListener(this);
|
targetSecurityTokenAuthenticationConfigurationItem.addChangeListener(this);
|
||||||
gridLayout.addComponent(targetSecTokenCheckBox, 0, 1);
|
gridLayout.addComponent(targetSecTokenCheckBox, 0, 1);
|
||||||
gridLayout.addComponent(targetSecurityTokenAuthenticationConfigurationItem, 1, 1);
|
gridLayout.addComponent(targetSecurityTokenAuthenticationConfigurationItem, 1, 1);
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ public class AuthenticationConfigurationView extends BaseConfigurationView
|
|||||||
gatewaySecTokenCheckBox.setId("gatewaysecuritycheckbox");
|
gatewaySecTokenCheckBox.setId("gatewaysecuritycheckbox");
|
||||||
gatewaySecTokenCheckBox.setValue(gatewaySecurityTokenAuthenticationConfigurationItem.isConfigEnabled());
|
gatewaySecTokenCheckBox.setValue(gatewaySecurityTokenAuthenticationConfigurationItem.isConfigEnabled());
|
||||||
gatewaySecTokenCheckBox.addValueChangeListener(this);
|
gatewaySecTokenCheckBox.addValueChangeListener(this);
|
||||||
gatewaySecurityTokenAuthenticationConfigurationItem.addConfigurationChangeListener(this);
|
gatewaySecurityTokenAuthenticationConfigurationItem.addChangeListener(this);
|
||||||
gridLayout.addComponent(gatewaySecTokenCheckBox, 0, 2);
|
gridLayout.addComponent(gatewaySecTokenCheckBox, 0, 2);
|
||||||
gridLayout.addComponent(gatewaySecurityTokenAuthenticationConfigurationItem, 1, 2);
|
gridLayout.addComponent(gatewaySecurityTokenAuthenticationConfigurationItem, 1, 2);
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@ public class AuthenticationConfigurationView extends BaseConfigurationView
|
|||||||
notifyConfigurationChanged();
|
notifyConfigurationChanged();
|
||||||
|
|
||||||
CheckBox checkBox = (CheckBox) event.getProperty();
|
CheckBox checkBox = (CheckBox) event.getProperty();
|
||||||
TenantConfigurationItem configurationItem = null;
|
AuthenticationConfigurationItem configurationItem = null;
|
||||||
|
|
||||||
if (checkBox == gatewaySecTokenCheckBox) {
|
if (checkBox == gatewaySecTokenCheckBox) {
|
||||||
configurationItem = gatewaySecurityTokenAuthenticationConfigurationItem;
|
configurationItem = gatewaySecurityTokenAuthenticationConfigurationItem;
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ public abstract class BaseConfigurationView extends CustomComponent implements C
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final List<ConfigurationGroupChangeListener> configurationChangeListeners = new ArrayList<>();
|
private final List<ConfigurationItemChangeListener> configurationChangeListeners = new ArrayList<>();
|
||||||
|
|
||||||
protected void notifyConfigurationChanged() {
|
protected void notifyConfigurationChanged() {
|
||||||
configurationChangeListeners.forEach(listener -> listener.configurationChanged());
|
configurationChangeListeners.forEach(listener -> listener.configurationHasChanged());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addChangeListener(final ConfigurationGroupChangeListener listener) {
|
public void addChangeListener(final ConfigurationItemChangeListener listener) {
|
||||||
configurationChangeListeners.add(listener);
|
configurationChangeListeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import com.vaadin.ui.Component;
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface ConfigurationGroup extends Component, ConfigurationElement {
|
public interface ConfigurationGroup extends Component, ConfigurationItem {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called to store any configuration changes.
|
* called to store any configuration changes.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package org.eclipse.hawkbit.ui.tenantconfiguration;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
public interface ConfigurationElement {
|
public interface ConfigurationItem {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called to verify that the Input done by the user is valid
|
* called to verify that the Input done by the user is valid
|
||||||
@@ -19,17 +19,17 @@ public interface ConfigurationElement {
|
|||||||
* the listener to be notified in case the item changes some
|
* the listener to be notified in case the item changes some
|
||||||
* configuration
|
* configuration
|
||||||
*/
|
*/
|
||||||
void addChangeListener(ConfigurationGroupChangeListener listener);
|
void addChangeListener(final ConfigurationItemChangeListener listener);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration Change Listener to be notified about configuration changes
|
* Configuration Change Listener to be notified about configuration changes
|
||||||
* in configuration group.
|
* in configuration group.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
interface ConfigurationGroupChangeListener extends Serializable {
|
interface ConfigurationItemChangeListener extends Serializable {
|
||||||
/**
|
/**
|
||||||
* called to notify about configuration has been changed.
|
* called to notify about configuration has been changed.
|
||||||
*/
|
*/
|
||||||
void configurationChanged();
|
void configurationHasChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ import com.vaadin.ui.VerticalLayout;
|
|||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
public class PollingConfigurationView extends BaseConfigurationView
|
public class PollingConfigurationView extends BaseConfigurationView
|
||||||
implements ConfigurationGroup, ConfigurationElement.ConfigurationGroupChangeListener {
|
implements ConfigurationGroup, ConfigurationItem.ConfigurationItemChangeListener {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -97,6 +97,7 @@ public class PollingConfigurationView extends BaseConfigurationView
|
|||||||
tenantPollingOverdueTime = fieldPollingOverdueTime.getValue();
|
tenantPollingOverdueTime = fieldPollingOverdueTime.getValue();
|
||||||
pollConfigurationHelper.setTenantOverduePollTimeIntervall(fieldPollingOverdueTime.getValue());
|
pollConfigurationHelper.setTenantOverduePollTimeIntervall(fieldPollingOverdueTime.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -111,7 +112,7 @@ public class PollingConfigurationView extends BaseConfigurationView
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configurationChanged() {
|
public void configurationHasChanged() {
|
||||||
notifyConfigurationChanged();
|
notifyConfigurationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import org.eclipse.hawkbit.ui.HawkbitUI;
|
|||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||||
import org.eclipse.hawkbit.ui.documentation.DocumentationPageLink;
|
import org.eclipse.hawkbit.ui.documentation.DocumentationPageLink;
|
||||||
import org.eclipse.hawkbit.ui.tenantconfiguration.ConfigurationElement.ConfigurationGroupChangeListener;
|
import org.eclipse.hawkbit.ui.tenantconfiguration.ConfigurationItem.ConfigurationItemChangeListener;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
@@ -45,7 +45,7 @@ import com.vaadin.ui.VerticalLayout;
|
|||||||
@SpringView(name = TenantConfigurationDashboardView.VIEW_NAME, ui = HawkbitUI.class)
|
@SpringView(name = TenantConfigurationDashboardView.VIEW_NAME, ui = HawkbitUI.class)
|
||||||
@ViewScope
|
@ViewScope
|
||||||
public class TenantConfigurationDashboardView extends CustomComponent
|
public class TenantConfigurationDashboardView extends CustomComponent
|
||||||
implements View, ConfigurationGroupChangeListener {
|
implements View, ConfigurationItemChangeListener {
|
||||||
|
|
||||||
public static final String VIEW_NAME = "spSystemConfig";
|
public static final String VIEW_NAME = "spSystemConfig";
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -168,7 +168,7 @@ public class TenantConfigurationDashboardView extends CustomComponent
|
|||||||
* ConfigurationGroupChangeListener #configurationChanged()
|
* ConfigurationGroupChangeListener #configurationChanged()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void configurationChanged() {
|
public void configurationHasChanged() {
|
||||||
saveConfigurationBtn.setEnabled(true);
|
saveConfigurationBtn.setEnabled(true);
|
||||||
undoConfigurationBtn.setEnabled(true);
|
undoConfigurationBtn.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ import com.vaadin.ui.VerticalLayout;
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
abstract class AbstractAuthenticationTenantConfigurationItem extends VerticalLayout implements TenantConfigurationItem {
|
abstract class AbstractAuthenticationTenantConfigurationItem extends VerticalLayout
|
||||||
|
implements AuthenticationConfigurationItem {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -35,7 +36,7 @@ abstract class AbstractAuthenticationTenantConfigurationItem extends VerticalLay
|
|||||||
private final TenantConfigurationKey configurationKey;
|
private final TenantConfigurationKey configurationKey;
|
||||||
private final transient SystemManagement systemManagement;
|
private final transient SystemManagement systemManagement;
|
||||||
|
|
||||||
private final List<TenantConfigurationChangeListener> configurationChangeListeners = new ArrayList<>();
|
private final List<ConfigurationItemChangeListener> configurationChangeListeners = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param configurationKey
|
* @param configurationKey
|
||||||
@@ -65,7 +66,8 @@ abstract class AbstractAuthenticationTenantConfigurationItem extends VerticalLay
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isConfigEnabled() {
|
public boolean isConfigEnabled() {
|
||||||
return systemManagement.getConfigurationValue(configurationKey, Boolean.class);
|
boolean b = systemManagement.getConfigurationValue(configurationKey, Boolean.class);
|
||||||
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,7 +97,12 @@ abstract class AbstractAuthenticationTenantConfigurationItem extends VerticalLay
|
|||||||
* TenantConfigurationChangeListener)
|
* TenantConfigurationChangeListener)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addConfigurationChangeListener(final TenantConfigurationChangeListener listener) {
|
public void addChangeListener(final ConfigurationItemChangeListener listener) {
|
||||||
configurationChangeListeners.add(listener);
|
configurationChangeListeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUserInputValid() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.tenantconfiguration.authentication;
|
package org.eclipse.hawkbit.ui.tenantconfiguration.authentication;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import org.eclipse.hawkbit.ui.tenantconfiguration.ConfigurationItem;
|
||||||
|
|
||||||
import com.vaadin.ui.Component;
|
import com.vaadin.ui.Component;
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ import com.vaadin.ui.Component;
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface TenantConfigurationItem extends Component {
|
public interface AuthenticationConfigurationItem extends Component, ConfigurationItem {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if configuration is enabled, otherwise {@code false}
|
* @return {@code true} if configuration is enabled, otherwise {@code false}
|
||||||
@@ -47,28 +47,4 @@ public interface TenantConfigurationItem extends Component {
|
|||||||
*/
|
*/
|
||||||
void undo();
|
void undo();
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a configuration change listener to notify about configuration
|
|
||||||
* changes.
|
|
||||||
*
|
|
||||||
* @param listener
|
|
||||||
* the listener to be notified in case the item changes some
|
|
||||||
* configuration
|
|
||||||
*/
|
|
||||||
void addConfigurationChangeListener(TenantConfigurationChangeListener listener);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configuration Change Listener to be notified about configuration changes
|
|
||||||
* in configuration item.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@FunctionalInterface
|
|
||||||
interface TenantConfigurationChangeListener extends Serializable {
|
|
||||||
/**
|
|
||||||
* called to notify about configuration has been changed.
|
|
||||||
*/
|
|
||||||
void configurationHasChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ import javax.annotation.PostConstruct;
|
|||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.tenantconfiguration.ConfigurationElement;
|
import org.eclipse.hawkbit.ui.tenantconfiguration.ConfigurationItem;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -32,11 +32,11 @@ import com.vaadin.ui.Label;
|
|||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
public class DurationConfigField extends GridLayout implements ValueChangeListener, ConfigurationElement {
|
public class DurationConfigField extends GridLayout implements ValueChangeListener, ConfigurationItem {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final List<ConfigurationGroupChangeListener> configurationChangeListeners = new ArrayList<>();
|
private final List<ConfigurationItemChangeListener> configurationChangeListeners = new ArrayList<>();
|
||||||
|
|
||||||
private CheckBox checkBox;
|
private CheckBox checkBox;
|
||||||
private DurationField durationField;
|
private DurationField durationField;
|
||||||
@@ -171,11 +171,11 @@ public class DurationConfigField extends GridLayout implements ValueChangeListen
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void notifyConfigurationChanged() {
|
private void notifyConfigurationChanged() {
|
||||||
configurationChangeListeners.forEach(listener -> listener.configurationChanged());
|
configurationChangeListeners.forEach(listener -> listener.configurationHasChanged());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addChangeListener(final ConfigurationGroupChangeListener listener) {
|
public void addChangeListener(final ConfigurationItemChangeListener listener) {
|
||||||
configurationChangeListeners.add(listener);
|
configurationChangeListeners.add(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user