Skip to content

Disable uploading files while an upload is in progress - #2237

Merged
pomegranited merged 1 commit into
openedx:masterfrom
open-craft:viadanna/block-uploads-master
Jul 3, 2025
Merged

pomegranited merged 1 commit into
openedx:masterfrom
open-craft:viadanna/block-uploads-master

Conversation

@viadanna

Copy link
Copy Markdown
Contributor

This PR disables the upload button and shows a spinner during uploads so continuing to click the upload button doesn't flood the LMS with requests.

What changed?

  • Disables the Upload Files button when upload starts.
  • Shows a spinner to indicate to the learner an upload is in progress.
  • Toggle both when the upload finishes or fails.

Developer Checklist

Testing Instructions

  1. Deploy this version of the xblock to a devstack or instance.
  2. Create a course and add the xblock.
  3. Edit the xblock settings to allow uploads.
  4. Go to the xblock in the LMS.
  5. Open the browser developer console and set throttling to 3G.
  6. Select a few files and click Upload files.
  7. Confirm the button is disabled and a spinner appears.
  8. Disable throttling in the developer console.
  9. Confirm the button is enabled again and the spinner disappears when the upload finishes.

Reviewer Checklist

Collectively, these should be completed by reviewers of this PR:

  • I've done a visual code review
  • I've tested the new functionality

FYI: @openedx/content-aurora

@viadanna
viadanna requested a review from a team September 26, 2024 10:36
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Sep 26, 2024
@openedx-webhooks

openedx-webhooks commented Sep 26, 2024 •

Copy link
Copy Markdown

Thanks for the pull request, @viadanna!

This repository is currently maintained by @openedx/2u-aurora.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@codecov

codecov Bot commented Sep 26, 2024 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.29%. Comparing base (3418d7b) to head (e733351).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2237   +/-   ##
=======================================
  Coverage   95.29%   95.29%           
=======================================
  Files         195      195           
  Lines       21664    21664           
  Branches     1509     1509           
=======================================
  Hits        20644    20644           
  Misses        771      771           
  Partials      249      249           
Flag Coverage Δ
unittests 95.29% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kaustavb12 kaustavb12 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

  • I tested this: Tested in local devstack
  • I read through the code

@itsjeyd itsjeyd added the product review PR requires product review before merging label Oct 11, 2024
@itsjeyd

itsjeyd commented Oct 11, 2024

Copy link
Copy Markdown

@viadanna Since this is a user-facing change it will need to go through product review. You can get that process started by creating a product proposal and pinging #wg-product-core on Slack to find a coordinator (cf. docs).

CC @kaustavb12

@pomegranited

Copy link
Copy Markdown
Contributor

@viadanna @kaustavb12 Once Product is done with their review, feel free to ping me for a CC review & merge.

@itsjeyd

itsjeyd commented Nov 21, 2024

Copy link
Copy Markdown

Hey @viadanna, checking in to see if you've had a chance yet to ping #wg-product-core on Slack to find a coordinator for the product proposal (openedx/platform-roadmap#387) for this PR?

@viadanna

Copy link
Copy Markdown
Contributor Author

@itsjeyd Yes, I did, but got no answer yet.

Cup0fCoffee pushed a commit to open-craft/openedx-platform that referenced this pull request Mar 7, 2025
Setting ora2 dependency to our fork while awaiting upstream PR being
merged[1]. Once it's merged, upstream will bump up the dependency
version which will include this change, so will be able to drop this
commit.

1: openedx/edx-ora2#2237

(cherry picked from commit 506201e)
Cup0fCoffee pushed a commit to open-craft/openedx-platform that referenced this pull request Mar 10, 2025
Setting ora2 dependency to our fork while awaiting upstream PR being
merged[1]. Once it's merged, upstream will bump up the dependency
version which will include this change, so will be able to drop this
commit.

1: openedx/edx-ora2#2237

(cherry picked from commit 506201e)
@itsjeyd
itsjeyd requested a review from ali-hugo May 8, 2025 07:37
@itsjeyd itsjeyd added the waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. label May 19, 2025
@itsjeyd itsjeyd added product review complete PR has gone through product review and removed product review PR requires product review before merging waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. labels Jun 27, 2025
@itsjeyd itsjeyd moved this from Product Review to Waiting on Author in Contributions Jun 27, 2025
@viadanna
viadanna force-pushed the viadanna/block-uploads-master branch from 3fc6d0e to d64de50 Compare June 27, 2025 11:35
@viadanna

Copy link
Copy Markdown
Contributor Author

@pomegranited this is good for CC review.

@pomegranited pomegranited left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @viadanna, this is working great, thank you for this fix!

One nit on styles, but I can approve once that's fixed.

👍

  • I tested this using the demoX course's ORA block
  • I read through the code
  • I checked for accessibility issues by using my keyboard to navigate and checking the aria tags
  • Includes documentation
  • User-facing strings are extracted for translation N/A

</div>
<input type="file" class="submission__answer__upload file--upload" id="submission_answer_upload_{{ xblock_id }}" {% if allow_multiple_files %}multiple=""{% endif %} accept="{{white_listed_file_types|join:", "}}">
<button type="submit" class="file__upload action action--upload">
<span class="icon fa fa-spinner fa-spin is--hidden" aria-hidden="true"></span>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is working great, but the is--hidden style isn't working so well, so the spinner is causing the button text to be off center:

image

Could you update %state-hidden to make display: none !important;?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure @pomegranited done 👍

@viadanna
viadanna force-pushed the viadanna/block-uploads-master branch 2 times, most recently from 8a267ad to d90fd57 Compare June 30, 2025 16:32
@viadanna
viadanna force-pushed the viadanna/block-uploads-master branch from d90fd57 to e733351 Compare July 2, 2025 08:08

@pomegranited pomegranited left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for that fix @viadanna , it's working perfectly now.

@pomegranited
pomegranited merged commit eab965d into openedx:master Jul 3, 2025
@github-project-automation github-project-automation Bot moved this from Waiting on Author to Done in Contributions Jul 3, 2025
@pomegranited
pomegranited deleted the viadanna/block-uploads-master branch July 3, 2025 09:39
@viadanna

Copy link
Copy Markdown
Contributor Author

@pomegranited are you able to create a new release from the tag 6.16.4 so we can bump this on master?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U product review complete PR has gone through product review

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants