Repository navigation
feat(cloud-registry): add admin option to form - #501
Conversation
Add the property `admin` (default `true`) to the create form. When it is `false`, the form hides the fields that only admins may set (custom service ID, `createdAt`, `updatedAt`), and with them "Advanced Configuration", and never sends them, also if they were filled in before. Move "Contact URL" and "Documentation URL" to the main section, above "Description". Closes #457, closes #447. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Document the attribute converter, accept `false` in any case, set the admin-only fields in one place and document `baseUrl`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideAdds backward-compatible admin-aware behavior to the Cloud Registry service creation form, preventing non-admin users from seeing or submitting custom IDs and timestamps, relocates general URL fields, and documents the new configuration. Sequence diagram for admin-aware service creationsequenceDiagram
actor User
participant Form as ServiceCreateForm
participant Registry as CloudRegistry
User->>Form: createService()
alt admin
Form->>Registry: PUT /services/{customServiceId}
Form->>Registry: serviceData with createdAt and updatedAt
else non-admin
Form->>Registry: POST /services
Form->>Registry: serviceData without custom ID or timestamps
end
Flow diagram for admin-controlled form fieldsflowchart TD
A[admin property] --> B{admin is true?}
B -->|Yes| C[Show Advanced Configuration]
C --> D[Allow custom service ID and timestamps]
B -->|No| E[Hide Advanced Configuration]
E --> F[Exclude custom ID and timestamps from submission]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Documentation build overview
|
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. If admin is incorrectly set to false, the form omits custom IDs and timestamps, so a service may be created with a generated ID or without the intended values; that registration remains after reverting, though it is bounded and can be corrected or recreated. The registry still checks permissions itself, so this option does not grant access to admin-only operations.
Resolve the conflict in service-create.ts: keep the admin option and use the provider from dev's provider handling (#502). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #501 +/- ##
==========================================
+ Coverage 69.93% 70.07% +0.13%
==========================================
Files 23 23
Lines 5216 5240 +24
Branches 132 134 +2
==========================================
+ Hits 3648 3672 +24
Misses 1566 1566
Partials 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
anuragxxd
left a comment
There was a problem hiding this comment.
Tested locally against a fake registry. With admin=false, "Advanced Configuration" is hidden and the custom ID and timestamps are never sent, even if they were filled in before switching. With admin=true, a custom ID goes via PUT /services/{id}. With dev merged in, tests, lint and build all pass.
Summary
Closes #457, closes #447.
Changes to
ecc-client-elixir-cloud-registry-service-create:admin(defaulttrue, so nothing changes for existing apps). When it isfalse, the form hides the fields that only admins may set (custom service ID, "Created At", "Updated At"), and with them "Advanced Configuration", which would be empty. It also never sends them, even if they were filled in beforeadminchanged. As an attribute,admin="false"turns it off (a custom converter, becausetype: Booleancan't turn off a property that defaults totrue).adminandbaseUrlin the properties table, plus a section onadmin.The
adminproperty also covers #447. The custom ID is admin-only (PUT /services/{id}for a new ID returns403for everyone else), so a separateallow-custom-idisn't needed.Apps set
adminfromadminof Cloud Registry'sGET /me. The registry still checks permissions itself.The other form PRs (#456 type picker, #461 environments, #453 validation, #462 change events) touch the same file. Each one is branched from
dev, so they can be reviewed in any order; I'll resolve the merge conflicts after each merge.Verification
npm run lint(pre-commit hook, all packages) andnpm run buildfor@elixir-cloud/cloud-registry: pass. The ESLint warnings are the ones already ondev.cc-forms-checks/check-457-admin-fields.mjs(withharness.mjs, outside the repo; I can add them here or attach them). 19 checks pass on this branch, and 12 fail ondev, as expected. They cover:admin: a PUT with the custom ID and the timestamps sent;admin=false: the fields and the section hidden, a POST without timestamps, also afteradminchanges at runtime;"false",""and none.Declined review findings
admin="false"(low): the demo page needs a running registry anyway. The docs show the attribute.nothinginstead of the emptyhtml``(low): the file doesn't usenothinganywhere, so I kept its style.Open questions
None.
🤖 Generated with Claude Code
Summary by Sourcery
Add admin-aware controls to the Cloud Registry service creation form while preserving existing admin-enabled behavior by default.
New Features:
Enhancements:
Documentation: