chore: remove dead files (#827)
This commit is contained in:
parent
4631655c3e
commit
6ae5a33acd
5 changed files with 19 additions and 242 deletions
|
|
@ -1,3 +1,21 @@
|
||||||
{
|
{
|
||||||
"ignorePatterns": ["node_modules/**", ".output/**", "**/api-client/**", "**/components/ui/**", "**/routeTree.gen.ts"]
|
"entry": [
|
||||||
|
"app/client.tsx",
|
||||||
|
"app/router.tsx",
|
||||||
|
"app/server.ts",
|
||||||
|
"app/server/plugins/bootstrap.ts",
|
||||||
|
"openapi-ts.config.ts",
|
||||||
|
"scripts/create-test-files.ts",
|
||||||
|
"scripts/patch-api-client.ts"
|
||||||
|
],
|
||||||
|
"ignorePatterns": [
|
||||||
|
"node_modules/**",
|
||||||
|
".output/**",
|
||||||
|
"**/api-client/**",
|
||||||
|
"**/components/ui/**",
|
||||||
|
"**/routeTree.gen.ts",
|
||||||
|
"apps/docs/**",
|
||||||
|
"app/client/hooks/use-mobile.ts",
|
||||||
|
"app/client/hooks/useMinimumDuration.ts"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,92 +0,0 @@
|
||||||
import { useMutation } from "@tanstack/react-query";
|
|
||||||
import { Activity, HeartIcon } from "lucide-react";
|
|
||||||
import { toast } from "sonner";
|
|
||||||
import { healthCheckVolumeMutation, updateVolumeMutation } from "~/client/api-client/@tanstack/react-query.gen";
|
|
||||||
import { OnOff } from "~/client/components/onoff";
|
|
||||||
import { Button } from "~/client/components/ui/button";
|
|
||||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "~/client/components/ui/card";
|
|
||||||
import type { Volume } from "~/client/lib/types";
|
|
||||||
import { TimeAgo } from "~/client/components/time-ago";
|
|
||||||
|
|
||||||
type Props = {
|
|
||||||
volume: Volume;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const HealthchecksCard = ({ volume }: Props) => {
|
|
||||||
const healthcheck = useMutation({
|
|
||||||
...healthCheckVolumeMutation(),
|
|
||||||
onSuccess: (d) => {
|
|
||||||
if (d.error) {
|
|
||||||
toast.error("Health check failed", { description: d.error });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
toast.success("Health check completed", { description: "The volume is healthy." });
|
|
||||||
},
|
|
||||||
onError: (error) => {
|
|
||||||
toast.error("Health check failed", { description: error.message });
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const toggleAutoRemount = useMutation({
|
|
||||||
...updateVolumeMutation(),
|
|
||||||
onSuccess: (d) => {
|
|
||||||
toast.success("Volume updated", {
|
|
||||||
description: `Auto remount is now ${d.autoRemount ? "enabled" : "paused"}.`,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onError: (error) => {
|
|
||||||
toast.error("Update failed", { description: error.message });
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Card className="flex-1 flex flex-col h-full">
|
|
||||||
<CardHeader>
|
|
||||||
<CardTitle className="flex items-center gap-2">
|
|
||||||
<HeartIcon className="h-4 w-4" />
|
|
||||||
Health Checks
|
|
||||||
</CardTitle>
|
|
||||||
<CardDescription>Monitor and automatically remount volumes on errors to ensure availability.</CardDescription>
|
|
||||||
</CardHeader>
|
|
||||||
<CardContent>
|
|
||||||
<div className="flex flex-col flex-1 justify-start">
|
|
||||||
{volume.lastError && <span className="text-sm text-red-500 wrap-break-word">{volume.lastError}</span>}
|
|
||||||
{volume.status === "mounted" && <span className="text-md text-success">Healthy</span>}
|
|
||||||
{volume.status !== "unmounted" && (
|
|
||||||
<span className="text-xs text-muted-foreground mb-4">
|
|
||||||
Checked <TimeAgo date={volume.lastHealthCheck} />
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
<div className="flex justify-between items-center gap-2">
|
|
||||||
<span className="text-sm">Remount on error</span>
|
|
||||||
<OnOff
|
|
||||||
isOn={volume.autoRemount}
|
|
||||||
toggle={() =>
|
|
||||||
toggleAutoRemount.mutate({
|
|
||||||
path: { shortId: volume.shortId },
|
|
||||||
body: { autoRemount: !volume.autoRemount },
|
|
||||||
})
|
|
||||||
}
|
|
||||||
disabled={toggleAutoRemount.isPending}
|
|
||||||
enabledLabel="Enabled"
|
|
||||||
disabledLabel="Paused"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{volume.status !== "unmounted" && (
|
|
||||||
<div className="flex justify-center">
|
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
className="mt-4"
|
|
||||||
loading={healthcheck.isPending}
|
|
||||||
onClick={() => healthcheck.mutate({ path: { shortId: volume.shortId } })}
|
|
||||||
>
|
|
||||||
<Activity className="h-4 w-4 mr-2" />
|
|
||||||
Run Health Check
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
@ -1,133 +0,0 @@
|
||||||
"use client";
|
|
||||||
|
|
||||||
import { HardDrive, Unplug } from "lucide-react";
|
|
||||||
import * as React from "react";
|
|
||||||
import { Label, Pie, PieChart } from "recharts";
|
|
||||||
import { ByteSize } from "~/client/components/bytes-size";
|
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from "~/client/components/ui/card";
|
|
||||||
import { type ChartConfig, ChartContainer, ChartTooltip, ChartTooltipContent } from "~/client/components/ui/chart";
|
|
||||||
import type { StatFs } from "~/client/lib/types";
|
|
||||||
|
|
||||||
type Props = {
|
|
||||||
statfs: StatFs;
|
|
||||||
};
|
|
||||||
|
|
||||||
export function StorageChart({ statfs }: Props) {
|
|
||||||
const chartData = React.useMemo(
|
|
||||||
() => [
|
|
||||||
{
|
|
||||||
name: "Used",
|
|
||||||
value: statfs.used,
|
|
||||||
fill: "var(--strong-accent)",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Free",
|
|
||||||
value: statfs.free,
|
|
||||||
fill: "lightgray",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[statfs],
|
|
||||||
);
|
|
||||||
|
|
||||||
const chartConfig = {} satisfies ChartConfig;
|
|
||||||
|
|
||||||
const usagePercentage = React.useMemo(() => {
|
|
||||||
return Math.round((statfs.used / statfs.total) * 100);
|
|
||||||
}, [statfs]);
|
|
||||||
|
|
||||||
const isEmpty = !statfs.total;
|
|
||||||
|
|
||||||
if (isEmpty) {
|
|
||||||
return (
|
|
||||||
<Card className="flex flex-col h-full text-sm">
|
|
||||||
<CardHeader className="items-center pb-0">
|
|
||||||
<CardTitle className="flex items-center gap-2">
|
|
||||||
<HardDrive className="h-4 w-4" />
|
|
||||||
Storage Usage
|
|
||||||
</CardTitle>
|
|
||||||
</CardHeader>
|
|
||||||
<CardContent className="flex-1 pb-10 flex flex-col items-center justify-center text-center">
|
|
||||||
<Unplug className="mb-4 h-5 w-5 text-muted-foreground" />
|
|
||||||
<p className="text-muted-foreground">No storage data available. Mount the volume to see usage statistics.</p>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Card className="flex flex-col h-full text-sm">
|
|
||||||
<CardHeader className="items-center pb-0">
|
|
||||||
<CardTitle className="flex items-center gap-2">
|
|
||||||
<HardDrive className="h-4 w-4" />
|
|
||||||
Storage Usage
|
|
||||||
</CardTitle>
|
|
||||||
</CardHeader>
|
|
||||||
<CardContent className="flex-1 pb-0">
|
|
||||||
<div>
|
|
||||||
<ChartContainer config={chartConfig} className="mx-auto aspect-square max-h-[250px]">
|
|
||||||
<PieChart>
|
|
||||||
<ChartTooltip
|
|
||||||
cursor={false}
|
|
||||||
content={
|
|
||||||
<ChartTooltipContent
|
|
||||||
hideLabel
|
|
||||||
formatter={(value, name) => [<ByteSize key={name} bytes={value as number} />, name]}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Pie data={chartData} dataKey="value" nameKey="name" innerRadius={60} strokeWidth={5}>
|
|
||||||
<Label
|
|
||||||
content={({ viewBox }) => {
|
|
||||||
if (viewBox && "cx" in viewBox && "cy" in viewBox) {
|
|
||||||
return (
|
|
||||||
<text x={viewBox.cx} y={viewBox.cy} textAnchor="middle" dominantBaseline="middle">
|
|
||||||
<tspan x={viewBox.cx} y={viewBox.cy} className="fill-foreground text-3xl font-bold">
|
|
||||||
{usagePercentage}%
|
|
||||||
</tspan>
|
|
||||||
<tspan x={viewBox.cx} y={(viewBox.cy || 0) + 24} className="fill-muted-foreground">
|
|
||||||
Used
|
|
||||||
</tspan>
|
|
||||||
</text>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Pie>
|
|
||||||
</PieChart>
|
|
||||||
</ChartContainer>
|
|
||||||
<div className="flex flex-col h-full justify-center">
|
|
||||||
<div className="grid gap-4 w-full">
|
|
||||||
<div className="flex items-center justify-between p-3 rounded-lg bg-muted/50">
|
|
||||||
<div className="flex items-center gap-3">
|
|
||||||
<HardDrive className="h-4 w-4 text-muted-foreground" />
|
|
||||||
<span className="font-medium">Total capacity</span>
|
|
||||||
</div>
|
|
||||||
<ByteSize bytes={statfs.total} className="font-mono text-sm" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex items-center justify-between p-3 rounded-lg bg-strong-accent/10">
|
|
||||||
<div className="flex items-center gap-3">
|
|
||||||
<div className="h-4 w-4 rounded-full bg-strong-accent" />
|
|
||||||
<span className="font-medium">Used space</span>
|
|
||||||
</div>
|
|
||||||
<div className="text-right">
|
|
||||||
<ByteSize bytes={statfs.used} className="font-mono text-sm" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex items-center justify-between p-3 rounded-lg bg-primary/10">
|
|
||||||
<div className="flex items-center gap-3">
|
|
||||||
<div className="h-4 w-4 rounded-full bg-primary" />
|
|
||||||
<span className="font-medium">Free space</span>
|
|
||||||
</div>
|
|
||||||
<div className="text-right">
|
|
||||||
<ByteSize bytes={statfs.free} className="font-mono text-sm" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
export { ssoIntegration } from "./sso.integration";
|
|
||||||
export { ssoController } from "./sso.controller";
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
export function deepClean<T>(obj: T): T {
|
|
||||||
if (Array.isArray(obj)) {
|
|
||||||
return obj.map(deepClean).filter((v) => v !== undefined && v !== null && v !== "") as T;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj && typeof obj === "object") {
|
|
||||||
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
||||||
const cleaned = deepClean(value);
|
|
||||||
if (cleaned !== undefined && cleaned !== "") acc[key as keyof T] = cleaned;
|
|
||||||
return acc;
|
|
||||||
}, {} as T);
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue