2022-10-27 23:28:21 +02:00
|
|
|
import { useTranslation } from "next-i18next";
|
|
|
|
|
|
|
|
import Container from "components/services/widget/container";
|
|
|
|
import Block from "components/services/widget/block";
|
|
|
|
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");
|
|
|
|
|
2022-11-07 09:24:15 -08:00
|
|
|
if (watchError) {
|
2023-04-30 19:09:37 -04:00
|
|
|
return <Container service={service} error={watchError} />;
|
2022-10-27 23:28:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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}>
|
2023-10-17 23:26:55 -07:00
|
|
|
<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 })}
|
|
|
|
/>
|
2022-10-27 23:28:21 +02:00
|
|
|
</Container>
|
|
|
|
);
|
|
|
|
}
|