Skip to content

Commit

Permalink
#7535 disabling sparkUI form on waiting for connection, hidding conne…
Browse files Browse the repository at this point in the history
…ct button after success
  • Loading branch information
Lukasz Mitusinski committed Jun 20, 2018
1 parent 670a761 commit 4323daa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,20 @@ private void initSparkContext(Message parentMessage) {

private void configureSparkContext(Message parentMessage, KernelFunctionality kernel) {
try {
this.sparkUIForm.setAllToDisabled();
TryResult configure = sparkEngine.configure(kernel, this, parentMessage);
if (configure.isError()) {
this.sparkUIForm.sendError(StacktraceHtmlPrinter.printRedBold(ERROR_CREATING_SPARK_SESSION));
this.sparkUIForm.setAllToEnabled();
} else {
singleSparkSession.active();
sparkUIForm.saveDefaults();
sparkUIForm.getConnectButton().setDomClasses(asList("hidden"));
sparkUiDefaults.saveProfileName(sparkUIForm.getProfileName());
applicationStart();
}
} catch (Exception e) {
this.sparkUIForm.setAllToEnabled();
this.sparkUIForm.sendError(StacktraceHtmlPrinter.printRedBold(e.getMessage()));
}
}
Expand All @@ -132,7 +136,6 @@ private SparkSession getSparkSession() {
private void applicationStart() {
this.statusPanel = new SparkUIStatus(message -> getSparkSession().sparkContext().stop());
this.sparkUIForm.setDomClasses(new ArrayList<>(asList("bx-disabled")));
this.sparkUIForm.setAllToDisabled();
add(0, this.statusPanel);
sendUpdate(SPARK_APP_ID, sparkEngine.getSparkAppId());
sendUpdate("sparkUiWebUrl", sparkEngine.getSparkUiWebUrl());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,20 @@ public String getProfileName() {
public void setAllToDisabled() {
this.profileManagement.getChildren().stream().map(x -> (ValueWidget) x).forEach(x -> x.setDisabled(true));
this.advancedOption.setDisabledToAll();
this.connectButton.setDisabled(true);
this.masterURL.setDisabled(true);
this.executorMemory.setDisabled(true);
this.executorCores.setDisabled(true);
}

public void setAllToEnabled() {
this.profileManagement.getChildren().stream().map(x -> (ValueWidget) x).forEach(x -> x.setDisabled(false));
this.advancedOption.setEnabledToAll();
this.connectButton.setDisabled(false);
this.connectButton.setDomClasses(new ArrayList<>());
this.masterURL.setDisabled(false);
this.executorMemory.setDisabled(false);
this.executorCores.setDisabled(false);
}

}

0 comments on commit 4323daa

Please sign in to comment.