Fix the deploy UI #386

Merged
merged 11 commits into from Jan 20, 2016

Projects

None yet

7 participants

@ThomasJClark
Contributor

A lot of users seem to have problems using the deploy UI. This PR should hopefully address those problems, and help us get information about future ones.

  • People seem to think the deploy is frozen a lot. I don't think we actually have a bug, I think this is either because the progress bar is always indeterminate, because you actually need to hit another button that appears after you deploy for the program to run, or because the UI actually does briefly freeze during deployment.
  • I think the "FRC" vs "FRC Advanced" thing is tripping people up. Users don't seem to completely understand the relationship between these two settings and the team number/deploy address settings, and that's probably because the two features were developed independently around the same time and kind of hacked together. Now that both are merged in, we can make the deployment GUI offload that logic to the settings and just provide a manual override.
  • When an error does happen, people usually have very little information to provide us. I think most cases would be solved without any effort on our part if we just had a label that plainly stated the error, and if not then at least we would have something to go on when helping users debug.

Note: all of the text fields below are automatically filled in, so users don't have to know what to use, but they can change it if they want.

New error messages

No connection to the roboRIO

unknown host

Wrong username/password (if manually overridden)

username

Java not installed (or in the wrong place if manually overridden)

java

Progress bars

Indeterminate (ex: waiting for connections)

status

Determinate (ex: uploading files)

uploading

Running

#383 needs to get merged before master will run on a roboRIO again, but this is what it looks like when it starts to run.

running

Misc. Improvements

  • Everything is configurable by the user, so this should be able to be used by teams employing coprocessors (as long as they deploy with SSH)
  • The project can be deployed even if it's not saved. Also, if there have been changed made to it since the last save, this will upload the changed version.
  • The GRIP jar doesn't have to be copied to a second, temporary local file. This may improve speed and disk usage.

TODO

  • Stop the pipeline when GRIP is running headlessly
  • Add a button to stop GRIP
  • Possible save username, directories, etc... to project settings?
  • @JLLeitschuh let me know if there's anything else you can think of, or any ideas on how the current changes can be improved.

Closes #352
Closes #367
Closes #375
Closes #376
Closes #377
Closes #388

See also:

@codecov-io

Current coverage is 50.81%

Merging #386 into master will increase coverage by +2.99% as of 9f91d13

@@            master    #386   diff @@
======================================
  Files          127     121     -6
  Stmts         3808    3621   -187
  Branches       417     423     +6
  Methods          0       0       
======================================
+ Hit           1821    1840    +19
- Partial        114     118     +4
+ Missed        1873    1663   -210

Review entire Coverage Diff as of 9f91d13


Uncovered Suggestions

  1. +0.58% via .../ExceptionAlert.java#83...103
  2. +0.41% via ...cketPreviewView.java#90...104
  3. +0.39% via ...cketPreviewView.java#38...51
  4. See 7 more...

Powered by Codecov. Updated on successful CI builds.

@cpapplefamily

When do you plan to release the latest version?

@ThomasJClark
Contributor

I'm thinking sometime this week. If depends on when all of these PRs get finished and merged

@AustinShalit
Member

If this is a more general deploy menu, should it be labeled with the FIRST logo?

@AustinShalit
Member

Maybe add a button that allows users to default to FRC defaults

@ThomasJClark
Contributor

If this is a more general deploy menu, should it be labeled with the FIRST logo?

Good point, maybe a generic "play" icon would be better

Maybe add a button that allows users to default to FRC defaults

It actually fills in FRC defaults automatically

@JLLeitschuh
Member

I agree with @AustinShalit on this one.
I still haven't reviewed this yet.

@ThomasJClark
Contributor

I agree with @AustinShalit on this one.

Which one? The icon?

@JLLeitschuh
Member

Yea, the genericizing the icon and the menu.
Also, I think that we should retain the ability to stop and then restart the deployed instance of GRIP.

@JLLeitschuh
Member

I don't know if you care, but currently your commit message won't automatically close those issues when this is merged.

@ThomasJClark
Contributor

They're already closed except #377.

Do I need to add it to a commit message to close it?

@JLLeitschuh JLLeitschuh and 1 other commented on an outdated diff Jan 19, 2016
...c/main/java/edu/wpi/grip/ui/MainWindowController.java
- dialog.showAndWait();
- } else {
- final Alert alert = new Alert(Alert.AlertType.INFORMATION,
- "You must have saved your project before it can be deployed to a remote device.");
- alert.getDialogPane().getStylesheets().addAll(root.getStylesheets());
- alert.getDialogPane().setStyle(root.getStyle());
-
- // Workaround for JavaFX's default Alert styling causing text to get cut off
- Label alertLabel = (Label) alert.getDialogPane().getChildren().filtered(node -> node instanceof Label).get(0);
- alertLabel.setMinHeight(Region.USE_PREF_SIZE);
-
- alert.showAndWait();
- }
-
+ public void deploy() {
+ ImageView graphic = new ImageView(new Image("/edu/wpi/grip/ui/icons/first.png"));
@JLLeitschuh
JLLeitschuh Jan 19, 2016 Member

Let's make this more generic since we don't just want to upload for FRC.

@JLLeitschuh JLLeitschuh commented on the diff Jan 19, 2016
ui/src/main/java/edu/wpi/grip/ui/DeployController.java
+ */
+@ParametrizedController(url = "Deploy.fxml")
+public class DeployController {
+
+ // Default deploy information for FRC. This can be overridden by the use for applications outside of FRC or not
+ // using the roboRIO (ie: coprocessors)
+ public final static String DEFAULT_USER = "lvuser";
+ private final static String DEFAULT_PASSWORD = "";
+ private final static String DEFAULT_JAVA_HOME = "/usr/local/frc/JRE/";
+ private final static String DEFAULT_DIR = "/home/" + DEFAULT_USER;
+ private final static String GRIP_JAR = "grip.jar";
+ private final static String PROJECT_FILE = "project.grip";
+
+ @FXML private TextField address;
+ @FXML private TextField user;
+ @FXML private TextField password;
ThomasJClark added some commits Jan 17, 2016
@ThomasJClark ThomasJClark Relace the deploy UI ade556e
@ThomasJClark ThomasJClark Stop the pipeline when deploying
So the local GRIP and deployed GRIP don't try to publish to the same
NetworkTables keys
7199ec6
@ThomasJClark ThomasJClark Add a deploy icon
Because deploy should be generic enough to work on platforms other than
the roboRIO, the icon should not be a FIRST logo
778cbc4
@ThomasJClark ThomasJClark Shutdown headless GRIP on SIGHUP
This means that when we deploy, the remote headless GRIP will shut
itself down when the SSH session is closed.
71668e7
@ThomasJClark ThomasJClark Add a cancel button c68b22b
@ThomasJClark ThomasJClark Improve stop handling
370f099
@ThomasJClark ThomasJClark Put property binding in FXML instead of in the controller
bcea46a
@JLLeitschuh JLLeitschuh commented on the diff Jan 20, 2016
ui/src/main/java/edu/wpi/grip/ui/DeployController.java
+ private final static String PROJECT_FILE = "project.grip";
+
+ @FXML private TextField address;
+ @FXML private TextField user;
+ @FXML private TextField password;
+ @FXML private TextField javaHome;
+ @FXML private TextField deployDir;
+ @FXML private ProgressIndicator progress;
+ @FXML private Button deployButton;
+ @FXML private Label status;
+ @FXML private TextArea console;
+
+ @Inject private EventBus eventBus;
+ @Inject private Project project;
+ @Inject private Pipeline pipeline;
+ @Inject private Logger logger;
@JLLeitschuh
JLLeitschuh Jan 20, 2016 Member

Formatting

@ThomasJClark
ThomasJClark Jan 20, 2016 Contributor

Both ways are used in the project, and we have no officially documented style guide. I've mostly been going by the Google Java Style for now:

A single parameterless annotation may instead appear together with the first line of the signature

This is consistent with the project so far, and I think is much more readable than this:

@FXML
private TextField address;
@FXML
private TextField user;
@FXML
private TextField password;
@FXML
private TextField javaHome;
@FXML
private TextField deployDir;
@FXML
private ProgressIndicator progress;
@FXML
private Button deployButton;
@FXML
private Label status;
@FXML
private TextArea console;
@Inject
private EventBus eventBus;
@Inject
private Project project;
@Inject
private Pipeline pipeline;
@Inject
private Logger logger;

Of course, we should keep that "may" in mind. In particular, @Settings, which has two relative long String parameters, should probably not be on the same line as the member declaration.

@JLLeitschuh
JLLeitschuh Jan 20, 2016 Member

We haven't really made an official decision on styling. We decided originally to use the default for Intellij. If you want to change it then we need to talk about it as a team.

@ThomasJClark
ThomasJClark Jan 20, 2016 Contributor

We haven't really made an official decision on styling

Like I said, this is true.

We decided originally to use the default for Intellij.

Like both of us said, this isn't true. Although I have recommended using IntelliJ's autoformatter, we never said our official style guide was the default settings in IntelliJ, and in practice our codebase more closely matches Google Java Style.

If you want to change it then we need to talk about it as a team.

I'm not changing anything. This code does not violate any official style guidelines we have, or any written but unofficial ones, and it's consistent with our current code, and it's subjectively more readable. If we want to establish an official style guide, I would think that would involve meeting as a team (although really I don't see why anyone would object to officially adopting Google's style)

@JLLeitschuh JLLeitschuh and 1 other commented on an outdated diff Jan 20, 2016
.../java/edu/wpi/grip/core/settings/ProjectSettings.java
+ @Setting(label = "Default deploy directory", description = "The directory on the remote host to deploy GRIP to.")
+ private String deployDir = "/home/lvuser";
+
+ @Setting(label = "Default deploy user", description = "The username to log in with when deploying over SSH.")
+ private String deployUser = "lvuser";
+
+ @Setting(label = "Default deploy java home", description = "Where Java is installed on the robot.")
+ private String deployJavaHome = "/usr/local/frc/JRE/";
@JLLeitschuh
JLLeitschuh Jan 20, 2016 Member

I don't like that this is specific to FRC by default.
I think we should do this differently, perhaps a button to assign the FRC defaults.
FRC teams are not our exclusive audience and if we do this I feel that it will make people feel that this application won't work for them if they aren't using a FRC control system

@ThomasJClark
ThomasJClark Jan 20, 2016 Contributor

FRC teams are really our primary audience, especially for the deploy tool. I think we'll have lots of issues/angry CD posts if we don't just make it work when you hit "Deploy".

IMO researchers/hobbyists/college students can probably figure out pretty quickly how to configure the deploy tool, if they use it at all.

Maybe eventually we can have a project wizard, and one of the templates you can select would be FRC

@JLLeitschuh JLLeitschuh commented on the diff Jan 20, 2016
ui/src/main/resources/edu/wpi/grip/ui/Deploy.fxml
+
+<?import edu.wpi.grip.ui.util.DPIUtility?>
+<?import edu.wpi.grip.ui.DeployController?>
+<?import javafx.scene.control.*?>
+<?import javafx.scene.image.Image?>
+<?import javafx.scene.image.ImageView?>
+<?import javafx.scene.layout.*?>
+<VBox styleClass="deploy-pane" maxWidth="Infinity" xmlns:fx="http://javafx.com/fxml/1"
+ xmlns="http://javafx.com/javafx/null" fx:controller="edu.wpi.grip.ui.DeployController">
+ <GridPane maxHeight="Infinity">
+ <columnConstraints>
+ <ColumnConstraints hgrow="NEVER"/>
+ <ColumnConstraints hgrow="ALWAYS"/>
+ </columnConstraints>
+
+ <Label disable="${deployButton.disabled}" text="Address" GridPane.columnIndex="0" GridPane.rowIndex="0"/>
@JLLeitschuh
JLLeitschuh Jan 20, 2016 Member

For all labels make sure you set what the label is a label for.
There should be a tag that is called for or similar.
https://docs.oracle.com/javafx/2/api/javafx/scene/control/Label.html#labelForProperty()

@ThomasJClark
ThomasJClark Jan 20, 2016 Contributor

labelFor is for keyboard shortcuts, which I'm not using here

@JLLeitschuh JLLeitschuh commented on the diff Jan 20, 2016
ui/src/main/java/edu/wpi/grip/ui/DeployController.java
+ SCPFileTransfer scp = ssh.newSCPFileTransfer();
+ scp.setTransferListener(new LoggingTransferListener() {
+ @Override
+ public StreamCopier.Listener file(String name, long size) {
+ setStatusAsync("Uploading " + name, false);
+ return transferred -> {
+ if (isNotCanceled())
+ Platform.runLater(() -> progress.setProgress((double) transferred / size));
+ };
+ }
+ });
+
+ // The project may or may not be saved to a file (and even if it was saved, it might be modified), so we
+ // serialize it to a string before deploying.
+ StringWriter projectWriter = new StringWriter();
+ project.save(projectWriter);
@JLLeitschuh
JLLeitschuh Jan 20, 2016 Member

Shouldn't we just ask if they want to save before they open the deploy UI?

@ThomasJClark
ThomasJClark Jan 20, 2016 Contributor

Why? What if you've made some changes that you want to test before saving?

@JLLeitschuh
JLLeitschuh Jan 20, 2016 Member

Sure. Thats fine. But shouldn't you offer them the option of saving before deploying.

@ThomasJClark
ThomasJClark Jan 20, 2016 Contributor

Why? That might mislead people into thinking you have to save to deploy, and I think it would get annoying after a while if you're not trying to save

@JLLeitschuh
Member

Closing the deploy UI doesn't stop the upload attempt.

@ThomasJClark
Contributor

Closing the deploy UI doesn't stop the upload attempt.

That's correct. I think people want to be able to work on their pipeline while they're running a test on the roboRIO to adjust things if it needs improvement. That's why I added separate "Stop" and "Close" buttons.

@stephenstockman

The new deploy interface looks awesome and am especially happy about the new method of seeing errors great work. As for the whole prompt for saving as a user I just want to be able to quickly alter and test different values without overwriting a previous working file for this getting promoted to save all the time will eventually get annoying. When something works better I'll either save it as a seperate file or overwrite the existing one manually.

@JLLeitschuh
Member

Moving chat to here so it doesn't get deleted by updating the files:

I don't like that this is specific to FRC by default.
I think we should do this differently, perhaps a button to assign the FRC defaults.
FRC teams are not our exclusive audience and if we do this I feel that it will make people feel that this application won't work for them if they aren't using a FRC control system

.

FRC teams are really our primary audience, especially for the deploy tool. I think we'll have lots of issues/angry CD posts if we don't just make it work when you hit "Deploy".

IMO researchers/hobbyists/college students can probably figure out pretty quickly how to configure the deploy tool, if they use it at all.

Maybe eventually we can have a project wizard, and one of the templates you can select would be FRC

I think we should have different deploy configurations. For example, deploying to a PI may require more configuration than to an FRC device.
We may need to mess with jars more for deploying to a PI. There's a whole problem with hard vs softabi and needing to upload different versions of network tables for that to work. (I was talking to Patrick and Fred about this)

@nightpool

@JLLeitschuh

I'm with @ThomasJClark on this one—right now non-FRC systems are the exception, especially when it comes to deployment. I don't even really see it as a very useful option in many other contexts tbqh.

maybe the right thing to do would be to provide a FRC-specific build that makes a lot of these things the default?

ThomasJClark added some commits Jan 20, 2016
@ThomasJClark ThomasJClark Update project settings for new deploy stuff
This generally makes ProjectSettings a little more cleaned up, but
mostly makes it work nicely with the deploy settings.  The deploy
variables are all now saved persistantly in the project settings, and
things like the deploy URL are calculated in a way that makes a little
more sense (so the user actually sees the calculated value)
7dc3d72
@ThomasJClark ThomasJClark Add deploy shortcut (ctrl+r) and update icon
The dialog graphic is now the settings icon, since it shows deploy
settings.  It also looked weird before, since it had the same play icon
in both a button and the dialog header. Plus, I'm somewhat concerned
that the unlabled play icon could be interpreted as a status icon (ie:
it's indicating that something is currently running)
1820184
@ThomasJClark ThomasJClark Fix padding
a4c6ffb
@ThomasJClark ThomasJClark Remove old error reporting stuff
The errors just show up in the console
f287e4f
@JLLeitschuh JLLeitschuh merged commit f65cb0f into WPIRoboticsProjects:master Jan 20, 2016

2 of 4 checks passed

codecov/patch 22.00% of diff hit (target 70.00%)
Details
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
codecov/project 50.81% (+2.99%) compared to 5f6d528 at 47.82%
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment