diff --git a/__test__/drop/drop.test.test.ts b/__test__/drop/drop.test.test.ts index c68d0a0b..5561999c 100644 --- a/__test__/drop/drop.test.test.ts +++ b/__test__/drop/drop.test.test.ts @@ -26,7 +26,7 @@ describe("unzipDrop using real zip files", () => { it("should correctly extract a zip with a single root folder", async () => { const appName = "single-file"; - const outputPath = path.join(APPLICATIONS_PATH, appName); + const outputPath = path.join(APPLICATIONS_PATH, appName, "code"); const zip = new AdmZip("./__test__/drop/zips/single-file.zip"); const zipBuffer = zip.toBuffer(); @@ -39,7 +39,7 @@ describe("unzipDrop using real zip files", () => { it("should correctly extract a zip with a single root folder and a subfolder", async () => { const appName = "folderwithfile"; - const outputPath = path.join(APPLICATIONS_PATH, appName); + const outputPath = path.join(APPLICATIONS_PATH, appName, "code"); const zip = new AdmZip("./__test__/drop/zips/folder-with-file.zip"); const zipBuffer = zip.toBuffer(); @@ -52,7 +52,7 @@ describe("unzipDrop using real zip files", () => { it("should correctly extract a zip with multiple root folders", async () => { const appName = "two-folders"; - const outputPath = path.join(APPLICATIONS_PATH, appName); + const outputPath = path.join(APPLICATIONS_PATH, appName, "code"); const zip = new AdmZip("./__test__/drop/zips/two-folders.zip"); const zipBuffer = zip.toBuffer(); @@ -67,7 +67,7 @@ describe("unzipDrop using real zip files", () => { it("should correctly extract a zip with a single root with a file", async () => { const appName = "nested"; - const outputPath = path.join(APPLICATIONS_PATH, appName); + const outputPath = path.join(APPLICATIONS_PATH, appName, "code"); const zip = new AdmZip("./__test__/drop/zips/nested.zip"); const zipBuffer = zip.toBuffer(); @@ -83,7 +83,7 @@ describe("unzipDrop using real zip files", () => { it("should correctly extract a zip with a single root with a folder", async () => { const appName = "folder-with-sibling-file"; - const outputPath = path.join(APPLICATIONS_PATH, appName); + const outputPath = path.join(APPLICATIONS_PATH, appName, "code"); const zip = new AdmZip("./__test__/drop/zips/folder-with-sibling-file.zip"); const zipBuffer = zip.toBuffer(); diff --git a/components/dashboard/application/advanced/volumes/add-volumes.tsx b/components/dashboard/application/advanced/volumes/add-volumes.tsx index 6b882b7c..e32ad756 100644 --- a/components/dashboard/application/advanced/volumes/add-volumes.tsx +++ b/components/dashboard/application/advanced/volumes/add-volumes.tsx @@ -63,6 +63,7 @@ const mySchema = z.discriminatedUnion("type", [ z .object({ type: z.literal("file"), + filePath: z.string().min(1, "File path required"), content: z.string().optional(), }) .merge(mountSchema), @@ -81,7 +82,7 @@ export const AddVolumes = ({ defaultValues: { type: serviceType === "compose" ? "file" : "bind", hostPath: "", - mountPath: "", + mountPath: serviceType === "compose" ? "/" : "", }, resolver: zodResolver(mySchema), }); @@ -125,6 +126,7 @@ export const AddVolumes = ({ serviceId, content: data.content, mountPath: data.mountPath, + filePath: data.filePath, type: data.type, serviceType, }) @@ -288,41 +290,62 @@ export const AddVolumes = ({ )} {type === "file" && ( + <> + ( + + Content + + +