mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-19 02:59:50 +00:00
Run pre-commit hooks over existing codebase
Co-Authored-By: Ben Phelps <ben@phelps.io>
This commit is contained in:
parent
fa50bbad9c
commit
19c25713c4
387 changed files with 4785 additions and 4109 deletions
|
@ -8,13 +8,13 @@ import useWidgetAPI from "utils/proxy/use-widget-api";
|
|||
import ResolvedIcon from "components/resolvedicon";
|
||||
|
||||
const statusMap = {
|
||||
"R": <ResolvedIcon icon="mdi-circle" width={32} height={32} />, // running
|
||||
"S": <ResolvedIcon icon="mdi-circle-outline" width={32} height={32} />, // sleeping
|
||||
"D": <ResolvedIcon icon="mdi-circle-double" width={32} height={32} />, // disk sleep
|
||||
"Z": <ResolvedIcon icon="mdi-circle-opacity" width={32} height={32} />, // zombie
|
||||
"T": <ResolvedIcon icon="mdi-decagram-outline" width={32} height={32} />, // traced
|
||||
"t": <ResolvedIcon icon="mdi-hexagon-outline" width={32} height={32} />, // traced
|
||||
"X": <ResolvedIcon icon="mdi-rhombus-outline" width={32} height={32} />, // dead
|
||||
R: <ResolvedIcon icon="mdi-circle" width={32} height={32} />, // running
|
||||
S: <ResolvedIcon icon="mdi-circle-outline" width={32} height={32} />, // sleeping
|
||||
D: <ResolvedIcon icon="mdi-circle-double" width={32} height={32} />, // disk sleep
|
||||
Z: <ResolvedIcon icon="mdi-circle-opacity" width={32} height={32} />, // zombie
|
||||
T: <ResolvedIcon icon="mdi-decagram-outline" width={32} height={32} />, // traced
|
||||
t: <ResolvedIcon icon="mdi-hexagon-outline" width={32} height={32} />, // traced
|
||||
X: <ResolvedIcon icon="mdi-rhombus-outline" width={32} height={32} />, // dead
|
||||
};
|
||||
|
||||
export default function Component({ service }) {
|
||||
|
@ -22,16 +22,24 @@ export default function Component({ service }) {
|
|||
const { widget } = service;
|
||||
const { chart } = widget;
|
||||
|
||||
const { data, error } = useWidgetAPI(service.widget, 'processlist', {
|
||||
const { data, error } = useWidgetAPI(service.widget, "processlist", {
|
||||
refreshInterval: 1000,
|
||||
});
|
||||
|
||||
if (error) {
|
||||
return <Container chart={chart}><Error error={error} /></Container>;
|
||||
return (
|
||||
<Container chart={chart}>
|
||||
<Error error={error} />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
return <Container chart={chart}><Block position="bottom-3 left-3">-</Block></Container>;
|
||||
return (
|
||||
<Container chart={chart}>
|
||||
<Block position="bottom-3 left-3">-</Block>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
data.splice(chart ? 5 : 1);
|
||||
|
@ -48,19 +56,21 @@ export default function Component({ service }) {
|
|||
|
||||
<Block position="bottom-4 right-3 left-3">
|
||||
<div className="pointer-events-none text-theme-900 dark:text-theme-200">
|
||||
{ data.map((item) => <div key={item.pid} className="text-[0.75rem] h-[0.8rem]">
|
||||
<div className="flex items-center">
|
||||
<div className="w-3 h-3 mr-1.5 opacity-50">
|
||||
{statusMap[item.status]}
|
||||
{data.map((item) => (
|
||||
<div key={item.pid} className="text-[0.75rem] h-[0.8rem]">
|
||||
<div className="flex items-center">
|
||||
<div className="w-3 h-3 mr-1.5 opacity-50">{statusMap[item.status]}</div>
|
||||
<div className="opacity-75 grow">{item.name}</div>
|
||||
<div className="opacity-25 w-14 text-right">{item.cpu_percent.toFixed(1)}%</div>
|
||||
<div className="opacity-25 w-14 text-right">
|
||||
{t("common.bytes", {
|
||||
value: item.memory_info[0],
|
||||
maximumFractionDigits: 0,
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
<div className="opacity-75 grow">{item.name}</div>
|
||||
<div className="opacity-25 w-14 text-right">{item.cpu_percent.toFixed(1)}%</div>
|
||||
<div className="opacity-25 w-14 text-right">{t("common.bytes", {
|
||||
value: item.memory_info[0],
|
||||
maximumFractionDigits: 0,
|
||||
})}</div>
|
||||
</div>
|
||||
</div>) }
|
||||
))}
|
||||
</div>
|
||||
</Block>
|
||||
</Container>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue