Skip to content

feat(cloud-registry): add admin option to form - #501

Merged
anuragxxd merged 4 commits into
devfrom
feat/create-form-admin-fields
Nov 1, 2026
Merged

anuragxxd merged 4 commits into
devfrom
feat/create-form-admin-fields

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #457, closes #447.

Changes to ecc-client-elixir-cloud-registry-service-create:

  • New property admin (default true, so nothing changes for existing apps). When it is false, 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 before admin changed. As an attribute, admin="false" turns it off (a custom converter, because type: Boolean can't turn off a property that defaults to true).
  • "Contact URL" and "Documentation URL" move to the main section, above "Description".
  • Empty timestamps are not sent (as before).
  • Docs: admin and baseUrl in the properties table, plus a section on admin.

The admin property also covers #447. The custom ID is admin-only (PUT /services/{id} for a new ID returns 403 for everyone else), so a separate allow-custom-id isn't needed.

Apps set admin from admin of Cloud Registry's GET /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) and npm run build for @elixir-cloud/cloud-registry: pass. The ESLint warnings are the ones already on dev.
  • The package has no test setup yet; tests are blocked on test: set up unit, integration and e2e tests #484 (the test stack is your decision). Until then, I checked the behaviour in Chromium with a Playwright script against the built package and a mock provider: cc-forms-checks/check-457-admin-fields.mjs (with harness.mjs, outside the repo; I can add them here or attach them). 19 checks pass on this branch, and 12 fail on dev, as expected. They cover:
    • the default fields;
    • the position of the contact and documentation URLs;
    • with admin: a PUT with the custom ID and the timestamps sent;
    • with admin=false: the fields and the section hidden, a POST without timestamps, also after admin changes at runtime;
    • the attribute values "false", "" and none.
  • CI: all checks pass (Conflict markers, Lint, Test on Node 22 and 24, PR title, Read the Docs).

Declined review findings

  • Demo page instance with admin="false" (low): the demo page needs a running registry anyway. The docs show the attribute.
  • Tests in the repo (low): blocked on test: set up unit, integration and e2e tests #484.
  • nothing instead of the empty html`` (low): the file doesn't use nothing anywhere, 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:

  • Add an admin option to control access to admin-only service creation fields and payload values.

Enhancements:

  • Move contact and documentation URLs into the main service details section.

Documentation:

  • Document the base URL and admin properties, including usage for HTML and React applications.

uniqueg and others added 2 commits October 28, 2026 19:47
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]>
@sourcery-ai

sourcery-ai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Adds 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 creation

sequenceDiagram
    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
Loading

Flow diagram for admin-controlled form fields

flowchart 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]
Loading

File-Level Changes

Change Details Files
Adds an admin property that controls exposure and submission of registry-admin-only fields.
  • Defaults to true for backward compatibility and supports case-insensitive admin="false" attribute conversion.
  • Hides Advanced Configuration, custom service ID, and timestamps when disabled, including after runtime changes.
  • Omits timestamps and prevents custom-ID creation requests when admin mode is disabled.
packages/ecc-client-elixir-cloud-registry/src/components/service-create/service-create.ts
Reorganizes the service form's general metadata fields.
  • Moves Contact URL and Documentation URL into the main section above Description.
  • Keeps the advanced section limited to admin-only configuration and renders it empty when unavailable.
packages/ecc-client-elixir-cloud-registry/src/components/service-create/service-create.ts
Documents the new component configuration and usage.
  • Adds baseUrl and admin to the properties table.
  • Documents admin-only behavior, attribute semantics, runtime permission-source guidance, and React/HTML examples.
apps/documentation/pages/docs/cloud-registry/components/service-create.mdx

Assessment against linked issues

Issue Objective Addressed Explanation
#447 Allow apps to render the service-creation form without the custom service ID field, while preserving the existing default behavior. ✅
#457 Move the Contact URL and Documentation URL fields into the main section above Description. ✅
#457 Add an admin option, defaulting to true, that hides custom ID and timestamp fields and the now-empty Advanced Configuration section for non-admins, and prevents those admin-only values from being submitted. ✅
#457 Do not send empty timestamps. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@read-the-docs-community

read-the-docs-community Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

@uniqueg
uniqueg marked this pull request as ready for review October 28, 2026 20:46
@uniqueg
uniqueg requested a review from anuragxxd as a code owner October 28, 2026 20:46

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

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

codecov Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.02985% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.07%. Comparing base (893e176) to head (8b80abf).
⚠️ Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
...ry/src/components/service-create/service-create.ts 94.02% 4 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@anuragxxd anuragxxd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery assessment

Approved.

@anuragxxd
anuragxxd merged commit ee4a4fc into dev Nov 1, 2026
19 checks passed
@anuragxxd
anuragxxd deleted the feat/create-form-admin-fields branch November 1, 2026 05:19
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.

feat(cloud-registry): create form layout and roles feat(cloud-registry): option to hide the custom ID

2 participants