Skip to content

Commit add81de

Browse files
authored
Bump API (#3382)
Bumping to the version going to dogfood, then will bump again for oxidecomputer/omicron#11281.
1 parent 3a4ae2a commit add81de

10 files changed

Lines changed: 196 additions & 67 deletions

File tree

‎OMICRON_VERSION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
17e6fee5320ad8f1fb4cbfd3d6328b808fca7124
1+
9d95e0cf4542d2bc776c40b69f97ba6e05cff199

‎app/api/__generated__/API_VERSION‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎app/api/__generated__/Api.ts‎

Lines changed: 65 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎app/api/__generated__/OMICRON_VERSION‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎app/api/__generated__/validate.ts‎

Lines changed: 49 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎app/forms/silo-quotas-edit.tsx‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,8 @@
66
* Copyright Oxide Computer Company
77
*/
88
import { useForm } from 'react-hook-form'
9-
import type { SetNonNullable } from 'type-fest'
109

11-
import {
12-
api,
13-
queryClient,
14-
useApiMutation,
15-
type SiloQuotasUpdate,
16-
type VirtualResourceCounts,
17-
} from '@oxide/api'
10+
import { api, queryClient, useApiMutation, type VirtualResourceCounts } from '@oxide/api'
1811
import { Cloud16Icon } from '@oxide/design-system/icons/react'
1912

2013
import { NumberField } from '~/components/form/fields/NumberField'
@@ -37,15 +30,21 @@ type Props = {
3730
onDismiss: () => void
3831
}
3932

33+
// memory and storage are in GiB here and converted to bytes on submit
34+
type QuotasFormValues = {
35+
cpus: number
36+
memory: number
37+
storage: number
38+
}
39+
4040
const ProvisionedHint = ({ value, unit }: { value: number; unit: string }) => (
4141
<div className="text-sans-sm text-secondary mt-1">
4242
Provisioned: <BigNum num={value} /> {unit}
4343
</div>
4444
)
4545

4646
export function EditQuotasSideModalForm({ silo, quotas, provisioned, onDismiss }: Props) {
47-
// required because we need to rule out undefined because NumberField hates that
48-
const defaultValues: SetNonNullable<Required<SiloQuotasUpdate>> = {
47+
const defaultValues: QuotasFormValues = {
4948
cpus: quotas.cpus,
5049
memory: bytesToGiB(quotas.memory),
5150
storage: bytesToGiB(quotas.storage),

‎app/forms/subnet-create.tsx‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
*/
88
import { useForm } from 'react-hook-form'
99
import { useNavigate } from 'react-router'
10-
import type { SetNonNullable } from 'type-fest'
1110

12-
import { api, queryClient, useApiMutation, type VpcSubnetCreate } from '@oxide/api'
11+
import { api, queryClient, useApiMutation } from '@oxide/api'
1312

1413
import { DescriptionField } from '~/components/form/fields/DescriptionField'
1514
import { ListboxField } from '~/components/form/fields/ListboxField'
@@ -30,7 +29,15 @@ import { SideModalFormDocs } from '~/ui/lib/ModalLinks'
3029
import { docLinks } from '~/util/links'
3130
import { pb } from '~/util/path-builder'
3231

33-
const defaultValues: SetNonNullable<Required<VpcSubnetCreate>> = {
32+
type SubnetCreateFormValues = {
33+
name: string
34+
description: string
35+
ipv4Block: string
36+
ipv6Block: string
37+
customRouter: string
38+
}
39+
40+
const defaultValues: SubnetCreateFormValues = {
3441
name: '',
3542
description: '',
3643
ipv4Block: '',

‎app/forms/subnet-edit.tsx‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,8 @@
77
*/
88
import { useForm } from 'react-hook-form'
99
import { useNavigate, type LoaderFunctionArgs } from 'react-router'
10-
import type { SetNonNullable } from 'type-fest'
1110

12-
import {
13-
api,
14-
q,
15-
queryClient,
16-
useApiMutation,
17-
usePrefetchedQuery,
18-
type VpcSubnetUpdate,
19-
} from '@oxide/api'
11+
import { api, q, queryClient, useApiMutation, usePrefetchedQuery } from '@oxide/api'
2012

2113
import { DescriptionField } from '~/components/form/fields/DescriptionField'
2214
import { ListboxField } from '~/components/form/fields/ListboxField'
@@ -39,6 +31,12 @@ import { docLinks } from '~/util/links'
3931
import { pb } from '~/util/path-builder'
4032
import type * as PP from '~/util/path-params'
4133

34+
type SubnetEditFormValues = {
35+
name: string
36+
description: string
37+
customRouter: string
38+
}
39+
4240
const subnetView = ({ project, vpc, subnet }: PP.VpcSubnet) =>
4341
q(api.vpcSubnetView, { query: { project, vpc }, path: { subnet } })
4442

@@ -68,7 +66,7 @@ export default function EditSubnetForm() {
6866
},
6967
})
7068

71-
const defaultValues: SetNonNullable<Required<VpcSubnetUpdate>> = {
69+
const defaultValues: SubnetEditFormValues = {
7270
name: subnet.name,
7371
description: subnet.description,
7472
customRouter: customRouterDataToForm(subnet.customRouterId),

‎app/forms/vpc-create.tsx‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88
import { useForm } from 'react-hook-form'
99
import { useNavigate } from 'react-router'
10-
import type { SetNonNullable } from 'type-fest'
1110

1211
import { api, q, queryClient, useApiMutation, type VpcCreate } from '@oxide/api'
1312

@@ -24,7 +23,16 @@ import { validateVpcIpv6Prefix } from '~/util/ip'
2423
import { docLinks } from '~/util/links'
2524
import { pb } from '~/util/path-builder'
2625

27-
const defaultValues: SetNonNullable<Required<VpcCreate>> = {
26+
type VpcCreateFormValues = {
27+
name: string
28+
description: string
29+
dnsName: string
30+
ipv6Prefix: string
31+
// defaults will go here once we support it in the UI. for now, omitting means
32+
// all defaults
33+
}
34+
35+
const defaultValues: VpcCreateFormValues = {
2836
name: '',
2937
description: '',
3038
dnsName: '',
@@ -59,12 +67,11 @@ export default function CreateVpcSideModalForm() {
5967
form={form}
6068
formType="create"
6169
resourceName="VPC"
62-
onSubmit={({ ipv6Prefix, ...rest }) =>
63-
createVpc.mutate({
64-
query: projectSelector,
65-
body: { ...rest, ipv6Prefix: ipv6Prefix.trim() || undefined },
66-
})
67-
}
70+
onSubmit={({ ipv6Prefix, ...rest }) => {
71+
// omitting `defaults` means create all defaults, i.e., the original behavior
72+
const body: VpcCreate = { ...rest, ipv6Prefix: ipv6Prefix.trim() || undefined }
73+
createVpc.mutate({ query: projectSelector, body })
74+
}}
6875
onDismiss={() => navigate(pb.vpcs(projectSelector))}
6976
loading={createVpc.isPending || createVpc.isSuccess}
7077
submitError={createVpc.error}

0 commit comments

Comments
 (0)