mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-07-15 21:03:47 +00:00
feat: implement clone host functionality
This commit is contained in:
@@ -336,6 +336,7 @@ function HostRow({
|
|||||||
onToggleSelect,
|
onToggleSelect,
|
||||||
onEdit,
|
onEdit,
|
||||||
onDelete,
|
onDelete,
|
||||||
|
onClone,
|
||||||
onDragStart,
|
onDragStart,
|
||||||
onDragEnd,
|
onDragEnd,
|
||||||
depth = 0,
|
depth = 0,
|
||||||
@@ -349,6 +350,7 @@ function HostRow({
|
|||||||
onToggleSelect: () => void;
|
onToggleSelect: () => void;
|
||||||
onEdit: () => void;
|
onEdit: () => void;
|
||||||
onDelete: () => void;
|
onDelete: () => void;
|
||||||
|
onClone: () => void;
|
||||||
onDragStart?: () => void;
|
onDragStart?: () => void;
|
||||||
onDragEnd?: () => void;
|
onDragEnd?: () => void;
|
||||||
depth?: number;
|
depth?: number;
|
||||||
@@ -649,9 +651,7 @@ function HostRow({
|
|||||||
</button>
|
</button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent align="end" className="text-xs">
|
<DropdownMenuContent align="end" className="text-xs">
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem onClick={() => onClone()}>
|
||||||
onClick={() => toast.success(t("hosts.hostCloned"))}
|
|
||||||
>
|
|
||||||
<Copy className="size-3.5 mr-2" />
|
<Copy className="size-3.5 mr-2" />
|
||||||
{t("hosts.cloneHostAction")}
|
{t("hosts.cloneHostAction")}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
@@ -5442,6 +5442,19 @@ export function HostManager({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
onClone={async () => {
|
||||||
|
try {
|
||||||
|
const cloned = await createSSHHost({
|
||||||
|
...host,
|
||||||
|
name: `${host.name || host.ip} (Copy)`,
|
||||||
|
pin: false,
|
||||||
|
} as any);
|
||||||
|
setHosts((prev) => [...prev, cloned]);
|
||||||
|
toast.success(`Cloned ${host.name}`);
|
||||||
|
} catch {
|
||||||
|
toast.error("Failed to clone host");
|
||||||
|
}
|
||||||
|
}}
|
||||||
onDragStart={() => setDraggedHost(host)}
|
onDragStart={() => setDraggedHost(host)}
|
||||||
onDragEnd={() => setDraggedHost(null)}
|
onDragEnd={() => setDraggedHost(null)}
|
||||||
/>
|
/>
|
||||||
@@ -5892,6 +5905,19 @@ export function HostManager({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
onClone={async () => {
|
||||||
|
try {
|
||||||
|
const cloned = await createSSHHost({
|
||||||
|
...host,
|
||||||
|
name: `${host.name || host.ip} (Copy)`,
|
||||||
|
pin: false,
|
||||||
|
} as any);
|
||||||
|
setHosts((prev) => [...prev, cloned]);
|
||||||
|
toast.success(`Cloned ${host.name}`);
|
||||||
|
} catch {
|
||||||
|
toast.error("Failed to clone host");
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -5943,6 +5969,19 @@ export function HostManager({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
onClone={async () => {
|
||||||
|
try {
|
||||||
|
const cloned = await createSSHHost({
|
||||||
|
...host,
|
||||||
|
name: `${host.name || host.ip} (Copy)`,
|
||||||
|
pin: false,
|
||||||
|
} as any);
|
||||||
|
setHosts((prev) => [...prev, cloned]);
|
||||||
|
toast.success(`Cloned ${host.name}`);
|
||||||
|
} catch {
|
||||||
|
toast.error("Failed to clone host");
|
||||||
|
}
|
||||||
|
}}
|
||||||
onDragStart={() => setDraggedHost(host)}
|
onDragStart={() => setDraggedHost(host)}
|
||||||
onDragEnd={() => setDraggedHost(null)}
|
onDragEnd={() => setDraggedHost(null)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user