diff --git a/apps/dokploy/components/dashboard/application/general/show.tsx b/apps/dokploy/components/dashboard/application/general/show.tsx index a8fef349b..5387659ad 100644 --- a/apps/dokploy/components/dashboard/application/general/show.tsx +++ b/apps/dokploy/components/dashboard/application/general/show.tsx @@ -69,7 +69,7 @@ export const ShowGeneralApplication = ({ applicationId }: Props) => { toast.success("Application deployed successfully"); refetch(); router.push( - `/dashboard/project/${data?.projectId}/services/application/${applicationId}?tab=deployments`, + `/dashboard/project/${data?.environment.projectId}/environment/${data?.environmentId}/services/application/${applicationId}?tab=deployments`, ); }) .catch(() => { diff --git a/apps/dokploy/components/dashboard/compose/general/actions.tsx b/apps/dokploy/components/dashboard/compose/general/actions.tsx index 29a9f9be3..870444be7 100644 --- a/apps/dokploy/components/dashboard/compose/general/actions.tsx +++ b/apps/dokploy/components/dashboard/compose/general/actions.tsx @@ -47,7 +47,7 @@ export const ComposeActions = ({ composeId }: Props) => { toast.success("Compose deployed successfully"); refetch(); router.push( - `/dashboard/project/${data?.project.projectId}/services/compose/${composeId}?tab=deployments`, + `/dashboard/project/${data?.environment.projectId}/environment/${data?.environmentId}/services/compose/${composeId}?tab=deployments`, ); }) .catch(() => { diff --git a/apps/dokploy/components/dashboard/search-command.tsx b/apps/dokploy/components/dashboard/search-command.tsx index b85024255..511ca00ab 100644 --- a/apps/dokploy/components/dashboard/search-command.tsx +++ b/apps/dokploy/components/dashboard/search-command.tsx @@ -87,7 +87,7 @@ export const SearchCommand = () => { key={application.id} onSelect={() => { router.push( - `/dashboard/project/${project.projectId}/services/${application.type}/${application.id}`, + `/dashboard/project/${project.projectId}/environment/${application.environmentId}/services/${application.type}/${application.id}`, ); setOpen(false); }} diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId].tsx index 931a24d87..d8ab5953c 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId].tsx @@ -1251,7 +1251,7 @@ const EnvironmentPage = ( key={service.id} onClick={() => { router.push( - `/dashboard/project/${projectId}/services/${service.type}/${service.id}`, + `/dashboard/project/${projectId}/environment/${environmentId}/services/${service.type}/${service.id}`, ); }} className="flex flex-col group relative cursor-pointer bg-transparent transition-colors hover:bg-border" diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/application/[applicationId].tsx similarity index 96% rename from apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx rename to apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/application/[applicationId].tsx index 09766130d..920eef81b 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/application/[applicationId].tsx @@ -71,7 +71,7 @@ const Service = ( const [_toggleMonitoring, _setToggleMonitoring] = useState(false); const { applicationId, activeTab } = props; const router = useRouter(); - const { projectId } = router.query; + const { projectId, environmentId } = router.query; const [tab, setTab] = useState(activeTab); useEffect(() => { @@ -97,18 +97,18 @@ const Service = ( list={[ { name: "Projects", href: "/dashboard/projects" }, { - name: data?.project?.name || "", + name: data?.environment.project.name || "", href: `/dashboard/project/${projectId}`, }, { name: data?.name || "", - href: `/dashboard/project/${projectId}/services/application/${applicationId}`, + href: `/dashboard/project/${projectId}/environment/${environmentId}/services/application/${applicationId}`, }, ]} /> - Application: {data?.name} - {data?.project.name} | Dokploy + Application: {data?.name} - {data?.environment.project.name} | Dokploy
@@ -215,7 +215,7 @@ const Service = ( className="w-full" onValueChange={(e) => { setTab(e as TabState); - const newPath = `/dashboard/project/${projectId}/services/application/${applicationId}?tab=${e}`; + const newPath = `/dashboard/project/${projectId}/environment/${environmentId}/services/application/${applicationId}?tab=${e}`; router.push(newPath); }} > @@ -379,6 +379,7 @@ export async function getServerSideProps( ctx: GetServerSidePropsContext<{ applicationId: string; activeTab: TabState; + environmentId: string; }>, ) { const { query, params, req, res } = ctx; @@ -420,6 +421,7 @@ export async function getServerSideProps( trpcState: helpers.dehydrate(), applicationId: params?.applicationId, activeTab: (activeTab || "general") as TabState, + environmentId: params?.environmentId, }, }; } catch { diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/services/compose/[composeId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/compose/[composeId].tsx similarity index 96% rename from apps/dokploy/pages/dashboard/project/[projectId]/services/compose/[composeId].tsx rename to apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/compose/[composeId].tsx index 080659696..9bae299bf 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/services/compose/[composeId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/compose/[composeId].tsx @@ -67,7 +67,7 @@ const Service = ( const [_toggleMonitoring, _setToggleMonitoring] = useState(false); const { composeId, activeTab } = props; const router = useRouter(); - const { projectId } = router.query; + const { projectId, environmentId } = router.query; const [tab, setTab] = useState(activeTab); useEffect(() => { @@ -88,18 +88,18 @@ const Service = ( list={[ { name: "Projects", href: "/dashboard/projects" }, { - name: data?.project?.name || "", + name: data?.environment?.project?.name || "", href: `/dashboard/project/${projectId}`, }, { name: data?.name || "", - href: `/dashboard/project/${projectId}/services/compose/${composeId}`, + href: `/dashboard/project/${projectId}/environment/${environmentId}/services/compose/${composeId}`, }, ]} /> - Compose: {data?.name} - {data?.project.name} | Dokploy + Compose: {data?.name} - {data?.environment?.project?.name} | Dokploy
@@ -208,7 +208,7 @@ const Service = ( className="w-full" onValueChange={(e) => { setTab(e as TabState); - const newPath = `/dashboard/project/${projectId}/services/compose/${composeId}?tab=${e}`; + const newPath = `/dashboard/project/${projectId}/environment/${environmentId}/services/compose/${composeId}?tab=${e}`; router.push(newPath); }} > @@ -375,6 +375,7 @@ export async function getServerSideProps( ctx: GetServerSidePropsContext<{ composeId: string; activeTab: TabState; + environmentId: string; }>, ) { const { query, params, req, res } = ctx; @@ -414,6 +415,7 @@ export async function getServerSideProps( trpcState: helpers.dehydrate(), composeId: params?.composeId, activeTab: (activeTab || "general") as TabState, + environmentId: params?.environmentId, }, }; } catch { diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/services/mariadb/[mariadbId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mariadb/[mariadbId].tsx similarity index 97% rename from apps/dokploy/pages/dashboard/project/[projectId]/services/mariadb/[mariadbId].tsx rename to apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mariadb/[mariadbId].tsx index a3520f9c9..543f5b914 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/services/mariadb/[mariadbId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mariadb/[mariadbId].tsx @@ -55,7 +55,7 @@ const Mariadb = ( const { mariadbId, activeTab } = props; const router = useRouter(); - const { projectId } = router.query; + const { projectId, environmentId } = router.query; const [tab, setSab] = useState(activeTab); const { data } = api.mariadb.one.useQuery({ mariadbId }); const { data: auth } = api.user.get.useQuery(); @@ -74,7 +74,7 @@ const Mariadb = ( }, { name: data?.name || "", - href: `/dashboard/project/${projectId}/services/mariadb/${mariadbId}`, + href: `/dashboard/project/${projectId}/environment/${environmentId}/services/mariadb/${mariadbId}`, }, ]} /> @@ -179,7 +179,7 @@ const Mariadb = ( className="w-full" onValueChange={(e) => { setSab(e as TabState); - const newPath = `/dashboard/project/${projectId}/services/mariadb/${mariadbId}?tab=${e}`; + const newPath = `/dashboard/project/${projectId}/environment/${environmentId}/services/mariadb/${mariadbId}?tab=${e}`; router.push(newPath, undefined, { shallow: true }); }} @@ -300,7 +300,7 @@ Mariadb.getLayout = (page: ReactElement) => { }; export async function getServerSideProps( - ctx: GetServerSidePropsContext<{ mariadbId: string; activeTab: TabState }>, + ctx: GetServerSidePropsContext<{ mariadbId: string; activeTab: TabState; environmentId: string }>, ) { const { query, params, req, res } = ctx; const activeTab = query.tab; @@ -338,6 +338,7 @@ export async function getServerSideProps( trpcState: helpers.dehydrate(), mariadbId: params?.mariadbId, activeTab: (activeTab || "general") as TabState, + environmentId: params?.environmentId, }, }; } catch { diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/services/mongo/[mongoId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mongo/[mongoId].tsx similarity index 97% rename from apps/dokploy/pages/dashboard/project/[projectId]/services/mongo/[mongoId].tsx rename to apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mongo/[mongoId].tsx index da782f624..65a7729c1 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/services/mongo/[mongoId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mongo/[mongoId].tsx @@ -54,7 +54,7 @@ const Mongo = ( const [_toggleMonitoring, _setToggleMonitoring] = useState(false); const { mongoId, activeTab } = props; const router = useRouter(); - const { projectId } = router.query; + const { projectId, environmentId } = router.query; const [tab, setSab] = useState(activeTab); const { data } = api.mongo.one.useQuery({ mongoId }); @@ -74,7 +74,7 @@ const Mongo = ( }, { name: data?.name || "", - href: `/dashboard/project/${projectId}/services/mongo/${mongoId}`, + href: `/dashboard/project/${projectId}/environment/${environmentId}/services/mongo/${mongoId}`, }, ]} /> @@ -180,7 +180,7 @@ const Mongo = ( className="w-full" onValueChange={(e) => { setSab(e as TabState); - const newPath = `/dashboard/project/${projectId}/services/mongo/${mongoId}?tab=${e}`; + const newPath = `/dashboard/project/${projectId}/environment/${environmentId}/services/mongo/${mongoId}?tab=${e}`; router.push(newPath, undefined, { shallow: true }); }} @@ -302,7 +302,7 @@ Mongo.getLayout = (page: ReactElement) => { }; export async function getServerSideProps( - ctx: GetServerSidePropsContext<{ mongoId: string; activeTab: TabState }>, + ctx: GetServerSidePropsContext<{ mongoId: string; activeTab: TabState; environmentId: string }>, ) { const { query, params, req, res } = ctx; const activeTab = query.tab; @@ -340,6 +340,7 @@ export async function getServerSideProps( trpcState: helpers.dehydrate(), mongoId: params?.mongoId, activeTab: (activeTab || "general") as TabState, + environmentId: params?.environmentId, }, }; } catch { diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/services/mysql/[mysqlId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mysql/[mysqlId].tsx similarity index 97% rename from apps/dokploy/pages/dashboard/project/[projectId]/services/mysql/[mysqlId].tsx rename to apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mysql/[mysqlId].tsx index b11174bf4..5d2b88c9a 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/services/mysql/[mysqlId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mysql/[mysqlId].tsx @@ -54,7 +54,7 @@ const MySql = ( const [_toggleMonitoring, _setToggleMonitoring] = useState(false); const { mysqlId, activeTab } = props; const router = useRouter(); - const { projectId } = router.query; + const { projectId, environmentId } = router.query; const [tab, setSab] = useState(activeTab); const { data } = api.mysql.one.useQuery({ mysqlId }); const { data: auth } = api.user.get.useQuery(); @@ -73,7 +73,7 @@ const MySql = ( }, { name: data?.name || "", - href: `/dashboard/project/${projectId}/services/mysql/${mysqlId}`, + href: `/dashboard/project/${projectId}/environment/${environmentId}/services/mysql/${mysqlId}`, }, ]} /> @@ -180,7 +180,7 @@ const MySql = ( className="w-full" onValueChange={(e) => { setSab(e as TabState); - const newPath = `/dashboard/project/${projectId}/services/mysql/${mysqlId}?tab=${e}`; + const newPath = `/dashboard/project/${projectId}/environment/${environmentId}/services/mysql/${mysqlId}?tab=${e}`; router.push(newPath, undefined, { shallow: true }); }} @@ -286,7 +286,7 @@ MySql.getLayout = (page: ReactElement) => { }; export async function getServerSideProps( - ctx: GetServerSidePropsContext<{ mysqlId: string; activeTab: TabState }>, + ctx: GetServerSidePropsContext<{ mysqlId: string; activeTab: TabState; environmentId: string }>, ) { const { query, params, req, res } = ctx; const activeTab = query.tab; diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/services/postgres/[postgresId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/postgres/[postgresId].tsx similarity index 97% rename from apps/dokploy/pages/dashboard/project/[projectId]/services/postgres/[postgresId].tsx rename to apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/postgres/[postgresId].tsx index ae76a6734..5efe4b69f 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/services/postgres/[postgresId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/postgres/[postgresId].tsx @@ -54,7 +54,7 @@ const Postgresql = ( const [_toggleMonitoring, _setToggleMonitoring] = useState(false); const { postgresId, activeTab } = props; const router = useRouter(); - const { projectId } = router.query; + const { projectId, environmentId } = router.query; const [tab, setSab] = useState(activeTab); const { data } = api.postgres.one.useQuery({ postgresId }); const { data: auth } = api.user.get.useQuery(); @@ -73,7 +73,7 @@ const Postgresql = ( }, { name: data?.name || "", - href: `/dashboard/project/${projectId}/services/postgres/${postgresId}`, + href: `/dashboard/project/${projectId}/environment/${environmentId}/services/postgres/${postgresId}`, }, ]} /> @@ -179,7 +179,7 @@ const Postgresql = ( className="w-full" onValueChange={(e) => { setSab(e as TabState); - const newPath = `/dashboard/project/${projectId}/services/postgres/${postgresId}?tab=${e}`; + const newPath = `/dashboard/project/${projectId}/environment/${environmentId}/services/postgres/${postgresId}?tab=${e}`; router.push(newPath, undefined, { shallow: true }); }} @@ -284,7 +284,7 @@ Postgresql.getLayout = (page: ReactElement) => { }; export async function getServerSideProps( - ctx: GetServerSidePropsContext<{ postgresId: string; activeTab: TabState }>, + ctx: GetServerSidePropsContext<{ postgresId: string; activeTab: TabState; environmentId: string }>, ) { const { query, params, req, res } = ctx; const activeTab = query.tab; diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/services/redis/[redisId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/redis/[redisId].tsx similarity index 97% rename from apps/dokploy/pages/dashboard/project/[projectId]/services/redis/[redisId].tsx rename to apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/redis/[redisId].tsx index 5627a14e5..86ffb0db5 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/services/redis/[redisId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/redis/[redisId].tsx @@ -53,7 +53,7 @@ const Redis = ( const [_toggleMonitoring, _setToggleMonitoring] = useState(false); const { redisId, activeTab } = props; const router = useRouter(); - const { projectId } = router.query; + const { projectId, environmentId } = router.query; const [tab, setSab] = useState(activeTab); const { data } = api.redis.one.useQuery({ redisId }); @@ -73,7 +73,7 @@ const Redis = ( }, { name: data?.name || "", - href: `/dashboard/project/${projectId}/services/redis/${redisId}`, + href: `/dashboard/project/${projectId}/environment/${environmentId}/services/redis/${redisId}`, }, ]} /> @@ -179,7 +179,7 @@ const Redis = ( className="w-full" onValueChange={(e) => { setSab(e as TabState); - const newPath = `/dashboard/project/${projectId}/services/redis/${redisId}?tab=${e}`; + const newPath = `/dashboard/project/${projectId}/environment/${environmentId}/services/redis/${redisId}?tab=${e}`; router.push(newPath, undefined, { shallow: true }); }} @@ -291,7 +291,7 @@ Redis.getLayout = (page: ReactElement) => { }; export async function getServerSideProps( - ctx: GetServerSidePropsContext<{ redisId: string; activeTab: TabState }>, + ctx: GetServerSidePropsContext<{ redisId: string; activeTab: TabState; environmentId: string }>, ) { const { query, params, req, res } = ctx; const activeTab = query.tab; diff --git a/packages/server/src/services/application.ts b/packages/server/src/services/application.ts index ac18b2d01..30579d29a 100644 --- a/packages/server/src/services/application.ts +++ b/packages/server/src/services/application.ts @@ -185,7 +185,7 @@ export const deployApplication = async ({ }) => { const application = await findApplicationById(applicationId); - const buildLink = `${await getDokployUrl()}/dashboard/project/${application.projectId}/services/application/${application.applicationId}?tab=deployments`; + const buildLink = `${await getDokployUrl()}/dashboard/project/${application.environment.projectId}/environment/${application.environmentId}/services/application/${application.applicationId}?tab=deployments`; const deployment = await createDeployment({ applicationId: applicationId, title: titleLog, @@ -312,7 +312,7 @@ export const deployRemoteApplication = async ({ }) => { const application = await findApplicationById(applicationId); - const buildLink = `${await getDokployUrl()}/dashboard/project/${application.projectId}/services/application/${application.applicationId}?tab=deployments`; + const buildLink = `${await getDokployUrl()}/dashboard/project/${application.environment.projectId}/environment/${application.environmentId}/services/application/${application.applicationId}?tab=deployments`; const deployment = await createDeployment({ applicationId: applicationId, title: titleLog,