mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-05 19:52:15 +00:00
[autofix.ci] apply automated fixes
This commit is contained in:
+69
-70
@@ -104,10 +104,9 @@ export const NetworkForm = ({ id, type }: NetworkFormProps) => {
|
|||||||
formData.networks
|
formData.networks
|
||||||
?.filter((network) => network.Target)
|
?.filter((network) => network.Target)
|
||||||
.map((network) => {
|
.map((network) => {
|
||||||
const entries =
|
const entries = (network.DriverOptsEntries ?? []).filter(
|
||||||
(network.DriverOptsEntries ?? []).filter(
|
(e) => e.key.trim() !== "",
|
||||||
(e) => e.key.trim() !== "",
|
);
|
||||||
);
|
|
||||||
const driverOpts =
|
const driverOpts =
|
||||||
entries.length > 0
|
entries.length > 0
|
||||||
? Object.fromEntries(
|
? Object.fromEntries(
|
||||||
@@ -194,74 +193,74 @@ export const NetworkForm = ({ id, type }: NetworkFormProps) => {
|
|||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<FormLabel>Driver options (optional)</FormLabel>
|
<FormLabel>Driver options (optional)</FormLabel>
|
||||||
<FormDescription>
|
<FormDescription>
|
||||||
e.g. com.docker.network.driver.mtu, com.docker.network.driver.host_binding
|
e.g. com.docker.network.driver.mtu,
|
||||||
|
com.docker.network.driver.host_binding
|
||||||
</FormDescription>
|
</FormDescription>
|
||||||
{(form.watch(`networks.${index}.DriverOptsEntries`) ?? []).map(
|
{(
|
||||||
(_, optIndex) => (
|
form.watch(`networks.${index}.DriverOptsEntries`) ?? []
|
||||||
<div
|
).map((_, optIndex) => (
|
||||||
key={optIndex}
|
<div
|
||||||
className="flex gap-2 items-end flex-wrap"
|
key={optIndex}
|
||||||
>
|
className="flex gap-2 items-end flex-wrap"
|
||||||
<FormField
|
>
|
||||||
control={form.control}
|
<FormField
|
||||||
name={`networks.${index}.DriverOptsEntries.${optIndex}.key`}
|
control={form.control}
|
||||||
render={({ field }) => (
|
name={`networks.${index}.DriverOptsEntries.${optIndex}.key`}
|
||||||
<FormItem className="flex-1 min-w-[140px]">
|
render={({ field }) => (
|
||||||
<FormControl>
|
<FormItem className="flex-1 min-w-[140px]">
|
||||||
<Input
|
<FormControl>
|
||||||
{...field}
|
<Input
|
||||||
placeholder="com.docker.network.driver.mtu"
|
{...field}
|
||||||
/>
|
placeholder="com.docker.network.driver.mtu"
|
||||||
</FormControl>
|
/>
|
||||||
<FormMessage />
|
</FormControl>
|
||||||
</FormItem>
|
<FormMessage />
|
||||||
)}
|
</FormItem>
|
||||||
/>
|
)}
|
||||||
<FormField
|
/>
|
||||||
control={form.control}
|
<FormField
|
||||||
name={`networks.${index}.DriverOptsEntries.${optIndex}.value`}
|
control={form.control}
|
||||||
render={({ field }) => (
|
name={`networks.${index}.DriverOptsEntries.${optIndex}.value`}
|
||||||
<FormItem className="flex-1 min-w-[100px]">
|
render={({ field }) => (
|
||||||
<FormControl>
|
<FormItem className="flex-1 min-w-[100px]">
|
||||||
<Input {...field} placeholder="1500" />
|
<FormControl>
|
||||||
</FormControl>
|
<Input {...field} placeholder="1500" />
|
||||||
<FormMessage />
|
</FormControl>
|
||||||
</FormItem>
|
<FormMessage />
|
||||||
)}
|
</FormItem>
|
||||||
/>
|
)}
|
||||||
<Button
|
/>
|
||||||
type="button"
|
<Button
|
||||||
variant="ghost"
|
type="button"
|
||||||
size="sm"
|
variant="ghost"
|
||||||
onClick={() => {
|
size="sm"
|
||||||
const entries =
|
onClick={() => {
|
||||||
form.getValues(
|
const entries =
|
||||||
`networks.${index}.DriverOptsEntries`,
|
form.getValues(
|
||||||
) ?? [];
|
|
||||||
form.setValue(
|
|
||||||
`networks.${index}.DriverOptsEntries`,
|
`networks.${index}.DriverOptsEntries`,
|
||||||
entries.filter((_, i) => i !== optIndex),
|
) ?? [];
|
||||||
);
|
form.setValue(
|
||||||
}}
|
`networks.${index}.DriverOptsEntries`,
|
||||||
>
|
entries.filter((_, i) => i !== optIndex),
|
||||||
Remove
|
);
|
||||||
</Button>
|
}}
|
||||||
</div>
|
>
|
||||||
),
|
Remove
|
||||||
)}
|
</Button>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const entries =
|
const entries =
|
||||||
form.getValues(
|
form.getValues(`networks.${index}.DriverOptsEntries`) ??
|
||||||
`networks.${index}.DriverOptsEntries`,
|
[];
|
||||||
) ?? [];
|
form.setValue(`networks.${index}.DriverOptsEntries`, [
|
||||||
form.setValue(
|
...entries,
|
||||||
`networks.${index}.DriverOptsEntries`,
|
{ key: "", value: "" },
|
||||||
[...entries, { key: "", value: "" }],
|
]);
|
||||||
);
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Add driver option
|
Add driver option
|
||||||
@@ -282,12 +281,12 @@ export const NetworkForm = ({ id, type }: NetworkFormProps) => {
|
|||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
append({
|
append({
|
||||||
Target: "",
|
Target: "",
|
||||||
Aliases: "",
|
Aliases: "",
|
||||||
DriverOptsEntries: [],
|
DriverOptsEntries: [],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
Add Network
|
Add Network
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user