mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-23 04:18:45 +00:00
feat(dashboard): add environment availability alert for projects
- Implemented a check for projects with no accessible environments, displaying an alert message to inform users. - Updated project link behavior to prevent navigation when no environments are available, enhancing user experience.
This commit is contained in:
@@ -293,13 +293,24 @@ export const ShowProjects = () => {
|
|||||||
project?.environments.find((env) => env.isDefault) ||
|
project?.environments.find((env) => env.isDefault) ||
|
||||||
project?.environments?.[0];
|
project?.environments?.[0];
|
||||||
|
|
||||||
|
const hasNoEnvironments = !accessibleEnvironment;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={project.projectId}
|
key={project.projectId}
|
||||||
className="w-full lg:max-w-md"
|
className="w-full lg:max-w-md"
|
||||||
>
|
>
|
||||||
<Link
|
<Link
|
||||||
href={`/dashboard/project/${project.projectId}/environment/${accessibleEnvironment?.environmentId}`}
|
href={
|
||||||
|
hasNoEnvironments
|
||||||
|
? "#"
|
||||||
|
: `/dashboard/project/${project.projectId}/environment/${accessibleEnvironment?.environmentId}`
|
||||||
|
}
|
||||||
|
onClick={(e) => {
|
||||||
|
if (hasNoEnvironments) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Card className="group relative w-full h-full bg-transparent transition-colors hover:bg-border">
|
<Card className="group relative w-full h-full bg-transparent transition-colors hover:bg-border">
|
||||||
{haveServicesWithDomains ? (
|
{haveServicesWithDomains ? (
|
||||||
@@ -431,6 +442,16 @@ export const ShowProjects = () => {
|
|||||||
<span className="text-sm font-medium text-muted-foreground break-all">
|
<span className="text-sm font-medium text-muted-foreground break-all">
|
||||||
{project.description}
|
{project.description}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
{hasNoEnvironments && (
|
||||||
|
<div className="flex flex-row gap-2 items-center rounded-lg bg-yellow-50 p-2 mt-2 dark:bg-yellow-950">
|
||||||
|
<AlertTriangle className="size-4 text-yellow-600 dark:text-yellow-400 shrink-0" />
|
||||||
|
<span className="text-xs text-yellow-600 dark:text-yellow-400">
|
||||||
|
You have access to this project but no
|
||||||
|
environments are available
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
<div className="flex self-start space-x-1">
|
<div className="flex self-start space-x-1">
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
|
|||||||
Reference in New Issue
Block a user