allow admin to delete files from ListOfFiles page
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- python, typescript
- Domain
- api, full-stack
Research direction
Start by reading server/api/views/uploadFile/views.py at UploadFileView/delete, then inspect FileRow.tsx around FileRow/handleSave and ListOfFiles, including updateFileName. Add the delete flow, confirmation prompt, and parent-state removal described in the issue. Done means an admin can delete any file from /listoffiles, the file disappears without a reload, and accidental deletion requires typing "delete".
Written by the indexing model from the issue text.
Description
Current State
Currently, there is no option to delete a file. In /listoffiles, there is only an "edit" button and a "download" button for each file.
We do have a backend endpoint for this at DELETE /v1/api/uploadFile. The view is at /server/api/views/uploadFile/views.py/UploadFileView/delete, but it is not called by the frontend currently. It allows only the uploader of the file to delete it.
Expected Behavior
- Any admin (
superuser) can delete any file from the/listoffilespage. - Shows a confirmation prompt before deletion
- Make accidental deletion near impossible by requiring them to type "delete"
- Deleted file disappears from the list without page reload
Changes needed
Backend:
- in
uploadFile/views.py/uploadFileView/delete, update the permission check to allow superusers (admin):
if upload_file.uploaded_by != request.user and not request.user.is_superuser:
Frontend:
- Add a delete button to each
FileRowalongside the existing edit and download buttons - Add the confirmation dialog before sending the delete request
- call
DELETE /api/v1/api/uploadFilewith{ guid: file.guid }and JWT auth header (same pattern as the existing edit handler aroundFileRow.tsx/FileRow/handleSave) - On success, remove the file from the parent component's state, making it disappear without a reload
- for reference, check out how
updateFileNameworks - you'll need to create a new
onDeleteprop, defined inListOfFilesand passed toFileRow.
- for reference, check out how
@sue-hntr Sue is a UX designer and can weigh in on design decisions and other specifics
- Dominant language
- TypeScript
- Stars
- 21
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CodeForPhilly/balancer-main
-
Bug
Difficulty 1/5 1-3 hours Newbie friendliness 72/100
CodeForPhilly/balancer-main#509 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 76/100
CodeForPhilly/balancer-main#503 ·
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
CodeForPhilly/balancer-main#502 · 1 comment ·
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
CodeForPhilly/balancer-main#488 ·
-
Documentation
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
CodeForPhilly/balancer-main#478 ·
All issues in CodeForPhilly/balancer-main
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
bcgov/bc-wallet-mobile#4761 · 1 comment ·
-
external-issue to-triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
area-deployment area-integrations triage:bot-seen
Difficulty 2/5 Half a day Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
refactor
Difficulty 2/5 1-3 hours Newbie friendliness 84/100