diff --git a/java/code/src/com/redhat/rhn/domain/action/ProxyConfigurationApplyAction.java b/java/code/src/com/redhat/rhn/domain/action/ProxyConfigurationApplyAction.java index 48e31675c47..25ec3abe222 100644 --- a/java/code/src/com/redhat/rhn/domain/action/ProxyConfigurationApplyAction.java +++ b/java/code/src/com/redhat/rhn/domain/action/ProxyConfigurationApplyAction.java @@ -29,8 +29,11 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.Optional; +import javax.persistence.Transient; + /** * ProxyConfigurationApply - Class representing TYPE_PROXY_CONFIGURATION_APPLY action */ @@ -38,7 +41,9 @@ public class ProxyConfigurationApplyAction extends Action { private static final String APPLY_PROXY_CONFIG = "proxy.apply_proxy_config"; private final Pillar pillar; - private final Map proxyConfigFiles; + + @Transient + private final transient Map proxyConfigFiles; /** * Default constructor @@ -75,18 +80,27 @@ public LocalCall>> getApplyProxyConfi Collections.singletonList(APPLY_PROXY_CONFIG), Optional.of(data), Optional.of(false), Optional.of(false), - new TypeToken>>() { } + new TypeToken<>() { } ); } - public LocalCall> getApplyProxyConfigCallSimple() { - Map data = new HashMap<>(); - data.putAll(ProxyConfigUtils.applyProxyConfigDataFromPillar(getPillar())); - data.putAll(getProxyConfigFiles()); + @Override + public int hashCode() { + return Objects.hash(pillar, proxyConfigFiles, getOrg()); + } - return State.apply( - Collections.singletonList(APPLY_PROXY_CONFIG), - Optional.of(data) - ); + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + ProxyConfigurationApplyAction that = (ProxyConfigurationApplyAction) obj; + return Objects.equals(pillar, that.pillar) && + Objects.equals(proxyConfigFiles, that.proxyConfigFiles) && + Objects.equals(getOrg(), that.getOrg()); } + } diff --git a/java/code/src/com/suse/proxy/update/ProxyConfigUpdateApplySaltState.java b/java/code/src/com/suse/proxy/update/ProxyConfigUpdateApplySaltState.java index 5f6af7f6aa5..1ce8ca647c9 100644 --- a/java/code/src/com/suse/proxy/update/ProxyConfigUpdateApplySaltState.java +++ b/java/code/src/com/suse/proxy/update/ProxyConfigUpdateApplySaltState.java @@ -55,7 +55,10 @@ public void handle(ProxyConfigUpdateContext context) { applyResults -> { if (applyResults.isEmpty()) { context.getErrorReport().register(FAIL_APPLY_MESSAGE); - LOG.error(FAIL_APPLY_MESSAGE + " Unexpected response size. {}", applyResults.size()); + LOG.error( + FAIL_APPLY_MESSAGE + " Unexpected response size. {}", + applyResults.size() + ); return null; } diff --git a/web/html/src/manager/minion/proxy/proxy-config.tsx b/web/html/src/manager/minion/proxy/proxy-config.tsx index 6372a8f4157..53054a0bb74 100644 --- a/web/html/src/manager/minion/proxy/proxy-config.tsx +++ b/web/html/src/manager/minion/proxy/proxy-config.tsx @@ -181,7 +181,7 @@ export function ProxyConfig({ const fileReaders = Object.keys(model) .filter((key) => { - const matcher = key.match(/^([a-zA-Z0-9]*[A-Za-z])[0-9]*$/); + const matcher = /^([a-zA-Z\d]*[A-Za-z])\d*$/.exec(key); const fieldName = matcher ? matcher[1] : key; return fileFields.includes(fieldName); }) @@ -219,9 +219,8 @@ export function ProxyConfig({ }; const registryData = model.sourceMode === SourceMode.Registry - ? Object.assign( - {}, - model.registryMode === RegistryMode.Simple + ? { + ...(model.registryMode === RegistryMode.Simple ? { registryBaseURL: model.registryBaseURL, registryBaseTag: model.registryBaseTag, @@ -237,8 +236,8 @@ export function ProxyConfig({ registrySshTag: model.registrySshTag, registryTftpdURL: model.registryTftpdURL, registryTftpdTag: model.registryTftpdTag, - } - ) + }), + } : {}; const formData = unflattenModel(Object.assign({}, commonData, registryData, ...values)); @@ -276,12 +275,12 @@ export function ProxyConfig({ }; const onChange = (newModel) => { - setModel(Object.assign({}, newModel)); + setModel({ ...newModel }); asyncValidate(newModel); }; const onAddField = (fieldName: string) => { - return (index: number) => setModel(Object.assign({}, model, { [fieldName + index]: "" })); + return (index: number) => setModel({ ...model, [fieldName + index]: "" }); }; const onRemoveField = (fieldName: string) => {