feat: Add Fleet Sharing functionality to the UI (#1228)

https://github.com/Termix-SSH/Support/issues/1228
This commit is contained in:
LukeGus committed 2026-09-20 18:12:10 -05:00
1 parent 6837144ad5
commit da840b925c
3 files changed
+509 -2

No files matched your search

+35 -1
View File
@@ -1,4 +1,9 @@
import { authApi, handleApiError } from "@/main-axios";
import {
authApi,
handleApiError,
type SharePermissionLevel,
type ShareTarget,
} from "@/main-axios";
export interface FleetRow {
id: number;
@@ -245,3 +250,32 @@ export async function runFleetPackageAction(
throw handleApiError(error, "run fleet package action");
}
}
export interface FleetShareHostResult {
hostId: number;
shared: boolean;
reason?: string;
}
export async function shareFleet(
fleetId: number,
shareData: {
targets: ShareTarget[];
permissionLevel: SharePermissionLevel;
durationHours?: number;
},
): Promise<{
success: boolean;
permissionLevel: SharePermissionLevel;
expiresAt: string | null;
hostsShared: number;
hostsTotal: number;
hostResults: FleetShareHostResult[];
}> {
try {
const response = await authApi.post(`/fleets/${fleetId}/share`, shareData);
return response.data;
} catch (error) {
throw handleApiError(error, "share fleet");
}
}