1
This commit is contained in:
parent
0fe5f766c8
commit
967c79a618
@ -279,66 +279,35 @@ const ApplicationModal: React.FC<ApplicationModalProps> = ({
|
|||||||
render={({field}) => (
|
render={({field}) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>代码仓库组</FormLabel>
|
<FormLabel>代码仓库组</FormLabel>
|
||||||
<Popover>
|
<Select
|
||||||
<PopoverTrigger asChild>
|
|
||||||
<FormControl>
|
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
role="combobox"
|
|
||||||
disabled={!form.watch('gitInstanceId')}
|
disabled={!form.watch('gitInstanceId')}
|
||||||
className={cn(
|
onValueChange={(value) => {
|
||||||
"w-full justify-between",
|
form.setValue("repositoryGroupId", Number(value));
|
||||||
!field.value && "text-muted-foreground"
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{field.value
|
|
||||||
? repositoryGroups.find(
|
|
||||||
(group) => group.id === field.value
|
|
||||||
)?.name
|
|
||||||
: "请选择代码仓库组"}
|
|
||||||
</Button>
|
|
||||||
</FormControl>
|
|
||||||
</PopoverTrigger>
|
|
||||||
<PopoverContent className="w-[--radix-popover-trigger-width] p-0" side="bottom" align="start">
|
|
||||||
<Command className="w-full">
|
|
||||||
<CommandInput
|
|
||||||
placeholder="搜索代码仓库组..."
|
|
||||||
className="h-9"
|
|
||||||
/>
|
|
||||||
<CommandEmpty>未找到代码仓库组</CommandEmpty>
|
|
||||||
<ScrollArea className="h-[200px] overflow-auto">
|
|
||||||
<CommandGroup className="overflow-hidden">
|
|
||||||
{repositoryGroups.map((group) => (
|
|
||||||
<CommandItem
|
|
||||||
key={group.id}
|
|
||||||
value={group.name}
|
|
||||||
onSelect={() => {
|
|
||||||
form.setValue("repositoryGroupId", group.id);
|
|
||||||
// 关闭 Popover
|
|
||||||
const popoverTrigger = document.querySelector('[role="combobox"]');
|
|
||||||
if (popoverTrigger) {
|
|
||||||
(popoverTrigger as HTMLElement).click();
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
className="cursor-pointer"
|
value={field.value?.toString()}
|
||||||
>
|
>
|
||||||
<Check
|
<FormControl>
|
||||||
className={cn(
|
<SelectTrigger>
|
||||||
"mr-2 h-4 w-4",
|
<SelectValue
|
||||||
group.id === field.value
|
placeholder={!form.watch('gitInstanceId')
|
||||||
? "opacity-100"
|
? "请先选择Git实例"
|
||||||
: "opacity-0"
|
: "请选择代码仓库组"
|
||||||
)}
|
}
|
||||||
/>
|
/>
|
||||||
|
</SelectTrigger>
|
||||||
|
</FormControl>
|
||||||
|
<SelectContent>
|
||||||
|
{repositoryGroups.map((group) => (
|
||||||
|
<SelectItem
|
||||||
|
key={group.id}
|
||||||
|
value={group.id.toString()}
|
||||||
|
>
|
||||||
{group.name}
|
{group.name}
|
||||||
</CommandItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
</CommandGroup>
|
</SelectContent>
|
||||||
</ScrollArea>
|
</Select>
|
||||||
</Command>
|
<FormMessage />
|
||||||
</PopoverContent>
|
|
||||||
</Popover>
|
|
||||||
<FormMessage/>
|
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user