Fix Backup & Recovery save button never enabling - #1355
Merged
Paul Lizer (paullizer) merged 2 commits intoAug 25, 2026
Conversation
Splitting the Data Management tab into five panes removed the element admin_data_management.js resolved its root from, so the module returned at startup and bound nothing. Toggling scheduled backups left the save button disabled, and the rest of the surface never loaded either. Panes now declare data-admin-group-pane="backup-recovery", the module binds across all of them, and the global save button uses the same attribute instead of the removed id. Fixes #1353 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.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.
Fixes #1353
Summary
Toggling Enable scheduled backups in Admin Settings → Backup, Migrate & Restore never enabled the Save Settings button — it stayed greyed out and labelled "Saved", so the setting could not be persisted.
The reported toggle turned out to be the visible tip of a much wider failure. The entire Backup & Recovery JavaScript module was inert: saved settings were never fetched, the backup inventory and job history never populated, and no button in any of the five tabs was wired up.
Root cause
Commit
9bbd7bda("Stage D part 6: Backup & Recovery") split the singleadmin/_panes/data-management.htmlpane into five sibling panes —backup,migrate,restore,cosmos-editor,jobs— and moved the shared save button, status line and warning into adata-admin-group-shared="backup-recovery"region outside the panes.admin_data_management.jswas not updated. It still resolved its root container from the id the split removed, and hard-stopped when it was missing:bindEvents()therefore never ran.bindDataManagementChangeTracking()was also scoped toelements.tabPane, so nochange/inputlistener was ever attached,dataManagementModifiedstayedfalse, andupdateDataManagementSaveButtonState()kept the button disabled.Measured: of the 214 element ids
bindElements()binds, exactly one —data-management— was absent from the composed Admin Settings template.The same removed id had a second consumer.
admin_settings.jsupdateSaveButtonState()hides the global Save Settings button while a Backup & Recovery tab is active:That lookup was always
null, so the global save button appeared on all five Backup & Recovery tabs alongside the dedicated one — two save buttons, only one of which applied to backup settings.Approach
Re-introducing an
id="data-management"wrapper is not viable: Bootstrap hides inactive panes through.tab-content > .tab-pane, a direct-child selector, so nesting the five panes one level deeper would stop that rule matching and display every pane at once.Instead the group membership is declared in the markup and both consumers read it. Each pane carries
data-admin-group-pane="backup-recovery", mirroring the existingdata-admin-group-shared="backup-recovery"convention and tying the panes to the real navigation group id inadmin_settings_nav.py. That also gives the functional tests a contract to enforce, so splitting or adding a Backup & Recovery tab in future cannot silently strand the module again.Changes
templates/admin/_panes/backup.htmldata-admin-group-pane="backup-recovery"templates/admin/_panes/migrate.htmldata-admin-group-pane="backup-recovery"templates/admin/_panes/restore.htmldata-admin-group-pane="backup-recovery"templates/admin/_panes/cosmos-editor.htmldata-admin-group-pane="backup-recovery"templates/admin/_panes/jobs.htmldata-admin-group-pane="backup-recovery"static/js/admin/admin_data_management.jsstatic/js/admin/admin_settings.jsconfig.pyVERSION = "0.261.001"functional_tests/test_admin_data_management_pane_binding.pyfunctional_tests/test_data_management_security_patterns.pydocs/explanation/fixes/BACKUP_SETTINGS_SAVE_BUTTON_FIX.mdThe Cosmos Editor
[data-ignore-data-management-change]opt-out is preserved, so a direct database editor still does not count as a settings edit.Testing
New
functional_tests/test_admin_data_management_pane_binding.pycovers:bindElements()resolves to a real element in the composed template — the general assertion that catches this class of bug.backup-recoverynavigation group has a pane declaring the group attribute.saveDataManagementSettings()sends, sampled across both the Backup and Migrate tabs, sit inside a tracked pane.config.pyVERSIONis at least0.261.001.Run against the pre-fix state it fails 7 of 8, including the check that names the reported symptom directly:
After the fix, 13 suites pass:
Before and after
/api/admin/data-management/settingsNotes
0.261.001and left there for this work, rather than patch-bumped per change.docs/_data/app_surface.ymlneeds no regeneration.support_menu_config.pystill links to#data-management, which keeps working through theLEGACY_TAB_REDIRECTSmap inadmin_sidebar_nav.js(data-management→backup). Left unchanged.Pre-existing issues found but not addressed
Both are documented in the fix doc and confirmed to predate this change:
functional_tests/test_admin_settings_tab_preservation.pyfails onMissing required HTML elements: ['class="tab-pane fade']. It reads the rawadmin_settings.htmlrather than the composed template, so it broke when the panes moved into includes. Verified: fails identically with these changes stashed.config.pyversion literal, the pattern the versioning instructions call out and thattest_support.versioning.assert_app_version_at_leastexists to replace. They were already failing — the highest literal in the suite is0.260.023whileconfig.pywas0.260.028. Verified the bump to0.261.001breaks none of them further, since no test asserts either version.getElementByIdliterals inadmin_settings.jswith no matching id in the composed template (for exampleworkspaces,agents-tab,enable_group_creation_setting). Some look like stale leftovers from the same information-architecture rework; others resolve against templates outside Admin Settings. Worth its own audit.