Snapins: refresh the "Snapin File (exists)" selector after a save - #1765
Merged
Merged
Conversation
Uploading a new file on the snapin general tab saved it to the storage node and set it as the snapin's file, but the page kept the old list and the old selection. The file input also kept the upload, so the next Update sent the same file again. After a successful save the tab now clears the file input and re-reads the list from a new getSnapinFileSelector sub, which selects the snapin's saved file. The option building moves into one helper, so the drawn list and the refreshed list cannot drift. The selector row is now always rendered, so there is a selector to fill after the first upload onto an empty node. The JS hides the row while it holds no files, as before. registerGeneralTab gains an optional onSuccess hook for this. The sub is get-prefixed, so Authorization maps it to view, the same as getSnapinPrimaryStoragegroups. FOG_BCACHE_VER 368 -> 369. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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
On the snapin edit page, uploading a new file on the General tab saves it to the storage node and sets it as the snapin's file. The page does not show that. The "Snapin File (exists)" selector keeps the old list and the old selection. The file input also keeps the upload, so a second Update sends the same file again.
Change
getSnapinFileSelectorsub. The sub selects the snapin's saved file._snapinFileOptions()builds the options for both the page and the sub, so the two lists cannot drift.fog.snapin.edit.jshides the row while it holds no files, as before.$.registerGeneralTabgains an optionalonSuccesshook.FOG_BCACHE_VER368 -> 369.Access
The sub is
get-prefixed, soAuthorization::resolvePagePermission()maps it toview. That is the same rulegetSnapinPrimaryStoragegroupsuses. No permission change.Testing
getSnapinFileSelectoranswers 401 JSON, the same as its sibling subs.🤖 Generated with Claude Code