refactor(cluster-settings): update dialog content and improve layout in swarm settings component

This commit is contained in:
Mauricio Siu
2025-08-03 16:45:07 -06:00
parent 3d10d48425
commit 0755f28307
2 changed files with 14 additions and 16 deletions
@@ -292,7 +292,7 @@ export const AddSwarmSettings = ({ id, type }: Props) => {
Swarm Settings Swarm Settings
</Button> </Button>
</DialogTrigger> </DialogTrigger>
<DialogContent className="sm:max-w-5xl p-0"> <DialogContent className="sm:max-w-5xl">
<DialogHeader> <DialogHeader>
<DialogTitle>Swarm Settings</DialogTitle> <DialogTitle>Swarm Settings</DialogTitle>
<DialogDescription> <DialogDescription>
@@ -300,10 +300,10 @@ export const AddSwarmSettings = ({ id, type }: Props) => {
</DialogDescription> </DialogDescription>
</DialogHeader> </DialogHeader>
{isError && <AlertBlock type="error">{error?.message}</AlertBlock>} {isError && <AlertBlock type="error">{error?.message}</AlertBlock>}
<div className="px-4"> <div>
<AlertBlock type="info"> <AlertBlock type="info">
Changing settings such as placements may cause the logs/monitoring Changing settings such as placements may cause the logs/monitoring,
to be unavailable. backups and other features to be unavailable.
</AlertBlock> </AlertBlock>
</div> </div>
@@ -311,13 +311,13 @@ export const AddSwarmSettings = ({ id, type }: Props) => {
<form <form
id="hook-form-add-permissions" id="hook-form-add-permissions"
onSubmit={form.handleSubmit(onSubmit)} onSubmit={form.handleSubmit(onSubmit)}
className="grid grid-cols-1 md:grid-cols-2 w-full gap-4 relative" className="grid grid-cols-1 md:grid-cols-2 w-full gap-4 relative mt-4"
> >
<FormField <FormField
control={form.control} control={form.control}
name="healthCheckSwarm" name="healthCheckSwarm"
render={({ field }) => ( render={({ field }) => (
<FormItem className="relative max-lg:px-4 lg:pl-6 "> <FormItem className="relative ">
<FormLabel>Health Check</FormLabel> <FormLabel>Health Check</FormLabel>
<TooltipProvider delayDuration={0}> <TooltipProvider delayDuration={0}>
<Tooltip> <Tooltip>
@@ -373,7 +373,7 @@ export const AddSwarmSettings = ({ id, type }: Props) => {
control={form.control} control={form.control}
name="restartPolicySwarm" name="restartPolicySwarm"
render={({ field }) => ( render={({ field }) => (
<FormItem className="relative max-lg:px-4 lg:pr-6 "> <FormItem className="relative ">
<FormLabel>Restart Policy</FormLabel> <FormLabel>Restart Policy</FormLabel>
<TooltipProvider delayDuration={0}> <TooltipProvider delayDuration={0}>
<Tooltip> <Tooltip>
@@ -427,7 +427,7 @@ export const AddSwarmSettings = ({ id, type }: Props) => {
control={form.control} control={form.control}
name="placementSwarm" name="placementSwarm"
render={({ field }) => ( render={({ field }) => (
<FormItem className="relative max-lg:px-4 lg:pl-6 "> <FormItem className="relative ">
<FormLabel>Placement</FormLabel> <FormLabel>Placement</FormLabel>
<TooltipProvider delayDuration={0}> <TooltipProvider delayDuration={0}>
<Tooltip> <Tooltip>
@@ -493,7 +493,7 @@ export const AddSwarmSettings = ({ id, type }: Props) => {
control={form.control} control={form.control}
name="updateConfigSwarm" name="updateConfigSwarm"
render={({ field }) => ( render={({ field }) => (
<FormItem className="relative max-lg:px-4 lg:pr-6 "> <FormItem className="relative ">
<FormLabel>Update Config</FormLabel> <FormLabel>Update Config</FormLabel>
<TooltipProvider delayDuration={0}> <TooltipProvider delayDuration={0}>
<Tooltip> <Tooltip>
@@ -551,7 +551,7 @@ export const AddSwarmSettings = ({ id, type }: Props) => {
control={form.control} control={form.control}
name="rollbackConfigSwarm" name="rollbackConfigSwarm"
render={({ field }) => ( render={({ field }) => (
<FormItem className="relative max-lg:px-4 lg:pl-6 "> <FormItem className="relative ">
<FormLabel>Rollback Config</FormLabel> <FormLabel>Rollback Config</FormLabel>
<TooltipProvider delayDuration={0}> <TooltipProvider delayDuration={0}>
<Tooltip> <Tooltip>
@@ -609,7 +609,7 @@ export const AddSwarmSettings = ({ id, type }: Props) => {
control={form.control} control={form.control}
name="modeSwarm" name="modeSwarm"
render={({ field }) => ( render={({ field }) => (
<FormItem className="relative max-lg:px-4 lg:pr-6 "> <FormItem className="relative ">
<FormLabel>Mode</FormLabel> <FormLabel>Mode</FormLabel>
<TooltipProvider delayDuration={0}> <TooltipProvider delayDuration={0}>
<Tooltip> <Tooltip>
@@ -672,7 +672,7 @@ export const AddSwarmSettings = ({ id, type }: Props) => {
control={form.control} control={form.control}
name="networkSwarm" name="networkSwarm"
render={({ field }) => ( render={({ field }) => (
<FormItem className="relative max-lg:px-4 lg:pl-6 "> <FormItem className="relative ">
<FormLabel>Network</FormLabel> <FormLabel>Network</FormLabel>
<TooltipProvider delayDuration={0}> <TooltipProvider delayDuration={0}>
<Tooltip> <Tooltip>
@@ -731,7 +731,7 @@ export const AddSwarmSettings = ({ id, type }: Props) => {
control={form.control} control={form.control}
name="labelsSwarm" name="labelsSwarm"
render={({ field }) => ( render={({ field }) => (
<FormItem className="relative max-lg:px-4 lg:pr-6 "> <FormItem className="relative ">
<FormLabel>Labels</FormLabel> <FormLabel>Labels</FormLabel>
<TooltipProvider delayDuration={0}> <TooltipProvider delayDuration={0}>
<Tooltip> <Tooltip>
@@ -102,8 +102,6 @@ export const ShowClusterSettings = ({ id, type }: Props) => {
} }
}, [form, form.reset, form.formState.isSubmitSuccessful, data?.command]); }, [form, form.reset, form.formState.isSubmitSuccessful, data?.command]);
console.log(form.formState.errors);
const onSubmit = async (data: AddCommand) => { const onSubmit = async (data: AddCommand) => {
await mutateAsync({ await mutateAsync({
applicationId: id || "", applicationId: id || "",
@@ -137,7 +135,7 @@ export const ShowClusterSettings = ({ id, type }: Props) => {
<div> <div>
<CardTitle className="text-xl">Cluster Settings</CardTitle> <CardTitle className="text-xl">Cluster Settings</CardTitle>
<CardDescription> <CardDescription>
Add the registry and the replicas of the application Modify swarm settings for the service.
</CardDescription> </CardDescription>
</div> </div>
<AddSwarmSettings id={id} type={type} /> <AddSwarmSettings id={id} type={type} />