mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-16 19:35:25 +02:00
fix: allow users to open projects with accessible environments
- Update environment selection to fallback to first accessible environment when default is not accessible - Fix search command to handle users without default environment access - Fix projects list to use accessible environment instead of always default - Add server-side redirect to accessible environment when accessing inaccessible one - Add comprehensive test coverage for environment access fallback logic Fixes #3394
This commit is contained in:
@@ -288,9 +288,11 @@ export const ShowProjects = () => {
|
||||
)
|
||||
.some(Boolean);
|
||||
|
||||
const productionEnvironment = project?.environments.find(
|
||||
(env) => env.isDefault,
|
||||
);
|
||||
// Find default environment from accessible environments, or fall back to first accessible environment
|
||||
const accessibleEnvironment =
|
||||
project?.environments.find(
|
||||
(env) => env.isDefault,
|
||||
) || project?.environments?.[0];
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -298,7 +300,7 @@ export const ShowProjects = () => {
|
||||
className="w-full lg:max-w-md"
|
||||
>
|
||||
<Link
|
||||
href={`/dashboard/project/${project.projectId}/environment/${productionEnvironment?.environmentId}`}
|
||||
href={`/dashboard/project/${project.projectId}/environment/${accessibleEnvironment?.environmentId}`}
|
||||
>
|
||||
<Card className="group relative w-full h-full bg-transparent transition-colors hover:bg-border">
|
||||
{haveServicesWithDomains ? (
|
||||
|
||||
@@ -89,7 +89,7 @@ export const SearchCommand = () => {
|
||||
<CommandGroup heading={"Projects"}>
|
||||
<CommandList>
|
||||
{data?.map((project) => {
|
||||
// Find default environment, or fall back to first environment
|
||||
// Find default environment from accessible environments, or fall back to first accessible environment
|
||||
const defaultEnvironment =
|
||||
project.environments.find(
|
||||
(environment) => environment.isDefault,
|
||||
|
||||
Reference in New Issue
Block a user