Add groups support (#146)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #146
This commit is contained in:
@ -1,8 +1,13 @@
|
||||
import React from "react";
|
||||
import { GroupApi } from "../api/GroupApi";
|
||||
import { VMGroup } from "../api/ServerApi";
|
||||
import { VMApi, VMInfo } from "../api/VMApi";
|
||||
import { useToast } from "../hooks/providers/ToastProvider";
|
||||
|
||||
export function VMLiveScreenshot(p: { vm: VMInfo }): React.ReactElement {
|
||||
export function VMLiveScreenshot(p: {
|
||||
vm: VMInfo;
|
||||
group?: VMGroup;
|
||||
}): React.ReactElement {
|
||||
const toast = useToast();
|
||||
|
||||
const [screenshotURL, setScreenshotURL] = React.useState<
|
||||
@ -14,7 +19,9 @@ export function VMLiveScreenshot(p: { vm: VMInfo }): React.ReactElement {
|
||||
React.useEffect(() => {
|
||||
const refresh = async () => {
|
||||
try {
|
||||
const screenshot = await VMApi.Screenshot(p.vm);
|
||||
const screenshot = p.group
|
||||
? await GroupApi.ScreenshotVM(p.group, p.vm)
|
||||
: await VMApi.Screenshot(p.vm);
|
||||
const u = URL.createObjectURL(screenshot);
|
||||
setScreenshotURL(u);
|
||||
} catch (e) {
|
||||
|
Reference in New Issue
Block a user