Merge branch 'feat/label-previews' of github.com:PiquelChips/dokploy into feat/label-previews

This commit is contained in:
Mauricio Siu
2025-08-23 20:13:22 -06:00

View File

@@ -211,86 +211,90 @@ export const ShowPreviewSettings = ({ applicationId }: Props) => {
</FormItem> </FormItem>
)} )}
/> />
<FormField <FormField
control={form.control} control={form.control}
name="previewLabels" name="previewLabels"
render={({ field }) => ( render={({ field }) => (
<FormItem className="md:col-span-2"> <FormItem className="md:col-span-2">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<FormLabel>Preview Labels</FormLabel> <FormLabel>Preview Labels</FormLabel>
<TooltipProvider> <TooltipProvider>
<Tooltip> <Tooltip>
<TooltipTrigger asChild> <TooltipTrigger asChild>
<HelpCircle className="size-4 text-muted-foreground hover:text-foreground transition-colors cursor-pointer" /> <HelpCircle className="size-4 text-muted-foreground hover:text-foreground transition-colors cursor-pointer" />
</TooltipTrigger> </TooltipTrigger>
<TooltipContent> <TooltipContent>
<p> <p>
Add a labels that will trigger a preview deployment Add a labels that will trigger a preview
for a pull request. If no labels are specified, all deployment for a pull request. If no labels
pull requests will trigger a preview deployment. are specified, all pull requests will trigger
</p> a preview deployment.
</TooltipContent> </p>
</Tooltip> </TooltipContent>
</TooltipProvider> </Tooltip>
</div> </TooltipProvider>
<div className="flex flex-wrap gap-2 mb-2"> </div>
{field.value?.map((label, index) => ( <div className="flex flex-wrap gap-2 mb-2">
<Badge {field.value?.map((label, index) => (
key={index} <Badge
variant="secondary" key={index}
className="flex items-center gap-1" variant="secondary"
> className="flex items-center gap-1"
{label} >
<X {label}
className="size-3 cursor-pointer hover:text-destructive" <X
onClick={() => { className="size-3 cursor-pointer hover:text-destructive"
const newLabels = [...(field.value || [])]; onClick={() => {
newLabels.splice(index, 1); const newLabels = [...(field.value || [])];
field.onChange(newLabels); newLabels.splice(index, 1);
}} field.onChange(newLabels);
/> }}
</Badge> />
))} </Badge>
</div> ))}
<div className="flex gap-2"> </div>
<FormControl> <div className="flex gap-2">
<Input <FormControl>
placeholder="Enter a label (e.g. enhancements, needs-review)" <Input
onKeyDown={(e) => { placeholder="Enter a label (e.g. enhancements, needs-review)"
if (e.key === "Enter") { onKeyDown={(e) => {
e.preventDefault(); if (e.key === "Enter") {
const input = e.currentTarget; e.preventDefault();
const label = input.value.trim(); const input = e.currentTarget;
if (label) { const label = input.value.trim();
field.onChange([...(field.value || []), label]); if (label) {
input.value = ""; field.onChange([
} ...(field.value || []),
} label,
}} ]);
/> input.value = "";
</FormControl> }
<Button }
type="button" }}
variant="outline" />
size="icon" </FormControl>
onClick={() => { <Button
const input = document.querySelector( type="button"
'input[placeholder*="Enter a label"]', variant="outline"
) as HTMLInputElement; size="icon"
const label = input.value.trim(); onClick={() => {
if (label) { const input = document.querySelector(
field.onChange([...(field.value || []), label]); 'input[placeholder*="Enter a label"]',
input.value = ""; ) as HTMLInputElement;
} const label = input.value.trim();
}} if (label) {
> field.onChange([...(field.value || []), label]);
<Plus className="size-4" /> input.value = "";
</Button> }
</div> }}
<FormMessage /> >
</FormItem> <Plus className="size-4" />
)} </Button>
/> </div>
<FormMessage />
</FormItem>
)}
/>
<FormField <FormField
control={form.control} control={form.control}
name="previewLimit" name="previewLimit"