mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 14:15:24 +00:00
feat: Add Fleet Sharing functionality to the UI (#1228)
https://github.com/Termix-SSH/Support/issues/1228
This commit is contained in:
1 parent
6837144ad5
commit
da840b925c
3 files changed
+509
-2
No files matched your search
@@ -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");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user