Allow refreshing parts from the info provider they were created with - #1532
Open
killecaptron wants to merge 2 commits into
Open
Allow refreshing parts from the info provider they were created with#1532killecaptron wants to merge 2 commits into
killecaptron wants to merge 2 commits into
Conversation
Updating a part from an info provider so far always went through the provider search: pick a provider, search for the part again, choose the right result - even though the part already knows exactly which provider and which provider ID it was created from. Add a button which uses that reference directly and jumps straight to the merge view of the same part at the same provider. It is only shown if the part actually was created by a provider and that provider is still active, and its tooltip states when the part was last updated from the provider. The link bypasses the info provider cache, as the whole point of pressing it is to get the current data. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The refresh button updates a single part from the provider it was created with, but keeping a whole shelf of parts up to date meant pressing it once per part. Add a "Refresh from info providers" action to the parts table, which does the same thing for the whole selection. It reuses the existing bulk import job for that: only the search step is replaced, as nothing has to be searched for - every part already knows its provider and provider ID, so its single result is exactly that provider entry, and the user lands directly in the well-known review step, where parts can be applied one by one or all at once. Building the results contacts no provider at all: the data is fetched when a part is actually applied, exactly as it is for an imported part. Parts which can not be refreshed (not created by a provider, or their provider is gone or disabled) are kept in the job with an error, so they stay visible instead of silently dropping out of the selection. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1532 +/- ##
============================================
- Coverage 62.39% 62.33% -0.07%
- Complexity 9879 9897 +18
============================================
Files 736 737 +1
Lines 31779 31866 +87
============================================
+ Hits 19829 19864 +35
- Misses 11950 12002 +52 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Updating a part from its info provider means going through the provider search again, even
though the part already stores which provider and which provider-specific ID it came from. For
a part that is refreshed regularly this is three steps to reach a page the part could link to
directly — and there is no way at all to refresh several parts without repeating those steps
for each one.
Change
Two steps, one per commit:
a button that goes straight to the existing update route with the stored provider key and ID,
bypassing the search. The tooltip shows when the part was last updated from the provider.
infrastructure (
BulkInfoProviderImportJob) rather than adding a second mechanism, so batchsize, the part count limit and the timeout handling all apply unchanged.
The new
BulkRefreshResultsBuildersorts the selection out beforehand: parts which were notcreated from a provider, and parts whose provider is no longer installed or is disabled, are
skipped and reported in the result instead of failing the whole job.
Both use
no_cache, since the point of an explicit refresh is to get current data.Notes on rate limits
Every refreshed part costs one provider request, and providers enforce limits per account
(TrustedParts, for example, allows 50 requests per 10 seconds) and often bill per request. This
PR does not add any pacing of its own — it inherits the bulk import's batch size and part count
limit, which bound the work but not the request rate. I have a follow-up which paces Part-DB's
provider requests centrally; happy to submit that first if you would rather have the guard rail
in place before this.
Permissions
No new permission: the button appears under the same conditions as the existing "update from
info provider" entry (
editon the part plus@info_providers.create_parts).