Skip to content

Commit 002af42

Browse files
Update to new networking API shape, with IPv6 (#3005)
* Update to new networking API shape, with IPv6 * Update api generator to 0.13.1 and run * Remove unused helper * simpler handling, as action is impossible without a pool * Updates to Networking Interfaces table * Update tests * Update form with IPv4, IPv6, dual stack * proper v4 vs v6 filtering * update types in form * more defaults * flatten default options * Add instance create tests * Update to latest Omicron; npm run gen-api * Bump @oxide/openapi-gen-ts * npm run gen-api * Update UX for ephemeral IP attach modal * e2e text flexibility * fix bug when defaultPool was falsy * fix runtime issue if siloPools haven't loaded * Fix bug where when both IPv4 and IPv6 default pools exist, { poolSelector: { type: 'auto' } } fails unless ipVersion is specified * Better handling of dual default pools * Simplify default badging * Fix v6 automatic pool assignment issue * Remove DefaultPoolCell * Ensure unicast pools are used for ephemeral IP form * Fix incorrect pool issue with Floating IP create flow * Proper handling of unicast pools in instance create * make sure external IP version matches NIC type * Better flow for IP Pool selector; add component * only show NIC-version-matching IP pools * fix crashing IP Pools list * update tests * Fix issue with sometimes blank field * Better handling of IP versions to show during create flow * Better IP type compatability handling * Better default-pool + ipVersion handling * Better handle defaults and empty states * refactor / copy * another refactor to defaults to match API * revert copy for now * external IP version compatibility should consider the primary NIC; add tests for Ephemeral IP attachment * Ensure that when custom NIC is created, Ephemeral IP options match first custom NIC in list * Disable ephemeral IP checkbox when instance has no compatible NICs * Add IP version to silo IP Pools table * Add IP version to IP Pool create flow * Proper height for NIC table rows * Better microcopy, tooltip, validation on IP Pool ranges * Better microcopy, tooltip, validation on IP Pool ranges * Update to latest omicron sha (92e0ae0c) * post-review updates round 1 * clean up NIC table * latest OMICRON_VERSION * More updates, plus test fixes * npm run fmt * Fix unrelated test * Better handle default / undefined data * smarter mock exception handling * Add logic to determine v4/v6 NICs during create flow * Use available pools to determine default NIC type on instance create * refactor logic around determining NIC and pool availability * refactoring * more cleanup * Disable NICs when no VPCs * Filter Floating IP options based on the available NICs on the instance * update tests and mock data * update OMICRON_VERSION; no API changes * Defer to API for selecting default pool * Default to selecting Ephemeral IP pool, rather than leaving blank, to reduce conflict when both v4 and v6 defaults exist * Refactor, work on tests * npm run fmt * a few small tweaks before larger experiment on default NIC selection * use ALL_ISH on NIC list * decouple NIC defaults from external IP pool configuration * address flaky/flakey vpc tests * Fix flaking Firefox failure * smarter defaults when pool list changes * Use util to evaluate version without extra lookup * refactor * Bump omicron and update api * Add links to docs in IP Pool Create form * gap-0 on IP versions double row * Remove icon * Proper radio buttons for NetworkInterfaceField * Use MiniTable with add/clear button pattern * Fix IP Pool column title in test * remove extra testing column * add explicit blur step to help with Firefox in e2e tests * update reducedMotion setting in Playwright config for e2e tests * TS updates * More playwright config tweaks; working locally but who knows * Add blur back in; again, all working locally * use remeda sortBy with array to sort pools * remove falsy checks on things that can't be falsy * split compatible pools filter into -cast and ip version Renames the pool-filtering hasIpVersion to poolHasIpVersion to make room for a predicate that filters by parsing the actual IP string. * replace filterFloatingIpsByVersion with hasIpVersion predicate Mirrors the poolHasIpVersion pattern: a curried predicate that can be used directly with Array.filter, e.g. .filter(hasIpVersion(['v4'])). * stable array for IP versions; ts-pattern for NIC type matching Hoists ALL_IP_VERSIONS constant to avoid creating a new array on every render when compatibleVersions prop is omitted, which was breaking useMemo caching. Rewrites getCompatibleVersionsFromNicType with exhaustive ts-pattern match for clearer control flow. * CLAUDE.md: add guidance on avoiding type casts * network-interface-create: add form values type to avoid cast * tests for IpPoolSelector * placeholder copy * test default pools with elaborate mock situation * simplify resolveIpStack, move to utils file * Simplify `IpPoolSelector` and call sites (#3032) * refactor IpPoolSelector, derive ipVersion * handle default pool in defaultValues, don't sort * get rid of advanced according on floating IP create * update e2es for removed advanced accordion * always require pool on floating IP and ephemeral IP attach * fix bad bad use of () => [...] sorter in remeda sortBy * get rid of ephemeralIpVersion form state var * instance-create: construct externalIps on submit use explicit form state for ephemeral IP and floating IPs state, build externalIps list out of those at submit time * small fixes * avoid required error on invisible pool selector * fix e2e failures by picking a pool even when two defaults * compatible versions constants to avoid render churn * IpPoolSelector: always mount Listbox even when there are no pools * no pools silo for testing * ephemeral IP checkbox disabled tooltip on label hover * use ben's styling suggestion on toIpPoolItem * sort pools first, checkbox 'checked', no explicit any --------- Co-authored-by: David Crespo <david.crespo@oxidecomputer.com> Co-authored-by: David Crespo <david-crespo@users.noreply.github.com>
1 parent 61464d9 commit 002af42

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+5545
-1193
lines changed

.oxlintrc.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
],
6060
"radix": "error",
6161

62+
"@typescript-eslint/no-explicit-any": "error",
63+
6264
// TypeScript rules (currently disabled but available)
6365
"@typescript-eslint/no-floating-promises": "off",
6466
"@typescript-eslint/unbound-method": "off"

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,4 @@
117117
- Use `validateName` for resource names, `validateDescription` for descriptions, `validateIp`/`validateIpNet` for IPs.
118118
- Role helpers live in `app/api/roles.ts`.
119119
- Use ts-pattern exhaustive match when doing conditional logic on union types to make sure all arms are handled
120+
- Avoid type casts (`as`) where possible; prefer type-safe alternatives like `satisfies`, `.returnType<T>()` for ts-pattern, or `as const`

OMICRON_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dd74446cbe12d52540d92b62f2de7eaf6520d591
1+
c765b3539203e34f65cd402f139cf604035d5993

0 commit comments

Comments
 (0)