@@ -36,6 +36,7 @@ import {
3636 SelectTrigger ,
3737 SelectValue ,
3838} from "@/components/ui/select" ;
39+ import { Switch } from "@/components/ui/switch" ;
3940import { Textarea } from "@/components/ui/textarea" ;
4041import { api } from "@/utils/api" ;
4142
@@ -53,6 +54,7 @@ const Schema = z.object({
5354 message : "SSH Key is required" ,
5455 } ) ,
5556 serverType : z . enum ( [ "deploy" , "build" ] ) . default ( "deploy" ) ,
57+ enableDockerCleanup : z . boolean ( ) . default ( true ) ,
5658} ) ;
5759
5860type Schema = z . infer < typeof Schema > ;
@@ -90,6 +92,7 @@ export const HandleServers = ({ serverId, asButton = false }: Props) => {
9092 username : "root" ,
9193 sshKeyId : "" ,
9294 serverType : "deploy" ,
95+ enableDockerCleanup : true ,
9396 } ,
9497 resolver : zodResolver ( Schema ) ,
9598 } ) ;
@@ -103,6 +106,7 @@ export const HandleServers = ({ serverId, asButton = false }: Props) => {
103106 username : data ?. username || "root" ,
104107 sshKeyId : data ?. sshKeyId || "" ,
105108 serverType : data ?. serverType || "deploy" ,
109+ enableDockerCleanup : data ?. enableDockerCleanup ?? true ,
106110 } ) ;
107111 } , [ form , form . reset , form . formState . isSubmitSuccessful , data ] ) ;
108112
@@ -119,6 +123,7 @@ export const HandleServers = ({ serverId, asButton = false }: Props) => {
119123 username : data . username || "root" ,
120124 sshKeyId : data . sshKeyId || "" ,
121125 serverType : data . serverType || "deploy" ,
126+ enableDockerCleanup : data . enableDockerCleanup ,
122127 serverId : serverId || "" ,
123128 } )
124129 . then ( async ( _data ) => {
@@ -418,6 +423,27 @@ export const HandleServers = ({ serverId, asButton = false }: Props) => {
418423 </ FormItem >
419424 ) }
420425 />
426+ < FormField
427+ control = { form . control }
428+ name = "enableDockerCleanup"
429+ render = { ( { field } ) => (
430+ < FormItem className = "flex flex-row items-center justify-between rounded-lg border p-3" >
431+ < div className = "space-y-0.5" >
432+ < FormLabel > Enable Docker Cleanup</ FormLabel >
433+ < FormDescription >
434+ Automatically prune unused Docker images daily. Keeps disk
435+ usage in check on this remote server.
436+ </ FormDescription >
437+ </ div >
438+ < FormControl >
439+ < Switch
440+ checked = { field . value }
441+ onCheckedChange = { field . onChange }
442+ />
443+ </ FormControl >
444+ </ FormItem >
445+ ) }
446+ />
421447 </ form >
422448
423449 < DialogFooter >
0 commit comments