Refactoring after review
- changed label sentence - remove I18N to parent class - remove empty lines - set variable for configurationEnabledChange directly Signed-off-by: Jonathan Philip Knoblauch <JonathanPhilip.Knoblauch@bosch-si.com>
This commit is contained in:
@@ -14,7 +14,9 @@ import java.util.List;
|
||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
|
||||
@@ -30,6 +32,9 @@ abstract class AbstractAuthenticationTenantConfigurationItem extends VerticalLay
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
private final TenantConfigurationKey configurationKey;
|
||||
private final transient TenantConfigurationManagement tenantConfigurationManagement;
|
||||
|
||||
@@ -53,7 +58,7 @@ abstract class AbstractAuthenticationTenantConfigurationItem extends VerticalLay
|
||||
*/
|
||||
protected void init(final String labelText) {
|
||||
setImmediate(true);
|
||||
addComponent(SPUIComponentProvider.getLabel(labelText, SPUILabelDefinitions.SP_LABEL_SIMPLE));
|
||||
addComponent(SPUIComponentProvider.getLabel(i18n.get(labelText), SPUILabelDefinitions.SP_LABEL_SIMPLE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,7 +12,6 @@ import javax.annotation.PostConstruct;
|
||||
|
||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
@@ -31,9 +30,6 @@ public class AnonymousDownloadAuthenticationConfigurationItem extends AbstractAu
|
||||
private boolean configurationEnabled = false;
|
||||
private boolean configurationEnabledChange = false;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
public AnonymousDownloadAuthenticationConfigurationItem(
|
||||
final TenantConfigurationManagement tenantConfigurationManagement) {
|
||||
@@ -42,26 +38,19 @@ public class AnonymousDownloadAuthenticationConfigurationItem extends AbstractAu
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
|
||||
super.init(i18n.get("label.configuration.anonymous.download"));
|
||||
super.init("label.configuration.anonymous.download");
|
||||
configurationEnabled = isConfigEnabled();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configEnable() {
|
||||
|
||||
if (!configurationEnabled) {
|
||||
configurationEnabledChange = true;
|
||||
}
|
||||
configurationEnabledChange = !configurationEnabled;
|
||||
configurationEnabled = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configDisable() {
|
||||
if (configurationEnabled) {
|
||||
configurationEnabledChange = true;
|
||||
}
|
||||
configurationEnabledChange = configurationEnabled;
|
||||
configurationEnabled = false;
|
||||
}
|
||||
|
||||
@@ -71,16 +60,13 @@ public class AnonymousDownloadAuthenticationConfigurationItem extends AbstractAu
|
||||
return;
|
||||
}
|
||||
getTenantConfigurationManagement().addOrUpdateConfiguration(getConfigurationKey(), configurationEnabled);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
|
||||
configurationEnabledChange = false;
|
||||
configurationEnabled = getTenantConfigurationManagement()
|
||||
.getConfigurationValue(getConfigurationKey(), Boolean.class).getValue();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import javax.annotation.PostConstruct;
|
||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -35,9 +34,6 @@ public class CertificateAuthenticationConfigurationItem extends AbstractAuthenti
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
private boolean configurationEnabled = false;
|
||||
private boolean configurationEnabledChange = false;
|
||||
private boolean configurationCaRootAuthorityChanged = false;
|
||||
@@ -60,7 +56,7 @@ public class CertificateAuthenticationConfigurationItem extends AbstractAuthenti
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
super.init(i18n.get("label.configuration.auth.header"));
|
||||
super.init("label.configuration.auth.header");
|
||||
configurationEnabled = isConfigEnabled();
|
||||
|
||||
detailLayout = new VerticalLayout();
|
||||
|
||||
@@ -15,7 +15,6 @@ import org.eclipse.hawkbit.security.SecurityTokenGenerator;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmall;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -41,8 +40,6 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac
|
||||
|
||||
@Autowired
|
||||
private transient SecurityTokenGenerator securityTokenGenerator;
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
private TextField gatewayTokenNameTextField;
|
||||
|
||||
@@ -72,7 +69,7 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
|
||||
super.init(i18n.get("label.configuration.auth.gatewaytoken"));
|
||||
super.init("label.configuration.auth.gatewaytoken");
|
||||
configurationEnabled = isConfigEnabled();
|
||||
|
||||
detailLayout = new VerticalLayout();
|
||||
|
||||
@@ -12,7 +12,6 @@ import javax.annotation.PostConstruct;
|
||||
|
||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
@@ -28,9 +27,6 @@ public class TargetSecurityTokenAuthenticationConfigurationItem extends Abstract
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
private boolean configurationEnabled = false;
|
||||
private boolean configurationEnabledChange = false;
|
||||
|
||||
@@ -49,7 +45,7 @@ public class TargetSecurityTokenAuthenticationConfigurationItem extends Abstract
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
super.init(i18n.get("label.configuration.auth.targettoken"));
|
||||
super.init("label.configuration.auth.targettoken");
|
||||
configurationEnabled = isConfigEnabled();
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,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.anonymous.download = Allow targets to download anonymous
|
||||
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
|
||||
|
||||
# Checkbox label prefix with - checkbox
|
||||
|
||||
@@ -159,7 +159,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.anonymous.download = Allow targets to download anonymous
|
||||
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
|
||||
|
||||
# Checkbox label prefix with - checkbox
|
||||
|
||||
@@ -160,7 +160,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.anonymous.download = Allow targets to download anonymous
|
||||
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
|
||||
|
||||
# Checkbox label prefix with - checkbox
|
||||
|
||||
Reference in New Issue
Block a user