Skip to content

Open the create load balancer dialog with a workload chosen - #1800

Merged
mattdjenkinson merged 1 commit into
mainfrom
feat/alb-create-for-workload
Nov 6, 2026
Merged

mattdjenkinson merged 1 commit into
mainfrom
feat/alb-create-for-workload

Conversation

@mattdjenkinson

Copy link
Copy Markdown
Contributor

The compute plugin's workload Overview now has an "Add to a load balancer" button (datum-cloud/compute#627). It links to /project/:id/alb?action=create&workload=<name>. This makes that link open the new load balancer dialog with the workload already chosen.

The dialog now opens from the link

The ALB page read ?action=create on its first render, before its create-permission check had answered. While the check loads, useResourcePermissions reports canCreate as false. The page deleted the parameter without opening anything, so the dialog usually didn't open from a link at all. The page now waits for the check to finish before reading or clearing the parameter.

It opens with the workload chosen

With &workload=<name>, the dialog:

  • opens on Datum compute, with that workload's NetworkService chosen;
  • chooses its port too, when it has only one;
  • sets the display name to the workload's name;
  • refetches the service list first, since the plugin may have just created the service;
  • says when the workload has no service, instead of leaving the picker empty.

Why the selection is set the way it is

  • The select's own control: the choice goes through each select's own form control. A second Form.useField control on the same field never reaches the select, because Conform keeps a separate value per control.
  • A tick after render: the port select remounts when the workload changes, and a value set in the same render as that remount never reaches the form.

Test plan

  • serviceForWorkload unit tests (vitest), and app/features/edge tests pass
  • New Cypress component test (workload-service-fields.cy.tsx) covers four cases: the workload and its only port are chosen; a workload with several ports gets only the workload; an outdated cached list is refetched; a workload with no service gets the note
  • Typecheck and lint
  • Locally, with the compute plugin: "Add to a load balancer" on cpu-mem-wave opens the dialog with it chosen

The compute plugin's "Add to a load balancer" links to
/project/:id/alb?action=create&workload=<name>. The ALB page now waits for
its create-permission check before reading the link: the check reads
false until it answers, so the parameter was being dropped before the
dialog could open.

With `workload`, the dialog opens on Datum compute with that workload's
service chosen, its port too when it has only one, and the display name
set to the workload's name. The service list is refetched first, since
the plugin may have just made the service. A workload with no service
says so instead of leaving the picker silently empty.

The choice goes through each select's own form control, a tick after
render, because the port select remounts when the workload changes and a
value set in that same commit never reaches the form.
@mattdjenkinson mattdjenkinson added the enhancement New feature or request label Nov 6, 2026
@mattdjenkinson mattdjenkinson self-assigned this Nov 6, 2026
@mattdjenkinson
mattdjenkinson requested a review from a team November 6, 2026 16:55
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

🧪 Test Summary

Job Status
E2E Regression (0) ✅ success
E2E Regression (1) ✅ success
E2E Regression (2) ✅ success
E2E Regression (3) ✅ success
E2E Smoke ✅ success
Unit Tests ✅ success
Vitest Unit Tests ✅ success

View workflow run

Need another run? Use Re-run failed jobs: one shard costs a few minutes, the whole workflow about 26.

@mattdjenkinson
mattdjenkinson merged commit b2d6829 into main Nov 6, 2026
18 checks passed
@mattdjenkinson
mattdjenkinson deleted the feat/alb-create-for-workload branch November 6, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants