Revert "Added optional boxed styling for information widgets and refactored information widgets"

This commit is contained in:
shamoon 2023-06-10 23:30:44 -07:00 committed by GitHub
parent 347761fcad
commit 6b2930ab8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 854 additions and 642 deletions

View file

@ -1,15 +1,12 @@
import useSWR from "swr";
import { BiError } from "react-icons/bi";
import { useTranslation } from "next-i18next";
import Error from "../widget/error";
import Container from "../widget/container";
import Raw from "../widget/raw";
import Node from "./node";
export default function Widget({ options }) {
const { cluster, nodes } = options;
const { i18n } = useTranslation();
const { t, i18n } = useTranslation();
const defaultData = {
cpu: {
@ -21,7 +18,7 @@ export default function Widget({ options }) {
used: 0,
total: 0,
free: 0,
percent: 0
precent: 0
}
};
@ -32,12 +29,23 @@ export default function Widget({ options }) {
);
if (error || data?.error) {
return <Error options={options} />
return (
<div className="flex flex-col justify-center first:ml-0 ml-4">
<div className="flex flex-row items-center justify-end">
<div className="flex flex-row items-center">
<BiError className="w-8 h-8 text-theme-800 dark:text-theme-200" />
<div className="flex flex-col ml-3 text-left">
<span className="text-theme-800 dark:text-theme-200 text-sm">{t("widget.api_error")}</span>
</div>
</div>
</div>
</div>
);
}
if (!data) {
return <Container options={options}>
<Raw>
return (
<div className="flex flex-col max-w:full sm:basis-auto self-center grow-0 flex-wrap">
<div className="flex flex-row self-center flex-wrap justify-between">
{cluster.show &&
<Node type="cluster" key="cluster" options={options.cluster} data={defaultData} />
@ -46,12 +54,12 @@ export default function Widget({ options }) {
<Node type="node" key="nodes" options={options.nodes} data={defaultData} />
}
</div>
</Raw>
</Container>;
</div>
);
}
return <Container options={options}>
<Raw>
return (
<div className="flex flex-col max-w:full sm:basis-auto self-center grow-0 flex-wrap">
<div className="flex flex-row self-center flex-wrap justify-between">
{cluster.show &&
<Node key="cluster" type="cluster" options={options.cluster} data={data.cluster} />
@ -61,6 +69,6 @@ export default function Widget({ options }) {
<Node key={node.name} type="node" options={options.nodes} data={node} />)
}
</div>
</Raw>
</Container>;
</div>
);
}