diff --git a/apps/dokploy/components/dashboard/application/advanced/show-application-advanced-settings.tsx b/apps/dokploy/components/dashboard/application/advanced/show-application-advanced-settings.tsx index 507fb50a..c603ea32 100644 --- a/apps/dokploy/components/dashboard/application/advanced/show-application-advanced-settings.tsx +++ b/apps/dokploy/components/dashboard/application/advanced/show-application-advanced-settings.tsx @@ -22,6 +22,13 @@ import React, { useEffect } from "react"; import { useForm } from "react-hook-form"; import { toast } from "sonner"; import { z } from "zod"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { InfoIcon } from "lucide-react"; const addResourcesApplication = z.object({ memoryReservation: z.number().nullable().optional(), @@ -101,10 +108,25 @@ export const ShowApplicationResources = ({ applicationId }: Props) => { name="memoryReservation" render={({ field }) => ( - Memory Reservation +
+ Memory Reservation + + + + + + +

+ Memory soft limit in bytes. Example: 256MB = + 268435456 bytes +

+
+
+
+
{ @@ -120,7 +142,6 @@ export const ShowApplicationResources = ({ applicationId }: Props) => { }} /> -
)} @@ -132,10 +153,25 @@ export const ShowApplicationResources = ({ applicationId }: Props) => { render={({ field }) => { return ( - Memory Limit +
+ Memory Limit + + + + + + +

+ Memory hard limit in bytes. Example: 1GB = + 1073741824 bytes +

+
+
+
+
{ @@ -163,21 +199,36 @@ export const ShowApplicationResources = ({ applicationId }: Props) => { render={({ field }) => { return ( - Cpu Limit +
+ CPU Limit + + + + + + +

+ CPU quota in units of 10^-9 CPUs. Example: 2 + CPUs = 2000000000 +

+
+
+
+
{ const value = e.target.value; - if ( - value === "" || - /^[0-9]*\.?[0-9]*$/.test(value) - ) { - const float = Number.parseFloat(value); - field.onChange(float); + if (value === "") { + field.onChange(null); + } else { + const number = Number.parseInt(value, 10); + if (!Number.isNaN(number)) { + field.onChange(number); + } } }} /> @@ -193,21 +244,36 @@ export const ShowApplicationResources = ({ applicationId }: Props) => { render={({ field }) => { return ( - Cpu Reservation +
+ CPU Reservation + + + + + + +

+ CPU shares (relative weight). Example: 1 CPU = + 1000000000 +

+
+
+
+
{ const value = e.target.value; - if ( - value === "" || - /^[0-9]*\.?[0-9]*$/.test(value) - ) { - const float = Number.parseFloat(value); - field.onChange(float); + if (value === "") { + field.onChange(null); + } else { + const number = Number.parseInt(value, 10); + if (!Number.isNaN(number)) { + field.onChange(number); + } } }} /> diff --git a/apps/dokploy/components/dashboard/mariadb/advanced/show-mariadb-resources.tsx b/apps/dokploy/components/dashboard/mariadb/advanced/show-mariadb-resources.tsx index 4708b123..7624441e 100644 --- a/apps/dokploy/components/dashboard/mariadb/advanced/show-mariadb-resources.tsx +++ b/apps/dokploy/components/dashboard/mariadb/advanced/show-mariadb-resources.tsx @@ -18,6 +18,13 @@ import { import { Input } from "@/components/ui/input"; import { api } from "@/utils/api"; import { zodResolver } from "@hookform/resolvers/zod"; +import { + TooltipProvider, + TooltipTrigger, + TooltipContent, + Tooltip, +} from "@/components/ui/tooltip"; +import { InfoIcon } from "lucide-react"; import React, { useEffect } from "react"; import { useForm } from "react-hook-form"; import { toast } from "sonner"; @@ -100,28 +107,40 @@ export const ShowMariadbResources = ({ mariadbId }: Props) => { name="memoryReservation" render={({ field }) => ( - Memory Reservation +
+ Memory Reservation + + + + + + +

+ Memory soft limit in bytes. Example: 256MB = + 268435456 bytes +

+
+
+
+
{ const value = e.target.value; if (value === "") { - // Si el campo está vacío, establece el valor como null. field.onChange(null); } else { const number = Number.parseInt(value, 10); if (!Number.isNaN(number)) { - // Solo actualiza el valor si se convierte a un número válido. field.onChange(number); } } }} /> -
)} @@ -133,21 +152,34 @@ export const ShowMariadbResources = ({ mariadbId }: Props) => { render={({ field }) => { return ( - Memory Limit +
+ Memory Limit + + + + + + +

+ Memory hard limit in bytes. Example: 1GB = + 1073741824 bytes +

+
+
+
+
{ const value = e.target.value; if (value === "") { - // Si el campo está vacío, establece el valor como null. field.onChange(null); } else { const number = Number.parseInt(value, 10); if (!Number.isNaN(number)) { - // Solo actualiza el valor si se convierte a un número válido. field.onChange(number); } } @@ -166,21 +198,34 @@ export const ShowMariadbResources = ({ mariadbId }: Props) => { render={({ field }) => { return ( - Cpu Limit +
+ CPU Limit + + + + + + +

+ CPU quota in units of 10^-9 CPUs. Example: 2 + CPUs = 2000000000 +

+
+
+
+
{ const value = e.target.value; if (value === "") { - // Si el campo está vacío, establece el valor como null. field.onChange(null); } else { const number = Number.parseInt(value, 10); if (!Number.isNaN(number)) { - // Solo actualiza el valor si se convierte a un número válido. field.onChange(number); } } @@ -198,21 +243,34 @@ export const ShowMariadbResources = ({ mariadbId }: Props) => { render={({ field }) => { return ( - Cpu Reservation +
+ CPU Reservation + + + + + + +

+ CPU shares (relative weight). Example: 1 CPU = + 1000000000 +

+
+
+
+
{ const value = e.target.value; if (value === "") { - // Si el campo está vacío, establece el valor como null. field.onChange(null); } else { const number = Number.parseInt(value, 10); if (!Number.isNaN(number)) { - // Solo actualiza el valor si se convierte a un número válido. field.onChange(number); } } diff --git a/apps/dokploy/components/dashboard/mongo/advanced/show-mongo-resources.tsx b/apps/dokploy/components/dashboard/mongo/advanced/show-mongo-resources.tsx index f60b87f1..d4824f52 100644 --- a/apps/dokploy/components/dashboard/mongo/advanced/show-mongo-resources.tsx +++ b/apps/dokploy/components/dashboard/mongo/advanced/show-mongo-resources.tsx @@ -19,6 +19,13 @@ import { Input } from "@/components/ui/input"; import { api } from "@/utils/api"; import { zodResolver } from "@hookform/resolvers/zod"; import React, { useEffect } from "react"; +import { + TooltipProvider, + TooltipTrigger, + TooltipContent, + Tooltip, +} from "@/components/ui/tooltip"; +import { InfoIcon } from "lucide-react"; import { useForm } from "react-hook-form"; import { toast } from "sonner"; import { z } from "zod"; @@ -89,10 +96,6 @@ export const ShowMongoResources = ({ mongoId }: Props) => { the changes.
- - Please remember to click Redeploy after modify the resources to - apply the changes. - { name="memoryReservation" render={({ field }) => ( - Memory Reservation +
+ Memory Reservation + + + + + + +

+ Memory soft limit in bytes. Example: 256MB = + 268435456 bytes +

+
+
+
+
{ const value = e.target.value; if (value === "") { - // Si el campo está vacío, establece el valor como null. field.onChange(null); } else { const number = Number.parseInt(value, 10); if (!Number.isNaN(number)) { - // Solo actualiza el valor si se convierte a un número válido. field.onChange(number); } } }} /> -
)} @@ -137,21 +152,34 @@ export const ShowMongoResources = ({ mongoId }: Props) => { render={({ field }) => { return ( - Memory Limit +
+ Memory Limit + + + + + + +

+ Memory hard limit in bytes. Example: 1GB = + 1073741824 bytes +

+
+
+
+
{ const value = e.target.value; if (value === "") { - // Si el campo está vacío, establece el valor como null. field.onChange(null); } else { const number = Number.parseInt(value, 10); if (!Number.isNaN(number)) { - // Solo actualiza el valor si se convierte a un número válido. field.onChange(number); } } @@ -170,21 +198,34 @@ export const ShowMongoResources = ({ mongoId }: Props) => { render={({ field }) => { return ( - Cpu Limit +
+ CPU Limit + + + + + + +

+ CPU quota in units of 10^-9 CPUs. Example: 2 + CPUs = 2000000000 +

+
+
+
+
{ const value = e.target.value; if (value === "") { - // Si el campo está vacío, establece el valor como null. field.onChange(null); } else { const number = Number.parseInt(value, 10); if (!Number.isNaN(number)) { - // Solo actualiza el valor si se convierte a un número válido. field.onChange(number); } } @@ -202,21 +243,34 @@ export const ShowMongoResources = ({ mongoId }: Props) => { render={({ field }) => { return ( - Cpu Reservation +
+ CPU Reservation + + + + + + +

+ CPU shares (relative weight). Example: 1 CPU = + 1000000000 +

+
+
+
+
{ const value = e.target.value; if (value === "") { - // Si el campo está vacío, establece el valor como null. field.onChange(null); } else { const number = Number.parseInt(value, 10); if (!Number.isNaN(number)) { - // Solo actualiza el valor si se convierte a un número válido. field.onChange(number); } } diff --git a/apps/dokploy/components/dashboard/mysql/advanced/show-mysql-resources.tsx b/apps/dokploy/components/dashboard/mysql/advanced/show-mysql-resources.tsx index 2f5a36b5..bcf5a0b9 100644 --- a/apps/dokploy/components/dashboard/mysql/advanced/show-mysql-resources.tsx +++ b/apps/dokploy/components/dashboard/mysql/advanced/show-mysql-resources.tsx @@ -20,6 +20,13 @@ import { api } from "@/utils/api"; import { zodResolver } from "@hookform/resolvers/zod"; import React, { useEffect } from "react"; import { useForm } from "react-hook-form"; +import { + TooltipProvider, + TooltipTrigger, + TooltipContent, + Tooltip, +} from "@/components/ui/tooltip"; +import { InfoIcon } from "lucide-react"; import { toast } from "sonner"; import { z } from "zod"; @@ -100,28 +107,40 @@ export const ShowMysqlResources = ({ mysqlId }: Props) => { name="memoryReservation" render={({ field }) => ( - Memory Reservation +
+ Memory Reservation + + + + + + +

+ Memory soft limit in bytes. Example: 256MB = + 268435456 bytes +

+
+
+
+
{ const value = e.target.value; if (value === "") { - // Si el campo está vacío, establece el valor como null. field.onChange(null); } else { const number = Number.parseInt(value, 10); if (!Number.isNaN(number)) { - // Solo actualiza el valor si se convierte a un número válido. field.onChange(number); } } }} /> -
)} @@ -133,21 +152,34 @@ export const ShowMysqlResources = ({ mysqlId }: Props) => { render={({ field }) => { return ( - Memory Limit +
+ Memory Limit + + + + + + +

+ Memory hard limit in bytes. Example: 1GB = + 1073741824 bytes +

+
+
+
+
{ const value = e.target.value; if (value === "") { - // Si el campo está vacío, establece el valor como null. field.onChange(null); } else { const number = Number.parseInt(value, 10); if (!Number.isNaN(number)) { - // Solo actualiza el valor si se convierte a un número válido. field.onChange(number); } } @@ -166,21 +198,34 @@ export const ShowMysqlResources = ({ mysqlId }: Props) => { render={({ field }) => { return ( - Cpu Limit +
+ CPU Limit + + + + + + +

+ CPU quota in units of 10^-9 CPUs. Example: 2 + CPUs = 2000000000 +

+
+
+
+
{ const value = e.target.value; if (value === "") { - // Si el campo está vacío, establece el valor como null. field.onChange(null); } else { const number = Number.parseInt(value, 10); if (!Number.isNaN(number)) { - // Solo actualiza el valor si se convierte a un número válido. field.onChange(number); } } @@ -198,21 +243,34 @@ export const ShowMysqlResources = ({ mysqlId }: Props) => { render={({ field }) => { return ( - Cpu Reservation +
+ CPU Reservation + + + + + + +

+ CPU shares (relative weight). Example: 1 CPU = + 1000000000 +

+
+
+
+
{ const value = e.target.value; if (value === "") { - // Si el campo está vacío, establece el valor como null. field.onChange(null); } else { const number = Number.parseInt(value, 10); if (!Number.isNaN(number)) { - // Solo actualiza el valor si se convierte a un número válido. field.onChange(number); } } diff --git a/apps/dokploy/components/dashboard/postgres/advanced/show-postgres-resources.tsx b/apps/dokploy/components/dashboard/postgres/advanced/show-postgres-resources.tsx index 4bf14788..678aec29 100644 --- a/apps/dokploy/components/dashboard/postgres/advanced/show-postgres-resources.tsx +++ b/apps/dokploy/components/dashboard/postgres/advanced/show-postgres-resources.tsx @@ -21,6 +21,13 @@ import { zodResolver } from "@hookform/resolvers/zod"; import React, { useEffect } from "react"; import { useForm } from "react-hook-form"; import { toast } from "sonner"; +import { + TooltipProvider, + TooltipTrigger, + TooltipContent, + Tooltip, +} from "@/components/ui/tooltip"; +import { InfoIcon } from "lucide-react"; import { z } from "zod"; const addResourcesPostgres = z.object({ @@ -100,10 +107,25 @@ export const ShowPostgresResources = ({ postgresId }: Props) => { name="memoryReservation" render={({ field }) => ( - Memory Reservation +
+ Memory Reservation + + + + + + +

+ Memory soft limit in bytes. Example: 256MB = + 268435456 bytes +

+
+
+
+
{ @@ -119,7 +141,6 @@ export const ShowPostgresResources = ({ postgresId }: Props) => { }} /> -
)} @@ -131,10 +152,25 @@ export const ShowPostgresResources = ({ postgresId }: Props) => { render={({ field }) => { return ( - Memory Limit +
+ Memory Limit + + + + + + +

+ Memory hard limit in bytes. Example: 1GB = + 1073741824 bytes +

+
+
+
+
{ @@ -162,10 +198,25 @@ export const ShowPostgresResources = ({ postgresId }: Props) => { render={({ field }) => { return ( - Cpu Limit +
+ CPU Limit + + + + + + +

+ CPU quota in units of 10^-9 CPUs. Example: 2 + CPUs = 2000000000 +

+
+
+
+
{ @@ -192,10 +243,25 @@ export const ShowPostgresResources = ({ postgresId }: Props) => { render={({ field }) => { return ( - Cpu Reservation +
+ CPU Reservation + + + + + + +

+ CPU shares (relative weight). Example: 1 CPU = + 1000000000 +

+
+
+
+
{ diff --git a/apps/dokploy/components/dashboard/redis/advanced/show-redis-resources.tsx b/apps/dokploy/components/dashboard/redis/advanced/show-redis-resources.tsx index bf6c8e7e..cbe28a7d 100644 --- a/apps/dokploy/components/dashboard/redis/advanced/show-redis-resources.tsx +++ b/apps/dokploy/components/dashboard/redis/advanced/show-redis-resources.tsx @@ -21,6 +21,13 @@ import { zodResolver } from "@hookform/resolvers/zod"; import React, { useEffect } from "react"; import { useForm } from "react-hook-form"; import { toast } from "sonner"; +import { + TooltipProvider, + TooltipTrigger, + TooltipContent, + Tooltip, +} from "@/components/ui/tooltip"; +import { InfoIcon } from "lucide-react"; import { z } from "zod"; const addResourcesRedis = z.object({ @@ -100,28 +107,40 @@ export const ShowRedisResources = ({ redisId }: Props) => { name="memoryReservation" render={({ field }) => ( - Memory Reservation +
+ Memory Reservation + + + + + + +

+ Memory soft limit in bytes. Example: 256MB = + 268435456 bytes +

+
+
+
+
{ const value = e.target.value; if (value === "") { - // Si el campo está vacío, establece el valor como null. field.onChange(null); } else { const number = Number.parseInt(value, 10); if (!Number.isNaN(number)) { - // Solo actualiza el valor si se convierte a un número válido. field.onChange(number); } } }} /> -
)} @@ -133,21 +152,34 @@ export const ShowRedisResources = ({ redisId }: Props) => { render={({ field }) => { return ( - Memory Limit +
+ Memory Limit + + + + + + +

+ Memory hard limit in bytes. Example: 1GB = + 1073741824 bytes +

+
+
+
+
{ const value = e.target.value; if (value === "") { - // Si el campo está vacío, establece el valor como null. field.onChange(null); } else { const number = Number.parseInt(value, 10); if (!Number.isNaN(number)) { - // Solo actualiza el valor si se convierte a un número válido. field.onChange(number); } } @@ -166,21 +198,34 @@ export const ShowRedisResources = ({ redisId }: Props) => { render={({ field }) => { return ( - Cpu Limit +
+ CPU Limit + + + + + + +

+ CPU quota in units of 10^-9 CPUs. Example: 2 + CPUs = 2000000000 +

+
+
+
+
{ const value = e.target.value; if (value === "") { - // Si el campo está vacío, establece el valor como null. field.onChange(null); } else { const number = Number.parseInt(value, 10); if (!Number.isNaN(number)) { - // Solo actualiza el valor si se convierte a un número válido. field.onChange(number); } } @@ -198,21 +243,34 @@ export const ShowRedisResources = ({ redisId }: Props) => { render={({ field }) => { return ( - Cpu Reservation +
+ CPU Reservation + + + + + + +

+ CPU shares (relative weight). Example: 1 CPU = + 1000000000 +

+
+
+
+
{ const value = e.target.value; if (value === "") { - // Si el campo está vacío, establece el valor como null. field.onChange(null); } else { const number = Number.parseInt(value, 10); if (!Number.isNaN(number)) { - // Solo actualiza el valor si se convierte a un número válido. field.onChange(number); } }