mirror of
https://github.com/gethomepage/homepage.git
synced 2026-05-18 11:27:33 +08:00
Some checks failed
Crowdin Action / Crowdin Sync (push) Has been cancelled
Tests / vitest (4) (push) Has been cancelled
Docker CI / Linting Checks (push) Has been cancelled
Release Drafter / Update Release Draft (push) Has been cancelled
Release Drafter / Auto Label PR (push) Has been cancelled
Tests / vitest (1) (push) Has been cancelled
Tests / vitest (2) (push) Has been cancelled
Tests / vitest (3) (push) Has been cancelled
Docker CI / Docker Build & Push (push) Has been cancelled
Repository Maintenance / Stale (push) Has been cancelled
Repository Maintenance / Lock Old Threads (push) Has been cancelled
Repository Maintenance / Close Answered Discussions (push) Has been cancelled
Repository Maintenance / Close Outdated Discussions (push) Has been cancelled
Repository Maintenance / Close Unsupported Feature Requests (push) Has been cancelled
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
import Block from "components/services/widget/block";
|
|
import Container from "components/services/widget/container";
|
|
import { useTranslation } from "next-i18next";
|
|
|
|
import useWidgetAPI from "utils/proxy/use-widget-api";
|
|
|
|
export default function Component({ service }) {
|
|
const { t } = useTranslation();
|
|
|
|
const { widget } = service;
|
|
|
|
const { data: watchData, error: watchError } = useWidgetAPI(widget, "watchtower");
|
|
|
|
if (watchError) {
|
|
return <Container service={service} error={watchError} />;
|
|
}
|
|
|
|
if (!watchData) {
|
|
return (
|
|
<Container service={service}>
|
|
<Block label="watchtower.containers_scanned" />
|
|
<Block label="watchtower.containers_updated" />
|
|
<Block label="watchtower.containers_failed" />
|
|
</Container>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Container service={service}>
|
|
<Block
|
|
label="watchtower.containers_scanned"
|
|
value={t("common.number", { value: watchData.watchtower_containers_scanned })}
|
|
/>
|
|
<Block
|
|
label="watchtower.containers_updated"
|
|
value={t("common.number", { value: watchData.watchtower_containers_updated })}
|
|
/>
|
|
<Block
|
|
label="watchtower.containers_failed"
|
|
value={t("common.number", { value: watchData.watchtower_containers_failed })}
|
|
/>
|
|
</Container>
|
|
);
|
|
}
|