import {
Activity,
AlertTriangle,
CircleStop,
CloudUpload,
Cpu,
Package,
Play,
RefreshCw,
RotateCcw,
Zap,
} from "lucide-solid";
import { createMemo, For, Show, type JSXElement } from "solid-js";
import { PageHeading } from "../../components/ui/page-heading";
import { ServiceTable } from "../../components/ui/service-table";
import { eventsFrom, servicesFrom } from "../../lib/view-state";
import { formatDuration } from "../../lib/model";
import type { PageProps } from "../types";
export default function OverviewPage(props: PageProps) {
const services = createMemo(() => servicesFrom(props.state()));
const events = createMemo(() => eventsFrom(props.state()));
const running = createMemo(
() => services().filter((service) => service.status === "running").length,
);
const totalCalls = createMemo(() =>
services().reduce((total, service) => total + service.calls, 0),
);
const errors = createMemo(() => services().reduce((total, service) => total + service.errors, 0));
return (
}>
{(state) => (
<>
>
}
/>
}
tone="bg-cyan-soft text-cyan-strong"
label="服务版本"
value={services().length.toString()}
note={`${state().snapshot?.deployments.length ?? 0} 个对外服务`}
/>
}
tone="bg-brand-soft text-brand"
label="运行实例"
value={running().toString()}
note={`${services().length - running()} 个未运行`}
/>
}
tone="bg-amber-soft text-amber-strong"
label="累计调用"
value={totalCalls().toLocaleString("zh-CN")}
note="持久化统计"
/>
}
tone="bg-coral-soft text-coral-strong"
label="调用异常"
value={errors().toString()}
note={errors() > 0 ? "需要检查" : "无异常"}
/>
Wasmeld Runtime
{state().snapshot?.runtime.status === "running"
? "Wasmtime sandbox 正常"
: "Engine 与 Actor 已释放"}
props.command({ type: "runtime-action", action: "start" })}
>
}
>
>
)}
);
}
function Metric(props: {
icon: JSXElement;
tone: string;
label: string;
value: string;
note: string;
}) {
return (
{props.icon}
{props.label}
{props.value}
{props.note}
);
}
function RuntimeStat(props: { label: string; value: string; detail: string }) {
return (
{props.label}
{props.value}
{props.detail}
);
}
function OverviewSkeleton() {
return (
);
}