Skip to content

Snapins: refresh the "Snapin File (exists)" selector after a save - #1765

Merged
fog-workflows[bot] merged 1 commit into
working-1.6from
fix/snapin-file-selector-refresh
Sep 14, 2026
Merged

fog-workflows[bot] merged 1 commit into
working-1.6from
fix/snapin-file-selector-refresh

Conversation

@mastacontrola

@mastacontrola mastacontrola commented Sep 14, 2026

Copy link
Copy Markdown
Member

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

  • After a successful save, the General tab clears the file input and re-reads the selector from a new getSnapinFileSelector sub. 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.
  • The selector row is always rendered, so it exists to fill after the first upload onto an empty node. fog.snapin.edit.js hides the row while it holds no files, as before.
  • $.registerGeneralTab gains an optional onSuccess hook.
  • FOG_BCACHE_VER 368 -> 369.

Access

The sub is get-prefixed, so Authorization::resolvePagePermission() maps it to view. That is the same rule getSnapinPrimaryStoragegroups uses. No permission change.

Testing

  • Both phpstan passes are clean.
  • Deployed to the 1.6 lab. Signed out, getSnapinFileSelector answers 401 JSON, the same as its sibling subs.
  • Not yet run: the upload in a signed-in browser. On a throwaway snapin, upload a file with a new name, click Update, and confirm that the selector lists and selects the new file and that the file input is empty.

🤖 Generated with Claude Code

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>
@fog-workflows
fog-workflows Bot enabled auto-merge September 14, 2026 12:53
@fog-workflows
fog-workflows Bot added this pull request to the merge queue Sep 14, 2026
Merged via the queue into working-1.6 with commit 2695e86 Sep 14, 2026
11 checks passed
@fog-workflows
fog-workflows Bot deleted the fix/snapin-file-selector-refresh branch September 14, 2026 13:02
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.

1 participant