Skip to content

Commit fed0438

Browse files
committed
Adjust the deploy GUI layout
1 parent 0f28f1b commit fed0438

2 files changed

Lines changed: 51 additions & 41 deletions

File tree

ui/src/main/java/edu/wpi/grip/ui/DeployController.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import javafx.application.Platform;
1313
import javafx.beans.binding.Bindings;
1414
import javafx.beans.property.BooleanProperty;
15+
import javafx.beans.property.StringProperty;
1516
import javafx.fxml.FXML;
1617
import javafx.scene.control.Label;
1718
import javafx.scene.control.ProgressIndicator;
@@ -57,10 +58,10 @@ public class DeployController {
5758
@FXML private TextField jvmArgs;
5859
@FXML private TextField deployDir;
5960
@FXML private ProgressIndicator progress;
60-
@FXML private Label command;
6161
@FXML private Label status;
6262
@FXML private TextArea console;
6363
@FXML private BooleanProperty deploying;
64+
@FXML private StringProperty command;
6465

6566
@Inject private EventBus eventBus;
6667
@Inject private Project project;
@@ -72,8 +73,8 @@ public class DeployController {
7273
@FXML
7374
public void initialize() {
7475
deploying.addListener((o, b, d) -> progress.setProgress(d ? ProgressIndicator.INDETERMINATE_PROGRESS : 0));
75-
command.textProperty().bind(Bindings.concat(javaHome.textProperty(), "/bin/java ", jvmArgs.textProperty(),
76-
" -jar '", deployDir.textProperty(), "/", GRIP_JAR, "' '", deployDir.textProperty(), "/", PROJECT_FILE, "'"));
76+
command.bind(Bindings.concat(javaHome.textProperty(), "/bin/java ", jvmArgs.textProperty(), " -jar '",
77+
deployDir.textProperty(), "/", GRIP_JAR, "' '", deployDir.textProperty(), "/", PROJECT_FILE, "'"));
7778

7879
loadSettings(pipeline.getProjectSettings());
7980
}
@@ -157,7 +158,7 @@ public StreamCopier.Listener file(String name, long size) {
157158
project.save(projectWriter);
158159

159160
// Upload the GRIP core JAR, a wrapper script to run it, and the serialized project to the robot
160-
final String commandStr = command.getText();
161+
final String commandStr = command.get();
161162
final String pathStr = deployDir.getText() + "/";
162163
scp.upload(new FileSystemFile(LOCAL_GRIP_JAR), pathStr + GRIP_JAR);
163164
scp.upload(new StringInMemoryFile(GRIP_WRAPPER, "echo \"" + commandStr + "\"\n" + commandStr, 0755), pathStr);
@@ -172,6 +173,7 @@ public StreamCopier.Listener file(String name, long size) {
172173
Session session = ssh.startSession();
173174
session.allocateDefaultPTY();
174175

176+
logger.info("Running " + commandStr);
175177
Session.Command cmd = session.exec(String.format("'%s/%s'", pathStr, GRIP_WRAPPER));
176178

177179
LineReader inputReader = new LineReader(new InputStreamReader(cmd.getInputStream()));

ui/src/main/resources/edu/wpi/grip/ui/Deploy.fxml

Lines changed: 45 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,60 +4,67 @@
44

55
<?import edu.wpi.grip.ui.util.DPIUtility?>
66
<?import javafx.beans.property.SimpleBooleanProperty?>
7+
<?import javafx.beans.property.SimpleStringProperty?>
78
<?import javafx.scene.control.*?>
89
<?import javafx.scene.image.Image?>
910
<?import javafx.scene.image.ImageView?>
1011
<?import javafx.scene.layout.*?>
1112
<VBox styleClass="deploy-pane" maxWidth="Infinity" xmlns:fx="http://javafx.com/fxml/1"
1213
onKeyPressed="if (event.code == javafx.scene.input.KeyCode.ENTER) { controller.onDeploy() }"
13-
xmlns="http://javafx.com/javafx/null" fx:controller="edu.wpi.grip.ui.DeployController">
14+
xmlns="http://javafx.com/javafx/null" fx:controller="edu.wpi.grip.ui.DeployController" fillWidth="true">
1415
<fx:define>
1516
<SimpleBooleanProperty fx:id="deploying"/>
17+
<SimpleStringProperty fx:id="command"/>
1618
</fx:define>
1719

18-
<GridPane maxHeight="Infinity">
19-
<columnConstraints>
20-
<ColumnConstraints hgrow="NEVER" halignment="RIGHT"/>
21-
<ColumnConstraints hgrow="ALWAYS"/>
22-
<ColumnConstraints hgrow="NEVER">
23-
<prefWidth>
24-
<DPIUtility fx:constant="FONT_SIZE"/>
25-
</prefWidth>
26-
</ColumnConstraints>
27-
<ColumnConstraints hgrow="NEVER" halignment="RIGHT"/>
28-
<ColumnConstraints hgrow="ALWAYS"/>
29-
</columnConstraints>
20+
<HBox maxWidth="Infinity">
21+
<GridPane maxHeight="Infinity" HBox.hgrow="ALWAYS">
22+
<columnConstraints>
23+
<ColumnConstraints hgrow="NEVER" halignment="RIGHT"/>
24+
<ColumnConstraints hgrow="ALWAYS"/>
25+
</columnConstraints>
3026

31-
<Label disable="${deployButton.disabled}" text="Address" GridPane.columnIndex="0" GridPane.rowIndex="0"/>
32-
<TextField disable="${deployButton.disabled}" fx:id="address" promptText="Address" GridPane.columnIndex="1"
33-
GridPane.rowIndex="0"/>
27+
<Label disable="${deployButton.disabled}" text="Address" GridPane.columnIndex="0" GridPane.rowIndex="0"/>
28+
<TextField disable="${deployButton.disabled}" fx:id="address" promptText="Address" GridPane.columnIndex="1"
29+
GridPane.rowIndex="0"/>
3430

35-
<Label disable="${deployButton.disabled}" text="User" GridPane.columnIndex="0" GridPane.rowIndex="1"/>
36-
<TextField disable="${deployButton.disabled}" fx:id="user" promptText="Username" GridPane.columnIndex="1"
37-
GridPane.rowIndex="1"/>
31+
<Label disable="${deployButton.disabled}" text="User" GridPane.columnIndex="0" GridPane.rowIndex="1"/>
32+
<TextField disable="${deployButton.disabled}" fx:id="user" promptText="Username" GridPane.columnIndex="1"
33+
GridPane.rowIndex="1"/>
3834

39-
<Label disable="${deployButton.disabled}" text="Password" GridPane.columnIndex="0" GridPane.rowIndex="2"/>
40-
<PasswordField disable="${deployButton.disabled}" fx:id="password" promptText="Password"
41-
GridPane.columnIndex="1" GridPane.rowIndex="2"/>
35+
<Label disable="${deployButton.disabled}" text="Password" GridPane.columnIndex="0" GridPane.rowIndex="2"/>
36+
<PasswordField disable="${deployButton.disabled}" fx:id="password" promptText="Password"
37+
GridPane.columnIndex="1" GridPane.rowIndex="2"/>
4238

43-
<Label disable="${deployButton.disabled}" text="Deploy Directory" GridPane.columnIndex="3"
44-
GridPane.rowIndex="0"/>
45-
<TextField disable="${deployButton.disabled}" fx:id="deployDir" promptText="Deploy Directory"
46-
GridPane.columnIndex="4" GridPane.rowIndex="0"/>
39+
</GridPane>
40+
<Separator orientation="VERTICAL" HBox.hgrow="NEVER" visible="false">
41+
<prefWidth>
42+
<DPIUtility fx:constant="SMALL_ICON_SIZE"/>
43+
</prefWidth>
44+
</Separator>
45+
<GridPane maxHeight="Infinity" HBox.hgrow="ALWAYS">
46+
<columnConstraints>
47+
<ColumnConstraints hgrow="NEVER" halignment="RIGHT"/>
48+
<ColumnConstraints hgrow="ALWAYS"/>
49+
</columnConstraints>
4750

48-
<Label disable="${deployButton.disabled}" text="Java Home" GridPane.columnIndex="3" GridPane.rowIndex="1"/>
49-
<TextField disable="${deployButton.disabled}" fx:id="javaHome" promptText="Java Home"
50-
GridPane.columnIndex="4" GridPane.rowIndex="1"/>
51+
<Label disable="${deployButton.disabled}" text="Deploy Directory" GridPane.columnIndex="0"
52+
GridPane.rowIndex="0"/>
53+
<TextField disable="${deployButton.disabled}" fx:id="deployDir" promptText="Deploy Directory"
54+
GridPane.columnIndex="1" GridPane.rowIndex="0"/>
5155

52-
<Label disable="${deployButton.disabled}" text="JVM Arguments" GridPane.columnIndex="3" GridPane.rowIndex="2"/>
53-
<TextField disable="${deployButton.disabled}" fx:id="jvmArgs" promptText="JVM Arguments"
54-
GridPane.columnIndex="4" GridPane.rowIndex="2"/>
56+
<Label disable="${deployButton.disabled}" text="Java Home" GridPane.columnIndex="0" GridPane.rowIndex="1"/>
57+
<TextField disable="${deployButton.disabled}" fx:id="javaHome" promptText="Java Home"
58+
GridPane.columnIndex="1" GridPane.rowIndex="1"/>
5559

56-
<Label disable="${deployButton.disabled}" text="Command" GridPane.columnIndex="0" GridPane.rowIndex="3"/>
57-
<Label fx:id="command" disable="${deployButton.disabled}" GridPane.columnIndex="1" GridPane.columnSpan="4"
58-
GridPane.rowIndex="3" style="-fx-font-family: monospace"/>
59-
</GridPane>
60+
<Label disable="${deployButton.disabled}" text="JVM Arguments" GridPane.columnIndex="0"
61+
GridPane.rowIndex="2"/>
62+
<TextField disable="${deployButton.disabled}" fx:id="jvmArgs" promptText="JVM Arguments"
63+
GridPane.columnIndex="1" GridPane.rowIndex="2"/>
64+
</GridPane>
65+
</HBox>
6066

67+
<Separator orientation="HORIZONTAL" VBox.vgrow="NEVER"/>
6168

6269
<ButtonBar>
6370
<buttons>
@@ -89,5 +96,6 @@
8996
<Label fx:id="status"/>
9097
</StackPane>
9198

92-
<TextArea fx:id="console" editable="false" styleClass="console" prefRowCount="24" prefColumnCount="100"/>
99+
<TextArea fx:id="console" editable="false" styleClass="console" prefRowCount="24" prefColumnCount="100"
100+
VBox.vgrow="ALWAYS"/>
93101
</VBox>

0 commit comments

Comments
 (0)