Repository navigation
Add the FOG 1.6 FOG Configuration settings page - #204
Merged
Merged
Conversation
GET /about/settings renders the settings catalog (config/fog-settings.js) as the 1.6 FOG Settings page: one card, a live search box, a category nav and one panel per category, with each row's value from sails.helpers.settings.get. A Setting record that is not a catalog key, such as schema, never shows. The page answers 403 without setting.read and disables every control without setting.update. A stored value that is not an option (FOG_VIEW_DEFAULT_SCREEN = 30) shows as one more, selected option. A catalog type the page cannot render answers 500 and logs the key and the type. Each control saves on change through POST /api/v1/setting/save (setting.update, apiCsrfGuard). A key not in the catalog, or a value that normalize() rejects, answers 400 with the 1.6 body and stores nothing. Only a string or a number reaches normalize(), so a crafted JSON body gets a 400, not a 500. A good save stores the normalized value and answers 202 with the 1.6 body. req.audit names the setting. The sidebar gets the 1.6 "FOG Configuration" leaf (order 150, after iPXE Menu). The two pinned menu lists and the ui16-03 header table gain the new entry. Tests: test/integration/settings-page.test.js (fails on the base: the route did not exist) and the UI check tools/smoke/checks/fog-settings.js. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#203 (the Audit Log page) added the Logging group at the same menu and smoke-table positions as this branch's FOG Configuration entry. Keep both, FOG Configuration (150) before Logging (170). Co-Authored-By: Claude Opus 5.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.
I built the FOG Settings page at
/about/settings, with its save route and its tests, and committed it onfactory/issue-199as4c2aa90.npm test,npm run test:uiandnpm run test:ui:prodall pass on the final code. Both reviewers (opus) are clean after two rounds.What changed
GET /about/settings(api/controllers/pages/settings.js,views/pages/settings.ejs) shows the settings catalog (config/fog-settings.js) in the 1.6 layout:#settings-searchand#settings-search-clearin its header;sails.helpers.settings.get. ASettingrecord that is not a catalog key, such asschema, never shows.setting.read. Withoutsetting.update, every control is disabled.FOG_VIEW_DEFAULT_SCREEN= 30) shows as one more option, selected.views/pages/partials/settings.js, inlined throughpartialname):?search=pre-fills it. A category click clears the search. Below 768px, a panel title toggles its panel.$.ajax. A good save shows the success toast, plus a "Reload required" toast for a reload row. A failed save puts the select back to its stored value and shows an error toast.POST /api/v1/setting/save(api/controllers/setting/save.js) has the policiesisLoggedIn,isAuthenticatedandapiCsrfGuard, and checkssetting.updateitself.Unknown setting: <key>. The check uses own keys only, soconstructorandschemaare refused too.normalize()rejects answers 400<key> value is not valid.req.auditnames the setting.fas fa-wrench, order 150) now sits after iPXE Menu. Both pinned menu lists have the new entry.menu.test.jsalso checks that the leaf is active on/about/settings.test/integration/settings-page.test.jsis new and covers 16 cases.tools/smoke/checks/fog-settings.jsis new./about/settingsis now inPAGES.Why, and where it differs from 1.6
The issue asks for a validated settings page. Until now the only way to change a setting was a raw
POST /api/v1/setting, which checks nothing. These choices differ from the 1.6 markup or from the spec's file list:data-keyanddata-descriptioninstead of 1.6's singledata-searchstring. The script matches each field on its own, as the spec words it, and reads the value from the live control. So a saved value matches without a page reload; 1.6 reloads the page body after each save. One difference: a term that spans two fields (for example "mode this") matched in 1.6 and does not match here.<a>also gets the Bootstrap 5nav-link activeclasses, so the active category shows as a pill. The 1.6li.activestays, so the existing CSS still applies.normalize(). A crafted body such as{"value":{"toString":1}}used to answer 500. It now answers 400. An array or a boolean value is now refused too.tools/smoke/checks/ui16-03-shell.jsgained a header row. That check fails on anyPAGESentry that has no row.Tests
The new mocha file fails on the base commit: 14 of its first 14 cases answer 404.
Each gate also failed its test when I put its defect back in a scratch copy:
apiCsrfGuardon the save routeX-Requested-With→ 403setting.updatecheckininstead ofObject.hasOwnconstructor) → 400setting.readgatecanUpdatealways truenormalizechecksideways→ 400The UI runs leave no tracked file changed.
The sandbox cannot reach GitHub, and one dependency (
sails-mongo) comes from GitHub, sonpm cifailed here. I used a copy of the localnode_modulesinstead. Five packages in it were older than the lockfile, so I replaced them with the exact lockfile versions from npm and checked each against the lockfile's integrity hash. CI runsnpm cias usual.Reviews
The models: Opus 5.5 planned and implemented the change.
spec-reviewerandstandards-reviewerboth ran on opus, because the tier is critical.canUpdatenow usesaudit.can.data-reloadattribute, not a test for the icon class.:modelroutes. No:modelroute can match it, so I corrected the comment.Holdout scenarios: none for this repo.
Tier: critical (opus, effort xhigh).
Closes #199
🤖 Generated with Claude Code