Skip to content

feat: fill ALB_NAME with the reader's own load balancers - #121

Open
AriaEdo wants to merge 3 commits into
mainfrom
feat/alb-name-placeholder
Open

AriaEdo wants to merge 3 commits into
mainfrom
feat/alb-name-placeholder

Conversation

@AriaEdo

@AriaEdo AriaEdo commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Marks ALB_NAME for a signed-in reader, like your-project-id. Hovering it shows the reader's load balancers in their current project, so they can copy a name or the whole code block filled in.

The list comes from GET /api/website/projects/:projectId/albs (datum-cloud/cloud-portal#1787). It's a separate request made after session-status, so the other tokens are marked without waiting for it.

Closes #116

Changes

docs-vars.js

  • ALB_NAME added to TOKEN_PATTERN. NEW_ALB_NAME and ${ALB_NAME} don't match.
  • One load balancer: filled in. Copy value and Copy code with my values work as for other tokens.
  • Several: the card lists them (name, plus display name when set) with nothing picked. Both copy buttons stay disabled until the reader picks one, so datumctl alb delete ALB_NAME --yes never gets a default. The pick applies to every ALB_NAME on the page.
  • Truncated (500 cap): the card says "Showing the first 500 load balancers."
  • No load balancers, any non-2xx, network error, or a bad body: ALB_NAME stays a plain placeholder. Names are checked against NAME_PATTERN.
  • Token values are now read from shared state when used instead of data-value on each span, so a pick updates every span at once.
  • Scrolling the list inside the card no longer closes the card.

style.css: picker list (scrolls past about 220px), picked state, disabled copy buttons. Both files are now Prettier-formatted, which accounts for most of the diff.

alb/operations/overview.mdx: the create command, its "Replace the following" entry, and the --display-name row use NEW_ALB_NAME. That load balancer doesn't exist yet, so filling it with an existing one would be wrong. Other ALB_NAME uses (describe, logs, delete, auth, MetricsQL gateway_name) refer to an existing load balancer and stay.

README.md: Placeholders gets an ALB_NAME row and a rule for NEW_ALB_NAME.

gateway_name in the metrics is the HTTPProxy name. The portal queries it the same way (app/features/edge/proxy/metrics/queries.ts in cloud-portal).

Test plan

  • node --check docs-vars.js
  • jsdom simulation with mocked portal responses:
    • empty list, 403, network error, invalid names → ALB_NAME unmarked, your-project-id still marked, nothing logged
    • one ALB → copy code gives datumctl alb delete web --yes --project my-proj. NEW_ALB_NAME is not marked. Inline code that is only the token gets no "Copy code" button
    • several ALBs → buttons disabled before a pick. Copying from a PROJECT_ID card leaves ALB_NAME as written. After a pick, the MetricsQL block copies with the picked name and the truncated note shows
    • signed out → no ALB request
    • the same simulation fails against main
  • On website.staging.env.datum.net against a staging portal that includes cloud-portal#1787: one ALB, several ALBs, none, signed out
  • Check the card in dark mode and on a long list (scroll, position)

A 401/403/404 from the ALB route still shows as a failed request in the browser console. JavaScript can't suppress that. There are no script errors.

docs-vars.js marks ALB_NAME for a signed-in reader, using the list from
GET /api/website/projects/:projectId/albs (cloud-portal#1787). The list is
fetched after session-status, so the other tokens don't wait for it.

- One load balancer: filled in, like your-project-id.
- Several: the hover card lists them with nothing picked, and both copy
  buttons stay disabled until the reader picks one. The pick applies to
  every ALB_NAME on the page.
- A truncated list (500 cap) says so. No load balancers or a failed
  request leaves ALB_NAME as a plain placeholder.

The create section of alb/operations/overview.mdx now uses NEW_ALB_NAME,
which is never marked, since it names a load balancer that doesn't exist
yet. README Placeholders documents both.

Closes #116
@mintlify

mintlify Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
Datum 🟢 Ready View Preview Nov 4, 2026, 5:37 PM

The picked option in the ALB_NAME card gets a check mark and a heavier border, so it stands out in light mode too. The mark has empty alt text, since aria-pressed already tells screen readers.
@cla-assistant

cla-assistant Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ AriaEdo
❌ dlotterman
You have signed the CLA already but the status is still pending? Let us recheck it.

This branch was successfully deployed

1 active deployment
staging — f5a33663 Deployed Nov 4, 2026 by mintlify[bot]
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.

Fill ALB_NAME with the reader's own load balancers

2 participants