mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-23 04:18:45 +00:00
fix: improve mount path warning for PostgreSQL by handling multiple data mounts
This commit is contained in:
@@ -109,16 +109,21 @@ export const ShowCustomCommand = ({ id, type }: Props) => {
|
|||||||
|
|
||||||
const mountPathWarning = (() => {
|
const mountPathWarning = (() => {
|
||||||
if (type !== "postgres" || !dockerImage) return null;
|
if (type !== "postgres" || !dockerImage) return null;
|
||||||
const mounts = (data as any)?.mounts ?? [];
|
const mounts = data && "mounts" in data ? data.mounts : [];
|
||||||
const dataMount = mounts.find(
|
const dataMounts = mounts.filter(
|
||||||
(mount: { type: string; mountPath: string }) =>
|
(mount) =>
|
||||||
mount.type === "volume" &&
|
mount.type === "volume" &&
|
||||||
POSTGRES_DATA_PATH_REGEX.test(mount.mountPath),
|
POSTGRES_DATA_PATH_REGEX.test(mount.mountPath),
|
||||||
);
|
);
|
||||||
if (!dataMount) return null;
|
if (dataMounts.length === 0) return null;
|
||||||
const expectedPath = getPostgresMountPath(dockerImage);
|
const expectedPath = getPostgresMountPath(dockerImage);
|
||||||
if (expectedPath === dataMount.mountPath) return null;
|
if (dataMounts.some((mount) => mount.mountPath === expectedPath)) {
|
||||||
return { expectedPath, currentPath: dataMount.mountPath };
|
return null;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
expectedPath,
|
||||||
|
currentPath: dataMounts.map((mount) => mount.mountPath).join(", "),
|
||||||
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
const onSubmit = async (formData: AddDockerImage) => {
|
const onSubmit = async (formData: AddDockerImage) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user