|
6 | 6 | * Copyright Oxide Computer Company |
7 | 7 | */ |
8 | 8 | import { useForm } from 'react-hook-form' |
9 | | -import { useNavigate, type LoaderFunctionArgs } from 'react-router' |
| 9 | +import { useNavigate } from 'react-router' |
10 | 10 |
|
11 | | -import { apiQueryClient, usePrefetchedApiQuery, type Image } from '@oxide/api' |
| 11 | +import { type Image } from '@oxide/api' |
12 | 12 | import { Images16Icon } from '@oxide/design-system/icons/react' |
13 | 13 |
|
14 | 14 | import { DescriptionField } from '~/components/form/fields/DescriptionField' |
15 | 15 | import { NameField } from '~/components/form/fields/NameField' |
16 | 16 | import { TextField } from '~/components/form/fields/TextField' |
17 | 17 | import { SideModalForm } from '~/components/form/SideModalForm' |
18 | | -import { |
19 | | - getProjectImageSelector, |
20 | | - getSiloImageSelector, |
21 | | - useProjectImageSelector, |
22 | | - useSiloImageSelector, |
23 | | -} from '~/hooks/use-params' |
24 | 18 | import { PropertiesTable } from '~/ui/lib/PropertiesTable' |
25 | 19 | import { ResourceLabel } from '~/ui/lib/SideModal' |
26 | | -import { pb } from '~/util/path-builder' |
27 | 20 | import { capitalize } from '~/util/str' |
28 | 21 | import { bytesToGiB } from '~/util/units' |
29 | 22 |
|
30 | | -export const ProjectImageEdit = { |
31 | | - loader: async ({ params }: LoaderFunctionArgs) => { |
32 | | - const { project, image } = getProjectImageSelector(params) |
33 | | - await apiQueryClient.prefetchQuery('imageView', { path: { image }, query: { project } }) |
34 | | - return null |
35 | | - }, |
36 | | - Component: EditProjectImageSideModalForm, |
37 | | -} |
38 | | - |
39 | | -export const SiloImageEdit = { |
40 | | - loader: async ({ params }: LoaderFunctionArgs) => { |
41 | | - const { image } = getSiloImageSelector(params) |
42 | | - await apiQueryClient.prefetchQuery('imageView', { path: { image } }) |
43 | | - return null |
44 | | - }, |
45 | | - Component: EditSiloImageSideModalForm, |
46 | | -} |
47 | | - |
48 | | -function EditProjectImageSideModalForm() { |
49 | | - const { project, image } = useProjectImageSelector() |
50 | | - const { data } = usePrefetchedApiQuery('imageView', { |
51 | | - path: { image }, |
52 | | - query: { project }, |
53 | | - }) |
54 | | - |
55 | | - const dismissLink = pb.projectImages({ project }) |
56 | | - return <EditImageSideModalForm image={data} dismissLink={dismissLink} type="Project" /> |
57 | | -} |
58 | | - |
59 | | -function EditSiloImageSideModalForm() { |
60 | | - const { image } = useSiloImageSelector() |
61 | | - const { data } = usePrefetchedApiQuery('imageView', { path: { image } }) |
62 | | - |
63 | | - return <EditImageSideModalForm image={data} dismissLink={pb.siloImages()} type="Silo" /> |
64 | | -} |
65 | | - |
66 | | -function EditImageSideModalForm({ |
| 23 | +export function EditImageSideModalForm({ |
67 | 24 | image, |
68 | 25 | dismissLink, |
69 | 26 | type, |
|
0 commit comments