diff --git a/remote_frontend/src/widgets/GroupVMAction.tsx b/remote_frontend/src/widgets/GroupVMAction.tsx new file mode 100644 index 0000000..7761421 --- /dev/null +++ b/remote_frontend/src/widgets/GroupVMAction.tsx @@ -0,0 +1,62 @@ +import { Button, Toolbar, Tooltip } from "@fluentui/react-components"; +import { PlayRegular } from "@fluentui/react-icons"; +import { VMGroup } from "../api/ServerApi"; +import { VMInfo, VMState } from "../api/VMApi"; + +export function GroupVMAction(p: { + group: VMGroup; + state?: VMState; + vm?: VMInfo; +}): React.ReactElement { + return ( + + } + tooltip="Start" + group={p.group} + vm={p.vm} + allowedStates={["Shutdown", "Shutoff", "Crashed"]} + currState={p.state} + needConfirm={false} + action={async () => {}} + /> + + ); +} + +function GroupVMButton(p: { + enabled: boolean; + icon: React.ReactElement; + action: (group: VMGroup, vm?: VMGroup) => Promise; + tooltip: string; + currState?: VMState; + allowedStates: VMState[]; + group: VMGroup; + vm?: VMInfo; + needConfirm: boolean; +}): React.ReactElement { + const process = () => {}; + + const allowed = + !p.vm || (p.currState && p.allowedStates.includes(p.currState)); + + if (!p.enabled) return <>; + + return ( + +