Skip to content

feat: suggest a connection's spaces in the space field and store the chosen id - #263

Merged
matt-richardson merged 16 commits into
mainfrom
mr/space-picker-ui
Oct 15, 2026
Merged

matt-richardson merged 16 commits into
mainfrom
mr/space-picker-ui

Conversation

@matt-richardson

@matt-richardson matt-richardson commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Part of DPT-3630 (Renaming an Octopus space breaks TeamCity configurations that name it).

Why

This is where the space id becomes something an admin can set from the UI. The space field on the connection form and on all six step forms now suggests the connection's spaces as you type. Choosing one, or typing a space's exact name, stores its id alongside the name.

It stays a text field

The field is still free text, deliberately. Listing spaces needs credentials at edit time, and not every setup has them: inline step credentials, an unsaved connection, and (until the follow-up PRs) parameter-held and OIDC keys. In those cases the field explains why nothing was suggested, and typing the name works as before. A plain <select> would have broken exactly those setups.

Anything typed that isn't an exact space name, including a %parameter% reference that TeamCity resolves at build time, is stored as the name alone, with no id.

Screenshots

Taken from a step form against the e2e Octopus container, whose licence allows only the Default space.

Entering the field suggests the connection's spaces:

Space field suggesting Default (Spaces-1)

A typed name that matches no space:

Warning that no space named Nonexistent was found

A saved space id that Octopus no longer has:

Warning that the saved space Retired Space (Spaces-999) was not found

Spaces can't be listed; the reason is in the tooltip:

Unable to retrieve spaces, with a tooltip saying Octopus rejected the API key

Inline credentials, with no connection to list spaces through:

Space field noting that a connection must be selected to choose from its spaces

Notes

  • The edit form learns which connection it's editing from the request. TeamCity's parameter name for that isn't contractual, so spacePickerConnectionId tries each plausible name. It only accepts a value that resolves to an Octopus connection in the project; otherwise the picker asks the admin to save the connection first.
  • On step forms TeamCity attaches its own parameter autocomplete to text fields. The picker shows TeamCity's parameter suggestions while a % reference is being typed and spaces otherwise. It still offers spaces if TeamCity's completion fails (there is an e2e test for this).
  • OctopusSpacePickerUiTest (4 cases) and OctopusConnectionUiTest pass locally against the real TeamCity and Octopus containers.

🤖 Generated with Claude Code

matt-richardson and others added 3 commits October 14, 2026 10:09
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…API key

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…chosen id

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from mr/space-lookup-endpoint to main October 14, 2026 04:59

@APErebus APErebus 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.

This one I found a lot harder to review due to all the spacePicker.js.

I'm going to approve because I trust it's been checked

@matt-richardson

Copy link
Copy Markdown
Contributor Author

This one I found a lot harder to review due to all the spacePicker.js.

I'm going to approve because I trust it's been checked

Yeah - that spacePicker.js is pretty big. There were a lot of edge cases / fighting with how teamcity wanted to render the box.

This is after i made it refactor to attempt to make it readable.

…ection from TeamCity

Switching a step's connection clears the stored space id, since an id only
identifies a space on one Octopus server. The connection form now gets the
connection being edited from TeamCity's oauthConnectionBean instead of trying
request parameter names. The picker's loader copes with missing markup and a
script that fails to load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@matt-richardson

Copy link
Copy Markdown
Contributor Author

This one I found a lot harder to review due to all the spacePicker.js.
I'm going to approve because I trust it's been checked

Yeah - that spacePicker.js is pretty big. There were a lot of edge cases / fighting with how teamcity wanted to render the box.

This is after i made it refactor to attempt to make it readable.

For completeness sake - I ran another code review on it, and it found a few edges and cleanups, which i've committed

@matt-richardson
matt-richardson enabled auto-merge (squash) October 15, 2026 04:12
@matt-richardson
matt-richardson merged commit b60d353 into main Oct 15, 2026
5 checks passed
@matt-richardson
matt-richardson deleted the mr/space-picker-ui branch October 15, 2026 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants