Repository navigation
Implement the Profiles section on the Control page - #261
yakutovicha wants to merge 4 commits into
Conversation
I would leave that out of this PR though. (no scope creep) I would be honestly fine for leaving this tab out of the initial 3.12 image release, out of all the others this one seems least useful at this point since most / all users will currently have only a single profile, and having more of them doesn't make much sense without more design / UX work in the Apps imo. |
|
@danielhollas I agree and discuss with @yakutovicha in person. We will close this PR for now and reassess for JL later. I let @yakutovicha do the honors 🙂 |
Replace the ProfileControlWidget placeholder with a per-profile row list: default badge, in-use marker, Make default, and Delete with an inline confirmation. - The config is always read fresh from disk (load_config), both to list and to change it. AiiDA's cached config misses changes made by other processes, and storing it would silently drop them, e.g. a profile created in a terminal after the page was loaded. - Delete is disabled for the profile loaded by the page. The "also delete all data" checkbox defaults to off and is passed explicitly, since Config.delete_profile deletes the storage by default. - Refresh rebuilds the rows and dismisses any pending confirmation, whose target may no longer exist. - Deleting the default profile reports the profile AiiDA picked as the new default. Tested against a fake config (badge placement, disabled states, the make-default and delete flows, confirmation dismissal) and, on the real test config, that making a profile the default keeps a profile added by another process.
When the deleted profile was the default and no profiles remain, AiiDA keeps the deleted name as the default, so the success message claimed the deleted profile was the new default. The "No profiles remain." branch could never be reached. Only name a new default when profiles remain. Also quote the name in the "Deleting profile" message, as in the other messages. The test fake now keeps the stale default like AiiDA does, and a new test deletes the last (default) profile and checks that no new default is claimed.
The test for keeping external config changes clicked "Make default" on the only test profile, which is already the default, so the button was disabled and the default never changed on disk. Add a second profile before rendering and make it the default, then check on disk both that the default changed and that the profile added by another process survived the store.
Making a profile the default does not change the profile this page has loaded: it stays marked "(in use)", and the Daemon tab keeps controlling its daemon until the page is reloaded. Say so in the success message, consistent with the Status tab's "reload the page to apply" warning. The make-default test asserts the full message.
79de393 to
afaa582
Compare
17d969a to
c19b4f4
Compare
|
as discussed, closing |
Fixes #256
Replaces the
ProfileControlWidgetplaceholder with one row per profile in the AiiDA config:Config.delete_profiledeletes the storage by default).Refresh rebuilds the rows and dismisses any pending confirmation, whose target may no longer exist.
Notes for review:
load_config(), both to list and to change it. AiiDA's cachedget_config()misses changes made by other processes, andstore()writes the whole in-memory config back, so a profile created in a terminal after the page loaded would silently disappear on "Make default". A test covers this against the real test config.Tests
Against a fake config (which mirrors AiiDA's default handling): badge placement, disabled states, name escaping, the make-default and delete flows (including retargeting the confirmation, cancel, failure, and deleting the last default profile), and confirmation dismissal on refresh. Against the real test config: making another profile the default changes it on disk and keeps a profile added by another process.
🤖 Generated with Claude Code