-
-
Notifications
You must be signed in to change notification settings - Fork 189
feature(attachments): add bulk deleting attachments using the row selector in table with mock api TASK-1516 TASK-1710 #5626
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
Conversation
|
||
interface BulkDeleteMediaFilesProps { | ||
selectedSubmissions: SubmissionResponse[] | ||
selectedRowIds: string[] // an array of the selected submission UIDs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't fully understand these two. One of these is a list of submission responses, and the other is a list of submission ids? So like first is a raw data of all possible submissions with attachments, and the second is a list of selected submissions?
Could we do this differently?
One idea would be to only have one prop, which is SubmissionResponse[]
but only of selected rows and only ones with attachments - this would require parent of the component to have some logic
Other idea would be to move that getSelectedSubmissionsWithAttachments
logic here. So we would pass whole unfiltered SubmissionResponse[]
(so it would factually be selectedSubmissions
, and not selectedSubmissionsButOnlyOnesWithAttachments
). Then you don't need selectedRowIds
, because you will get that from selectedSubmissions
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prop containing a row of Ids was a leftover so I got rid of it. The idea is to implement the first option (which I think is successful after I fix the comment previous to this).
I originally wanted to do the second option because I don't want the parent component to have extra logic but it lead to a dependency loop that I didn't want to spend budget time to fix for the MVP. I think in general we'd want to go with less logic for the parent components if reasonable, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in general we'd want to go with less logic for the parent components if reasonable, right?
Yes :)
{getMediaCount(props.selectedSubmissions)} | ||
</Text> | ||
} | ||
onClick={() => setWarningAcknowledged(!warningAcknowledged)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should also have checked={warningAcknowledged}
</Button> | ||
|
||
<Button | ||
disabled={!warningAcknowledged || isDeletePending} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have found a bug:
- Open this bulk delete modal
- π’ checkbox is unchecked, and "Delete" button is disabled
- Check the checkbox
- Close the modal with "x"
- Open modal again
- π checkbox is unchecked, and "Delete" button is not disabled
This is happening because warningAcknowledged
is not being reset to false
when modal is being closed.
Co-authored-by: Leszek Pietrzak <[email protected]>
ποΈ Checklist
<type>(<scope>)<!>: <title> TASK-1234
frontend
orbackend
unless it's globalπ£ Summary
Adds a way to bulk delete attachments for submissions through the table view bulk options.
π Preview steps
Standard workflow:
removingAttachmentsEnabled
feature flagSome deleted files workflow:
submissionsActions.getSubmissions.listen
fromjsapp/js/actions/submissions.ts
file, like so:response.results[<index>]._attachments
is useful to test how many attachments/submissions are displayed in the modalis_deleted
tag