mirror of
https://github.com/gethomepage/homepage.git
synced 2026-01-09 18:02:08 +08:00
refactor widget api design
this passes all widget API calls through the backend, with a pluggable design and reusable API handlers
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
import useSWR from "swr";
|
||||
|
||||
import { calculateCPUPercent, formatBytes } from "utils/stats-helpers";
|
||||
|
||||
import Widget from "../widget";
|
||||
import Block from "../block";
|
||||
|
||||
import { calculateCPUPercent, formatBytes } from "utils/stats-helpers";
|
||||
|
||||
export default function Docker({ service }) {
|
||||
const config = service.widget;
|
||||
|
||||
const { data: statusData, error: statusError } = useSWR(
|
||||
`/api/docker/status/${config.container}/${config.server || ""}`,
|
||||
{
|
||||
refreshInterval: 1500,
|
||||
refreshInterval: 5000,
|
||||
}
|
||||
);
|
||||
|
||||
const { data: statsData, error: statsError } = useSWR(
|
||||
`/api/docker/stats/${config.container}/${config.server || ""}`,
|
||||
{
|
||||
refreshInterval: 1500,
|
||||
refreshInterval: 5000,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user