diff --git a/apps/client/app/api-client/sdk.gen.ts b/apps/client/app/api-client/sdk.gen.ts index 2ce7f43..205e7dd 100644 --- a/apps/client/app/api-client/sdk.gen.ts +++ b/apps/client/app/api-client/sdk.gen.ts @@ -12,7 +12,6 @@ import type { LogoutResponses, GetMeData, GetMeResponses, - GetMeErrors, GetStatusData, GetStatusResponses, ListVolumesData, @@ -34,16 +33,13 @@ import type { GetContainersUsingVolumeErrors, MountVolumeData, MountVolumeResponses, - MountVolumeErrors, UnmountVolumeData, UnmountVolumeResponses, - UnmountVolumeErrors, HealthCheckVolumeData, HealthCheckVolumeResponses, HealthCheckVolumeErrors, ListFilesData, ListFilesResponses, - ListFilesErrors, ListRepositoriesData, ListRepositoriesResponses, CreateRepositoryData, @@ -130,7 +126,7 @@ export const logout = (options?: Options(options?: Options) => { - return (options?.client ?? _heyApiClient).get({ + return (options?.client ?? _heyApiClient).get({ url: "/api/v1/auth/me", ...options, }); @@ -246,7 +242,7 @@ export const getContainersUsingVolume = ( * Mount a volume */ export const mountVolume = (options: Options) => { - return (options.client ?? _heyApiClient).post({ + return (options.client ?? _heyApiClient).post({ url: "/api/v1/volumes/{name}/mount", ...options, }); @@ -258,7 +254,7 @@ export const mountVolume = (options: Optio export const unmountVolume = ( options: Options, ) => { - return (options.client ?? _heyApiClient).post({ + return (options.client ?? _heyApiClient).post({ url: "/api/v1/volumes/{name}/unmount", ...options, }); @@ -280,7 +276,7 @@ export const healthCheckVolume = ( * List files in a volume directory */ export const listFiles = (options: Options) => { - return (options.client ?? _heyApiClient).get({ + return (options.client ?? _heyApiClient).get({ url: "/api/v1/volumes/{name}/files", ...options, }); diff --git a/apps/client/app/api-client/types.gen.ts b/apps/client/app/api-client/types.gen.ts index 8309437..7571aa7 100644 --- a/apps/client/app/api-client/types.gen.ts +++ b/apps/client/app/api-client/types.gen.ts @@ -23,8 +23,9 @@ export type RegisterResponses = { */ 201: { message: string; - user: { - id: string; + success: boolean; + user?: { + id: number; username: string; }; }; @@ -55,8 +56,9 @@ export type LoginResponses = { */ 200: { message: string; - user: { - id: string; + success: boolean; + user?: { + id: number; username: string; }; }; @@ -76,7 +78,7 @@ export type LogoutResponses = { * Logout successful */ 200: { - message: string; + success: boolean; }; }; @@ -89,21 +91,15 @@ export type GetMeData = { url: "/api/v1/auth/me"; }; -export type GetMeErrors = { - /** - * Not authenticated - */ - 401: unknown; -}; - export type GetMeResponses = { /** * Current user information */ 200: { message: string; - user: { - id: string; + success: boolean; + user?: { + id: number; username: string; }; }; @@ -232,11 +228,46 @@ export type CreateVolumeResponses = { * Volume created successfully */ 201: { - message: string; - volume: { - name: string; - path: string; - }; + autoRemount: boolean; + config: + | { + backend: "directory"; + } + | { + backend: "nfs"; + exportPath: string; + server: string; + version: "3" | "4" | "4.1"; + port?: number; + } + | { + backend: "smb"; + password: string; + server: string; + share: string; + username: string; + vers?: "1.0" | "2.0" | "2.1" | "3.0"; + port?: number; + domain?: string; + } + | { + backend: "webdav"; + path: string; + server: string; + port?: number; + password?: string; + ssl?: boolean; + username?: string; + }; + createdAt: number; + id: number; + lastError: string | null; + lastHealthCheck: number; + name: string; + path: string; + status: "error" | "mounted" | "unmounted"; + type: "directory" | "nfs" | "smb" | "webdav"; + updatedAt: number; }; }; @@ -438,49 +469,46 @@ export type UpdateVolumeResponses = { * Volume updated successfully */ 200: { - message: string; - volume: { - autoRemount: boolean; - config: - | { - backend: "directory"; - } - | { - backend: "nfs"; - exportPath: string; - server: string; - version: "3" | "4" | "4.1"; - port?: number; - } - | { - backend: "smb"; - password: string; - server: string; - share: string; - username: string; - vers?: "1.0" | "2.0" | "2.1" | "3.0"; - port?: number; - domain?: string; - } - | { - backend: "webdav"; - path: string; - server: string; - port?: number; - password?: string; - ssl?: boolean; - username?: string; - }; - createdAt: number; - id: number; - lastError: string | null; - lastHealthCheck: number; - name: string; - path: string; - status: "error" | "mounted" | "unmounted"; - type: "directory" | "nfs" | "smb" | "webdav"; - updatedAt: number; - }; + autoRemount: boolean; + config: + | { + backend: "directory"; + } + | { + backend: "nfs"; + exportPath: string; + server: string; + version: "3" | "4" | "4.1"; + port?: number; + } + | { + backend: "smb"; + password: string; + server: string; + share: string; + username: string; + vers?: "1.0" | "2.0" | "2.1" | "3.0"; + port?: number; + domain?: string; + } + | { + backend: "webdav"; + path: string; + server: string; + port?: number; + password?: string; + ssl?: boolean; + username?: string; + }; + createdAt: number; + id: number; + lastError: string | null; + lastHealthCheck: number; + name: string; + path: string; + status: "error" | "mounted" | "unmounted"; + type: "directory" | "nfs" | "smb" | "webdav"; + updatedAt: number; }; }; @@ -506,14 +534,12 @@ export type GetContainersUsingVolumeResponses = { /** * List of containers using the volume */ - 200: { - containers: Array<{ - id: string; - image: string; - name: string; - state: string; - }>; - }; + 200: Array<{ + id: string; + image: string; + name: string; + state: string; + }>; }; export type GetContainersUsingVolumeResponse = @@ -528,13 +554,6 @@ export type MountVolumeData = { url: "/api/v1/volumes/{name}/mount"; }; -export type MountVolumeErrors = { - /** - * Volume not found - */ - 404: unknown; -}; - export type MountVolumeResponses = { /** * Volume mounted successfully @@ -556,13 +575,6 @@ export type UnmountVolumeData = { url: "/api/v1/volumes/{name}/unmount"; }; -export type UnmountVolumeErrors = { - /** - * Volume not found - */ - 404: unknown; -}; - export type UnmountVolumeResponses = { /** * Volume unmounted successfully @@ -617,13 +629,6 @@ export type ListFilesData = { url: "/api/v1/volumes/{name}/files"; }; -export type ListFilesErrors = { - /** - * Volume not found - */ - 404: unknown; -}; - export type ListFilesResponses = { /** * List of files in the volume @@ -653,31 +658,29 @@ export type ListRepositoriesResponses = { /** * List of repositories */ - 200: { - repositories: Array<{ - compressionMode: "auto" | "better" | "fastest" | "max" | "off" | null; - config: - | { - accessKeyId: string; - backend: "s3"; - bucket: string; - endpoint: string; - secretAccessKey: string; - } - | { - backend: "local"; - path: string; - }; - createdAt: number; - id: string; - lastChecked: number | null; - lastError: string | null; - name: string; - status: "error" | "healthy" | "unknown" | null; - type: "local" | "s3"; - updatedAt: number; - }>; - }; + 200: Array<{ + compressionMode: "auto" | "better" | "fastest" | "max" | "off" | null; + config: + | { + accessKeyId: string; + backend: "s3"; + bucket: string; + endpoint: string; + secretAccessKey: string; + } + | { + backend: "local"; + path: string; + }; + createdAt: number; + id: string; + lastChecked: number | null; + lastError: string | null; + name: string; + status: "error" | "healthy" | "unknown" | null; + type: "local" | "s3"; + updatedAt: number; + }>; }; export type ListRepositoriesResponse = ListRepositoriesResponses[keyof ListRepositoriesResponses]; @@ -753,29 +756,27 @@ export type GetRepositoryResponses = { * Repository details */ 200: { - repository: { - compressionMode: "auto" | "better" | "fastest" | "max" | "off" | null; - config: - | { - accessKeyId: string; - backend: "s3"; - bucket: string; - endpoint: string; - secretAccessKey: string; - } - | { - backend: "local"; - path: string; - }; - createdAt: number; - id: string; - lastChecked: number | null; - lastError: string | null; - name: string; - status: "error" | "healthy" | "unknown" | null; - type: "local" | "s3"; - updatedAt: number; - }; + compressionMode: "auto" | "better" | "fastest" | "max" | "off" | null; + config: + | { + accessKeyId: string; + backend: "s3"; + bucket: string; + endpoint: string; + secretAccessKey: string; + } + | { + backend: "local"; + path: string; + }; + createdAt: number; + id: string; + lastChecked: number | null; + lastError: string | null; + name: string; + status: "error" | "healthy" | "unknown" | null; + type: "local" | "s3"; + updatedAt: number; }; }; @@ -818,32 +819,30 @@ export type ListBackupSchedulesResponses = { /** * List of backup schedules */ - 200: { - schedules: Array<{ - createdAt: number; - cronExpression: string; - enabled: boolean; - excludePatterns: Array | null; - id: number; - includePatterns: Array | null; - lastBackupAt: number | null; - lastBackupError: string | null; - lastBackupStatus: "error" | "success" | null; - nextBackupAt: number | null; - repositoryId: string; - retentionPolicy: { - keepDaily?: number; - keepHourly?: number; - keepLast?: number; - keepMonthly?: number; - keepWeekly?: number; - keepWithinDuration?: string; - keepYearly?: number; - } | null; - updatedAt: number; - volumeId: number; - }>; - }; + 200: Array<{ + createdAt: number; + cronExpression: string; + enabled: boolean; + excludePatterns: Array | null; + id: number; + includePatterns: Array | null; + lastBackupAt: number | null; + lastBackupError: string | null; + lastBackupStatus: "error" | "success" | null; + nextBackupAt: number | null; + repositoryId: string; + retentionPolicy: { + keepDaily?: number; + keepHourly?: number; + keepLast?: number; + keepMonthly?: number; + keepWeekly?: number; + keepWithinDuration?: string; + keepYearly?: number; + } | null; + updatedAt: number; + volumeId: number; + }>; }; export type ListBackupSchedulesResponse = ListBackupSchedulesResponses[keyof ListBackupSchedulesResponses]; @@ -877,31 +876,28 @@ export type CreateBackupScheduleResponses = { * Backup schedule created successfully */ 201: { - message: string; - schedule: { - createdAt: number; - cronExpression: string; - enabled: boolean; - excludePatterns: Array | null; - id: number; - includePatterns: Array | null; - lastBackupAt: number | null; - lastBackupError: string | null; - lastBackupStatus: "error" | "success" | null; - nextBackupAt: number | null; - repositoryId: string; - retentionPolicy: { - keepDaily?: number; - keepHourly?: number; - keepLast?: number; - keepMonthly?: number; - keepWeekly?: number; - keepWithinDuration?: string; - keepYearly?: number; - } | null; - updatedAt: number; - volumeId: number; - }; + createdAt: number; + cronExpression: string; + enabled: boolean; + excludePatterns: Array | null; + id: number; + includePatterns: Array | null; + lastBackupAt: number | null; + lastBackupError: string | null; + lastBackupStatus: "error" | "success" | null; + nextBackupAt: number | null; + repositoryId: string; + retentionPolicy: { + keepDaily?: number; + keepHourly?: number; + keepLast?: number; + keepMonthly?: number; + keepWeekly?: number; + keepWithinDuration?: string; + keepYearly?: number; + } | null; + updatedAt: number; + volumeId: number; }; }; @@ -921,7 +917,7 @@ export type DeleteBackupScheduleResponses = { * Backup schedule deleted successfully */ 200: { - message: string; + success: boolean; }; }; @@ -941,30 +937,28 @@ export type GetBackupScheduleResponses = { * Backup schedule details */ 200: { - schedule: { - createdAt: number; - cronExpression: string; - enabled: boolean; - excludePatterns: Array | null; - id: number; - includePatterns: Array | null; - lastBackupAt: number | null; - lastBackupError: string | null; - lastBackupStatus: "error" | "success" | null; - nextBackupAt: number | null; - repositoryId: string; - retentionPolicy: { - keepDaily?: number; - keepHourly?: number; - keepLast?: number; - keepMonthly?: number; - keepWeekly?: number; - keepWithinDuration?: string; - keepYearly?: number; - } | null; - updatedAt: number; - volumeId: number; - }; + createdAt: number; + cronExpression: string; + enabled: boolean; + excludePatterns: Array | null; + id: number; + includePatterns: Array | null; + lastBackupAt: number | null; + lastBackupError: string | null; + lastBackupStatus: "error" | "success" | null; + nextBackupAt: number | null; + repositoryId: string; + retentionPolicy: { + keepDaily?: number; + keepHourly?: number; + keepLast?: number; + keepMonthly?: number; + keepWeekly?: number; + keepWithinDuration?: string; + keepYearly?: number; + } | null; + updatedAt: number; + volumeId: number; }; }; @@ -1000,31 +994,28 @@ export type UpdateBackupScheduleResponses = { * Backup schedule updated successfully */ 200: { - message: string; - schedule: { - createdAt: number; - cronExpression: string; - enabled: boolean; - excludePatterns: Array | null; - id: number; - includePatterns: Array | null; - lastBackupAt: number | null; - lastBackupError: string | null; - lastBackupStatus: "error" | "success" | null; - nextBackupAt: number | null; - repositoryId: string; - retentionPolicy: { - keepDaily?: number; - keepHourly?: number; - keepLast?: number; - keepMonthly?: number; - keepWeekly?: number; - keepWithinDuration?: string; - keepYearly?: number; - } | null; - updatedAt: number; - volumeId: number; - }; + createdAt: number; + cronExpression: string; + enabled: boolean; + excludePatterns: Array | null; + id: number; + includePatterns: Array | null; + lastBackupAt: number | null; + lastBackupError: string | null; + lastBackupStatus: "error" | "success" | null; + nextBackupAt: number | null; + repositoryId: string; + retentionPolicy: { + keepDaily?: number; + keepHourly?: number; + keepLast?: number; + keepMonthly?: number; + keepWeekly?: number; + keepWithinDuration?: string; + keepYearly?: number; + } | null; + updatedAt: number; + volumeId: number; }; }; @@ -1086,8 +1077,7 @@ export type RunBackupNowResponses = { * Backup started successfully */ 200: { - backupStarted: boolean; - message: string; + success: boolean; }; }; diff --git a/apps/client/app/components/ui/chart.tsx b/apps/client/app/components/ui/chart.tsx index d0d0984..b6e10b4 100644 --- a/apps/client/app/components/ui/chart.tsx +++ b/apps/client/app/components/ui/chart.tsx @@ -1,355 +1,298 @@ -import * as React from "react" -import * as RechartsPrimitive from "recharts" +// @ts-nocheck +// biome-ignore-all lint: reason +import * as React from "react"; +import * as RechartsPrimitive from "recharts"; -import { cn } from "~/lib/utils" +import { cn } from "~/lib/utils"; // Format: { THEME_NAME: CSS_SELECTOR } -const THEMES = { light: "", dark: ".dark" } as const +const THEMES = { light: "", dark: ".dark" } as const; export type ChartConfig = { - [k in string]: { - label?: React.ReactNode - icon?: React.ComponentType - } & ( - | { color?: string; theme?: never } - | { color?: never; theme: Record } - ) -} + [k in string]: { + label?: React.ReactNode; + icon?: React.ComponentType; + } & ({ color?: string; theme?: never } | { color?: never; theme: Record }); +}; type ChartContextProps = { - config: ChartConfig -} + config: ChartConfig; +}; -const ChartContext = React.createContext(null) +const ChartContext = React.createContext(null); function useChart() { - const context = React.useContext(ChartContext) + const context = React.useContext(ChartContext); - if (!context) { - throw new Error("useChart must be used within a ") - } + if (!context) { + throw new Error("useChart must be used within a "); + } - return context + return context; } function ChartContainer({ - id, - className, - children, - config, - ...props + id, + className, + children, + config, + ...props }: React.ComponentProps<"div"> & { - config: ChartConfig - children: React.ComponentProps< - typeof RechartsPrimitive.ResponsiveContainer - >["children"] + config: ChartConfig; + children: React.ComponentProps["children"]; }) { - const uniqueId = React.useId() - const chartId = `chart-${id || uniqueId.replace(/:/g, "")}` + const uniqueId = React.useId(); + const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`; - return ( - -
- - - {children} - -
-
- ) + return ( + +
+ + {children} +
+
+ ); } const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => { - const colorConfig = Object.entries(config).filter( - ([, config]) => config.theme || config.color - ) + const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color); - if (!colorConfig.length) { - return null - } + if (!colorConfig.length) { + return null; + } - return ( -