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

fix: drag and drop to be correct directory #18400

Merged
merged 7 commits into from
Oct 8, 2021

Conversation

ImCesar
Copy link
Contributor

@ImCesar ImCesar commented Oct 7, 2021

Fixed a bug where drag and drop was adding a directory above the one provided. The server now handles getting the correct directory path. User can now pick a directory or drag and drop a directory. Also if they drag a file from their project directory it will get the root directory correctly.

Demo

GlobalAddProject.mov

PR Tasks

  • Have tests been added/updated?
  • Has the original issue or this PR been tagged with a release in ZenHub?
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?
  • Have new configuration options been added to the cypress.schema.json?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 7, 2021

Thanks for taking the time to open a PR!

Copy link
Contributor

@JessicaSachs JessicaSachs left a comment

Choose a reason for hiding this comment

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

Quick naming change. I haven't tested this locally.

packages/data-context/src/actions/ProjectActions.ts Outdated Show resolved Hide resolved
return path
}

return path.substring(0, path.lastIndexOf('/'))
Copy link
Contributor

Choose a reason for hiding this comment

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

Speaking of the native path module, this is likely going to break on windows. Can we sanitize the projectPath using the real path module?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good callout, I was curious how the front end would pass the path string when this was being done on the client. I am going to pull this on windows as well to double check everything is working

@@ -52,9 +51,22 @@ function handleButtonClick () {

function handleFileSelection (e: Event) {
const target = e.target as HTMLInputElement
const dirPath = getDirectoryPath(target.files)
const files = target.files
const path = getFilePath(files)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not as bothered by path on the client side because there's no confusion.

Copy link
Contributor

@JessicaSachs JessicaSachs left a comment

Choose a reason for hiding this comment

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

(apparently you can't delete incorrect reviews)

@JessicaSachs JessicaSachs self-requested a review October 8, 2021 00:27
Copy link
Contributor

@JessicaSachs JessicaSachs left a comment

Choose a reason for hiding this comment

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

Nice. Thanks for updating everything.

@ImCesar ImCesar merged commit 6610083 into unified-desktop-gui Oct 8, 2021
@ImCesar ImCesar deleted the fix-drag-and-drop-path branch October 8, 2021 01:30
tgriesser added a commit that referenced this pull request Oct 10, 2021
* unified-desktop-gui: (40 commits)
  feat: index.html configurability and storybook support (#18242)
  fix: remove .json check from require_async, prevent child_process spawn (#18416)
  percy snapshot the tooltip visually, prevent it from being hidden
  fix: failing tests from #18372 (#18414)
  fix: `everyNthFrame` should only be applied for Chrome 89+ (#18392)
  feat(app): render spec list, command log, iframe (#18372)
  fix: drag and drop to be correct directory (#18400)
  refactor: Add GitDataSource, FileDataSource, toast for errors (#18385)
  docs: General updates to contributing guide (#18283)
  Add shorter --ct alias for --component
  Add --e2e and --component CLI options
  chore: Update Chrome (beta) to 95.0.4638.40 (#18389)
  chore: use circleci timings split for e2e tests (#18367)
  fix: fixed title (#18370)
  chore(deps): update dependency electron to v14 🌟 (#18384)
  chore(server): share client route (#18215)
  fix: Prevent Cypress from crashing when argument parsing "spec: {}" (#18312)
  chore: update husky dev dependency to v7 (#18345)
  feat: add defineConfig function to help type config (#18302)
  chore: Update Chrome (stable) to 94.0.4606.71 (#18324)
  ...
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.

None yet

3 participants