Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useField } from 'formik'
import { CreateDiskForm } from 'app/forms/disk-create'
import { AttachDiskForm } from 'app/forms/disk-attach'
import { Button, Error16Icon, FieldLabel, MiniTable, SideModal } from '@oxide/ui'
import type { FormValues } from '../../forms'
import type { FormValues } from 'app/forms'

type DiskTableItem =
| (FormValues<'disk-create'> & { type: 'create' })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState } from 'react'
import { useField } from 'formik'
import { Button, Error16Icon, MiniTable, Radio, SideModal } from '@oxide/ui'
import type { InstanceNetworkInterfaceAttachment, NetworkInterfaceCreate } from '@oxide/api'
import { RadioField } from '@oxide/form'
import { RadioField } from 'app/components/form'
import CreateNetworkInterfaceForm from 'app/forms/network-interface-create'

export function NetworkInterfaceField() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { FieldLabel, TextField as UITextField } from '@oxide/ui'
import { capitalize } from '@oxide/util'
import cn from 'classnames'
import React from 'react'
import { useError } from '../hooks/useError'
import { useFieldError } from '../../../hooks/useFieldError'

export interface TextFieldProps extends UITextFieldProps {
id: string
Expand Down Expand Up @@ -39,7 +39,7 @@ export function TextField({
...props
}: TextFieldProps) {
const { description, helpText, required } = props
const error = useError(name)
const error = useFieldError(name)
return (
<div className="max-w-lg">
<FieldLabel id={`${id}-label`} tip={description} optional={!required}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ export * from './TextField'
export * from './NameField'
export * from './TagsField'
export * from './RadioField'
export * from './NetworkInterfaceField'
export * from './DisksTableField'
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion app/forms/disk-attach.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Form, NameField } from '@oxide/form'
import { Form, NameField } from 'app/components/form'
import React from 'react'
import type { Disk } from '@oxide/api'
import { useApiMutation, useApiQueryClient } from '@oxide/api'
Expand Down
2 changes: 1 addition & 1 deletion app/forms/disk-create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
TextField,
RadioField,
Radio,
} from '@oxide/form'
} from 'app/components/form'
import { Divider } from '@oxide/ui'
import type { Disk } from '@oxide/api'
import { useApiMutation, useApiQueryClient } from '@oxide/api'
Expand Down
2 changes: 1 addition & 1 deletion app/forms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type CreateInstanceForm from './instance-create'
import type AttachDiskForm from './disk-attach'
import type CreateNetworkInterfaceForm from './network-interface-create'

import type { FormProps } from '@oxide/form'
import type { FormProps } from 'app/components/form'
import type { ErrorResponse } from '@oxide/api'
import type { ComponentType } from 'react'

Expand Down
6 changes: 3 additions & 3 deletions app/forms/instance-create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import { useApiMutation, useApiQueryClient } from '@oxide/api'
import type { PrebuiltFormProps } from 'app/forms'
import {
DescriptionField,
DisksTableField,
Form,
NameField,
NetworkInterfaceField,
RadioField,
TagsField,
TextField,
} from '@oxide/form'
} from 'app/components/form'
import {
CentOSResponsiveIcon,
DebianResponsiveIcon,
Expand All @@ -25,9 +27,7 @@ import {
WindowsResponsiveIcon,
} from '@oxide/ui'
import { useParams, useToast } from 'app/hooks'
import { DisksTableField } from 'app/components/fields/DisksTableField'
import filesize from 'filesize'
import { NetworkInterfaceField } from 'app/components/fields/NetworkInterfaceField'

const values = {
name: '',
Expand Down
2 changes: 1 addition & 1 deletion app/forms/network-interface-create.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { DescriptionField, Form, NameField, TextField } from '@oxide/form'
import { DescriptionField, Form, NameField, TextField } from 'app/components/form'
import { Divider } from '@oxide/ui'
import type { NetworkInterfaceCreate, NetworkInterface } from '@oxide/api'
import { useApiMutation, useApiQueryClient } from '@oxide/api'
Expand Down
2 changes: 1 addition & 1 deletion app/forms/org-create.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { Form, NameField, DescriptionField } from '@oxide/form'
import { Form, NameField, DescriptionField } from 'app/components/form'
import type { Organization } from '@oxide/api'
import { useApiMutation, useApiQueryClient } from '@oxide/api'
import { useToast } from 'app/hooks'
Expand Down
2 changes: 1 addition & 1 deletion app/forms/project-create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Success16Icon } from '@oxide/ui'
import type { Project } from '@oxide/api'
import { useApiMutation, useApiQueryClient } from '@oxide/api'
import { useParams, useToast } from '../hooks'
import { Form, NameField, DescriptionField } from '@oxide/form'
import { Form, NameField, DescriptionField } from 'app/components/form'
import type { PrebuiltFormProps } from 'app/forms'

const values = {
Expand Down
2 changes: 1 addition & 1 deletion app/forms/subnet-create.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DescriptionField, Form, NameField, TextField } from '@oxide/form'
import { DescriptionField, Form, NameField, TextField } from 'app/components/form'
import { Divider } from '@oxide/ui'
import React from 'react'
import type { VpcSubnet } from '@oxide/api'
Expand Down
2 changes: 1 addition & 1 deletion app/forms/vpc-create.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { Form, NameField, DescriptionField, TextField } from '@oxide/form'
import { Form, NameField, DescriptionField, TextField } from 'app/components/form'
import type { Vpc } from '@oxide/api'
import { useApiMutation, useApiQueryClient } from '@oxide/api'
import { useParams, useToast } from 'app/hooks'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useFormikContext } from 'formik'

export const useError = (name: string): string | undefined => {
export const useFieldError = (name: string): string | undefined => {
const { errors } = useFormikContext()
return (errors as Record<string, string>)[name]
}
2 changes: 1 addition & 1 deletion app/layouts/OrgLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Sidebar, NavLinkItem } from '../components/Sidebar'
import { PageHeader } from '../components/PageHeader'
import { Pagination } from '@oxide/pagination'
import { SkipLinkTarget } from '@oxide/ui'
import { Form } from '@oxide/form'
import { Form } from 'app/components/form'

const OrgLayout = () => {
const { orgName } = useParams('orgName')
Expand Down
2 changes: 1 addition & 1 deletion app/layouts/ProjectLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Sidebar, NavLinkItem } from '../components/Sidebar'
import { PageHeader } from '../components/PageHeader'
import { useParams, useQuickActions } from 'app/hooks'
import { Pagination } from '@oxide/pagination'
import { Form } from '@oxide/form'
import { Form } from 'app/components/form'

const ProjectLayout = () => {
const navigate = useNavigate()
Expand Down
2 changes: 1 addition & 1 deletion app/layouts/RootLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Breadcrumbs } from '../components/Breadcrumbs'
import { TopBar } from '../components/TopBar'
import { PageHeader } from '../components/PageHeader'
import { Pagination } from '@oxide/pagination'
import { Form } from '@oxide/form'
import { Form } from 'app/components/form'

const RootLayout = () => {
return (
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"@oxide/api-mocks": ["libs/api-mocks/index.ts"],
"@oxide/ui": ["libs/ui/index.ts"],
"@oxide/util": ["libs/util/index.ts"],
"@oxide/form": ["libs/form/index.ts"],
"@oxide/table": ["libs/table/index.ts"],
"@oxide/pagination": ["libs/pagination/index.ts"]
},
Expand Down