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

Menu item redesign and sessions are manually saved to filesystem #2391

Merged
merged 25 commits into from
Oct 13, 2021

Conversation

cmdcolin
Copy link
Collaborator

@cmdcolin cmdcolin commented Oct 11, 2021

Shortlist of main changes

  1. Sessions are only written to disk on using "Save as"
  2. They can be written anywhere on the filesystem, a system dialog prompts them where to save it with default name jbrowse_session.json for their session in the desktop folder by default
  3. A recent_sessions.json file is maintained in app userData e.g. ~/.config/@jbrowse/desktop/recent_sessions.json
  4. We manually have CRUD operations on this JSON, similar to if it was a database
  5. recent_sessions.json is a list of entries in the format {path:string to path on filesystem, name: session name, screenshot: stringified data url for session screenshot, updated: +Date.now() of when session was updated}
  6. Menu is redesigned with a couple new icons chosen, including a dna icon and save+save as from materialdesignicons
  7. There is no need to avoid duplicate session names because they can share name but just have different paths, so path is now the unique key

Screenshot from 2021-10-11 16-58-15

fixes #2377
fixes #2378

@github-actions github-actions bot added the needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) label Oct 11, 2021
@garrettjstevens
Copy link
Collaborator

Looking good! I'll try it out in a bit, but just one first-glance comment: since the connections icon is a plug, it makes me think of plugins. Another option might be the Cable icon?

mui com_components_material-icons_

@cmdcolin
Copy link
Collaborator Author

Cable may not exist in @material-ui/icons@4, the latest icon searcher is e.g. import CableIcon from '@mui/icons-material/Cable';

materialdesignicons has a diagonalized cable version of it

@cmdcolin
Copy link
Collaborator Author

I also don't know if there is a way to go back to the @material-ui/icons@4 search engine...

@garrettjstevens
Copy link
Collaborator

v4 icon searcher is here: https://v4.mui.com/components/material-icons/, doesn't appear to have Cable. Could copy from the v5 code:

function CableIcon(props: SvgIconProps) {
  return (
    <SvgIcon {...props}>
      <path d="M20 5V4c0-.55-.45-1-1-1h-2c-.55 0-1 .45-1 1v1h-1v4c0 .55.45 1 1 1h1v7c0 1.1-.9 2-2 2s-2-.9-2-2V7c0-2.21-1.79-4-4-4S5 4.79 5 7v7H4c-.55 0-1 .45-1 1v4h1v1c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-1h1v-4c0-.55-.45-1-1-1H7V7c0-1.1.9-2 2-2s2 .9 2 2v10c0 2.21 1.79 4 4 4s4-1.79 4-4v-7h1c.55 0 1-.45 1-1V5h-1z" />
    </SvgIcon>
  )
}

@cmdcolin
Copy link
Collaborator Author

Kk...Added cable to @jbrowse/core/ui/Icons and used in web/desktop File menu for Open connection

@cmdcolin cmdcolin marked this pull request as draft October 12, 2021 16:27
@codecov
Copy link

codecov bot commented Oct 12, 2021

Codecov Report

Merging #2391 (f504fff) into main (ebdd085) will decrease coverage by 0.10%.
The diff coverage is 14.02%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2391      +/-   ##
==========================================
- Coverage   60.90%   60.80%   -0.11%     
==========================================
  Files         534      534              
  Lines       24638    24701      +63     
  Branches     5794     5801       +7     
==========================================
+ Hits        15007    15020      +13     
- Misses       9315     9364      +49     
- Partials      316      317       +1     
Impacted Files Coverage Δ
products/jbrowse-desktop/src/Loader.tsx 0.00% <0.00%> (ø)
.../jbrowse-desktop/src/StartScreen/LauncherPanel.tsx 0.00% <0.00%> (ø)
...browse-desktop/src/StartScreen/QuickstartPanel.tsx 0.00% <0.00%> (ø)
...se-desktop/src/StartScreen/RecentSessionsPanel.tsx 0.00% <0.00%> (ø)
...ts/jbrowse-desktop/src/StartScreen/SessionCard.tsx 0.00% <0.00%> (ø)
...op/src/StartScreen/dialogs/DeleteSessionDialog.tsx 0.00% <0.00%> (ø)
...op/src/StartScreen/dialogs/RenameSessionDialog.tsx 0.00% <ø> (ø)
products/jbrowse-desktop/src/StartScreen/util.tsx 0.00% <0.00%> (ø)
products/jbrowse-desktop/src/rootModel.ts 0.00% <0.00%> (-0.64%) ⬇️
...roducts/jbrowse-desktop/src/OpenSequenceDialog.tsx 5.08% <12.50%> (ø)
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ebdd085...f504fff. Read the comment docs.

@cmdcolin cmdcolin removed the needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) label Oct 12, 2021
@cmdcolin cmdcolin marked this pull request as ready for review October 12, 2021 17:56
@github-actions github-actions bot added the needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) label Oct 12, 2021
@cmdcolin cmdcolin marked this pull request as draft October 12, 2021 18:49
@cmdcolin
Copy link
Collaborator Author

this needed to go back into draft because there is a little confusion about the mode when saving anywhere on the filesystem, and what happens when there is no file on the filesystem.

the issue is particularly visible when installing a plugin: this requires a file on the filesystem to be rehydrated to. so probably, we should not really ever run the system without a file on the filesystem in existence

@cmdcolin
Copy link
Collaborator Author

Now we have, on the start screen, a setting called "Show autosave sessions" which is false by default. This is a little bit of a compromise between #615 and autosaves and current needs of this PR. We retain autosaves, hide by default, and allow sessions to be saved to specific places on the filesystem

Screen Shot 2021-10-12 at 5 46 50 PM

@cmdcolin cmdcolin marked this pull request as ready for review October 12, 2021 21:59
@cmdcolin
Copy link
Collaborator Author

changed format of recent_sessions.json to not contain stringified pngs, pngs now written to a 'thumbnails' folder in userdata

the file is read and dumped repeatedly during operation (on every saveSession) so needed to be kept small.

@cmdcolin cmdcolin merged commit cd2b38a into main Oct 13, 2021
@cmdcolin cmdcolin deleted the menu_item_redesign branch October 13, 2021 01:29
@cmdcolin
Copy link
Collaborator Author

optimistic merge :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Save desktop sessions as a single user-placed file Reorganize web and desktop top-level menus
2 participants