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

Add incomplete upload dialog to DLP when unembargo is blocked #2082

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jjnesbitt
Copy link
Member

Recently we've had several instances of a dandiset unembargo being blocked by incomplete/active uploads. Most of the time, these uploads are junk and the owners simply wish to clear them, which requires admin intervention. This PR adds the API and Vue client support for users to list and delete these lingering uploads themselves.

Here is a video of the new UI.

dandi-unembargo-uploads-2024-11-21_14.18.53.mp4

Copy link
Member

@mvandenburgh mvandenburgh left a comment

Choose a reason for hiding this comment

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

LGTM except one note about pagination

Comment on lines 467 to 482
@swagger_auto_schema(
methods=['GET'],
manual_parameters=[DANDISET_PK_PARAM],
request_body=no_body,
operation_summary='List active/incomplete uploads in this dandiset.',
)
@action(methods=['GET'], detail=True)
def uploads(self, request, dandiset__pk):
dandiset: Dandiset = self.get_object()

# Special case where a "safe" method is access restricted, due to the nature of uploads
self.require_owner_perm(dandiset)

uploads: QuerySet[Upload] = dandiset.uploads.all()
serializer = DandisetUploadSerializer(instance=uploads, many=True)
return Response(serializer.data, status=status.HTTP_200_OK)
Copy link
Member

Choose a reason for hiding this comment

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

I think we should paginate these. Someone could theoretically DoS the server by creating thousands of uploads (which may be a completely legitimate action) and then hitting this endpoint.

Copy link
Member Author

Choose a reason for hiding this comment

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

Just pushed that change. It's a bit awkward since we can't use the default pagination behavior, due to this being a "detailed" endpoint that still needs pagination. That was originally the reason I didn't bother, since it seemed unlikely to be an issue anyway, but better safe than sorry. I've also changed the client to match that, and tested it locally, confirming the overall behavior is unchanged.

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.

2 participants