Repository navigation
docs: fix the endpoints of the live previews - #564
Conversation
The live previews called demo deployments that are gone. They now take their endpoints, and the IDs of single-object samples, from apps/documentation/utils/endpoints.ts, each overridable at build time with a NEXT_PUBLIC_* variable. The Service Registry and Cloud Registry previews use a public registry, the TRS previews WorkflowHub. There is no public WES or TRS-Filer without a login, so their previews show a notice unless an endpoint is set. The Services, Service, Tools and TRS-Filer form previews pass baseUrl instead of provider: these components read provider only on their first update, which runs before React sets it on the server-rendered element. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add "Live previews" to the page "Contributing": where the endpoints are set, how to override them, and what works with the defaults. Callouts on the preview pages say what each preview needs. The code samples use example.com placeholders instead of the removed demo deployments, and the TRS-Filer samples pass the base URL as a string, as the provider expects. The "Live Demo" links of the introduction point to the preview pages; WES and TRS-Filer have none. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThis documentation-only PR consolidates live-preview endpoints and sample IDs into a build-configurable module, switches previews to working public defaults or explicit missing-endpoint notices, fixes affected base URL initialization, replaces stale demo links and hosts, and documents authentication, CORS, and customization requirements. Sequence diagram for documentation preview endpoint selectionsequenceDiagram
participant Build as Documentation build
participant Config as endpoints.ts
participant Preview as Preview component
participant API as Remote GA4GH API
participant Notice as MissingEndpoint
Build->>Config: Read process.env.NEXT_PUBLIC_* variables
Config-->>Preview: Provide endpoint and sampleIds
alt endpoint configured
Preview->>API: Fetch using baseUrl or provider
API-->>Preview: Return preview data
else endpoint is empty
Preview->>Notice: Render service and variable
Notice-->>Preview: Show setup guidance
end
Flow diagram for updated live preview navigationflowchart LR
Table[Introduction component table] --> Link[Live preview link]
Link --> Service[Service Registry preview]
Link --> Cloud[Cloud Registry preview]
Link --> TRS[TRS preview]
Service --> CORS[Anonymous CORS request]
Cloud --> CORS
TRS --> CORS
WES[WES entry] --> Docs[Documentation and configuration instructions]
Filer[TRS-Filer entry] --> Docs
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #564 +/- ##
=======================================
Coverage 71.40% 71.40%
=======================================
Files 23 23
Lines 5655 5655
Branches 199 199
=======================================
Hits 4038 4038
Misses 1610 1610
Partials 7 7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Documentation build overview
10 files changed ·
|
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="apps/documentation/components/packages/service-registry/ServicePreview.tsx" line_range="17" />
<code_context>
- provider={provider}
- serviceId="JOMGD2"
+ <ECCClientGa4ghServiceRegistryService
+ baseUrl={endpoints.serviceRegistry}
+ serviceId={sampleIds.service}
onEccServiceChanged={handleServiceChanged}
</code_context>
<issue_to_address>
**Previews fetch initial data twice**
When a Service Registry or TRS Tools preview mounts with its configured `baseUrl`, `firstUpdated()` starts the initial fetch and Lit’s initial `updated()` starts it again; the unsequenced `loadData` responses can let an older snapshot overwrite newer data, leaving stale results, and the duplicate requests can throttle public endpoints.
Skip one of the initial fetch paths so mounting starts only one request.
Also at `apps/documentation/components/packages/service-registry/ServicesPreview.tsx:22`, `apps/documentation/components/packages/trs/ToolsPreview.tsx:13`, `apps/documentation/components/packages/service-registry/ServicePreview.tsx:18`.
</issue_to_address>
### Comment 2
<location path="apps/documentation/pages/docs/cloud-registry/components/service-create.mdx" line_range="31" />
<code_context>
<Tabs.Tab>
<ServiceCreatePreview />
+ <Callout type="info" emoji="ℹ️">
+ The preview above loads the service types from a public Cloud Registry without a login. Creating a service there needs a login, so submitting the form fails with an error. See [Live previews](/docs/contributing#live-previews) to use another registry.
+ </Callout>
</Tabs.Tab>
</code_context>
<issue_to_address>
**Cloud Registry submission**
The issue asks for all previews to work without authentication. The callout says the form loads its options, but submitting it fails because creating a service requires a login.
</issue_to_address>
### Comment 3
<location path="apps/documentation/utils/endpoints.ts" line_range="15" />
<code_context>
+export const endpoints = {
+ // GA4GH Service Registry (read-only previews)
+ serviceRegistry:
+ process.env.NEXT_PUBLIC_SERVICE_REGISTRY_URL || 'https://elixir-on.cloud/ga4gh/registry/v1',
+ // Cloud Registry (form; creating a service needs a login)
+ cloudRegistry:
</code_context>
<issue_to_address>
**Trailing slashes break previews**
When a configured `NEXT_PUBLIC_*_URL` value ends in `/`, the REST providers append paths directly to `baseUrl` (for example, `${this.baseUrl}/services`) without normalizing it, so APIs that do not collapse doubled path separators return 404 and the corresponding previews fail.
Strip trailing slashes from configured endpoint values before passing them to the providers.
Also at `apps/documentation/utils/endpoints.ts:18`, `apps/documentation/utils/endpoints.ts:20`, `apps/documentation/utils/endpoints.ts:22`, `apps/documentation/utils/endpoints.ts:24`.
</issue_to_address>Linked issues
#445 Docs: live examples broken — update WES, TRS, Cloud Registry and Service Registry endpoints · 1 of 3 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Replace the broken preview endpoints with maintained endpoints that do not require authentication. | 🟡 Partly met | Service Registry, Cloud Registry, and TRS use public endpoints, but WES and TRS-Filer have no default endpoint and show a notice instead. |
| 2 | Define the preview endpoints in one config file. | ✅ Met | The preview wrappers use apps/documentation/utils/endpoints.ts for their endpoint values. |
| 3 | Make all documentation previews and Live Demo links work without authentication. | 🟡 Partly met | Some previews work, but WES and TRS-Filer are notices, the Service preview uses a placeholder ID, and Cloud Registry form submission needs a login. |
Sourcery assessment
Approval pending. 3 findings to address first.
Blocking findings: apps/documentation/components/packages/service-registry/ServicePreview.tsx:17, apps/documentation/pages/docs/cloud-registry/components/service-create.mdx:31, apps/documentation/utils/endpoints.ts:15
The providers append paths to the base URL, so an overridden endpoint that ends in "/" would double the separator. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Linked issues
#445 Docs: live examples broken — update WES, TRS, Cloud Registry and Service Registry endpoints · 1 of 2 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | All documentation previews and “Live Demo” links work without authentication. | 🟡 Partly met | The remaining links now lead to preview pages, and the TRS and registry read previews use public endpoints, but the default Service preview uses a placeholder ID, Cloud Registry creation requires login, and WES/TRS-Filer show notices instead of live previews. |
| 2 | Define the preview endpoints in one place. | ✅ Met | Preview endpoint values are centralized in apps/documentation/utils/endpoints.ts; the documentation samples use placeholder hosts. |
Summary
The live previews of the documentation called demo deployments that are gone. This PR:
apps/documentation/utils/endpoints.ts. Each value can be overridden at build time with aNEXT_PUBLIC_*variable (NEXT_PUBLIC_SERVICE_REGISTRY_URL,NEXT_PUBLIC_CLOUD_REGISTRY_URL,NEXT_PUBLIC_TRS_URL,NEXT_PUBLIC_TRS_FILER_URL,NEXT_PUBLIC_WES_URL,NEXT_PUBLIC_SERVICE_ID,NEXT_PUBLIC_TRS_TOOL_ID,NEXT_PUBLIC_WES_RUN_ID).https://elixir-on.cloud/ga4gh/registry/v1; TRS:https://workflowhub.eu/ga4gh/trs/v2(sample tool2); WES and TRS-Filer: none.components/common/MissingEndpoint.tsx) unless an endpoint is set, instead of calling a broken URL.baseUrlinstead ofprovider. These components readprovideronly infirstUpdated, which runs before React sets the property on the server-rendered element, so they showed "Please provide either a base URL ... or a custom provider" and never fetched. They do reload onbaseUrlchanges. The component bug itself is not fixed here (see "Follow-ups").example.complaceholders instead of the old hosts. The TRS-Filer samples now pass the base URL as a string (the provider's constructor takesbaseUrl: string, not{ url }).Only
apps/documentation/is touched; no component package changes.Closes #445
Decisions
NEXT_PUBLIC_WES_URL=... npm run dev).Acceptance criteria, honestly
apps/documentation/utils/endpoints.ts; the only other mentions areexample.complaceholders in code samples).NEXT_PUBLIC_SERVICE_IDis set); Cloud Registry form submission (needs a login); WES (3 previews) and TRS-Filer form (no public instance: notice instead).https://elixir-cloud-components.vercel.app,https://cloud-components.readthedocs.ioandhttp://localhost:3000). On other origins, e.g. Vercel or Read the Docs preview builds of this PR, the registry previews are blocked by CORS. WorkflowHub sendsAccess-Control-Allow-Origin: *.Verification
npm run lint(repo root; includes the build of all packages and the docs app): passes.npx tsc --noEmit -p .andnpx eslint .inapps/documentation/: pass.out/):/docs/trs/components/tools: lists WorkflowHub workflows (requests to/toolClassesand/tools?limit=5return 200). Before thebaseUrlchange, no request was made and the "Please provide ..." error showed./docs/trs/components/tool: shows tool2with versions and files (200s)./docs/service-registry/components/services: requests/servicesand/services/types(200), shows "No services found"./docs/cloud-registry/components/service-create: requests/services/typesand/service-info(200)./docs/wes/components/runs,/docs/trs-filer/components/tool-create: show the notice.NEXT_PUBLIC_WES_URLandNEXT_PUBLIC_TRS_FILER_URLset to dummy hosts: the WES and TRS-Filer previews render and call the configured hosts.CI passed, Lint, Test on Node 22 and 24, CodeQL, Codecov, Read the Docs build).curlof the default endpoints: registry/services,/services/types,/service-info200 without login; WorkflowHub/tools,/tools/2,/toolClasses200 (one transient 503 seen once).Light lane: changes only the documentation app (pages, preview wrappers, one config file); no component package, CI, release or security-relevant code. Diff reviewed by the author instead of reviewer subagents.
Declined review findings
firstUpdated()returns early and each request was observed once. Covered by the component follow-up below.Fixed: Sourcery "Trailing slashes break previews" (86291ac).
Open questions
None blocking this PR.
Follow-ups
tool-createcomponents ignore aproviderset after their first update (they only react tobaseUrl), unlike the Cloud Registry form (fixed in fix(cloud-registry): react to provider changes #502) and the WES components. This PR works around it in the docs; a fix belongs in the packages (needs code owner review). Should an issue be opened?sampleIds.servicecan name it.endpoints.tsneeds to change.🤖 Generated with Claude Code