Local modifications to ClusterLabs/Anvil by Alteeve
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.5 KiB

import { FC, useState } from 'react';
import CrudList from '../CrudList';
import PrepareHostForm from './PrepareHostForm';
import TestAccessForm from './TestAccessForm';
import { BodyText } from '../Text';
const ManageHost: FC = () => {
const [inquireHostResponse, setInquireHostResponse] = useState<
InquireHostResponse | undefined
>();
return (
<CrudList<APIHostOverview, APIHostDetail>
addHeader="Initialize host"
editHeader=""
entriesUrl="/host?types=dr,node"
entryUrlPrefix="/host"
getDeleteErrorMessage={(children, ...rest) => ({
...rest,
children: <>Failed to delete host(s). {children}</>,
})}
getDeleteHeader={(count) => `Delete the following ${count} host(s)?`}
getDeleteSuccessMessage={() => ({
children: <>Successfully deleted host(s)</>,
})}
listEmpty="No host(s) found"
listProps={{ allowAddItem: true, allowEdit: false }}
renderAddForm={(tools) => (
<>
<TestAccessForm setResponse={setInquireHostResponse} />
{inquireHostResponse && (
<PrepareHostForm host={inquireHostResponse} tools={tools} />
)}
</>
)}
renderDeleteItem={(hosts, { key }) => {
const host = hosts?.[key];
return <BodyText>{host?.shortHostName}</BodyText>;
}}
renderEditForm={() => <></>}
renderListItem={(uuid, { hostName }) => <BodyText>{hostName}</BodyText>}
/>
);
};
export default ManageHost;