This commit is contained in:
Saeed Vaziry
2025-05-30 11:02:07 +02:00
parent 1b9f826bcb
commit 104cd2fce8
14 changed files with 572 additions and 266 deletions

View File

@ -77,11 +77,15 @@ function Action({ type, worker }: { type: 'start' | 'stop' | 'restart'; worker:
return (
<Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild>
<DropdownMenuItem onSelect={(e) => e.preventDefault()}>{type}</DropdownMenuItem>
<DropdownMenuItem onSelect={(e) => e.preventDefault()} className="capitalize">
{type}
</DropdownMenuItem>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>{type} worker</DialogTitle>
<DialogTitle>
<span className="capitalize">{type}</span> worker
</DialogTitle>
<DialogDescription className="sr-only">{type} worker</DialogDescription>
</DialogHeader>
<p className="p-4">Are you sure you want to {type} the worker?</p>
@ -89,7 +93,7 @@ function Action({ type, worker }: { type: 'start' | 'stop' | 'restart'; worker:
<DialogClose asChild>
<Button variant="outline">Cancel</Button>
</DialogClose>
<Button disabled={form.processing} onClick={submit}>
<Button variant={['stop'].includes(type) ? 'destructive' : 'default'} disabled={form.processing} onClick={submit} className="capitalize">
{form.processing && <LoaderCircleIcon className="animate-spin" />}
<FormSuccessful successful={form.recentlySuccessful} />
{type}

View File

@ -107,25 +107,27 @@ export default function WorkerForm({ serverId, worker, children }: { serverId: n
/>
<InputError message={form.errors.numprocs} />
</FormField>
<div className="grid grid-cols-2 gap-6">
{/*auto start*/}
<FormField>
<div className="flex items-center space-x-2">
<Switch id="auto_start" checked={form.data.auto_start} onCheckedChange={(value) => form.setData('auto_start', value)} />
<Label htmlFor="auto_start">Auto start</Label>
<InputError message={form.errors.auto_start} />
</div>
</FormField>
{/*auto restart*/}
<FormField>
<div className="flex items-center space-x-2">
<Switch id="auto_restart" checked={form.data.auto_restart} onCheckedChange={(value) => form.setData('auto_restart', value)} />
<Label htmlFor="auto_restart">Auto restart</Label>
<InputError message={form.errors.auto_restart} />
</div>
</FormField>
</div>
</FormFields>
{/*auto start*/}
<FormField>
<div className="flex items-center space-x-2">
<Switch id="auto_start" checked={form.data.auto_start} onCheckedChange={(value) => form.setData('auto_start', value)} />
<Label htmlFor="auto_start">Auto start</Label>
<InputError message={form.errors.auto_start} />
</div>
</FormField>
{/*auto restart*/}
<FormField>
<div className="flex items-center space-x-2">
<Switch id="auto_restart" checked={form.data.auto_restart} onCheckedChange={(value) => form.setData('auto_restart', value)} />
<Label htmlFor="auto_restart">Auto restart</Label>
<InputError message={form.errors.auto_restart} />
</div>
</FormField>
</Form>
<DialogFooter>
<DialogClose asChild>