tanishqgandhi1908 opened a new pull request, #8428:
URL: https://github.com/apache/texera/pull/8428

   ### What changes were proposed in this PR?
   
   The upload panel on a dataset's or model's **Versions & Files** tab said 
*"Drag & drop file/folder to upload"*, and dragging a folder did work — but the 
button beside it could only pick files. Uploading a folder was possible only by 
dragging one in, which rules out a maximised window, a laptop with nothing to 
drag from, and keyboard use.
   
   The panel now offers **Upload Files** and **Upload Folder**.
   
   Two buttons rather than one, because a file input cannot do both: a folder 
can only be chosen when the input carries `webkitdirectory`, and that attribute 
*switches the dialog's mode* rather than widening it — with it the OS dialog 
picks only directories, without it only files. Drag & drop can accept either 
because it is a different API: a drop carries entries that report 
`isFile`/`isDirectory`, while an input hands back a flat `FileList`. Google 
Drive, Dropbox and OneDrive all split the same choice in two.
   
   The panel keeps one hidden input per mode and both buttons feed the same 
handler.
   
   `fileDropped`'s tail — size limits, conflict resolution, existing-file 
skipping, the banner — is now a shared `addSelection`, so both routes behave 
identically.
   
   **Before** — one button, files only:
   
   <img width="368" height="167" alt="issue7-1-upload-panel-before" 
src="https://github.com/user-attachments/assets/a6f0a743-0c2b-4adc-bb35-88be8fb05db9";
 />
   
   
   **After** — the folder route is reachable without dragging:
   <img width="368" height="167" alt="issue7-1-upload-panel-after" 
src="https://github.com/user-attachments/assets/eee6a5be-0368-46dc-ac0b-42e8abf2fad5";
 />
   
   
   ### Any related issues, documentation, discussions?
   
   Closes #8387.
   
   ### How was this PR tested?
   
   `files-uploader.component.spec.ts` and `version-uploader.component.spec.ts`, 
108 passed. Four new
   cases:
   
   - one picker per mode, asserting only the folder input carries 
`webkitdirectory`
   - each button opens its own picker, and not the other
   - **a picked folder keeps its structure** — `readings/2026/a.csv` rather 
than `a.csv`
   - a picked loose file uses its bare name, which is what it carries
   
   One existing case, `opens the file selector from the drop-zone button`, 
asserted the button clicked
   `ngx-file-drop`'s hidden input. That input is no longer the picker, so it is 
replaced by the two cases
   above.
   
   ```
   cd frontend
   npx ng test --include 
src/app/dashboard/component/user/files-uploader/files-uploader.component.spec.ts
 \
     --include 
src/app/dashboard/component/user/version-uploader/version-uploader.component.spec.ts
   ```
   
   Checked end-to-end against a local stack by picking a real folder through 
the new button:
   
   ```
   readings/
   ├── notes.md
   └── 2026/{a.csv,b.csv}
   
   staged -> readings/notes.md, readings/2026/a.csv, readings/2026/b.csv
   ```
   
   Full relative paths, nested folder included — identical to dropping the same 
folder in.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 5)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to