mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-04 22:43:40 +01:00
30 lines
845 B
React
30 lines
845 B
React
![]() |
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: statsData, error: statsError } = useWidgetAPI(widget, "cfd_tunnel");
|
||
|
|
||
|
if (statsError) {
|
||
|
return <Container error={statsError} />;
|
||
|
}
|
||
|
|
||
|
if (!statsData) {
|
||
|
return (
|
||
|
<Container service={service}>
|
||
|
<Block label="cloudflared.status" />
|
||
|
<Block label="cloudflared.origin_ip" />
|
||
|
</Container>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
return (
|
||
|
<Container service={service}>
|
||
|
<Block label="cloudflared.status" value={statsData.status} />
|
||
|
<Block label="cloudflared.origin_ip" value={statsData.origin_ip} />
|
||
|
</Container>
|
||
|
);
|
||
|
}
|