diff --git a/components/dashboard/application/advanced/volumes/add-volumes.tsx b/components/dashboard/application/advanced/volumes/add-volumes.tsx index a7a39b83..e32ad756 100644 --- a/components/dashboard/application/advanced/volumes/add-volumes.tsx +++ b/components/dashboard/application/advanced/volumes/add-volumes.tsx @@ -330,7 +330,7 @@ export const AddVolumes = ({ /> )} - {serviceType === "application" && ( + {serviceType !== "compose" && ( { key={mount.mountId} className="flex w-full flex-col sm:flex-row sm:items-center justify-between gap-4 sm:gap-10 border rounded-lg p-4" > - {/* */} -
+
Mount Type @@ -91,12 +90,21 @@ export const ShowVolumes = ({ applicationId }: Props) => { )} {mount.type === "file" && ( -
- Content - - {mount.content} - -
+ <> +
+ Content + + {mount.content} + +
+ +
+ File Path + + {mount.filePath} + +
+ )} {mount.type === "bind" && (
@@ -118,6 +126,7 @@ export const ShowVolumes = ({ applicationId }: Props) => { mountId={mount.mountId} type={mount.type} refetch={refetch} + serviceType="application" />
diff --git a/components/dashboard/application/advanced/volumes/update-volume.tsx b/components/dashboard/application/advanced/volumes/update-volume.tsx index 34c17128..4bb6851c 100644 --- a/components/dashboard/application/advanced/volumes/update-volume.tsx +++ b/components/dashboard/application/advanced/volumes/update-volume.tsx @@ -48,6 +48,7 @@ const mySchema = z.discriminatedUnion("type", [ .object({ type: z.literal("file"), content: z.string().optional(), + filePath: z.string().min(1, "File path required"), }) .merge(mountSchema), ]); @@ -58,9 +59,23 @@ interface Props { mountId: string; type: "bind" | "volume" | "file"; refetch: () => void; + serviceType: + | "application" + | "postgres" + | "redis" + | "mongo" + | "redis" + | "mysql" + | "mariadb" + | "compose"; } -export const UpdateVolume = ({ mountId, type, refetch }: Props) => { +export const UpdateVolume = ({ + mountId, + type, + refetch, + serviceType, +}: Props) => { const utils = api.useUtils(); const { data } = api.mounts.one.useQuery( { @@ -103,6 +118,7 @@ export const UpdateVolume = ({ mountId, type, refetch }: Props) => { form.reset({ content: data.content || "", mountPath: data.mountPath, + filePath: data.filePath || "", type: "file", }); } @@ -141,6 +157,7 @@ export const UpdateVolume = ({ mountId, type, refetch }: Props) => { content: data.content, mountPath: data.mountPath, type: data.type, + filePath: data.filePath, mountId, }) .then(() => { @@ -166,6 +183,11 @@ export const UpdateVolume = ({ mountId, type, refetch }: Props) => { Update the mount {isError && {error?.message}} + {type === "file" && ( + + Updating the mount will recreate the file or directory. + + )}
{ )} {type === "file" && ( - ( - - Content - + <> + ( + + Content -