Show basic VM characteristics
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pierre HUBERT 2024-05-07 22:02:50 +02:00
parent e6605edad8
commit 50dbdafebf

View File

@ -19,16 +19,18 @@ import {
PowerRegular, PowerRegular,
StopRegular, StopRegular,
} from "@fluentui/react-icons"; } from "@fluentui/react-icons";
import { filesize } from "filesize";
import React from "react"; import React from "react";
import { VMApi, VMInfo, VMState } from "../api/VMApi"; import { VMApi, VMInfo, VMState } from "../api/VMApi";
import { useConfirm } from "../hooks/providers/ConfirmDialogProvider";
import { useToast } from "../hooks/providers/ToastProvider"; import { useToast } from "../hooks/providers/ToastProvider";
import { AsyncWidget } from "./AsyncWidget"; import { AsyncWidget } from "./AsyncWidget";
import { SectionContainer } from "./SectionContainer"; import { SectionContainer } from "./SectionContainer";
import { VMLiveScreenshot } from "./VMLiveScreenshot"; import { VMLiveScreenshot } from "./VMLiveScreenshot";
import { useConfirm } from "../hooks/providers/ConfirmDialogProvider";
const useStyles = makeStyles({ const useStyles = makeStyles({
body1Stronger: typographyStyles.body1Stronger, body1Stronger: typographyStyles.body1Stronger,
caption1: typographyStyles.caption1,
}); });
export function VirtualMachinesWidget(): React.ReactElement { export function VirtualMachinesWidget(): React.ReactElement {
@ -72,6 +74,8 @@ function VMWidget(p: { vm: VMInfo }): React.ReactElement {
const [state, setState] = React.useState<VMState | undefined>(); const [state, setState] = React.useState<VMState | undefined>();
const styles = useStyles();
const load = async () => { const load = async () => {
const newState = await VMApi.State(p.vm); const newState = await VMApi.State(p.vm);
if (state !== newState) setState(newState); if (state !== newState) setState(newState);
@ -117,6 +121,10 @@ function VMWidget(p: { vm: VMInfo }): React.ReactElement {
</Caption1> </Caption1>
} }
/> />
<p className={styles.caption1} style={{ margin: "0px auto" }}>
{p.vm.architecture} &bull; RAM : {filesize(p.vm.memory * 1000 * 1000)}{" "}
&bull; {p.vm.number_vcpu} vCPU
</p>
<p style={{ flex: 1 }}>{p.vm.description}</p> <p style={{ flex: 1 }}>{p.vm.description}</p>