mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-10 10:25:03 +00:00
* fix(usage): fetch only when shown and add a host-wide off switch * fix(usage): restore policy defaults and isolate usage test state * refactor(usage): give the sidebar footer sole ownership of its summary
22 lines
679 B
TypeScript
22 lines
679 B
TypeScript
import { useTranslation } from "react-i18next";
|
|
import { useUsageDisplay } from "./display";
|
|
import { useHostUsage } from "./queries";
|
|
import { UsageSection } from "./usage-section";
|
|
|
|
/** A host's usage reports, for its settings page. */
|
|
export function HostUsageSection({ serverId }: { serverId: string }) {
|
|
const { t } = useTranslation();
|
|
const { view, refresh } = useHostUsage(serverId);
|
|
const { display } = useUsageDisplay(view.kind === "ready" ? view.reports : []);
|
|
return (
|
|
<UsageSection
|
|
serverId={serverId}
|
|
title={t("providerUsage.title")}
|
|
view={view}
|
|
display={display}
|
|
onRefresh={refresh}
|
|
testID="usage-card"
|
|
/>
|
|
);
|
|
}
|