Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow 'Open Workspace' to open workspace whenever possible, even if logfile does not exist #1618

Conversation

emilyanndavis
Copy link
Contributor

@emilyanndavis emilyanndavis commented Aug 21, 2024

Description

Fixes #1598, with a solution that is more forgiving (and perhaps more user-friendly) than the one in PR #1617.

Checklist

  • Updated HISTORY.rst and link to any relevant issue (if these changes are user-facing)
  • [n/a] Updated the user's guide (if needed)
  • Tested the Workbench UI (if relevant)

Representative screenshots

Open workspace with valid logfile (logfile is no longer selected, for the sake of simplicity)

open-workspace_valid-logfile_not-highlighted_2024-08-29

Open workspace with missing logfile (in this case, it was manually deleted after a successful run)

open-workspace_missing-logfile_2024-08-23

Open empty workspace (this might happen if, for example, the workspace is readonly—see #1599)

open-workspace_empty-workspace_2024-08-23

Error modal when workspace cannot be opened (for example, if it does not exist, as would be the case if the workspace path specified a not-yet-extant subdirectory of a readonly directory—see #1599)

open-workspace_nonexistent-workspace_2024-08-23

@emilyanndavis emilyanndavis marked this pull request as ready for review August 23, 2024 20:31
Copy link
Contributor

@davemfish davemfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @emilyanndavis , this looks great to me. I like the new error modal. It's nice that openPath returns an error when it doesn't work.

I appreciate you trying to preserve the behavior of opening the workspace with the logfile selected, when it exists. I don't think we were very intentional about that behavior when we first designed this. I'm sure the main objective was just to open to the workspace directory.

So I'm curious what you think about dropping the showItemInFolder pathway altogether and always using openPath? Mainly for the sake of simplicity.

On the other hand if you like having the file selected then I think your solution in this PR is great!

workbench/tests/renderer/investtab.test.js Show resolved Hide resolved
Copy link
Contributor

@davemfish davemfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emilyanndavis this looks good except for some syntax in HISTORY that's not passing our checks. Maybe the indentation?

And I'm not sure why all the other checks are being cancelled. I didn't think the failed HISTORY check would cause that, but maybe it does?

I had one other code-comment, but it doesn't necessarily require any changes. Thanks!

if (workspace_dir) {
this.openWorkspaceDir(workspace_dir);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a benefit to defining both handleOpenWorkspace and openWorkspaceDir? As opposed to doing all the logic in one function? It's fairly inconsequential so if you prefer it this way feel free to leave it as-is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not. I think this is a holdover from when handleOpenWorkspace also called shell.showItemInFolder when the logfile was valid. With that complexity gone, it does look a little silly now.

? (
<ModelStatusAlert
status={status}
handleOpenWorkspace={() => this.handleOpenWorkspace(argsValues?.workspace_dir)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emilyanndavis
Copy link
Contributor Author

@emilyanndavis this looks good except for some syntax in HISTORY that's not passing our checks. Maybe the indentation?

And I'm not sure why all the other checks are being cancelled. I didn't think the failed HISTORY check would cause that, but maybe it does?

Yes, it was the indentation. Should be fixed now. And the other checks were cancelled because I cancelled them once I saw the HISTORY check had failed. :)

Copy link
Contributor

@davemfish davemfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good now!

@davemfish davemfish merged commit c056170 into natcap:main Sep 5, 2024
29 checks passed
@emilyanndavis emilyanndavis deleted the bugfix/1598-improved-error-handling-when-logfile-does-not-exist branch September 5, 2024 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Open Workspace button is enabled even when there is no workspace
2 participants