Skip to content

Commit

Permalink
#7470: adjust spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
jaroslawmalekcodete committed Jun 5, 2018
1 parent ec59acd commit 741b2c9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 15 deletions.
8 changes: 4 additions & 4 deletions js/notebook/src/Spinner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ class SpinnerView extends widgets.DOMWidgetView {
' animation-delay: 0s;\n' +
'}\n' +
'.lds-spinner {\n' +
' width: 200px !important;\n' +
' height: 200px !important;\n' +
' -webkit-transform: translate(-100px, -100px) scale(1) translate(100px, 100px);\n' +
' transform: translate(-100px, -100px) scale(1) translate(100px, 100px);\n' +
' width: 30px !important;\n' +
' height: 30px !important;\n' +
' -webkit-transform: translate(-15px, -15px) scale(0.15) translate(15px, 15px);\n' +
' transform: translate(-15px, -15px) scale(0.15) translate(15px, 15px);\n' +
'}\n' +
'</style></div>'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.twosigma.beakerx.widget;

import java.util.ArrayList;
import java.util.List;

/**
Expand All @@ -25,6 +26,10 @@ public class HBox extends Box {
public static final String VIEW_NAME_VALUE = "HBoxView";
public static final String MODEL_NAME_VALUE = "HBoxModel";

public HBox() {
this(new ArrayList<>());
}

public HBox(List<Widget> children) {
super(children);
openComm();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,14 @@ public String getViewModuleValue() {
return BeakerxWidget.VIEW_MODULE_VALUE;
}

Spinner spinner;

@Override
public void startSpinner(Message parentMessage) {
this.spinner = new Spinner(parentMessage);
add(spinner);
this.sparkUIForm.startSpinner(parentMessage);
}

@Override
public void stopSpinner() {
remove(spinner);
this.sparkUIForm.stopSpinner();
}

private void initSparkContext(Message parentMessage) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@
*/
package com.twosigma.beakerx.widget;

import com.twosigma.beakerx.message.Message;
import org.apache.spark.SparkConf;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import static com.twosigma.beakerx.widget.SparkUI.SPARK_EXECUTOR_CORES;
import static com.twosigma.beakerx.widget.SparkUI.SPARK_EXECUTOR_MEMORY;
import static com.twosigma.beakerx.widget.SparkUI.SPARK_MASTER;
import static com.twosigma.beakerx.widget.SparkUI.SPARK_MASTER_DEFAULT;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;

public class SparkUIForm extends VBox {
Expand All @@ -39,6 +40,8 @@ public class SparkUIForm extends VBox {
private SparkEngine sparkEngine;
private SparkUI.OnSparkButtonAction onStartAction;
private Button connectButton;
private Spinner spinner;
private HBox spinnerPanel;

public SparkUIForm(SparkEngine sparkEngine, SparkUI.OnSparkButtonAction onStartAction) {
super(new ArrayList<>());
Expand All @@ -59,10 +62,21 @@ private void createSparkView() {
this.add(advancedOption);
}

public void addConnectButton(Button connect) {
private void addConnectButton(Button connect) {
this.connectButton = connect;
this.errors = new HBox(new ArrayList<>());
add(new VBox(Arrays.asList(connectButton, this.errors)));
this.spinnerPanel = new HBox();
HBox hBox = new HBox(asList(connectButton, spinnerPanel));
add(new VBox(asList(hBox, this.errors)));
}

public void startSpinner(Message parentMessage) {
this.spinner = new Spinner(parentMessage);
spinnerPanel.add(spinner, parentMessage);
}

public void stopSpinner() {
spinnerPanel.remove(spinner);
}

private SparkConf getSparkConf() {
Expand All @@ -72,7 +86,7 @@ private SparkConf getSparkConf() {
private Text createMasterURL() {
Text masterURL = new Text();
masterURL.setDescription("Master URL");
masterURL.setDomClasses(new ArrayList<>(Arrays.asList("bx-spark-config", "bx-spark-master-url")));
masterURL.setDomClasses(new ArrayList<>(asList("bx-spark-config", "bx-spark-master-url")));
if (getSparkConf().contains(SPARK_MASTER)) {
masterURL.setValue(getSparkConf().get(SPARK_MASTER));
} else {
Expand All @@ -91,7 +105,7 @@ private Button createConnectButton() {
private Text createExecutorMemory() {
Text memory = new Text();
memory.setDescription("Executor Memory");
memory.setDomClasses(new ArrayList<>(Arrays.asList("bx-spark-config", "bx-spark-executor-memory")));
memory.setDomClasses(new ArrayList<>(asList("bx-spark-config", "bx-spark-executor-memory")));
if (getSparkConf().contains(SPARK_EXECUTOR_MEMORY)) {
memory.setValue(getSparkConf().get(SPARK_EXECUTOR_MEMORY));
} else {
Expand All @@ -103,7 +117,7 @@ private Text createExecutorMemory() {
private Text createExecutorCores() {
Text cores = new Text();
cores.setDescription("Executor cores");
cores.setDomClasses(new ArrayList<>(Arrays.asList("bx-spark-config", "bx-spark-executor-cores")));
cores.setDomClasses(new ArrayList<>(asList("bx-spark-config", "bx-spark-executor-cores")));
if (getSparkConf().contains(SPARK_EXECUTOR_CORES)) {
cores.setValue(getSparkConf().get(SPARK_EXECUTOR_CORES));
} else {
Expand Down

0 comments on commit 741b2c9

Please sign in to comment.