import type { Actions } from 'easy-peasy';
import { useStoreActions } from 'easy-peasy';
import type { ReactNode } from 'react';
import { useEffect, useState } from 'react';
import tw from 'twin.macro';
import type { NodeInformation } from '@/api/admin/nodes/getNodeInformation';
import getNodeInformation from '@/api/admin/nodes/getNodeInformation';
import AdminBox from '@/components/admin/AdminBox';
import SpinnerOverlay from '@/components/elements/SpinnerOverlay';
import { Context } from '@/components/admin/nodes/NodeRouter';
import type { ApplicationStore } from '@/state';
const Code = ({ className, children }: { className?: string; children: ReactNode }) => {
return (
{children}
);
};
export default () => {
const { clearFlashes, clearAndAddHttpError } = useStoreActions(
(actions: Actions) => actions.flashes,
);
const [loading, setLoading] = useState(true);
const [info, setInfo] = useState(null);
const node = Context.useStoreState(state => state.node);
if (node === undefined) {
return <>>;
}
useEffect(() => {
clearFlashes('node');
getNodeInformation(node.id)
.then(info => setInfo(info))
.catch(error => {
console.error(error);
clearAndAddHttpError({ key: 'node', error });
})
.then(() => setLoading(false));
}, []);
if (loading) {
return (
);
}
return (
Wings Version |
{info?.version}
|
Operating System |
{info?.system.type}
|
Architecture |
{info?.system.arch}
|
Kernel |
{info?.system.release}
|
CPU Threads |
{info?.system.cpus}
|
{/* TODO: Description code-block with edit option */}
);
};