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

feat: Project Lifecycle #350

Merged

Conversation

cguedes
Copy link
Collaborator

@cguedes cguedes commented Aug 15, 2023

Closes #286, #288

This PR adds four new operations to Ref Studio to control the project lifecycle.

  • New Project
  • Open Project
  • Close Project
  • Try Sample Project
File Menu Entries Explorer Actions when no project is open
image image

Operations

New Project

When a new project is created (default directory is the users desktop folder), a modal asks for the project name, and the project is created empty (no files, no uploads folder) and with a unsaved file open.

Notes

  • If the project folder exists, a warning is shown, and all the content is removed.
  • The current project (and open editores) is closed
Project Name Dialog Warning message New Project
Screenshot 2023-08-15 at 15 16 04 Screenshot 2023-08-15 at 15 17 26 Screenshot 2023-08-15 at 15 20 09

Open Project

When a project is requested to be open, a folder explorer modal is opened (opens desktop by default). After selection, the current open project is closed and the new one is open.

Notes:

  • The project name show in the explorer is derived from the path (last segment)
  • Any directory can be open
Select Folder Dialog
Screenshot 2023-08-15 at 15 29 06

Close project

Closing a project can be done via File -> Close Project or via the explorer panel icon (X).
When a project is closed, all the open editors are closed and the project path reset to an empty string "".

Try Sample Project

Trying a sample project will create a sample folder RefStudio Sample in the Desktop folder with 3 files (the ones we've had before).

Notes:

  • If the action if performed again, will remove the sample folder and create a fresh sample project.
  • For now, no PDF (or reference ingestion) is performed for the sample. We should improve this later.

Extra Notes

  • Deprecated settings.general keys and created new key for the current open project project.currentDir.
    • Code migrate settings.general.appDataDir + settings.appDataDir.projectName to the new project.currentDir on the first run.
    • The settings file is kept in the application config folder (/Users/USER/Library/Application Support/studio.ref.desktop/refstudio-settings.json).
  • Updated settings panel -> general to remove project directory.
  • Project directory is shown in the footer (bottom left).
  • The uploads folder creation is delayed to the first upload (so that new projects won't have that empty folder listed).
  • Every time a project is created or open, the path is saved in the settings in order to reopen the project automatically on the next run.

@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

Merging #350 (7e8d2a4) into main (adc02a8) will decrease coverage by 1.42%.
Report is 5 commits behind head on main.
The diff coverage is 63.00%.

@@            Coverage Diff             @@
##             main     #350      +/-   ##
==========================================
- Coverage   86.35%   84.94%   -1.42%     
==========================================
  Files         150      153       +3     
  Lines        8487     8819     +332     
  Branches      957      973      +16     
==========================================
+ Hits         7329     7491     +162     
- Misses       1147     1317     +170     
  Partials       11       11              
Files Changed Coverage Δ
src/application/sidebar/ExplorerPanel.tsx 0.00% <0.00%> (ø)
src/atoms/projectState.ts 37.80% <37.80%> (ø)
src/application/listeners/projectEventListeners.ts 52.63% <52.63%> (ø)
src/io/filesystem.ts 93.84% <88.42%> (-3.84%) ⬇️
src/settings/settingsManager.ts 94.33% <91.83%> (-3.31%) ⬇️
src/AppStartup.tsx 96.29% <92.59%> (-1.63%) ⬇️
python/sidecar/settings.py 100.00% <100.00%> (ø)
src/api/sidecar.ts 100.00% <100.00%> (ø)
src/atoms/referencesState.ts 78.51% <100.00%> (+3.13%) ⬆️
src/components/InfoMessage.tsx 100.00% <100.00%> (ø)
... and 7 more

... and 5 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

src/AppStartup.tsx Outdated Show resolved Hide resolved
src/application/sidebar/ExplorerPanel.tsx Outdated Show resolved Hide resolved
src/atoms/projectState.ts Show resolved Hide resolved
src/atoms/referencesState.ts Outdated Show resolved Hide resolved
src/io/filesystem.ts Outdated Show resolved Hide resolved
@cguedes cguedes marked this pull request as ready for review August 16, 2023 08:39
@cguedes cguedes merged commit e4bcd3e into main Aug 16, 2023
9 of 11 checks passed
@cguedes cguedes deleted the 288-allow-for-projects-to-be-created-saved-opened-and-deleted branch August 16, 2023 08:42
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.

Allow for projects to be created, saved, opened, and deleted Configure project storage location
2 participants