2019-08-17 23:03:10 +00:00
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
|
import { Server } from '@/api/server/getServer';
|
|
|
|
import getServers from '@/api/getServers';
|
|
|
|
import ServerRow from '@/components/dashboard/ServerRow';
|
|
|
|
import Spinner from '@/components/elements/Spinner';
|
2020-04-17 18:17:01 +00:00
|
|
|
import PageContentBlock from '@/components/elements/PageContentBlock';
|
2019-06-26 04:28:56 +00:00
|
|
|
|
2019-08-17 23:03:10 +00:00
|
|
|
export default () => {
|
|
|
|
const [ servers, setServers ] = useState<null | Server[]>(null);
|
|
|
|
|
|
|
|
const loadServers = () => getServers().then(data => setServers(data.items));
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
loadServers();
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
if (servers === null) {
|
|
|
|
return <Spinner size={'large'} centered={true}/>;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2020-04-17 18:17:01 +00:00
|
|
|
<PageContentBlock>
|
2019-12-23 04:56:34 +00:00
|
|
|
{servers.length > 0 ?
|
2019-08-17 23:03:10 +00:00
|
|
|
servers.map(server => (
|
|
|
|
<ServerRow key={server.uuid} server={server} className={'mt-2'}/>
|
|
|
|
))
|
2019-12-22 23:31:12 +00:00
|
|
|
:
|
|
|
|
<p className={'text-center text-sm text-neutral-400'}>
|
|
|
|
It looks like you have no servers.
|
|
|
|
</p>
|
2019-08-17 23:03:10 +00:00
|
|
|
}
|
2020-04-17 18:17:01 +00:00
|
|
|
</PageContentBlock>
|
2019-08-17 23:03:10 +00:00
|
|
|
);
|
|
|
|
};
|