Repository navigation
feat(cloud-registry): pick service types from list - #503
Conversation
Replace the three free-text type fields of the create form with one list of the registered types (`GET /services/types`), labelled `group · artifact · version`. The new property `allowNewType` (attribute `allow-new-type`, default `true`) adds "Add new service type", which shows required fields for a new type; without it, only listed types can be chosen. If no types are registered, the new-type fields show right away (or a hint, if adding is off). The list reloads after a service is created. Closes #456. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Track whether the types are loading, loaded or failed: show the new-type fields or the "none registered" hint only for a loaded, empty list, and a hint if loading failed. Ignore outdated answers, drop a chosen type that is no longer listed, keep the entered type when "Add new service type" is chosen again, and fire no failure event when the reload after a create fails. Accept `false` in any case. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Clear an implicit new type when adding types is turned off, keep a new type being entered when types show up, and drop the list of a previous registry when loading fails. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThe service creation form now loads registered Cloud Registry service types into a labeled picker, optionally permits adding a new type through validated fields, handles asynchronous loading and refresh edge cases, and documents the new Sequence diagram for service type loading and creation refreshsequenceDiagram
participant Form as ServiceCreateForm
participant Provider as CloudRegistryProvider
participant Registry as CloudRegistry
Form->>Provider: loadServiceTypes()
Provider->>Registry: getServiceTypes()
Registry-->>Provider: service types
Provider-->>Form: serviceTypes
Form->>Form: selectType(choice)
Form->>Provider: createService(formData)
Provider->>Registry: createService(formData)
Registry-->>Provider: service created
Provider-->>Form: success
Form->>Provider: loadServiceTypes(false)
Provider->>Registry: getServiceTypes()
Registry-->>Provider: refreshed service types
Provider-->>Form: serviceTypes
State diagram for service type loading and selectionstateDiagram-v2
[*] --> Loading
Loading --> Loaded: getServiceTypes()
Loading --> Failed: getServiceTypes() throws
Loaded --> ListedChoice: selectType(listed type)
Loaded --> NewType: selectType(NEW_TYPE)
Loaded --> NewType: no registered types and allowNewType
ListedChoice --> Loaded: serviceTypes reload drops stale choice
NewType --> Empty: allowNewType disabled
NewType --> Loaded: clearType()
Failed --> NewType: allowNewType
Failed --> Failed: allowNewType disabled
ListedChoice --> Loading: loadServiceTypes()
NewType --> Loading: loadServiceTypes()
Loading --> Loaded: loadServiceTypes(false) succeeds
Loading --> Failed: loadServiceTypes(false) fails
Flow diagram for service type selectionflowchart TD
A[Load registered service types] --> B{Types available?}
B -->|Yes| C[Choose listed type]
B -->|No| D{allowNewType enabled?}
C --> E[Populate group artifact version]
D -->|Yes| F[Choose Add new service type]
D -->|No| G[Show admin hint and disable submission]
F --> H[Enter required group artifact version]
E --> I{typeComplete}
H --> I
I -->|Yes| J[Create service]
I -->|No| K[Keep Create Service disabled]
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 found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="packages/ecc-client-elixir-cloud-registry/src/components/service-create/service-create.ts" line_range="137" />
<code_context>
+ // a reload after a create keeps the list; other loads start over
+ if (reportErrors) this.typesStatus = "loading";
try {
- this.serviceTypes = await this._provider.getServiceTypes();
+ const types = await this._provider.getServiceTypes();
+ if (request !== this.typesRequest) return;
</code_context>
<issue_to_address>
**Stalled type request blocks selection**
When `GET /services/types` stalls without settling, `loadServiceTypes()` waits on `getServiceTypes()` without a deadline, so a request that never settles leaves `typesStatus` at `loading`; with `allowNewType` disabled, users have no listed type to select and cannot submit until the request completes or the page is refreshed.
Give the type-list request a finite timeout and handle timeout as a load failure so the UI can report the problem and recover.
</issue_to_address>
### Comment 2
<location path="packages/ecc-client-elixir-cloud-registry/src/components/service-create/service-create.ts" line_range="181" />
<code_context>
+ changedProperties.has("serviceTypes") &&
+ this.allowNewType &&
+ this.typeChoice === "" &&
+ (this.formData.type.artifact || this.formData.type.version)
+ ) {
+ this.typeChoice = NEW_TYPE;
</code_context>
<issue_to_address>
**Group-only drafts disappear**
When the user edits only the group and the type list changes, `willUpdate` does not recognize the group-only edit as an in-progress new type, so `typeChoice` stays empty and `newType` becomes false when registered types are present; the new-type fields disappear, and choosing “Add new service type” resets the user's group.
Treat a changed group field as an in-progress new type when updating `typeChoice`.
Also at `packages/ecc-client-elixir-cloud-registry/src/components/service-create/service-create.ts:182`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 2 findings to address first, and if the form submits the wrong type, the registry will retain a service record with that type after this change is reverted. The mistake is limited to the services created and can be corrected by updating or removing those records.
Blocking findings: packages/ecc-client-elixir-cloud-registry/src/components/service-create/service-create.ts:137, packages/ecc-client-elixir-cloud-registry/src/components/service-create/service-create.ts:181
Treat a changed group as a new type being entered, so that it stays when types show up. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve the conflicts in service-create.ts: keep the type picker and its type status and reloads, on dev's provider handling (#502) and problem details (#504); drop the duplicate typesRequest field. Adapt dev's new service-create tests to the type picker: fillForm chooses "Add new service type", and the provider tests expect the reload of the types after a create. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #503 +/- ##
==========================================
+ Coverage 70.07% 70.75% +0.68%
==========================================
Files 23 23
Lines 5240 5448 +208
Branches 134 164 +30
==========================================
+ Hits 3672 3855 +183
- Misses 1566 1589 +23
- Partials 2 4 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
# Conflicts: # apps/documentation/pages/docs/cloud-registry/components/service-create.mdx # packages/ecc-client-elixir-cloud-registry/src/components/service-create/service-create.ts
"Add new service type" was the last entry of the type list and looked like a registered type, so long lists hid it. It now comes first, with a plus icon and a separator before the registered types.
|
@uniqueg We merged |
There was a problem hiding this comment.
Linked issues
#456 feat(cloud-registry): pick service types from a list · 3 of 4 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Offer registered service types from GET /services/types as one choice labelled group · artifact · version. | ✅ Met | The component loads the types and renders each with the requested label. |
| 2 | Add allow-new-type, defaulting to true; when enabled, offer “Add new service type” with required fields. | 🟡 Partly met | The property defaults to true and the option reveals the required fields, but the option appears first rather than at the end of the list as requested. |
| 3 | Without allow-new-type, let users choose only listed types. | ✅ Met | When adding is disabled, the new-type option and fields are hidden; the docs show the property bound to may_add_service_types from GET /me. |
| 4 | Users can submit a complete service type and add a new one only when the app allows it. | ✅ Met | Submission requires a complete listed or new type, and new types are gated by allowNewType. |
Summary
Closes #456.
ecc-client-elixir-cloud-registry-service-createnow asks for the service type as one choice from the registered types (GET /services/types), labelledgroup · artifact · version(e.g.org.ga4gh · tes · 1.1.0). Before, it had three free-text fields, and typos created new types.allowNewType(attributeallow-new-type, defaulttrue, so new types stay possible as before):org.ga4gh, as before).may_add_service_typesof Cloud Registry'sGET /me(falsein deployments withcustom.access_control.service_types: controlled, except for admins).allow-new-type="false"turns it off (same converter asadminin feat(cloud-registry): add admin option to form #501).ecc-service-create-failedafter the success event.allowNewTypeoff discards a new type entered so far.allowNewTypein the properties table, plus a section on it.The other form PRs (#501 admin fields, #461 environments, #453 validation, #462 change events) change 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 the build of@elixir-cloud/cloud-registrypass. The ESLint warnings are the ones already ondev.cc-forms-checks/check-456-type-picker.mjs(withharness.mjs, outside the repo; I can add them or attach them). All checks pass. They cover:allowNewTypeoff, also at runtime, and the attribute;Declined review findings
ecc-utils-design-selectpolls every 100 ms per item, and the list has no search, so very long type lists get slow. That belongs to the design package (an event-driven select or a combobox) and is out of scope here. I can open an issue.baseUrl/provider(firstUpdated/updated): that's fix(cloud-registry): react to provider changes #448, in a separate PR.DEFAULT_TYPEconstant and foldingtypeChoiceinto one "effective choice" getter (low): these would also touch the duplicated initial form data andresetForm, which predate this PR.Open questions
None.
🤖 Generated with Claude Code
Summary by Sourcery
Add registered service type selection to the Cloud Registry service creation form while preserving controlled support for creating new types.
New Features:
allowNewTypeproperty and correspondingallow-new-typeattribute to control whether new service types may be entered.Bug Fixes:
Enhancements:
Documentation:
allowNewTypeproperty, supported behavior, and usage examples.Tests: