import React, { useEffect, useState } from 'react'; import tw from 'twin.macro'; import { Actions, useStoreActions } from 'easy-peasy'; import { ApplicationStore } from '@/state'; import AdminBox from '@/components/admin/AdminBox'; import getNodeInformation, { NodeInformation } from '@/api/admin/nodes/getNodeInformation'; import SpinnerOverlay from '@/components/elements/SpinnerOverlay'; import { Context } from '@/components/admin/nodes/NodeRouter'; const Code = ({ className, children }: { className?: string, children: React.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 */}
); };