mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-09 14:58:47 +00:00
first public source commit
This commit is contained in:
parent
1a4fbb9d42
commit
3914fee775
65 changed files with 4697 additions and 312 deletions
29
src/components/services/status.jsx
Normal file
29
src/components/services/status.jsx
Normal file
|
@ -0,0 +1,29 @@
|
|||
import useSWR from "swr";
|
||||
|
||||
export default function Status({ service }) {
|
||||
const { data, error } = useSWR(
|
||||
`/api/docker/status/${service.container}/${service.server || ""}`
|
||||
);
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<div className="w-3 h-3 bg-rose-300 dark:bg-rose-500 rounded-full" />
|
||||
);
|
||||
}
|
||||
|
||||
if (data && data.status === "running") {
|
||||
return (
|
||||
<div className="w-3 h-3 bg-emerald-300 dark:bg-emerald-500 rounded-full" />
|
||||
);
|
||||
}
|
||||
|
||||
if (data && data.status === "not found") {
|
||||
return (
|
||||
<>
|
||||
<div className="h-2.5 w-2.5 bg-orange-400/50 dark:bg-yellow-200/40 -rotate-45"></div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return <div className="w-3 h-3 bg-black/20 dark:bg-white/40 rounded-full" />;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue