From 0374165a7fcbd3db841b916f2bc77083a366a8a3 Mon Sep 17 00:00:00 2001
From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com>
Date: Sat, 17 Aug 2024 16:57:27 -0600
Subject: [PATCH] refactor: remove unused code
---
.../compose/general/generic/show.tsx | 6 +--
.../general/show-converted-compose.tsx | 52 +++++++++++--------
apps/dokploy/server/api/routers/domain.ts | 7 +--
apps/dokploy/server/api/services/domain.ts | 22 --------
apps/dokploy/server/utils/docker/domain.ts | 2 +-
5 files changed, 36 insertions(+), 53 deletions(-)
diff --git a/apps/dokploy/components/dashboard/compose/general/generic/show.tsx b/apps/dokploy/components/dashboard/compose/general/generic/show.tsx
index bcece796..93a2d769 100644
--- a/apps/dokploy/components/dashboard/compose/general/generic/show.tsx
+++ b/apps/dokploy/components/dashboard/compose/general/generic/show.tsx
@@ -30,10 +30,10 @@ export const ShowProviderFormCompose = ({ composeId }: Props) => {
Select the source of your code
- {/*
diff --git a/apps/dokploy/components/dashboard/compose/general/show-converted-compose.tsx b/apps/dokploy/components/dashboard/compose/general/show-converted-compose.tsx
index e0476d19..bb01badc 100644
--- a/apps/dokploy/components/dashboard/compose/general/show-converted-compose.tsx
+++ b/apps/dokploy/components/dashboard/compose/general/show-converted-compose.tsx
@@ -10,7 +10,7 @@ import {
DialogTrigger,
} from "@/components/ui/dialog";
import { api } from "@/utils/api";
-import { Puzzle } from "lucide-react";
+import { Puzzle, RefreshCw } from "lucide-react";
import { useState } from "react";
import { toast } from "sonner";
@@ -39,37 +39,47 @@ export const ShowConvertedCompose = ({ composeId }: Props) => {
Converted Compose
- See how the docker compose file will look like after adding the
- domains
+ Preview your docker-compose file with added domains. Note: At least
+ one domain must be specified for this conversion to take effect.
{isError && {error?.message}}
-
diff --git a/apps/dokploy/server/api/routers/domain.ts b/apps/dokploy/server/api/routers/domain.ts
index 2eb2905e..309dd91a 100644
--- a/apps/dokploy/server/api/routers/domain.ts
+++ b/apps/dokploy/server/api/routers/domain.ts
@@ -18,7 +18,6 @@ import {
findDomainsByApplicationId,
findDomainsByComposeId,
generateTraefikMeDomain,
- generateWildcard,
removeDomainById,
updateDomainById,
} from "../services/domain";
@@ -52,11 +51,7 @@ export const domainRouter = createTRPCRouter({
.mutation(async ({ input }) => {
return generateTraefikMeDomain(input.appName);
}),
- generateWildcard: protectedProcedure
- .input(apiFindDomainByApplication)
- .mutation(async ({ input }) => {
- return generateWildcard(input);
- }),
+
update: protectedProcedure
.input(apiUpdateDomain)
.mutation(async ({ input }) => {
diff --git a/apps/dokploy/server/api/services/domain.ts b/apps/dokploy/server/api/services/domain.ts
index e3b852c6..53687d28 100644
--- a/apps/dokploy/server/api/services/domain.ts
+++ b/apps/dokploy/server/api/services/domain.ts
@@ -45,28 +45,6 @@ export const generateTraefikMeDomain = async (appName: string) => {
});
};
-export const generateWildcard = async (
- input: typeof apiFindDomainByApplication._type,
-) => {
- // const application = await findApplicationById(input.applicationId);
- // const admin = await findAdmin();
- // if (!admin.host) {
- // throw new TRPCError({
- // code: "BAD_REQUEST",
- // message: "We need a host to generate a wildcard domain",
- // });
- // }
- // const domain = await createDomain({
- // applicationId: application.applicationId,
- // host: generateWildcardDomain(application.appName, admin.host || ""),
- // port: 3000,
- // certificateType: "none",
- // https: false,
- // path: "/",
- // });
- // return domain;
-};
-
export const generateWildcardDomain = (
appName: string,
serverDomain: string,
diff --git a/apps/dokploy/server/utils/docker/domain.ts b/apps/dokploy/server/utils/docker/domain.ts
index f590c5b4..924a9e8e 100644
--- a/apps/dokploy/server/utils/docker/domain.ts
+++ b/apps/dokploy/server/utils/docker/domain.ts
@@ -84,7 +84,7 @@ export const addDomainToCompose = async (
const { appName } = compose;
const result = await loadDockerCompose(compose);
- if (!result) {
+ if (!result || domains.length === 0) {
return null;
}