import { useState } from "react"; import { useConsole } from "../context"; import { Card, Bar, DataListRaw } from "../components/ui"; import { shortId } from "../api/client"; export default function EnvSection() { const ctx = useConsole(); const [name, setName] = useState(""); const [branch, setBranch] = useState(""); const [executor, setExecutor] = useState(""); return ( 环境 (选、建、管:当前项目的基准检出)}> {ctx.envCount} {ctx.envs.length === 0 ?
先选项目
: ( {ctx.envs.map((e) => (
  • {e.name}({shortId(e.id)}) / 分支 {e.branch || "默认分支"} / 执行器 {e.executor || "不限"} / 状态 {e.status} {e.status === "failed" && e.error_text ? " / 失败原因:" + e.error_text : ""} {e.status === "archived" ? null : }
  • ))}
    )} setName(e.target.value)} /> setBranch(e.target.value)} /> {executor === "cloud-hypervisor" ?
    实验执行器,默认关闭:环境创建白名单同样允许 cloud-hypervisor(后端环境接口 allowlist:local / docker / cloud-hypervisor,不含 cloud);仍需后端有 KVM 宿主上的 CHV worker 才会认领,否则任务排队。前端只传值,不绕过后端白名单。
    : null} {ctx.envMsg}
    ); }