Skip to content

Commit

Permalink
fix isssues with applying changes from ClusterConfigDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
patschuh committed Jan 27, 2021
1 parent 626f958 commit 46cc552
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
6 changes: 5 additions & 1 deletion src/main/java/at/esque/kafka/Controller.java
Expand Up @@ -902,7 +902,11 @@ public void deleteClusterConfigsClick(ActionEvent event) {

@FXML
public void editClusterConfigsClick(ActionEvent actionEvent) {
ClusterConfigDialog.show(selectedCluster()).ifPresent(clusterConfig -> configHandler.saveConfigs());
ClusterConfig existingConfig = selectedCluster();
ClusterConfigDialog.show(existingConfig).ifPresent(clusterConfig -> {
existingConfig.update(clusterConfig);
configHandler.saveConfigs();
});
}

@FXML
Expand Down
28 changes: 16 additions & 12 deletions src/main/java/at/esque/kafka/cluster/ClusterConfig.java
Expand Up @@ -26,19 +26,23 @@ public class ClusterConfig {
public ClusterConfig(){}

public ClusterConfig(ClusterConfig existingConfig) {
update(existingConfig);
}

public void update(ClusterConfig existingConfig) {
if(existingConfig != null) {
this.identifier = existingConfig.identifier;
this.bootStrapServers = existingConfig.bootStrapServers;
this.schemaRegistry = existingConfig.schemaRegistry;
this.schemaRegistryBasicAuthUserInfo = existingConfig.schemaRegistryBasicAuthUserInfo;
this.sslEnabled = existingConfig.sslEnabled;
this.keyStoreLocation = existingConfig.keyStoreLocation;
this.keyStorePassword = existingConfig.keyStorePassword;
this.trustStoreLocation = existingConfig.trustStoreLocation;
this.trustStorePassword = existingConfig.trustStorePassword;
this.saslSecurityProtocol = existingConfig.saslSecurityProtocol;
this.saslMechanism = existingConfig.saslMechanism;
this.saslJaasConfig = existingConfig.saslJaasConfig;
this.setIdentifier(existingConfig.getIdentifier());
this.setBootStrapServers(existingConfig.getBootStrapServers());
this.setSchemaRegistry(existingConfig.getSchemaRegistry());
this.setSchemaRegistryBasicAuthUserInfo(existingConfig.getSchemaRegistryBasicAuthUserInfo());
this.setSslEnabled(existingConfig.isSslEnabled());
this.setKeyStoreLocation(existingConfig.getKeyStoreLocation());
this.setKeyStorePassword(existingConfig.getKeyStorePassword());
this.setTrustStoreLocation(existingConfig.getTrustStoreLocation());
this.setTrustStorePassword(existingConfig.getTrustStorePassword());
this.setSaslSecurityProtocol(existingConfig.getSaslSecurityProtocol());
this.setSaslMechanism(existingConfig.getSaslMechanism());
this.setSaslJaasConfig(existingConfig.getSaslJaasConfig());
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/at/esque/kafka/dialogs/ClusterConfigDialog.java
Expand Up @@ -76,14 +76,15 @@ public static Optional<ClusterConfig> show(ClusterConfig existingConfig) {
Group.of(
Field.ofBooleanType(copy.isSslEnabled())
.label(LABEL_ENABLE_SSL)
.tooltip(LABEL_ENABLE_SSL),
.tooltip(LABEL_ENABLE_SSL)
.bind(copy.sslEnabledProperty()),
Field.ofStringType(copy.getKeyStoreLocation()==null?"":copy.getKeyStoreLocation())
.label(LABEL_KEY_STORE_LOCATION)
.tooltip(LABEL_KEY_STORE_LOCATION)
.placeholder(LABEL_KEY_STORE_LOCATION)
.format(new NullFormatStringConverter())
.bind(copy.keyStoreLocationProperty()),
Field.ofStringType(copy.getKeyStorePassword()==null?"":copy.getKeyStorePassword())
Field.ofPasswordType(copy.getKeyStorePassword()==null?"":copy.getKeyStorePassword())
.label(LABEL_KEY_STORE_PASSWORD)
.tooltip(LABEL_KEY_STORE_PASSWORD)
.placeholder(LABEL_KEY_STORE_PASSWORD)
Expand All @@ -95,7 +96,7 @@ public static Optional<ClusterConfig> show(ClusterConfig existingConfig) {
.placeholder(LABEL_TRUST_STORE_LOCATION)
.format(new NullFormatStringConverter())
.bind(copy.trustStoreLocationProperty()),
Field.ofStringType(copy.getTrustStorePassword()==null?"":copy.getTrustStorePassword())
Field.ofPasswordType(copy.getTrustStorePassword()==null?"":copy.getTrustStorePassword())
.label(LABEL_TRUST_STORE_PASSWORD)
.tooltip(LABEL_TRUST_STORE_PASSWORD)
.placeholder(LABEL_TRUST_STORE_PASSWORD)
Expand Down

0 comments on commit 46cc552

Please sign in to comment.