From abe787593cd092284c0d185ced3d29f946d11ad8 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Tue, 17 Sep 2024 00:05:47 -0600 Subject: [PATCH] refactor(multi-server): remove databases and hide monitoring when using deploy on server --- .../services/application/[applicationId].tsx | 25 ++++++++++---- .../services/compose/[composeId].tsx | 33 ++++++++++++------- .../services/mariadb/[mariadbId].tsx | 25 +++++++++----- .../[projectId]/services/mongo/[mongoId].tsx | 25 +++++++++----- .../[projectId]/services/mysql/[mysqlId].tsx | 24 ++++++++++---- .../services/postgres/[postgresId].tsx | 25 +++++++++----- .../[projectId]/services/redis/[redisId].tsx | 25 +++++++++----- apps/dokploy/server/api/routers/mariadb.ts | 2 +- apps/dokploy/server/api/routers/mongo.ts | 2 +- apps/dokploy/server/api/routers/mysql.ts | 2 +- apps/dokploy/server/api/routers/postgres.ts | 2 +- apps/dokploy/server/api/routers/redis.ts | 2 +- 12 files changed, 129 insertions(+), 63 deletions(-) diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx index 05f7ab651..e7b1c122a 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx @@ -22,6 +22,7 @@ import { BreadcrumbLink, } from "@/components/ui/breadcrumb"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { cn } from "@/lib/utils"; import { appRouter } from "@/server/api/root"; import { validateRequest } from "@/server/auth/auth"; import { api } from "@/utils/api"; @@ -125,10 +126,17 @@ const Service = ( }} >
- + General Environment - Monitoring + {!data?.serverId && ( + Monitoring + )} Logs Deployments Domains @@ -152,11 +160,14 @@ const Service = (
- -
- -
-
+ {!data?.serverId && ( + +
+ +
+
+ )} +
- + General Environment - Monitoring + {!data?.serverId && ( + Monitoring + )} Logs Deployments Domains @@ -147,16 +155,17 @@ const Service = (
- - -
- -
-
+ {!data?.serverId && ( + +
+ +
+
+ )}
diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/services/mariadb/[mariadbId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/services/mariadb/[mariadbId].tsx index 3c16e27f9..75be903a8 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/services/mariadb/[mariadbId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/services/mariadb/[mariadbId].tsx @@ -9,7 +9,6 @@ import { ShowInternalMariadbCredentials } from "@/components/dashboard/mariadb/g import { UpdateMariadb } from "@/components/dashboard/mariadb/update-mariadb"; import { DockerMonitoring } from "@/components/dashboard/monitoring/docker/show"; import { MariadbIcon } from "@/components/icons/data-tools-icons"; -import { DashboardLayout } from "@/components/layouts/dashboard-layout"; import { ProjectLayout } from "@/components/layouts/project-layout"; import { StatusTooltip } from "@/components/shared/status-tooltip"; import { @@ -18,6 +17,7 @@ import { BreadcrumbLink, } from "@/components/ui/breadcrumb"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { cn } from "@/lib/utils"; import { appRouter } from "@/server/api/root"; import { validateRequest } from "@/server/auth/auth"; import { api } from "@/utils/api"; @@ -108,10 +108,17 @@ const Mariadb = ( }} >
- + General Environment - Monitoring + {!data?.serverId && ( + Monitoring + )} Backups Logs Advanced @@ -136,11 +143,13 @@ const Mariadb = (
- -
- -
-
+ {!data?.serverId && ( + +
+ +
+
+ )}
- + General Environment - Monitoring + {!data?.serverId && ( + Monitoring + )} Backups Logs Advanced @@ -138,11 +145,13 @@ const Mongo = (
- -
- -
-
+ {!data?.serverId && ( + +
+ +
+
+ )}
- + General Environment - Monitoring + {!data?.serverId && ( + Monitoring + )} Backups Logs Advanced @@ -137,11 +145,13 @@ const MySql = (
- -
- -
-
+ {!data?.serverId && ( + +
+ +
+
+ )}
- + General Environment - Monitoring + {!data?.serverId && ( + Monitoring + )} Backups Logs Advanced @@ -138,11 +145,13 @@ const Postgresql = (
- -
- -
-
+ {!data?.serverId && ( + +
+ +
+
+ )}
- + General Environment - Monitoring + {!data?.serverId && ( + Monitoring + )} Logs Advanced @@ -136,11 +143,13 @@ const Redis = (
- -
- -
-
+ {!data?.serverId && ( + +
+ +
+
+ )}
await removeService(mongo?.appName), + async () => await removeService(mongo?.appName, mongo.serverId), async () => await removeMariadbById(input.mariadbId), ]; diff --git a/apps/dokploy/server/api/routers/mongo.ts b/apps/dokploy/server/api/routers/mongo.ts index 152dc3d1d..f51d0eb9e 100644 --- a/apps/dokploy/server/api/routers/mongo.ts +++ b/apps/dokploy/server/api/routers/mongo.ts @@ -160,7 +160,7 @@ export const mongoRouter = createTRPCRouter({ const mongo = await findMongoById(input.mongoId); const cleanupOperations = [ - async () => await removeService(mongo?.appName), + async () => await removeService(mongo?.appName, mongo.serverId), async () => await removeMongoById(input.mongoId), ]; diff --git a/apps/dokploy/server/api/routers/mysql.ts b/apps/dokploy/server/api/routers/mysql.ts index 9cd0fdd40..71f6d514b 100644 --- a/apps/dokploy/server/api/routers/mysql.ts +++ b/apps/dokploy/server/api/routers/mysql.ts @@ -156,7 +156,7 @@ export const mysqlRouter = createTRPCRouter({ const mongo = await findMySqlById(input.mysqlId); const cleanupOperations = [ - async () => await removeService(mongo?.appName), + async () => await removeService(mongo?.appName, mongo.serverId), async () => await removeMySqlById(input.mysqlId), ]; diff --git a/apps/dokploy/server/api/routers/postgres.ts b/apps/dokploy/server/api/routers/postgres.ts index 696583811..b902ee517 100644 --- a/apps/dokploy/server/api/routers/postgres.ts +++ b/apps/dokploy/server/api/routers/postgres.ts @@ -135,7 +135,7 @@ export const postgresRouter = createTRPCRouter({ const postgres = await findPostgresById(input.postgresId); const cleanupOperations = [ - removeService(postgres.appName), + removeService(postgres.appName, postgres.serverId), removePostgresById(input.postgresId), ]; diff --git a/apps/dokploy/server/api/routers/redis.ts b/apps/dokploy/server/api/routers/redis.ts index c52d8385d..19bfa7c20 100644 --- a/apps/dokploy/server/api/routers/redis.ts +++ b/apps/dokploy/server/api/routers/redis.ts @@ -156,7 +156,7 @@ export const redisRouter = createTRPCRouter({ const redis = await findRedisById(input.redisId); const cleanupOperations = [ - async () => await removeService(redis?.appName), + async () => await removeService(redis?.appName, redis.serverId), async () => await removeRedisById(input.redisId), ];