Skip to content

Commit 8b4ad4e

Browse files
[autofix.ci] apply automated fixes (attempt 3/3)
1 parent 199a9ae commit 8b4ad4e

File tree

4 files changed

+49
-25
lines changed

4 files changed

+49
-25
lines changed

apps/dokploy/components/dashboard/application/advanced/volumes/show-volumes.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,12 @@ export const ShowVolumes = ({ id, type }: Props) => {
217217
</div>
218218
)}
219219
{/* Show defined volumes from docker-compose.yml for compose services */}
220-
{(() => {
221-
const composeVolumes = getComposeVolumes(data, type);
222-
return composeVolumes && <ComposeVolumes composeVolumes={composeVolumes} />;
223-
})()}
220+
{(() => {
221+
const composeVolumes = getComposeVolumes(data, type);
222+
return (
223+
composeVolumes && <ComposeVolumes composeVolumes={composeVolumes} />
224+
);
225+
})()}
224226
</CardContent>
225227
</Card>
226228
);

apps/dokploy/server/api/models/compose.models.ts

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,14 @@ export interface Compose {
7171
volumeName: string | null;
7272
filePath: string | null;
7373
content: string | null;
74-
serviceType: "application" | "postgres" | "mysql" | "mariadb" | "mongo" | "redis" | "compose";
74+
serviceType:
75+
| "application"
76+
| "postgres"
77+
| "mysql"
78+
| "mariadb"
79+
| "mongo"
80+
| "redis"
81+
| "compose";
7582
mountPath: string;
7683
applicationId: string | null;
7784
postgresId: string | null;
@@ -101,13 +108,16 @@ export interface Compose {
101108
composeId: string | null;
102109
destination: any;
103110
deployments: any[];
104-
}>;
111+
}>;
105112
hasGitProviderAccess: boolean;
106113
unauthorizedProvider: string | null;
107-
definedVolumesInComposeFile?: Record<string, {
108-
config: any;
109-
usage: Array<{ service: string; mountPath: string }>;
110-
hostPath?: string;
111-
isBindMount?: boolean;
112-
}>;
113-
};
114+
definedVolumesInComposeFile?: Record<
115+
string,
116+
{
117+
config: any;
118+
usage: Array<{ service: string; mountPath: string }>;
119+
hostPath?: string;
120+
isBindMount?: boolean;
121+
}
122+
>;
123+
}

apps/dokploy/server/api/routers/compose.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ export const composeRouter = createTRPCRouter({
180180
}
181181

182182
// Load volumes defined in docker-compose.yml if exists
183-
const definedVolumesInComposeFile = await loadDefinedVolumesInComposeFile(input.composeId);
183+
const definedVolumesInComposeFile = await loadDefinedVolumesInComposeFile(
184+
input.composeId,
185+
);
184186

185187
return {
186188
...compose,

packages/server/src/services/compose.ts

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export const createComposeByTemplate = async (
110110

111111
/**
112112
* Find compose by ID
113-
*
113+
*
114114
* @param composeId ID of the compose service
115115
*/
116116
export const findComposeById = async (composeId: string) => {
@@ -192,7 +192,7 @@ export const loadServices = async (
192192

193193
/**
194194
* Load defined volumes from a docker-compose.yml file
195-
*
195+
*
196196
* @param composeId ID of the compose service
197197
*/
198198
export const loadDefinedVolumesInComposeFile = async (composeId: string) => {
@@ -207,18 +207,20 @@ export const loadDefinedVolumesInComposeFile = async (composeId: string) => {
207207
} else {
208208
composeData = await loadDockerCompose(compose);
209209
}
210-
210+
211211
if (!composeData) {
212212
return {};
213213
}
214-
214+
215215
return extractVolumesFromComposeData(composeData);
216216
}
217217

218218
// Validate that we have the necessary provider configuration
219219
const hasValidProvider = validateComposeProvider(compose);
220220
if (!hasValidProvider) {
221-
console.warn(`No valid provider configuration for compose ${composeId}, returning empty volumes`);
221+
console.warn(
222+
`No valid provider configuration for compose ${composeId}, returning empty volumes`,
223+
);
222224
return {};
223225
}
224226

@@ -257,11 +259,21 @@ const validateComposeProvider = (compose: any): boolean => {
257259
case "github":
258260
return !!compose.repository && !!compose.owner && !!compose.githubId;
259261
case "gitlab":
260-
return !!compose.gitlabRepository && !!compose.gitlabOwner && !!compose.gitlabId;
262+
return (
263+
!!compose.gitlabRepository &&
264+
!!compose.gitlabOwner &&
265+
!!compose.gitlabId
266+
);
261267
case "bitbucket":
262-
return !!compose.bitbucketRepository && !!compose.bitbucketOwner && !!compose.bitbucketId;
268+
return (
269+
!!compose.bitbucketRepository &&
270+
!!compose.bitbucketOwner &&
271+
!!compose.bitbucketId
272+
);
263273
case "gitea":
264-
return !!compose.giteaRepository && !!compose.giteaOwner && !!compose.giteaId;
274+
return (
275+
!!compose.giteaRepository && !!compose.giteaOwner && !!compose.giteaId
276+
);
265277
case "git":
266278
return !!compose.customGitUrl;
267279
case "raw":
@@ -366,9 +378,7 @@ const extractVolumesFromComposeData = (composeData: ComposeSpecification) => {
366378
}
367379
> = {};
368380

369-
for (const [volumeName, volumeConfig] of Object.entries(
370-
volumesDefinition,
371-
)) {
381+
for (const [volumeName, volumeConfig] of Object.entries(volumesDefinition)) {
372382
result[volumeName] = {
373383
config: volumeConfig,
374384
usage: volumeUsage[volumeName] || [],

0 commit comments

Comments
 (0)