Skip to content

Add-on Store: Added the action to cancel the install of a add-on when it is being downloaded.#16671

Merged
seanbudd merged 44 commits into
nvaccess:masterfrom
hwf1324:cancelDownloadOrInstallAddon
Sep 6, 2024
Merged

Add-on Store: Added the action to cancel the install of a add-on when it is being downloaded.#16671
seanbudd merged 44 commits into
nvaccess:masterfrom
hwf1324:cancelDownloadOrInstallAddon

Conversation

@hwf1324

@hwf1324 hwf1324 commented Jun 9, 2024

Copy link
Copy Markdown
Contributor

Link to issue number:

Closes #15578

Summary of the issue:

When downloading an add-on from the add-on store, if you don't want to continue downloading the add-on or have downloaded it by mistake, currently users can only remove the add-on once it is installed.

Description of user facing changes

Add the action to cancel the install of a add-on.
You can cancel the ongoing download when the add-on is being downloaded, and cancel the installation of the add-on when it's waiting to be installed.

Description of development approach

Added an actions specific to the add-on when downloading it:

  • When the add-on is downloading: cancel the download of the add-on.
  • When the add-on download is complete: cancel the installation of the add-on.

Batch actions are also supported.

Testing strategy:

Manual testing:

  1. When the status of the add-on is "Downloading": Cancel the download.
  2. When the status of the add-on is "Downloaded, pending install": Cancel the installation.
  3. When multiple add-ons are selected, among which there are add-ons that are being downloaded or waiting to be installed: deselect the installation of the add-on.

Test results:

The status of the add-on changes to the previous status, and the temporary/cache files are cleared.

Known issues with pull request:

The "Installed, pending restart" case is not handled.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

Summary by CodeRabbit

  • New Features

    • Added the ability to cancel the installation of selected add-ons in the add-on store.
  • Documentation

    • Updated user guide and change log to include information about the new cancel installation feature for add-ons.

@hwf1324 hwf1324 requested a review from a team as a code owner June 9, 2024 09:03
@hwf1324 hwf1324 requested a review from SaschaCowley June 9, 2024 09:03
@hwf1324

hwf1324 commented Jun 9, 2024

Copy link
Copy Markdown
Contributor Author

cc: @seanbudd , @CyrilleB79 , @nvdaes
Can you help review this PR?

@nvdaes nvdaes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Cancelling installation and download seem to work properly.
I don't speak English natively, but my impression is that the documentation regarding changes maybe improved, for example, using the word added instead of add. Also, mentioning these actionns in the user guide maybe helpful, and if batch actions were supported, for example to cancell all installation and downloads, or even an action to cancell downloads and pending installing. For example, if some add-ons have been downloaded and some of them are been currently downloading, an action to cancell all this, so that when Escape is pressed NVDA doesn't require restart, will be great.

@hwf1324

hwf1324 commented Jun 9, 2024

Copy link
Copy Markdown
Contributor Author

Cancelling installation and download seem to work properly. I don't speak English natively, but my impression is that the documentation regarding changes maybe improved, for example, using the word added instead of add. Also, mentioning these actionns in the user guide maybe helpful, and if batch actions were supported, for example to cancell all installation and downloads, or even an action to cancell downloads and pending installing. For example, if some add-ons have been downloaded and some of them are been currently downloading, an action to cancell all this, so that when Escape is pressed NVDA doesn't require restart, will be great.

Thanks @nvdaes , I appreciate your review!

Yes, documentation is indeed a problem and I don't speak English. I hope to get more suggestions and will try to improve it afterwards.

Regarding the batch action, the main thing I'm thinking about is what should the action be called?

And one more thing, should it deal with "Installed, pending restart"? There seems to be an ambiguity in the current wording of " cancel install".

@hwf1324 hwf1324 changed the title Add-on Store: Add the action to cancel the download/install of a add-on when it is being downloaded. Add-on Store: Added the action to cancel the download/install of a add-on when it is being downloaded. Jun 9, 2024
@nvdaes

nvdaes commented Jun 9, 2024

Copy link
Copy Markdown
Collaborator

Regarding the batch action, the main thing I'm thinking about is what should the action be called?
And one more thing, should it deal with "Installed, pending restart"? There seems to be an ambiguity in the current wording of " cancel install".

I'd prefer just to have an action to cancel downloading and also installation, since the same add-on cannot have a download in progress and, at the same time, a state of pending installing. For me having two actions is not needed and makes the design more complicated.
NVDA, when using the cancel installation action, is not requesting to restart, so I don't know if something about this should be done.
You may name the cancel action just Cancel installation, imo download can be seen as part of the process of installing, and add-ons aren't downloaded if they won't be installed.

@cary-rowen

Copy link
Copy Markdown
Contributor

cc @Qchristensen @XLTechie
For doc, this requires help from a NV Access and native English speaker.

Comment thread user_docs/en/changes.md Outdated
@josephsl

josephsl commented Jun 9, 2024

Copy link
Copy Markdown
Contributor

Hi,

I don't think we should limit docs review to native English speakers. Native English speakers can provide specific grammar/spelling/active/passive voice suggestions, but the best people who could review docs might be folks who can understand the proposed code a bit better and understand some intricacies of technical communication (both Quentin and Luke are well qualified). I added a docs suggestion based on overall PR description and after thinking about intentions of the PR author and how things could get lost when expressing changes from one language to another (a.k.a. translator's point of view). Also, if you haven't, I advise mentioning the new action in the user guide.

Thanks.

@cary-rowen

Copy link
Copy Markdown
Contributor

@josephsl

I don't think we should limit docs review to native English speakers. Native English speakers can provide specific grammar/spelling/active/passive voice suggestions, but the best people who could review docs might be folks who can understand the proposed code a bit better and understand some intricacies of technical communication (both Quentin and Luke are well qualified).

Yes you are right, thank you for reviewing and giving some valuable suggestions.

@hwf1324 hwf1324 requested a review from a team as a code owner June 10, 2024 04:43
@hwf1324 hwf1324 requested a review from Qchristensen June 10, 2024 04:43
@XLTechie

XLTechie commented Jun 10, 2024 via email

Copy link
Copy Markdown
Collaborator

@hwf1324

hwf1324 commented Jun 10, 2024

Copy link
Copy Markdown
Contributor Author

The Cancel download control will do nothing, because there is no download in progress. But the user's over all intention, of cancelling the installation of the add-on, has not been accomplished.

In fact in the code, canceling a download calls the cancel install function if the download has completed.

But it has to be recognized that this is not clear.

@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Jun 11, 2024
@seanbudd

Copy link
Copy Markdown
Member

Please make the cancellation a single action, whether or not the download has completed shouldn't be relevant to the user

@seanbudd seanbudd marked this pull request as draft June 11, 2024 03:56
@hwf1324 hwf1324 changed the title Add-on Store: Added the action to cancel the download/install of a add-on when it is being downloaded. Add-on Store: Added the action to cancel the install of a add-on when it is being downloaded. Jun 11, 2024
@hwf1324 hwf1324 marked this pull request as ready for review June 11, 2024 08:28
@coderabbitai

coderabbitai Bot commented Jun 11, 2024

Copy link
Copy Markdown
Contributor

Walkthrough

The update enhances the NVDA add-on store by introducing the ability to cancel the installation of add-ons that are either downloading or have been downloaded but not yet installed. This feature provides users with more control, allowing them to abort unwanted installations directly from the GUI, rather than manually deleting files.

Changes

File Path Change Summary
source/addonStore/network.py Added import for AvailableAddonStatus and modified _done method to check addon status.
source/gui/.../actions.py Introduced a batch action for canceling addon installations and added canUseCancelInstallAction method.
source/gui/.../addonList.py Added canUseCancelInstallAction method to AddonListViewModel to check addon status.
source/gui/.../store.py Added methods cancelInstallAddon and cancelInstallAddons to handle canceling installations.
user_docs/en/changes.md Documented the new feature allowing users to cancel installations of downloaded add-ons.
user_docs/en/userGuide.md Updated user guide to include instructions on canceling add-on installations post-download.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GUI
    participant ViewModel
    participant Network

    User ->> GUI: Select add-ons to cancel
    GUI ->> ViewModel: Invoke cancelInstallAddons
    ViewModel ->> Network: Check addon status
    Network -->> ViewModel: Return status
    ViewModel ->> Network: Cancel installation if status is DOWNLOADING or DOWNLOAD_SUCCESS
    Network -->> ViewModel: Confirm cancellation
    ViewModel -->> GUI: Update status
    GUI -->> User: Display updated add-on status
Loading

Assessment against linked issues

Objective (Issue #15578) Addressed Explanation
Users can cancel the installation of downloaded/in-progress add-ons
Add a cancel/abandon operation for add-ons in downloaded/waiting states

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit d41062bdf2

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

Outside diff range and nitpick comments (1)
user_docs/en/changes.md (1)

35-35: Consider enhancing the description for clarity.

The current description is a bit vague. Consider specifying what the user can expect when they choose to cancel the installation. For example:

- Added an action in the add-on store's updatable/available add-ons list that allows users to cancel the installation of add-ons that are currently being downloaded or are pending installation. This ensures greater control over the add-on management process. (#15578, @hwf1324)

Comment thread source/gui/addonStoreGui/viewModels/store.py Outdated
Comment thread source/gui/addonStoreGui/controls/actions.py Outdated
Comment thread source/addonStore/network.py Outdated
Comment thread source/gui/addonStoreGui/viewModels/store.py Outdated
Comment thread source/gui/addonStoreGui/viewModels/store.py Outdated
Comment thread source/gui/addonStoreGui/viewModels/store.py Outdated
Comment thread source/gui/addonStoreGui/viewModels/store.py Outdated
Comment thread user_docs/en/changes.md Outdated
Comment thread user_docs/en/userGuide.md Outdated
@seanbudd seanbudd marked this pull request as draft June 12, 2024 01:16
@seanbudd

seanbudd commented Sep 2, 2024

Copy link
Copy Markdown
Member

@hwf1324

A new issue has been encountered where temporary download files may not be deleted in time when the download is canceled. will throw an error that is occupied by another program.

This sounds like an issue with thread locking still. I'll push a branch for you to test which adds locks

@hwf1324

hwf1324 commented Sep 2, 2024

Copy link
Copy Markdown
Contributor Author

@seanbudd

This sounds like an issue with thread locking still. I'll push a branch for you to test which adds locks

This is more noticeable when downloading very large add-ons, such as xyOCR.

I was getting download speeds of 10MB or more.

@seanbudd

seanbudd commented Sep 2, 2024

Copy link
Copy Markdown
Member

See proposed code here: hwf1324#1
And build to test: https://ci.appveyor.com/project/NVAccess/nvda/builds/50516360

@seanbudd seanbudd marked this pull request as draft September 2, 2024 02:06
@hwf1324

hwf1324 commented Sep 2, 2024

Copy link
Copy Markdown
Contributor Author

See proposed code here: hwf1324#1 And build to test: https://ci.appveyor.com/project/NVAccess/nvda/builds/50516360

I've gone through the test of cancelling on multiple downloads and it's working fine now.

Although I can't reproduce the error I encountered before on the previous code.

Comment thread source/addonStore/models/addon.py Outdated
Comment thread source/gui/addonStoreGui/viewModels/store.py Outdated
Comment thread source/addonStore/models/addon.py Outdated
@hwf1324 hwf1324 marked this pull request as ready for review September 2, 2024 06:57
Comment thread source/addonStore/models/addon.py Outdated

@SaschaCowley SaschaCowley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Generally looks fine to me, I just think there may have been a missed lock.

Comment thread source/addonStore/network.py
@seanbudd seanbudd force-pushed the cancelDownloadOrInstallAddon branch from 7ff11f7 to 7c44238 Compare September 3, 2024 02:19

@Qchristensen Qchristensen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reads well

@seanbudd seanbudd merged commit 8cdd43a into nvaccess:master Sep 6, 2024
@github-actions github-actions Bot added this to the 2025.1 milestone Sep 6, 2024
@hwf1324 hwf1324 deleted the cancelDownloadOrInstallAddon branch September 9, 2024 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. merge-early Merge Early in a developer cycle

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add-on store: Users can uninstall downloaded/in-progress add-ons

10 participants