@overlordai/server 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/public/assets/{AccessTokensPage-BNaz9M2D.js → AccessTokensPage-D73_4hLR.js} +1 -1
- package/public/assets/{AdminPage-BK3yXUTo.js → AdminPage-D6pFjGmN.js} +1 -1
- package/public/assets/{ApiReferencePage-B5840y13.js → ApiReferencePage-Cr6xHbdi.js} +1 -1
- package/public/assets/{AuditLogPage-CTyPeBTm.js → AuditLogPage-GREFjQX6.js} +1 -1
- package/public/assets/{BotManage-CfcannzE.js → BotManage-D9kc8BY5.js} +1 -1
- package/public/assets/{CliReferencePage-BkFni7kH.js → CliReferencePage-BIwVJvQK.js} +1 -1
- package/public/assets/{DeveloperManage-qek3ScKE.js → DeveloperManage-TJw3eF8S.js} +1 -1
- package/public/assets/{EditProjectPage-BJ1h9Teb.js → EditProjectPage-DwCS51Mo.js} +1 -1
- package/public/assets/{EmptyState-BPAoLpts.js → EmptyState-B5jMtmkr.js} +1 -1
- package/public/assets/{HomePage-BolSOHNk.js → HomePage-Be7BEt8c.js} +1 -1
- package/public/assets/{LandingPage-Bd51R0zG.js → LandingPage-B-3pUdk_.js} +1 -1
- package/public/assets/{LoginPage-pvTUbSIt.js → LoginPage-Dstlxfad.js} +1 -1
- package/public/assets/{MachineDetailPage-BH-KZK-O.js → MachineDetailPage-C3AAUkBm.js} +1 -1
- package/public/assets/MachineListPage-DYv4UXDO.js +6 -0
- package/public/assets/{NotFoundPage-CEkbHGWM.js → NotFoundPage-CRp_HeR8.js} +1 -1
- package/public/assets/{PipelineEditorPage-C-PHUced.js → PipelineEditorPage-jSzry5nq.js} +1 -1
- package/public/assets/{ProfilePage-9A1i3I4h.js → ProfilePage-BjTXfqR-.js} +1 -1
- package/public/assets/{ProjectDetailPage-DFmRizSR.js → ProjectDetailPage-Dm8phZfW.js} +1 -1
- package/public/assets/{ProjectListPage-Dbj2OlMz.js → ProjectListPage-DxBqxFUe.js} +1 -1
- package/public/assets/{QuickAuth-DRYnjdDV.js → QuickAuth-BGJ9EbFe.js} +1 -1
- package/public/assets/{RemoveMemberConfirmDialog-B1Wfe6qD.js → RemoveMemberConfirmDialog-Dpvy8p31.js} +1 -1
- package/public/assets/{Select-Coph7K6I.js → Select-DobTn2ab.js} +1 -1
- package/public/assets/{SettingsPage-YG6bu8P-.js → SettingsPage-I5qaiH25.js} +1 -1
- package/public/assets/{Skeleton-DTD8fr3E.js → Skeleton-D-ZoNR01.js} +1 -1
- package/public/assets/{TaskDetailPage-DXSxtOVO.js → TaskDetailPage-Lqh5i3TN.js} +1 -1
- package/public/assets/{TaskListPage-t4Dv8BDy.js → TaskListPage-BPHnFmpO.js} +1 -1
- package/public/assets/{TaskStatusBadge-CTYxCsEO.js → TaskStatusBadge-RjE_jGwc.js} +1 -1
- package/public/assets/TokenManage-CQqbOJcD.js +1 -0
- package/public/assets/{TotpSetupPage--DR3X8Ic.js → TotpSetupPage-BNuui0Vg.js} +1 -1
- package/public/assets/{WorkerSetupGuidePage-HEUz68fc.js → WorkerSetupGuidePage-jvt8Z6j1.js} +1 -1
- package/public/assets/{arrow-left-EPKSp1wq.js → arrow-left-R4PVWL3u.js} +1 -1
- package/public/assets/{arrow-right-CW48svkF.js → arrow-right-t-l7E3bV.js} +1 -1
- package/public/assets/{bot-BlE3obwB.js → bot-KOWEPW_6.js} +1 -1
- package/public/assets/{copy-CljRO0MZ.js → copy-fRb9wi57.js} +1 -1
- package/public/assets/{external-link-BOPlNQYO.js → external-link-CB9tx4V-.js} +1 -1
- package/public/assets/index-BwfyjudA.css +1 -0
- package/public/assets/{index-CluWJF_4.js → index-bdjBPTjT.js} +3 -3
- package/public/assets/{key-OMhi1y8r.js → key-BZHp4zSH.js} +1 -1
- package/public/assets/{loader-circle-DEx7RlNw.js → loader-circle-DyfiwA3n.js} +1 -1
- package/public/assets/{pencil-BgpOCLzp.js → pencil-DgTA8lMR.js} +1 -1
- package/public/assets/{plus-DMsT-oJS.js → plus-CS3VSUw-.js} +1 -1
- package/public/assets/{rotate-ccw-D8Wc0cH7.js → rotate-ccw-e6dKDLQp.js} +1 -1
- package/public/assets/{scroll-text-B0kPxzfj.js → scroll-text-DvCW6HuW.js} +1 -1
- package/public/assets/{settings-D3F-dJby.js → settings-DDZ75kV_.js} +1 -1
- package/public/assets/{task.store-bgSaXfA1.js → task.store-CDfQR9zk.js} +1 -1
- package/public/assets/{trash-2-CpNRRu-J.js → trash-2-Z9HHaMPB.js} +1 -1
- package/public/assets/{users-D0C2zcU6.js → users-yEz_0v7L.js} +1 -1
- package/public/index.html +2 -2
- package/public/assets/MachineListPage-DKuE_lOr.js +0 -6
- package/public/assets/TokenManage-CUQ3wwfj.js +0 -1
- package/public/assets/index-DeEHxWoz.css +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@overlordai/server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"@nestjs/platform-express": "^10.4.0",
|
|
20
20
|
"@nestjs/platform-ws": "^10.4.0",
|
|
21
21
|
"@nestjs/websockets": "^10.4.0",
|
|
22
|
+
"@overlordai/protocol": "1.0.17",
|
|
22
23
|
"bcrypt": "^6.0.0",
|
|
23
24
|
"better-sqlite3": "^11.0.0",
|
|
24
25
|
"bullmq": "^5.0.0",
|
|
@@ -30,8 +31,7 @@
|
|
|
30
31
|
"pino": "^9.0.0",
|
|
31
32
|
"reflect-metadata": "^0.2.2",
|
|
32
33
|
"rxjs": "^7.8.0",
|
|
33
|
-
"uuid": "^11.1.0"
|
|
34
|
-
"@overlordai/protocol": "1.0.15"
|
|
34
|
+
"uuid": "^11.1.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@nestjs/testing": "^10.4.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as _,r as o,j as e,f as j,l as w,h as C,t as y,o as T,K as S}from"./index-
|
|
1
|
+
import{a as _,r as o,j as e,f as j,l as w,h as C,t as y,o as T,K as S}from"./index-bdjBPTjT.js";import{S as D}from"./Select-DobTn2ab.js";import{E as A}from"./EmptyState-B5jMtmkr.js";import{T as E}from"./Skeleton-D-ZoNR01.js";import{P as L}from"./plus-CS3VSUw-.js";import{C as R}from"./copy-fRb9wi57.js";import{T as M}from"./trash-2-Z9HHaMPB.js";function O({isOpen:t,onClose:d,onCreated:l}){const{t:s}=_(),[n,i]=o.useState(""),[x,m]=o.useState("never"),[u,v]=o.useState(!1),[p,c]=o.useState(""),b=[{value:"never",label:s("access_tokens.no_expiry")},{value:"30",label:s("access_tokens.days_30")},{value:"90",label:s("access_tokens.days_90")},{value:"365",label:s("access_tokens.days_365")}],h=()=>{i(""),m("never"),c(""),d()},f=async()=>{if(c(""),!n.trim()){c(s("access_tokens.token_label_required"));return}try{v(!0);const a=await j.post("web/profile/tokens",{json:{label:n.trim(),...x!=="never"&&{expiresAt:new Date(Date.now()+parseInt(x,10)*864e5).toISOString()}}}).json();i(""),m("never"),l({token:a.token,name:a.name})}catch(a){const k=a instanceof Error?a.message:s("access_tokens.failed_to_create_token");c(k)}finally{v(!1)}};return t?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-40 bg-[var(--modal-backdrop)]",onClick:h}),e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] shadow-lg",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"border-b border-[var(--border)] px-5 py-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--text-primary)]",children:s("access_tokens.create_personal_access_token")}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:s("access_tokens.tokens_authenticate_desc")})]}),e.jsxs("div",{className:"space-y-4 px-5 py-5",children:[p&&e.jsx("div",{className:"rounded-[4px] border border-[var(--destructive)]/30 bg-[var(--destructive)]/5 px-3 py-2 text-xs text-[var(--destructive)]",children:p}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("access_tokens.token_name")}),e.jsx("input",{type:"text",placeholder:s("access_tokens.token_name_placeholder"),value:n,onChange:a=>i(a.target.value),onKeyDown:a=>{a.key==="Enter"&&f()},className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("access_tokens.expires")}),e.jsx(D,{value:x,onChange:m,options:b})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[e.jsx("button",{onClick:h,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:s("common.cancel")}),e.jsx("button",{onClick:f,disabled:u,className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-medium text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:s(u?"common.creating":"access_tokens.create_token")})]})]})})]}):null}function P({isOpen:t,onClose:d,onConfirm:l,tokenLabel:s,isLoading:n}){const{t:i}=_();return e.jsx(w,{isOpen:t,onClose:d,onConfirm:l,title:i("access_tokens.revoke_token_title"),message:i("access_tokens.revoke_confirm",{name:s}),confirmLabel:i("access_tokens.revoke"),confirmVariant:"danger",isLoading:n})}function $(t){const d=Date.now()-new Date(t).getTime(),l=Math.floor(d/1e3);if(l<60)return`${l}s ago`;const s=Math.floor(l/60);if(s<60)return`${s}m ago`;const n=Math.floor(s/60);return n<24?`${n} hours ago`:`${Math.floor(n/24)}d ago`}function V(){const{t}=_(),[d,l]=o.useState([]),[s,n]=o.useState(!0),[i,x]=o.useState(!1),[m,u]=o.useState(null),[v,p]=o.useState(!1),[c,b]=o.useState(null),[h,f]=o.useState(null);C(o.useMemo(()=>e.jsxs("button",{onClick:()=>x(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black transition-opacity hover:opacity-90",children:[e.jsx(L,{className:"h-3.5 w-3.5"}),t("access_tokens.create_token")]}),[t]));const a=o.useCallback(async()=>{try{n(!0);const r=await j.get("web/profile/tokens").json();l(r)}catch{y.error(t("access_tokens.failed_to_load_tokens"))}finally{n(!1)}},[t]);o.useEffect(()=>{a()},[a]);const k=r=>{x(!1),u(r.token),p(!1),a()},g=async()=>{if(m)try{await navigator.clipboard.writeText(m),p(!0),setTimeout(()=>p(!1),2e3)}catch{}},N=async()=>{if(c)try{f(c.id),await j.post(`web/profile/tokens/${c.id}/revoke`),y.success(t("access_tokens.token_revoked")),b(null),a()}catch{y.error(t("access_tokens.failed_to_revoke_token"))}finally{f(null)}};return e.jsxs("div",{className:"mx-auto max-w-4xl px-6 py-8 font-mono lowercase",children:[m&&e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--warning)] bg-[var(--bg-card)] px-4 py-3",children:[e.jsx("p",{className:"mb-2 text-xs font-medium text-[var(--warning)]",children:t("access_tokens.copy_token_warning")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 break-all rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 text-xs text-[var(--text-primary)]",children:m}),e.jsxs("button",{onClick:g,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:[v?e.jsx(T,{className:"h-3.5 w-3.5 text-[var(--accent)]"}):e.jsx(R,{className:"h-3.5 w-3.5"}),t(v?"common.copied":"common.copy")]})]}),e.jsx("div",{className:"mt-2 flex justify-end",children:e.jsx("button",{onClick:()=>u(null),className:"text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)]",children:t("common.dismiss")})})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:s?e.jsx("div",{className:"p-4",children:e.jsx(E,{rows:3})}):d.length===0?e.jsx(A,{icon:S,title:t("access_tokens.no_tokens"),description:t("access_tokens.create_token_desc"),actionLabel:t("access_tokens.create_token"),onAction:()=>x(!0)}):e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"px-4 py-2.5 font-normal",children:t("common.name")}),e.jsx("th",{className:"px-4 py-2.5 font-normal",children:t("common.status")}),e.jsx("th",{className:"px-4 py-2.5 font-normal",children:t("access_tokens.created")}),e.jsx("th",{className:"px-4 py-2.5 font-normal",children:t("access_tokens.last_used")}),e.jsx("th",{className:"px-4 py-2.5 font-normal",children:t("access_tokens.expires")}),e.jsx("th",{className:"px-4 py-2.5 font-normal text-right",children:t("common.actions")})]})}),e.jsx("tbody",{children:d.map(r=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] last:border-b-0 hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"px-4 py-3 text-[var(--text-primary)]",children:r.label}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:r.status==="active"?"text-green-400":"text-[var(--text-muted)]",children:r.status})}),e.jsx("td",{className:"px-4 py-3 text-[var(--text-secondary)]",children:new Date(r.createdAt).toLocaleDateString()}),e.jsx("td",{className:"px-4 py-3 text-[var(--text-secondary)]",children:r.lastUsedAt?$(r.lastUsedAt):t("common.never")}),e.jsx("td",{className:"px-4 py-3 text-[var(--text-secondary)]",children:r.expiresAt?new Date(r.expiresAt).toLocaleDateString():t("common.never")}),e.jsx("td",{className:"px-4 py-3 text-right",children:r.status==="active"&&e.jsxs("button",{onClick:()=>b(r),disabled:h===r.id,className:"inline-flex items-center gap-1 text-xs text-[var(--destructive)] hover:underline disabled:opacity-50",children:[e.jsx(M,{className:"h-3 w-3"}),t("access_tokens.revoke")]})})]},r.id))})]})}),e.jsx(O,{isOpen:i,onClose:()=>x(!1),onCreated:k}),e.jsx(P,{isOpen:!!c,onClose:()=>b(null),onConfirm:N,tokenLabel:(c==null?void 0:c.label)??"",isLoading:h!==null})]})}export{V as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,e as l,d as c,K as p,r as b,j as e,w as x,O as v}from"./index-
|
|
1
|
+
import{a as d,e as l,d as c,K as p,r as b,j as e,w as x,O as v}from"./index-bdjBPTjT.js";import{U as f}from"./users-yEz_0v7L.js";import{B as u}from"./bot-KOWEPW_6.js";import{S as g}from"./scroll-text-DvCW6HuW.js";import{S as h}from"./settings-DDZ75kV_.js";function S(){const{t:a}=d(),t=l(),o=c(),r=[{to:"/admin/developers",label:a("admin.tab_developers"),icon:f},{to:"/admin/bots",label:a("admin.tab_bots"),icon:u},{to:"/admin/tokens",label:a("admin.tab_tokens"),icon:p},{to:"/admin/audit-logs",label:a("admin.tab_audit_logs"),icon:g},{to:"/admin/settings",label:a("admin.tab_settings"),icon:h}];return b.useEffect(()=>{(t.pathname==="/admin"||t.pathname==="/admin/")&&o("/admin/developers",{replace:!0})},[t.pathname,o]),e.jsxs("div",{children:[e.jsx("div",{className:"mb-6 flex flex-nowrap gap-2 overflow-x-auto border-b border-[var(--border)] no-scrollbar",children:r.map(({to:s,label:n,icon:i})=>e.jsxs(x,{to:s,className:({isActive:m})=>`flex shrink-0 items-center gap-2 border-b-2 px-4 py-2 text-sm transition-colors ${m?"border-[var(--accent)] text-[var(--accent)]":"border-transparent text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:[e.jsx(i,{size:16}),n]},s))}),e.jsx(v,{})]})}export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d,a as n,h as p,r as o,j as t,K as c}from"./index-CluWJF_4.js";import{Q as h}from"./QuickAuth-DRYnjdDV.js";import"./copy-CljRO0MZ.js";const l={GET:"text-green-400",POST:"text-blue-400",PUT:"text-yellow-400",DELETE:"text-red-400"},m=[{title:"authentication",prefix:"/api/auth",endpoints:[{method:"POST",path:"/login",description:"authenticate with username + password (optional totpCode)",auth:"none",body:'{ "username": "string", "password": "string", "totpCode?": "string" }',response:'{ "accessToken": "string", "refreshToken": "string" }'},{method:"POST",path:"/refresh",description:"refresh access token (rotates refresh token)",auth:"none",body:'{ "refreshToken": "string" }',response:'{ "accessToken": "string", "refreshToken": "string" }'},{method:"POST",path:"/logout",description:"invalidate refresh token",auth:"jwt",body:'{ "refreshToken": "string" }'}]},{title:"tasks",prefix:"/api/web/tasks",endpoints:[{method:"GET",path:"",description:"list tasks with optional filters",auth:"jwt",response:'[ { "id": 1, "description": "...", "status": "RUNNING", ... } ]'},{method:"POST",path:"",description:"create a new task",auth:"jwt",body:'{ "projectKey": "string", "description": "string", "machineId?": "string" }'},{method:"GET",path:"/:id",description:"get task details",auth:"jwt"},{method:"POST",path:"/:id/cancel",description:"cancel a running task",auth:"jwt"},{method:"POST",path:"/:id/retry",description:"retry a failed task",auth:"jwt"},{method:"POST",path:"/:id/confirm-stage",description:"confirm/choose/input for suspended stage",auth:"jwt",body:'{ "stageIndex": "number", "result": "string" }'},{method:"POST",path:"/:id/pty-token",description:"get pty websocket token",auth:"jwt"}]},{title:"machines",prefix:"/api/web/machines",endpoints:[{method:"GET",path:"",description:"list all machines",auth:"jwt"},{method:"GET",path:"/:id",description:"get machine details",auth:"jwt"},{method:"GET",path:"/:id/tasks",description:"list tasks assigned to a machine",auth:"jwt"},{method:"POST",path:"/:id/drain",description:"start draining a machine",auth:"jwt"},{method:"POST",path:"/:id/undrain",description:"cancel machine drain",auth:"jwt"}]},{title:"projects",prefix:"/api/web/projects",endpoints:[{method:"GET",path:"",description:"list all projects",auth:"jwt"},{method:"GET",path:"/:key",description:"get project details",auth:"jwt"}]},{title:"profile",prefix:"/api/web/profile",endpoints:[{method:"GET",path:"",description:"get current user profile",auth:"jwt"},{method:"PUT",path:"",description:"update profile (gitName, gitEmail)",auth:"jwt",body:'{ "gitName?": "string", "gitEmail?": "string" }'},{method:"PUT",path:"/password",description:"change password",auth:"jwt",body:'{ "currentPassword": "string", "newPassword": "string" }'},{method:"POST",path:"/totp/setup",description:"initialize totp setup",auth:"jwt"},{method:"POST",path:"/totp/verify",description:"verify totp setup code",auth:"jwt",body:'{ "code": "string" }'},{method:"GET",path:"/tokens",description:"list personal access tokens",auth:"jwt"},{method:"POST",path:"/tokens",description:"create a personal access token",auth:"jwt",body:'{ "label": "string", "expiresAt?": "string" }'},{method:"POST",path:"/tokens/:id/revoke",description:"revoke a token",auth:"jwt"}]},{title:"workspaces & tunnels",prefix:"/api/web",endpoints:[{method:"GET",path:"/workspaces/:taskId",description:"get workspace for a task",auth:"jwt"},{method:"POST",path:"/workspace-tunnel/:taskId/start",description:"start a cursor remote tunnel",auth:"jwt"},{method:"POST",path:"/workspace-tunnel/:taskId/stop",description:"stop a running tunnel",auth:"jwt"},{method:"GET",path:"/workspace-tunnel/:taskId/status",description:"get tunnel status",auth:"jwt"}]},{title:"dashboard",prefix:"/api/web/dashboard",endpoints:[{method:"GET",path:"/stats",description:"get dashboard statistics",auth:"jwt"},{method:"GET",path:"/recent-tasks",description:"get recent tasks for dashboard",auth:"jwt"},{method:"GET",path:"/recent-activity",description:"get recent activity feed",auth:"jwt"}]},{title:"notifications",prefix:"/api/web/notifications",endpoints:[{method:"GET",path:"",description:"list notifications with cursor pagination",auth:"jwt"},{method:"POST",path:"/:id/read",description:"mark a notification as read",auth:"jwt"},{method:"POST",path:"/read-all",description:"mark all notifications as read",auth:"jwt"}]},{title:"search",prefix:"/api/web",endpoints:[{method:"GET",path:"/search?q=query",description:"global search across tasks, machines, projects",auth:"jwt"}]},{title:"admin — developers",prefix:"/api/admin/developers",endpoints:[{method:"GET",path:"",description:"list all developers",auth:"jwt"},{method:"POST",path:"",description:"create a developer",auth:"jwt",body:'{ "name": "string", "password": "string", "role": "string", "gitName": "string", "gitEmail": "string" }'},{method:"PUT",path:"/:id",description:"update developer",auth:"jwt"},{method:"PUT",path:"/:id/reset-totp",description:"reset developer totp",auth:"jwt"}]},{title:"admin — projects",prefix:"/api/admin/projects",endpoints:[{method:"GET",path:"",description:"list all projects",auth:"jwt"},{method:"POST",path:"",description:"create a project",auth:"jwt"},{method:"PUT",path:"/:key",description:"update project (including pipeline)",auth:"jwt"},{method:"DELETE",path:"/:key",description:"delete a project",auth:"jwt"},{method:"GET",path:"/:key/members",description:"get project members",auth:"jwt"},{method:"POST",path:"/:key/members",description:"add project member",auth:"jwt"},{method:"DELETE",path:"/:key/members?developerId=N",description:"remove project member",auth:"jwt"}]},{title:"admin — worker tokens",prefix:"/api/admin/worker-tokens",endpoints:[{method:"GET",path:"",description:"list all worker enrollment tokens",auth:"jwt"},{method:"POST",path:"",description:"generate a new worker token",auth:"jwt"},{method:"POST",path:"/:id/revoke",description:"revoke a worker token",auth:"jwt"},{method:"GET",path:"/:id/status",description:"get token status and linked machine",auth:"jwt"}]},{title:"admin — machines",prefix:"/api/admin/machines",endpoints:[{method:"GET",path:"",description:"list all machines (admin)",auth:"jwt"},{method:"PUT",path:"/:id",description:"update machine status",auth:"jwt",body:'{ "status?": "string" }'}]},{title:"admin — bots",prefix:"/api/admin/bots",endpoints:[{method:"GET",path:"",description:"list bot instances",auth:"jwt"},{method:"POST",path:"",description:"create a bot instance",auth:"jwt"},{method:"GET",path:"/:id/bindings",description:"get chat bindings for a bot",auth:"jwt"},{method:"POST",path:"/:id/bindings",description:"create a chat binding",auth:"jwt"},{method:"DELETE",path:"/:id/bindings",description:"delete a chat binding",auth:"jwt"}]},{title:"admin — audit & settings",prefix:"/api/admin",endpoints:[{method:"GET",path:"/audit-logs",description:"query audit log with filters",auth:"jwt"},{method:"GET",path:"/settings",description:"get all system settings",auth:"jwt"},{method:"PUT",path:"/settings",description:"update system settings",auth:"jwt"}]},{title:"websocket",prefix:"",endpoints:[{method:"GET",path:"WS /ws/pty/:taskId",description:'pty terminal websocket — first obtain a channel token via POST /api/web/tasks/:taskId/pty-token, then send an auth frame after connection: { type: "auth", token: "<jwt>", channelToken: "<channel-token>" }',auth:"jwt"},{method:"GET",path:"WS /api/workers/pty/:taskId",description:'worker pty websocket — auth via frame: { type: "auth", workerJwt: "<worker-jwt>", channelToken: "<channel-token>" }',auth:"worker-token"}]}];function x({ep:e,prefix:s}){const[a,i]=o.useState(!1),{t:r}=n();return t.jsxs("div",{className:"border-b border-[var(--border-row)] last:border-b-0",children:[t.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors hover:bg-[var(--bg-input)]",onClick:()=>i(!a),children:[t.jsx("span",{className:`w-12 shrink-0 text-xs font-bold ${l[e.method]}`,children:e.method}),t.jsxs("code",{className:"flex-1 text-xs text-[var(--text-primary)] truncate",children:[s,e.path]}),t.jsxs("span",{className:"text-xs text-[var(--text-muted)] hidden sm:inline truncate max-w-[200px]",children:["// ",e.description]})]}),a&&t.jsxs("div",{className:"border-t border-[var(--border-row)] bg-[var(--bg-primary)] px-4 py-3 space-y-2",children:[t.jsxs("p",{className:"text-xs text-[var(--text-secondary)]",children:["// ",e.description]}),t.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[t.jsx("span",{className:"text-[var(--text-muted)]",children:"auth:"}),t.jsx("span",{className:e.auth==="none"?"text-[var(--text-muted)]":"text-[var(--accent)]",children:e.auth})]}),e.body&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:r("docs.request_body")}),t.jsx("pre",{className:"rounded-[4px] bg-[var(--bg-card)] px-3 py-2 text-xs text-[var(--text-secondary)] overflow-x-auto",children:e.body})]}),e.response&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:r("docs.response")}),t.jsx("pre",{className:"rounded-[4px] bg-[var(--bg-card)] px-3 py-2 text-xs text-[var(--text-secondary)] overflow-x-auto",children:e.response})]})]})]})}function k(){const e=d(),{t:s}=n();return p(o.useMemo(()=>t.jsxs("button",{onClick:()=>e("/access-tokens"),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[t.jsx(c,{className:"h-3.5 w-3.5"}),s("access_tokens.create_token")]}),[e,s])),t.jsxs("div",{className:"mx-auto max-w-4xl px-6 py-8 font-mono lowercase",children:[t.jsx("div",{className:"mb-8",children:t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("docs.api_base_url_desc",{url:"http://localhost:9000"})})}),t.jsx(h,{mode:"api"}),t.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-2",children:[t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("docs.authentication")}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-[var(--accent)]",children:"jwt"}),t.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:["obtained via /api/auth/login — pass as ",t.jsx("code",{children:"authorization: bearer <token>"})]})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-[var(--accent)]",children:"pat"}),t.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:"personal access token — same header format, for cli/api usage"})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-yellow-400",children:"worker-token"}),t.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:"enrollment token for worker registration — used during initial handshake"})]})]}),t.jsx("div",{className:"space-y-6",children:m.map(a=>t.jsxs("div",{children:[t.jsxs("h2",{className:"mb-2 text-sm text-[var(--accent)]",children:["> ",a.title]}),t.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:a.endpoints.map((i,r)=>t.jsx(x,{ep:i,prefix:a.prefix},`${i.method}-${i.path}-${r}`))})]},a.title))})]})}export{k as default};
|
|
1
|
+
import{d,a as n,h as p,r as o,j as t,K as c}from"./index-bdjBPTjT.js";import{Q as h}from"./QuickAuth-BGJ9EbFe.js";import"./copy-fRb9wi57.js";const l={GET:"text-green-400",POST:"text-blue-400",PUT:"text-yellow-400",DELETE:"text-red-400"},m=[{title:"authentication",prefix:"/api/auth",endpoints:[{method:"POST",path:"/login",description:"authenticate with username + password (optional totpCode)",auth:"none",body:'{ "username": "string", "password": "string", "totpCode?": "string" }',response:'{ "accessToken": "string", "refreshToken": "string" }'},{method:"POST",path:"/refresh",description:"refresh access token (rotates refresh token)",auth:"none",body:'{ "refreshToken": "string" }',response:'{ "accessToken": "string", "refreshToken": "string" }'},{method:"POST",path:"/logout",description:"invalidate refresh token",auth:"jwt",body:'{ "refreshToken": "string" }'}]},{title:"tasks",prefix:"/api/web/tasks",endpoints:[{method:"GET",path:"",description:"list tasks with optional filters",auth:"jwt",response:'[ { "id": 1, "description": "...", "status": "RUNNING", ... } ]'},{method:"POST",path:"",description:"create a new task",auth:"jwt",body:'{ "projectKey": "string", "description": "string", "machineId?": "string" }'},{method:"GET",path:"/:id",description:"get task details",auth:"jwt"},{method:"POST",path:"/:id/cancel",description:"cancel a running task",auth:"jwt"},{method:"POST",path:"/:id/retry",description:"retry a failed task",auth:"jwt"},{method:"POST",path:"/:id/confirm-stage",description:"confirm/choose/input for suspended stage",auth:"jwt",body:'{ "stageIndex": "number", "result": "string" }'},{method:"POST",path:"/:id/pty-token",description:"get pty websocket token",auth:"jwt"}]},{title:"machines",prefix:"/api/web/machines",endpoints:[{method:"GET",path:"",description:"list all machines",auth:"jwt"},{method:"GET",path:"/:id",description:"get machine details",auth:"jwt"},{method:"GET",path:"/:id/tasks",description:"list tasks assigned to a machine",auth:"jwt"},{method:"POST",path:"/:id/drain",description:"start draining a machine",auth:"jwt"},{method:"POST",path:"/:id/undrain",description:"cancel machine drain",auth:"jwt"}]},{title:"projects",prefix:"/api/web/projects",endpoints:[{method:"GET",path:"",description:"list all projects",auth:"jwt"},{method:"GET",path:"/:key",description:"get project details",auth:"jwt"}]},{title:"profile",prefix:"/api/web/profile",endpoints:[{method:"GET",path:"",description:"get current user profile",auth:"jwt"},{method:"PUT",path:"",description:"update profile (gitName, gitEmail)",auth:"jwt",body:'{ "gitName?": "string", "gitEmail?": "string" }'},{method:"PUT",path:"/password",description:"change password",auth:"jwt",body:'{ "currentPassword": "string", "newPassword": "string" }'},{method:"POST",path:"/totp/setup",description:"initialize totp setup",auth:"jwt"},{method:"POST",path:"/totp/verify",description:"verify totp setup code",auth:"jwt",body:'{ "code": "string" }'},{method:"GET",path:"/tokens",description:"list personal access tokens",auth:"jwt"},{method:"POST",path:"/tokens",description:"create a personal access token",auth:"jwt",body:'{ "label": "string", "expiresAt?": "string" }'},{method:"POST",path:"/tokens/:id/revoke",description:"revoke a token",auth:"jwt"}]},{title:"workspaces & tunnels",prefix:"/api/web",endpoints:[{method:"GET",path:"/workspaces/:taskId",description:"get workspace for a task",auth:"jwt"},{method:"POST",path:"/workspace-tunnel/:taskId/start",description:"start a cursor remote tunnel",auth:"jwt"},{method:"POST",path:"/workspace-tunnel/:taskId/stop",description:"stop a running tunnel",auth:"jwt"},{method:"GET",path:"/workspace-tunnel/:taskId/status",description:"get tunnel status",auth:"jwt"}]},{title:"dashboard",prefix:"/api/web/dashboard",endpoints:[{method:"GET",path:"/stats",description:"get dashboard statistics",auth:"jwt"},{method:"GET",path:"/recent-tasks",description:"get recent tasks for dashboard",auth:"jwt"},{method:"GET",path:"/recent-activity",description:"get recent activity feed",auth:"jwt"}]},{title:"notifications",prefix:"/api/web/notifications",endpoints:[{method:"GET",path:"",description:"list notifications with cursor pagination",auth:"jwt"},{method:"POST",path:"/:id/read",description:"mark a notification as read",auth:"jwt"},{method:"POST",path:"/read-all",description:"mark all notifications as read",auth:"jwt"}]},{title:"search",prefix:"/api/web",endpoints:[{method:"GET",path:"/search?q=query",description:"global search across tasks, machines, projects",auth:"jwt"}]},{title:"admin — developers",prefix:"/api/admin/developers",endpoints:[{method:"GET",path:"",description:"list all developers",auth:"jwt"},{method:"POST",path:"",description:"create a developer",auth:"jwt",body:'{ "name": "string", "password": "string", "role": "string", "gitName": "string", "gitEmail": "string" }'},{method:"PUT",path:"/:id",description:"update developer",auth:"jwt"},{method:"PUT",path:"/:id/reset-totp",description:"reset developer totp",auth:"jwt"}]},{title:"admin — projects",prefix:"/api/admin/projects",endpoints:[{method:"GET",path:"",description:"list all projects",auth:"jwt"},{method:"POST",path:"",description:"create a project",auth:"jwt"},{method:"PUT",path:"/:key",description:"update project (including pipeline)",auth:"jwt"},{method:"DELETE",path:"/:key",description:"delete a project",auth:"jwt"},{method:"GET",path:"/:key/members",description:"get project members",auth:"jwt"},{method:"POST",path:"/:key/members",description:"add project member",auth:"jwt"},{method:"DELETE",path:"/:key/members?developerId=N",description:"remove project member",auth:"jwt"}]},{title:"admin — worker tokens",prefix:"/api/admin/worker-tokens",endpoints:[{method:"GET",path:"",description:"list all worker enrollment tokens",auth:"jwt"},{method:"POST",path:"",description:"generate a new worker token",auth:"jwt"},{method:"POST",path:"/:id/revoke",description:"revoke a worker token",auth:"jwt"},{method:"GET",path:"/:id/status",description:"get token status and linked machine",auth:"jwt"}]},{title:"admin — machines",prefix:"/api/admin/machines",endpoints:[{method:"GET",path:"",description:"list all machines (admin)",auth:"jwt"},{method:"PUT",path:"/:id",description:"update machine status",auth:"jwt",body:'{ "status?": "string" }'}]},{title:"admin — bots",prefix:"/api/admin/bots",endpoints:[{method:"GET",path:"",description:"list bot instances",auth:"jwt"},{method:"POST",path:"",description:"create a bot instance",auth:"jwt"},{method:"GET",path:"/:id/bindings",description:"get chat bindings for a bot",auth:"jwt"},{method:"POST",path:"/:id/bindings",description:"create a chat binding",auth:"jwt"},{method:"DELETE",path:"/:id/bindings",description:"delete a chat binding",auth:"jwt"}]},{title:"admin — audit & settings",prefix:"/api/admin",endpoints:[{method:"GET",path:"/audit-logs",description:"query audit log with filters",auth:"jwt"},{method:"GET",path:"/settings",description:"get all system settings",auth:"jwt"},{method:"PUT",path:"/settings",description:"update system settings",auth:"jwt"}]},{title:"websocket",prefix:"",endpoints:[{method:"GET",path:"WS /ws/pty/:taskId",description:'pty terminal websocket — first obtain a channel token via POST /api/web/tasks/:taskId/pty-token, then send an auth frame after connection: { type: "auth", token: "<jwt>", channelToken: "<channel-token>" }',auth:"jwt"},{method:"GET",path:"WS /api/workers/pty/:taskId",description:'worker pty websocket — auth via frame: { type: "auth", workerJwt: "<worker-jwt>", channelToken: "<channel-token>" }',auth:"worker-token"}]}];function x({ep:e,prefix:s}){const[a,i]=o.useState(!1),{t:r}=n();return t.jsxs("div",{className:"border-b border-[var(--border-row)] last:border-b-0",children:[t.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors hover:bg-[var(--bg-input)]",onClick:()=>i(!a),children:[t.jsx("span",{className:`w-12 shrink-0 text-xs font-bold ${l[e.method]}`,children:e.method}),t.jsxs("code",{className:"flex-1 text-xs text-[var(--text-primary)] truncate",children:[s,e.path]}),t.jsxs("span",{className:"text-xs text-[var(--text-muted)] hidden sm:inline truncate max-w-[200px]",children:["// ",e.description]})]}),a&&t.jsxs("div",{className:"border-t border-[var(--border-row)] bg-[var(--bg-primary)] px-4 py-3 space-y-2",children:[t.jsxs("p",{className:"text-xs text-[var(--text-secondary)]",children:["// ",e.description]}),t.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[t.jsx("span",{className:"text-[var(--text-muted)]",children:"auth:"}),t.jsx("span",{className:e.auth==="none"?"text-[var(--text-muted)]":"text-[var(--accent)]",children:e.auth})]}),e.body&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:r("docs.request_body")}),t.jsx("pre",{className:"rounded-[4px] bg-[var(--bg-card)] px-3 py-2 text-xs text-[var(--text-secondary)] overflow-x-auto",children:e.body})]}),e.response&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:r("docs.response")}),t.jsx("pre",{className:"rounded-[4px] bg-[var(--bg-card)] px-3 py-2 text-xs text-[var(--text-secondary)] overflow-x-auto",children:e.response})]})]})]})}function k(){const e=d(),{t:s}=n();return p(o.useMemo(()=>t.jsxs("button",{onClick:()=>e("/access-tokens"),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[t.jsx(c,{className:"h-3.5 w-3.5"}),s("access_tokens.create_token")]}),[e,s])),t.jsxs("div",{className:"mx-auto max-w-4xl px-6 py-8 font-mono lowercase",children:[t.jsx("div",{className:"mb-8",children:t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("docs.api_base_url_desc",{url:"http://localhost:9000"})})}),t.jsx(h,{mode:"api"}),t.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-2",children:[t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("docs.authentication")}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-[var(--accent)]",children:"jwt"}),t.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:["obtained via /api/auth/login — pass as ",t.jsx("code",{children:"authorization: bearer <token>"})]})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-[var(--accent)]",children:"pat"}),t.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:"personal access token — same header format, for cli/api usage"})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-yellow-400",children:"worker-token"}),t.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:"enrollment token for worker registration — used during initial handshake"})]})]}),t.jsx("div",{className:"space-y-6",children:m.map(a=>t.jsxs("div",{children:[t.jsxs("h2",{className:"mb-2 text-sm text-[var(--accent)]",children:["> ",a.title]}),t.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:a.endpoints.map((i,r)=>t.jsx(x,{ep:i,prefix:a.prefix},`${i.method}-${i.path}-${r}`))})]},a.title))})]})}export{k as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as h,a as S,r,f as k,j as e,i as L}from"./index-
|
|
1
|
+
import{c as h,a as S,r,f as k,j as e,i as L}from"./index-bdjBPTjT.js";import{S as E}from"./Select-DobTn2ab.js";import{E as T}from"./EmptyState-B5jMtmkr.js";import{T as F}from"./Skeleton-D-ZoNR01.js";import{S as A}from"./scroll-text-DvCW6HuW.js";/**
|
|
2
2
|
* @license lucide-react v0.469.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as M,a as B,r as a,j as e,X as I,f as _,l as z,t as K}from"./index-
|
|
1
|
+
import{c as M,a as B,r as a,j as e,X as I,f as _,l as z,t as K}from"./index-bdjBPTjT.js";import{S as P}from"./Select-DobTn2ab.js";import{T as $}from"./trash-2-Z9HHaMPB.js";import{P as D}from"./plus-CS3VSUw-.js";import{E as q}from"./EmptyState-B5jMtmkr.js";import{T}from"./Skeleton-D-ZoNR01.js";import{B as F}from"./bot-KOWEPW_6.js";import{P as O}from"./pencil-DgTA8lMR.js";/**
|
|
2
2
|
* @license lucide-react v0.469.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as l,a as i,h as m,r as n,j as e,K as p,C as v}from"./index-
|
|
1
|
+
import{d as l,a as i,h as m,r as n,j as e,K as p,C as v}from"./index-bdjBPTjT.js";import{Q as u}from"./QuickAuth-BGJ9EbFe.js";import{C as g}from"./copy-fRb9wi57.js";const x=[{command:"ov login",description:"authenticate with the overlord server using a personal access token",usage:"ov login",example:`ov login
|
|
2
2
|
> Enter server URL: http://localhost:9000
|
|
3
3
|
> Enter PAT: ov_pat_xxxxx
|
|
4
4
|
✓ Logged in as admin`},{command:"ov logout",description:"clear stored credentials",usage:"ov logout"},{command:"ov whoami",description:"show current authenticated user",usage:"ov whoami"},{command:"ov task create",description:"create a new task",usage:"ov task create -d <description> [-p <project>] [--on <machine>]",flags:[{flag:"-d, --description",desc:"task description (required unless -f)"},{flag:"-p, --project",desc:"project key to assign the task to"},{flag:"--on",desc:"target machine id (optional)"},{flag:"-f, --file",desc:"create task from yaml file"}],example:'ov task create -d "fix login bug" -p overlord'},{command:"ov task list",description:"list all tasks with optional filters",usage:"ov task list [--status <status>] [-p <project>]",flags:[{flag:"--status",desc:"filter by status (RUNNING, QUEUED, COMPLETED, FAILED, CANCELLED)"},{flag:"-p, --project",desc:"filter by project key"}]},{command:"ov task show <id>",description:"show detailed information about a task",usage:"ov task show <task_id>"},{command:"ov task cancel <id>",description:"cancel a running or queued task",usage:"ov task cancel <task_id>"},{command:"ov task retry <id>",description:"retry a failed task",usage:"ov task retry <task_id>"},{command:"ov task logs <id>",description:"view task logs (streams via pty if active, fetches historical otherwise)",usage:"ov task logs <task_id> [--json]",flags:[{flag:"--json",desc:"output as json"}]},{command:"ov task confirm <id>",description:"confirm a suspended task stage",usage:"ov task confirm <task_id> --stage <index>",flags:[{flag:"--stage <index>",desc:"stage index to confirm (required)"}]},{command:"ov task choose <id> <option>",description:"submit a choice for a suspended task",usage:"ov task choose <task_id> <option> --stage <index>",flags:[{flag:"--stage <index>",desc:"stage index to respond to (required)"}]},{command:"ov task input <id> <text>",description:"submit text input for a suspended task",usage:"ov task input <task_id> <text> --stage <index>",flags:[{flag:"--stage <index>",desc:"stage index to respond to (required)"}]},{command:"ov attach <id>",description:"connect to a task pty terminal",usage:"ov attach <task_id> [--watch] [--takeover] [--session <id>]",flags:[{flag:"--watch",desc:"read-only observer mode"},{flag:"--takeover",desc:"take over pty control from current user"},{flag:"--session <id>",desc:"session id for takeover"}]},{command:"ov project list",description:"list all projects",usage:"ov project list"},{command:"ov project show <key>",description:"show project details",usage:"ov project show <project_key>"},{command:"ov machine list",description:"list all registered machines",usage:"ov machine list"},{command:"ov machine show <id>",description:"show machine details",usage:"ov machine show <machine_id>"},{command:"ov notifications",description:"view your notifications",usage:"ov notifications [--all] [--json]",flags:[{flag:"--all",desc:"show all notifications (including read)"},{flag:"--json",desc:"output as json"}]},{command:"ov notifications read <id>",description:"mark a notification as read",usage:"ov notifications read <notification_id>"},{command:"ov search <query>",description:"search across tasks, machines, and projects",usage:"ov search <query>"},{command:"ov config set <key> <value>",description:"set a configuration value",usage:"ov config set <key> <value>",flags:[{flag:"server",desc:"overlord server url"},{flag:"default-project",desc:"default project key"},{flag:"output-format",desc:"output format (table, json)"},{flag:"color",desc:"enable/disable color (true/false)"}]},{command:"ov config get <key>",description:"get a configuration value",usage:"ov config get <key>"},{command:"ov config list",description:"list all configuration values",usage:"ov config list [--json]"}],f=[{command:"overlord install",description:"interactive server installation wizard — checks environment, configures database, creates admin account",usage:"overlord install"},{command:"overlord setup worker",description:"interactive worker setup wizard — configures connection, writes .env, registers service",usage:"overlord setup worker"},{command:"overlord start [component]",description:"start server or worker services (systemd / launchd)",usage:"overlord start [server|worker]"},{command:"overlord stop [component]",description:"stop running processes",usage:"overlord stop [server|worker]"},{command:"overlord status",description:"show process status table (pid, cpu, memory, uptime)",usage:"overlord status"},{command:"overlord logs [component]",description:"view server or worker logs",usage:"overlord logs [server|worker] [--lines <n>]"},{command:"overlord doctor",description:"run system diagnostics",usage:"overlord doctor"},{command:"overlord upgrade",description:"upgrade to latest release with sha256 verification",usage:"overlord upgrade [--version <tag>]"}];function d({text:a}){const[t,o]=n.useState(!1),{t:s}=i();return e.jsx("button",{onClick:async()=>{await navigator.clipboard.writeText(a),o(!0),setTimeout(()=>o(!1),2e3)},className:"rounded-[4px] p-1 text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",title:s("common.copy"),children:t?e.jsx(v,{className:"h-3 w-3 text-[var(--accent)]"}):e.jsx(g,{className:"h-3 w-3"})})}function c({title:a,commands:t}){const{t:o}=i();return e.jsxs("div",{children:[e.jsxs("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:["> ",a]}),e.jsx("div",{className:"space-y-3",children:t.map(s=>e.jsxs("details",{className:"group rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("summary",{className:"flex cursor-pointer items-center justify-between px-4 py-3 hover:bg-[var(--bg-input)] transition-colors",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("code",{className:"text-xs text-[var(--accent)]",children:s.command}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// ",s.description]})]})}),e.jsxs("div",{className:"border-t border-[var(--border)] px-4 py-3 space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)]",children:o("docs.usage")}),e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsx("code",{className:"text-xs text-[var(--text-primary)]",children:s.usage}),e.jsx(d,{text:s.usage})]})]}),s.flags&&s.flags.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)]",children:o("docs.flags")}),e.jsx("div",{className:"space-y-1",children:s.flags.map(r=>e.jsxs("div",{className:"flex items-start gap-3 text-xs",children:[e.jsx("code",{className:"shrink-0 text-[var(--accent)]",children:r.flag}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:r.desc})]},r.flag))})]}),s.example&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)]",children:o("docs.example")}),e.jsx("pre",{className:"rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 text-xs text-[var(--text-secondary)] whitespace-pre-wrap",children:s.example})]})]})]},s.command))})]})}function y(){const a=l(),{t}=i();return m(n.useMemo(()=>e.jsxs("button",{onClick:()=>a("/access-tokens"),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[e.jsx(p,{className:"h-3.5 w-3.5"}),t("access_tokens.create_token")]}),[a,t])),e.jsxs("div",{className:"mx-auto max-w-4xl px-6 py-8 font-mono lowercase",children:[e.jsx("div",{className:"mb-8",children:e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:t("docs.cli_tools_desc",{ov:"ov",overlord:"overlord"})})}),e.jsx(u,{mode:"cli"}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:t("docs.quick_install")}),e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsx("code",{className:"text-xs text-[var(--accent)]",children:"npm install -g @overlordai/developer-cli"}),e.jsx(d,{text:"npm install -g @overlordai/developer-cli"})]})]}),e.jsxs("div",{className:"space-y-8",children:[e.jsx(c,{title:t("docs.developer_cli"),commands:x}),e.jsx(c,{title:t("docs.admin_cli"),commands:f})]})]})}export{y as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as k,a as _,r as s,j as e,X as S,f as w,u as E,i as M}from"./index-
|
|
1
|
+
import{c as k,a as _,r as s,j as e,X as S,f as w,u as E,i as M}from"./index-bdjBPTjT.js";import{S as D}from"./Select-DobTn2ab.js";import{E as O}from"./EmptyState-B5jMtmkr.js";import{T}from"./Skeleton-D-ZoNR01.js";import{P}from"./plus-CS3VSUw-.js";import{U as q}from"./users-yEz_0v7L.js";import{P as $}from"./pencil-DgTA8lMR.js";import{R as F}from"./rotate-ccw-e6dKDLQp.js";/**
|
|
2
2
|
* @license lucide-react v0.469.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{m as ne,d as oe,a as le,r as a,f as u,j as e,L as ce,t as y}from"./index-
|
|
1
|
+
import{m as ne,d as oe,a as le,r as a,f as u,j as e,L as ce,t as y}from"./index-bdjBPTjT.js";import{G as m,A as d}from"./protocol-C4f2G7mk.js";import{S as W}from"./Select-DobTn2ab.js";import{U as de,A as ie,R as pe}from"./RemoveMemberConfirmDialog-Dpvy8p31.js";import{P as xe}from"./plus-CS3VSUw-.js";function ge(){const{key:o}=ne(),l=oe(),{t:r}=le(),[n,X]=a.useState(null),[N,Q]=a.useState([]),[V,Y]=a.useState(!0),[C,b]=a.useState(!1),[v,w]=a.useState(""),[j,S]=a.useState(""),[_,k]=a.useState(m.GITHUB),[T,M]=a.useState(""),[O,P]=a.useState(d.CLAUDE),[R,A]=a.useState(""),[I,U]=a.useState("50"),[D,E]=a.useState(""),[$,G]=a.useState(""),[L,B]=a.useState(""),[F,J]=a.useState("0"),[g,q]=a.useState(!1),[i,h]=a.useState(""),[Z,z]=a.useState(!1),[c,f]=a.useState(null),[ee,H]=a.useState(!1),p=a.useCallback(async()=>{if(o)try{const[t,x]=await Promise.all([u.get(`web/projects/${o}`).json(),u.get(`admin/projects/${o}/members`).json().catch(()=>[])]);if(X(t),Q(x),w(t.name),S(t.repoUrl),k(t.gitPlatform),M(t.defaultBranch),P(t.agentType),A(t.agentCommand??""),U(String(t.maxTurns)),E(t.workspaceRoot??""),G(t.setupCommands??""),B(t.testCommand??""),J(String(t.ptyOutputFilter??0)),q(t.isDefault),t.pipeline)try{h(JSON.stringify(JSON.parse(t.pipeline),null,2))}catch{h(t.pipeline)}}catch{}finally{Y(!1)}},[o]);a.useEffect(()=>{p()},[p]);async function te(t){if(t.preventDefault(),!n)return;b(!0);let x=null;if(i.trim())try{JSON.parse(i),x=i.trim()}catch{y.error(r("projects.invalid_pipeline_json")),b(!1);return}try{await u.put(`admin/projects/${n.key}`,{json:{name:v,repoUrl:j,defaultBranch:T,gitPlatform:_,agentType:O,agentCommand:R||null,maxTurns:parseInt(I,10)||50,workspaceRoot:D||null,setupCommands:$||null,testCommand:L||null,ptyOutputFilter:parseInt(F,10)||0,pipeline:x}}),y.success(r("projects.project_saved")),l(`/projects/${n.key}`)}catch(K){const se=K instanceof Error?K.message:r("projects.failed_to_save_project");y.error(se)}finally{b(!1)}}function re(){l(`/projects/${o}`)}async function ae(){if(!(!n||!c)){H(!0);try{await u.delete(`admin/projects/${n.key}/members`,{searchParams:{developerId:String(c.developerId)}}),await p()}catch{}finally{H(!1),f(null)}}}return V?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-[var(--border)] border-t-[var(--accent)]"})}):n?e.jsxs("form",{onSubmit:te,className:"mx-auto max-w-6xl px-6 py-8",children:[e.jsxs("div",{className:"mb-2 text-xs text-[var(--text-muted)]",children:[e.jsx("span",{className:"cursor-pointer hover:text-[var(--text-secondary)]",onClick:()=>l("/projects"),children:r("projects.title")})," / ",e.jsx("span",{className:"cursor-pointer hover:text-[var(--text-secondary)]",onClick:()=>l(`/projects/${n.key}`),children:n.key})," / ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:r("common.edit")})]}),e.jsx("h1",{className:"text-lg font-bold text-[var(--text-primary)] mb-4",children:r("projects.edit_project_title")}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-[1fr_400px]",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.basic_info")}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(s,{label:r("projects.key"),children:e.jsx("input",{type:"text",value:n.key,readOnly:!0,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-muted)] outline-none opacity-60 cursor-not-allowed"})}),e.jsx(s,{label:r("projects.name"),children:e.jsx("input",{type:"text",value:v,onChange:t=>w(t.target.value),required:!0,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsx(s,{label:r("projects.repo_url"),children:e.jsx("input",{type:"text",value:j,onChange:t=>S(t.target.value),required:!0,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsx(s,{label:r("projects.git_platform"),children:e.jsx(W,{value:_,onChange:t=>k(t),options:[{value:m.GITHUB,label:r("projects.github")},{value:m.GITLAB,label:r("projects.gitlab")},{value:m.GITEA,label:r("projects.gitea")}]})}),e.jsx(s,{label:r("projects.default_branch"),children:e.jsx("input",{type:"text",value:T,onChange:t=>M(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})})]})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.agent_config")}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(s,{label:r("projects.agent_type"),children:e.jsx(W,{value:O,onChange:t=>P(t),options:[{value:d.CLAUDE,label:r("projects.claude")},{value:d.CURSOR,label:r("projects.cursor")},{value:d.CODEX,label:r("projects.codex")},{value:d.CUSTOM,label:r("projects.custom")}]})}),e.jsx(s,{label:r("projects.agent_command"),children:e.jsx("input",{type:"text",value:R,onChange:t=>A(t.target.value),placeholder:"custom agent command",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsx(s,{label:r("projects.max_turns"),children:e.jsx("input",{type:"number",value:I,onChange:t=>U(t.target.value),min:1,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsx(s,{label:r("projects.workspace_root"),children:e.jsx("input",{type:"text",value:D,onChange:t=>E(t.target.value),placeholder:"/path/to/workspace",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})})]})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.environment")}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(s,{label:r("projects.setup_commands"),children:e.jsx("textarea",{value:$,onChange:t=>G(t.target.value),rows:3,placeholder:`npm install
|
|
2
2
|
npm run build`,className:"w-full resize-y rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsx(s,{label:r("projects.post_command"),children:e.jsx("input",{type:"text",value:L,onChange:t=>B(t.target.value),placeholder:"npm test",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})})]})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.security")}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(s,{label:r("projects.pty_output_filter"),children:e.jsx("input",{type:"text",value:F,onChange:t=>J(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsx(s,{label:r("projects.git_clean"),children:e.jsx("button",{type:"button",onClick:()=>q(!g),className:`relative inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full transition-colors ${g?"bg-[var(--accent)]":"bg-[var(--border)]"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${g?"translate-x-6":"translate-x-1"}`})})})]})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--accent)]",children:r("projects.pipeline_section")}),e.jsx(ce,{to:"/projects/"+o+"/pipeline",className:"text-xs text-[var(--accent)] hover:underline",children:r("projects.edit_pipeline")})]}),e.jsx("textarea",{value:i,onChange:t=>h(t.target.value),rows:20,spellCheck:!1,placeholder:'{"stages": [], "defaults": {}}',className:"w-full resize-y rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]",style:{fontFamily:'"JetBrains Mono", monospace',textTransform:"none"}})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--accent)]",children:r("projects.members")}),e.jsxs("button",{type:"button",onClick:()=>z(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-medium text-black",children:[e.jsx(xe,{className:"h-3.5 w-3.5"}),r("projects.add_member")]})]}),N.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("projects.no_members_yet")})]}):e.jsx("div",{className:"space-y-2",children:N.map(t=>e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-[var(--accent)]/20 text-xs font-bold text-[var(--accent)]",children:String(t.developerId).charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-xs text-[var(--text-primary)]",children:["#",t.developerId]}),e.jsx("span",{className:"ml-2 rounded-[4px] px-1.5 py-0.5 text-[10px] font-medium",style:{color:t.role==="maintainer"?"var(--warning)":"var(--text-secondary)",background:t.role==="maintainer"?"rgba(245,158,11,0.1)":"rgba(163,163,163,0.1)"},children:t.role})]})]}),e.jsx("button",{type:"button",onClick:()=>f(t),className:"text-[var(--destructive)] hover:opacity-70 transition-opacity","aria-label":r("projects.remove_member"),children:e.jsx(de,{className:"h-3.5 w-3.5"})})]},t.developerId))})]})]})]}),e.jsxs("div",{className:"mt-8 flex items-center justify-end gap-3 border-t border-[var(--border)] pt-6",children:[e.jsx("button",{type:"button",onClick:re,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:r("common.discard")}),e.jsx("button",{type:"submit",disabled:C||!v||!j,className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-medium text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:r(C?"common.saving":"projects.save_changes")})]}),e.jsx(ie,{isOpen:Z,onClose:()=>z(!1),projectKey:n.key,onAdded:p}),e.jsx(pe,{isOpen:!!c,onClose:()=>f(null),onConfirm:ae,memberName:c?String(c.developerId):"",loading:ee})]}):e.jsxs("div",{className:"mx-auto max-w-4xl px-6 py-8 text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:r("projects.project_not_found")}),e.jsx("button",{onClick:()=>l("/projects"),className:"mt-4 rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:r("projects.back_to_projects")})]})}function s({label:o,children:l}){return e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("label",{className:"w-36 shrink-0 pt-2 text-xs text-[var(--text-muted)]",children:o}),e.jsx("div",{className:"flex-1",children:l})]})}export{ge as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as H,a as A,u as q,r,f as b,j as e,L as p}from"./index-CluWJF_4.js";import{M as o}from"./protocol-C4f2G7mk.js";import{T as R}from"./TaskStatusBadge-CTYxCsEO.js";import{T as f}from"./Skeleton-DTD8fr3E.js";import{A as j}from"./arrow-right-CW48svkF.js";const G=3e4,P=[{key:"active_tasks",labelKey:"dashboard.active_tasks"},{key:"queued_tasks",labelKey:"dashboard.queued_tasks"},{key:"online_workers",labelKey:"dashboard.online_workers"},{key:"completed_today",labelKey:"dashboard.completed_today"}],V=["mon","tue","wed","thu","fri","sat","sun"];function g(l){const a=Date.now(),x=new Date(l).getTime(),d=a-x,n=Math.floor(d/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const t=Math.floor(n/60);return t<24?`${t}h ago`:`${Math.floor(t/24)}d ago`}function z(l,a){return l.length<=a?l:l.slice(0,a)+"..."}function Y({dailyRates:l,overallRate:a}){const{t:x}=A(),d=V.map((t,i)=>({label:t,value:l[i]??0})),n=Math.max(...d.map(t=>t.value),1);return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-2xl font-bold text-[var(--text-primary)]",children:[a,"%"]}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:x("dashboard.last_7_days")})]}),e.jsx("div",{className:"flex gap-2",style:{height:80},children:d.map(t=>{const i=n>0?Math.max(t.value/n*100,4):4;return e.jsxs("div",{className:"flex flex-1 flex-col items-center gap-1",children:[e.jsx("div",{className:"relative w-full h-full rounded-[4px]",style:{backgroundColor:"rgba(34,197,94,0.1)"},children:e.jsx("div",{className:"absolute bottom-0 left-0 right-0 rounded-[4px]",style:{height:`${i}%`,backgroundColor:t.value>=80?"var(--accent)":t.value>=50?"var(--warning)":"var(--destructive)"}})}),e.jsx("span",{className:"shrink-0 text-[10px] text-[var(--text-muted)]",children:t.label})]},t.label)})})]})}function Z(){const l=H(),{t:a}=A(),x=q(s=>{var c;return((c=s.user)==null?void 0:c.role)==="admin"}),[d,n]=r.useState(null),[t,i]=r.useState([]),[N,T]=r.useState([]),[y,w]=r.useState([]),[k,C]=r.useState(!0),[E,I]=r.useState(!0),[D,$]=r.useState(!0),[F,K]=r.useState(!0),m=r.useCallback(async()=>{try{const s=await b.get("web/dashboard/stats").json();n(s)}catch{}finally{C(!1)}},[]),h=r.useCallback(async()=>{try{const s=await b.get("web/dashboard/recent-tasks",{searchParams:{limit:"5"}}).json();i(s)}catch{}finally{I(!1)}},[]),_=r.useCallback(async()=>{try{const s=await b.get("web/machines").json();T(s)}catch{}finally{$(!1)}},[]),S=r.useCallback(async()=>{try{const s=await b.get("web/dashboard/recent-activity").json();w(s)}catch{w([])}finally{K(!1)}},[]);r.useEffect(()=>{m(),h(),_(),S()},[m,h,_,S]);const u=r.useRef(null);r.useEffect(()=>(u.current=setInterval(()=>{m(),h()},G),()=>{u.current&&clearInterval(u.current)}),[m,h]);const L=(d==null?void 0:d.success_rate_daily)??null,M=(d==null?void 0:d.task_success_rate_7d)??0;function O(s){switch(s){case o.ONLINE:return"var(--accent)";case o.DRAINING:return"var(--warning)";case o.OFFLINE:default:return"var(--text-muted)"}}function B(s){switch(s){case o.ONLINE:return a("dashboard.online");case o.DRAINING:return a("dashboard.idle");case o.OFFLINE:default:return a("dashboard.offline")}}return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-6 md:py-8 font-mono",children:[e.jsx("div",{className:"mb-4 md:hidden",children:e.jsxs("span",{className:"text-base font-bold text-[var(--accent)]",children:["// ",a("dashboard.title")]})}),e.jsx("div",{className:"mb-6 md:mb-8 grid grid-cols-2 gap-3 md:gap-4 lg:grid-cols-4",children:P.map(({key:s,labelKey:c})=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 md:p-4",children:[e.jsxs("span",{className:"text-[9px] md:text-xs text-[var(--text-muted)]",children:[a(c),":"]}),k?e.jsx("div",{className:"mt-1 h-6 md:h-8 w-12 md:w-16 animate-pulse rounded bg-[var(--bg-input)]"}):e.jsx("div",{className:"mt-1 flex items-baseline gap-2",children:e.jsx("span",{className:"text-2xl md:text-3xl font-bold text-[var(--text-primary)]",children:(d==null?void 0:d[s])??0})})]},s))}),e.jsxs("div",{className:"mb-6 grid gap-6 lg:grid-cols-3 items-stretch",children:[e.jsx("div",{className:"hidden md:flex flex-col gap-6 lg:col-span-2",children:e.jsxs("div",{className:"flex flex-1 flex-col rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("div",{className:"border-b border-[var(--border)] px-5 py-3",children:e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("dashboard.task_success_rate")})}),e.jsx("div",{className:"flex flex-1 flex-col justify-center p-5",children:k?e.jsx("div",{className:"h-24 animate-pulse rounded bg-[var(--bg-input)]"}):L?e.jsx(Y,{dailyRates:L,overallRate:M}):e.jsxs("div",{className:"flex flex-col items-center gap-2 py-6",children:[e.jsxs("span",{className:"text-2xl font-bold text-[var(--text-primary)]",children:[M,"%"]}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("dashboard.daily_breakdown_not_available")})]})})]})}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] md:border",children:[e.jsxs("div",{className:"hidden md:flex items-center justify-between border-b border-[var(--border)] px-5 py-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("dashboard.recent_tasks")}),e.jsxs(p,{to:"/tasks",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[a("common.view_all")," ",e.jsx(j,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"flex md:hidden items-center justify-between px-3 py-3",children:e.jsx("h2",{className:"text-xs font-bold text-[var(--accent)]",children:a("dashboard.recent_tasks")})}),e.jsx("div",{className:"px-3 pb-3 md:p-4",children:E?e.jsx(f,{rows:4}):t.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("dashboard.no_tasks_yet")})]}):e.jsx("div",{className:"flex flex-col gap-2 md:gap-0",children:t.map(s=>e.jsxs("div",{onClick:()=>l(`/tasks/${s.id}`),className:"flex cursor-pointer items-center gap-3 rounded-[4px] border border-[var(--border)] p-3 transition-colors hover:bg-[var(--bg-input)] md:rounded-none md:border-0 md:border-b md:border-[var(--border-row)] md:p-0 md:py-2.5 last:md:border-b-0",children:[e.jsxs("div",{className:"flex-1 min-w-0 md:hidden",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[10px] text-[var(--text-primary)] leading-tight",style:{wordBreak:"break-word"},children:["#",s.id," ",s.description]}),e.jsx("span",{className:"shrink-0",children:e.jsx(R,{status:s.status})})]}),e.jsx("span",{className:"text-[9px] text-[var(--text-muted)] mt-1 block",children:g(s.created_at)})]}),e.jsxs("span",{className:"hidden md:inline shrink-0 text-xs text-[var(--text-muted)]",children:["#",s.id]}),e.jsx("span",{className:"hidden md:inline flex-1 text-xs text-[var(--text-primary)] truncate",children:z(s.description,40)}),e.jsx("span",{className:"hidden md:inline",children:e.jsx(R,{status:s.status})}),e.jsx("span",{className:"hidden md:inline shrink-0 text-xs text-[var(--text-muted)]",children:g(s.created_at)})]},s.id))})})]})]}),e.jsxs("div",{className:"hidden md:grid gap-6 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("dashboard.worker_status")}),e.jsxs(p,{to:"/machines",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[a("common.view_all")," ",e.jsx(j,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"p-4",children:D?e.jsx(f,{rows:3}):N.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("dashboard.no_workers_registered")})]}):e.jsx("div",{className:"flex flex-col",children:N.map(s=>e.jsxs("div",{onClick:()=>l(`/machines/${s.id}`),className:"flex cursor-pointer items-center justify-between border-b border-[var(--border-row)] py-2.5 transition-colors hover:bg-[var(--bg-input)] last:border-b-0",children:[e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:s.name}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s.host??"--"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:[s.activeSlots,"/",s.maxSlots," ",a("dashboard.slots")]}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs",style:{color:O(s.status)},children:[e.jsx("span",{style:{fontSize:"0.5rem"},children:"●"}),B(s.status)]})]})]},s.id))})})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("dashboard.recent_activity")}),x&&e.jsxs(p,{to:"/admin/audit-logs",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[a("common.view_all")," ",e.jsx(j,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"p-4",children:F?e.jsx(f,{rows:4}):y.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("dashboard.no_recent_activity")})]}):e.jsx("div",{className:"flex flex-col",children:y.map(s=>{const c=s.message.match(/task\s*#?(\d+)/i),v=c?c[1]:null;return e.jsxs("div",{className:`flex items-start gap-3 border-b border-[var(--border-row)] py-2 last:border-b-0 ${v?"cursor-pointer hover:bg-[var(--bg-input)] transition-colors":""}`,onClick:()=>v&&l(`/tasks/${v}`),children:[e.jsx("span",{className:"shrink-0 text-xs text-[var(--text-muted)]",children:g(s.timestamp)}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:s.message})]},s.id)})})})]})]})]})}export{Z as default};
|
|
1
|
+
import{d as H,a as A,u as q,r,f as b,j as e,L as p}from"./index-bdjBPTjT.js";import{M as o}from"./protocol-C4f2G7mk.js";import{T as R}from"./TaskStatusBadge-RjE_jGwc.js";import{T as f}from"./Skeleton-D-ZoNR01.js";import{A as j}from"./arrow-right-t-l7E3bV.js";const G=3e4,P=[{key:"active_tasks",labelKey:"dashboard.active_tasks"},{key:"queued_tasks",labelKey:"dashboard.queued_tasks"},{key:"online_workers",labelKey:"dashboard.online_workers"},{key:"completed_today",labelKey:"dashboard.completed_today"}],V=["mon","tue","wed","thu","fri","sat","sun"];function g(l){const a=Date.now(),x=new Date(l).getTime(),d=a-x,n=Math.floor(d/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const t=Math.floor(n/60);return t<24?`${t}h ago`:`${Math.floor(t/24)}d ago`}function z(l,a){return l.length<=a?l:l.slice(0,a)+"..."}function Y({dailyRates:l,overallRate:a}){const{t:x}=A(),d=V.map((t,i)=>({label:t,value:l[i]??0})),n=Math.max(...d.map(t=>t.value),1);return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-2xl font-bold text-[var(--text-primary)]",children:[a,"%"]}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:x("dashboard.last_7_days")})]}),e.jsx("div",{className:"flex gap-2",style:{height:80},children:d.map(t=>{const i=n>0?Math.max(t.value/n*100,4):4;return e.jsxs("div",{className:"flex flex-1 flex-col items-center gap-1",children:[e.jsx("div",{className:"relative w-full h-full rounded-[4px]",style:{backgroundColor:"rgba(34,197,94,0.1)"},children:e.jsx("div",{className:"absolute bottom-0 left-0 right-0 rounded-[4px]",style:{height:`${i}%`,backgroundColor:t.value>=80?"var(--accent)":t.value>=50?"var(--warning)":"var(--destructive)"}})}),e.jsx("span",{className:"shrink-0 text-[10px] text-[var(--text-muted)]",children:t.label})]},t.label)})})]})}function Z(){const l=H(),{t:a}=A(),x=q(s=>{var c;return((c=s.user)==null?void 0:c.role)==="admin"}),[d,n]=r.useState(null),[t,i]=r.useState([]),[N,T]=r.useState([]),[y,w]=r.useState([]),[k,C]=r.useState(!0),[E,I]=r.useState(!0),[D,$]=r.useState(!0),[F,K]=r.useState(!0),m=r.useCallback(async()=>{try{const s=await b.get("web/dashboard/stats").json();n(s)}catch{}finally{C(!1)}},[]),h=r.useCallback(async()=>{try{const s=await b.get("web/dashboard/recent-tasks",{searchParams:{limit:"5"}}).json();i(s)}catch{}finally{I(!1)}},[]),_=r.useCallback(async()=>{try{const s=await b.get("web/machines").json();T(s)}catch{}finally{$(!1)}},[]),S=r.useCallback(async()=>{try{const s=await b.get("web/dashboard/recent-activity").json();w(s)}catch{w([])}finally{K(!1)}},[]);r.useEffect(()=>{m(),h(),_(),S()},[m,h,_,S]);const u=r.useRef(null);r.useEffect(()=>(u.current=setInterval(()=>{m(),h()},G),()=>{u.current&&clearInterval(u.current)}),[m,h]);const L=(d==null?void 0:d.success_rate_daily)??null,M=(d==null?void 0:d.task_success_rate_7d)??0;function O(s){switch(s){case o.ONLINE:return"var(--accent)";case o.DRAINING:return"var(--warning)";case o.OFFLINE:default:return"var(--text-muted)"}}function B(s){switch(s){case o.ONLINE:return a("dashboard.online");case o.DRAINING:return a("dashboard.idle");case o.OFFLINE:default:return a("dashboard.offline")}}return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-6 md:py-8 font-mono",children:[e.jsx("div",{className:"mb-4 md:hidden",children:e.jsxs("span",{className:"text-base font-bold text-[var(--accent)]",children:["// ",a("dashboard.title")]})}),e.jsx("div",{className:"mb-6 md:mb-8 grid grid-cols-2 gap-3 md:gap-4 lg:grid-cols-4",children:P.map(({key:s,labelKey:c})=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 md:p-4",children:[e.jsxs("span",{className:"text-[9px] md:text-xs text-[var(--text-muted)]",children:[a(c),":"]}),k?e.jsx("div",{className:"mt-1 h-6 md:h-8 w-12 md:w-16 animate-pulse rounded bg-[var(--bg-input)]"}):e.jsx("div",{className:"mt-1 flex items-baseline gap-2",children:e.jsx("span",{className:"text-2xl md:text-3xl font-bold text-[var(--text-primary)]",children:(d==null?void 0:d[s])??0})})]},s))}),e.jsxs("div",{className:"mb-6 grid gap-6 lg:grid-cols-3 items-stretch",children:[e.jsx("div",{className:"hidden md:flex flex-col gap-6 lg:col-span-2",children:e.jsxs("div",{className:"flex flex-1 flex-col rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("div",{className:"border-b border-[var(--border)] px-5 py-3",children:e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("dashboard.task_success_rate")})}),e.jsx("div",{className:"flex flex-1 flex-col justify-center p-5",children:k?e.jsx("div",{className:"h-24 animate-pulse rounded bg-[var(--bg-input)]"}):L?e.jsx(Y,{dailyRates:L,overallRate:M}):e.jsxs("div",{className:"flex flex-col items-center gap-2 py-6",children:[e.jsxs("span",{className:"text-2xl font-bold text-[var(--text-primary)]",children:[M,"%"]}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("dashboard.daily_breakdown_not_available")})]})})]})}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] md:border",children:[e.jsxs("div",{className:"hidden md:flex items-center justify-between border-b border-[var(--border)] px-5 py-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("dashboard.recent_tasks")}),e.jsxs(p,{to:"/tasks",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[a("common.view_all")," ",e.jsx(j,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"flex md:hidden items-center justify-between px-3 py-3",children:e.jsx("h2",{className:"text-xs font-bold text-[var(--accent)]",children:a("dashboard.recent_tasks")})}),e.jsx("div",{className:"px-3 pb-3 md:p-4",children:E?e.jsx(f,{rows:4}):t.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("dashboard.no_tasks_yet")})]}):e.jsx("div",{className:"flex flex-col gap-2 md:gap-0",children:t.map(s=>e.jsxs("div",{onClick:()=>l(`/tasks/${s.id}`),className:"flex cursor-pointer items-center gap-3 rounded-[4px] border border-[var(--border)] p-3 transition-colors hover:bg-[var(--bg-input)] md:rounded-none md:border-0 md:border-b md:border-[var(--border-row)] md:p-0 md:py-2.5 last:md:border-b-0",children:[e.jsxs("div",{className:"flex-1 min-w-0 md:hidden",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[10px] text-[var(--text-primary)] leading-tight",style:{wordBreak:"break-word"},children:["#",s.id," ",s.description]}),e.jsx("span",{className:"shrink-0",children:e.jsx(R,{status:s.status})})]}),e.jsx("span",{className:"text-[9px] text-[var(--text-muted)] mt-1 block",children:g(s.created_at)})]}),e.jsxs("span",{className:"hidden md:inline shrink-0 text-xs text-[var(--text-muted)]",children:["#",s.id]}),e.jsx("span",{className:"hidden md:inline flex-1 text-xs text-[var(--text-primary)] truncate",children:z(s.description,40)}),e.jsx("span",{className:"hidden md:inline",children:e.jsx(R,{status:s.status})}),e.jsx("span",{className:"hidden md:inline shrink-0 text-xs text-[var(--text-muted)]",children:g(s.created_at)})]},s.id))})})]})]}),e.jsxs("div",{className:"hidden md:grid gap-6 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("dashboard.worker_status")}),e.jsxs(p,{to:"/machines",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[a("common.view_all")," ",e.jsx(j,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"p-4",children:D?e.jsx(f,{rows:3}):N.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("dashboard.no_workers_registered")})]}):e.jsx("div",{className:"flex flex-col",children:N.map(s=>e.jsxs("div",{onClick:()=>l(`/machines/${s.id}`),className:"flex cursor-pointer items-center justify-between border-b border-[var(--border-row)] py-2.5 transition-colors hover:bg-[var(--bg-input)] last:border-b-0",children:[e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:s.name}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s.host??"--"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:[s.activeSlots,"/",s.maxSlots," ",a("dashboard.slots")]}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs",style:{color:O(s.status)},children:[e.jsx("span",{style:{fontSize:"0.5rem"},children:"●"}),B(s.status)]})]})]},s.id))})})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("dashboard.recent_activity")}),x&&e.jsxs(p,{to:"/admin/audit-logs",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[a("common.view_all")," ",e.jsx(j,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"p-4",children:F?e.jsx(f,{rows:4}):y.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("dashboard.no_recent_activity")})]}):e.jsx("div",{className:"flex flex-col",children:y.map(s=>{const c=s.message.match(/task\s*#?(\d+)/i),v=c?c[1]:null;return e.jsxs("div",{className:`flex items-start gap-3 border-b border-[var(--border-row)] py-2 last:border-b-0 ${v?"cursor-pointer hover:bg-[var(--bg-input)] transition-colors":""}`,onClick:()=>v&&l(`/tasks/${v}`),children:[e.jsx("span",{className:"shrink-0 text-xs text-[var(--text-muted)]",children:g(s.timestamp)}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:s.message})]},s.id)})})})]})]})]})}export{Z as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as s,r as m,u as h,a as p,j as e,T as g,L as r,b as y,S as v,C as b}from"./index-
|
|
1
|
+
import{c as s,r as m,u as h,a as p,j as e,T as g,L as r,b as y,S as v,C as b}from"./index-bdjBPTjT.js";import{A as l}from"./arrow-right-t-l7E3bV.js";import{B as u}from"./bot-KOWEPW_6.js";import{U as f}from"./users-yEz_0v7L.js";import{C as j}from"./copy-fRb9wi57.js";/**
|
|
2
2
|
* @license lucide-react v0.469.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as W,e as q,u as m,a as I,r as c,j as t,N as _}from"./index-
|
|
1
|
+
import{d as W,e as q,u as m,a as I,r as c,j as t,N as _}from"./index-bdjBPTjT.js";function P(){var w,B;const h=W(),y=q(),x=m(e=>e.login),v=m(e=>e.requireTotpSetup),k=m(e=>e.user),{t:n}=I(),[C,S]=c.useState("credentials"),[u,F]=c.useState(""),[p,z]=c.useState(""),[i,b]=c.useState(""),[l,g]=c.useState(!1),[j,d]=c.useState(""),f=c.useRef([]);if(k&&!v){let e=(B=(w=y.state)==null?void 0:w.from)==null?void 0:B.pathname;return(e==="/totp-setup"||e==="/login")&&(e=void 0),t.jsx(_,{to:e??"/home",replace:!0})}if(v)return t.jsx(_,{to:"/totp-setup",replace:!0});const M=async e=>{var r,o;if(e.preventDefault(),d(""),!u.trim()||!p.trim()){d(n("auth.username_and_password_required"));return}g(!0);try{await x({username:u.trim(),password:p});const a=m.getState();if(a.requireTotpSetup)return;if(a.user){let s=(o=(r=y.state)==null?void 0:r.from)==null?void 0:o.pathname;(s==="/totp-setup"||s==="/login")&&(s=void 0),h(s??"/home",{replace:!0})}}catch(a){const s=a instanceof Error?a.message:n("auth.login_failed");s==="TOTP_REQUIRED"?(S("totp"),d("")):d(s)}finally{g(!1)}},J=async e=>{var r,o;if(e.preventDefault(),d(""),!i.trim()||i.trim().length!==6){d(n("auth.please_enter_valid_6_digit_code"));return}g(!0);try{if(await x({username:u.trim(),password:p,totpCode:i.trim()}),m.getState().user){let s=(o=(r=y.state)==null?void 0:r.from)==null?void 0:o.pathname;(s==="/totp-setup"||s==="/login")&&(s=void 0),h(s??"/home",{replace:!0})}}catch(a){const s=a instanceof Error?a.message:n("auth.invalid_totp_code");d(s)}finally{g(!1)}},R=()=>{S("credentials"),b(""),d("")},T=(e,r)=>{var s;const o=r.replace(/\D/g,"").slice(-1),a=i.split("");for(;a.length<6;)a.push("");a[e]=o,b(a.join("")),o&&e<5&&((s=f.current[e+1])==null||s.focus())},D=(e,r)=>{var o;r.key==="Backspace"&&!i[e]&&e>0&&((o=f.current[e-1])==null||o.focus())},E=e=>{var a;e.preventDefault();const r=e.clipboardData.getData("text").replace(/\D/g,"").slice(0,6);b(r);const o=Math.min(r.length,5);(a=f.current[o])==null||a.focus()};return t.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--bg-primary)",padding:"1rem",fontFamily:"'JetBrains Mono', monospace"},children:t.jsxs("div",{style:{width:"100%",maxWidth:"400px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"2rem"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.625rem",marginBottom:"0.25rem"},children:[t.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"2rem",height:"2rem",borderRadius:"4px",backgroundColor:"var(--accent)",fontFamily:"'JetBrains Mono', monospace"},"aria-hidden":!0,children:t.jsx("span",{style:{fontSize:"1.25rem",fontWeight:600,color:"#0C0C0C"},children:"~"})}),t.jsx("span",{style:{fontSize:"1.25rem",fontWeight:700,color:"var(--text-primary)",fontFamily:"'JetBrains Mono', monospace"},children:n("landing.overlord")})]}),t.jsx("div",{style:{textAlign:"center",color:"var(--text-muted)",fontSize:"0.75rem",marginBottom:"2rem",fontFamily:"'JetBrains Mono', monospace"},children:n(C==="credentials"?"auth.ai_powered_development_system":"auth.two_factor_verification")}),j&&t.jsx("div",{style:{marginBottom:"1rem",padding:"0.5rem 0.75rem",borderRadius:"4px",backgroundColor:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.3)",color:"var(--destructive)",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",overflowWrap:"break-word",wordBreak:"break-word"},children:j}),C==="credentials"?t.jsxs("form",{onSubmit:M,style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[t.jsxs("div",{children:[t.jsx("label",{style:{display:"block",color:"var(--text-secondary)",fontSize:"0.75rem",marginBottom:"0.375rem",fontFamily:"'JetBrains Mono', monospace"},children:n("auth.username")}),t.jsx("input",{type:"text",placeholder:n("auth.enter_username"),value:u,onChange:e=>F(e.target.value),autoFocus:!0,autoComplete:"username",required:!0,style:{width:"100%",padding:"0.625rem 0.75rem",backgroundColor:"var(--bg-input)",border:"1px solid var(--border)",borderRadius:"4px",color:"var(--text-primary)",fontSize:"0.875rem",fontFamily:"'JetBrains Mono', monospace",outline:"none",boxSizing:"border-box"},onFocus:e=>e.target.style.borderColor="var(--accent)",onBlur:e=>e.target.style.borderColor="var(--border)"})]}),t.jsxs("div",{children:[t.jsx("label",{style:{display:"block",color:"var(--text-secondary)",fontSize:"0.75rem",marginBottom:"0.375rem",fontFamily:"'JetBrains Mono', monospace"},children:n("auth.password")}),t.jsx("input",{type:"password",placeholder:n("auth.enter_password"),value:p,onChange:e=>z(e.target.value),autoComplete:"current-password",required:!0,style:{width:"100%",padding:"0.625rem 0.75rem",backgroundColor:"var(--bg-input)",border:"1px solid var(--border)",borderRadius:"4px",color:"var(--text-primary)",fontSize:"0.875rem",fontFamily:"'JetBrains Mono', monospace",outline:"none",boxSizing:"border-box"},onFocus:e=>e.target.style.borderColor="var(--accent)",onBlur:e=>e.target.style.borderColor="var(--border)"})]}),t.jsx("button",{type:"submit",disabled:l,style:{width:"100%",padding:"0.625rem",backgroundColor:"var(--accent)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.875rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:l?"not-allowed":"pointer",opacity:l?.7:1,marginTop:"0.5rem"},children:n(l?"common.signing_in":"auth.sign_in")}),t.jsx("button",{type:"button",onClick:()=>h("/"),style:{width:"100%",padding:"0.5rem",backgroundColor:"transparent",border:"none",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},className:"text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:n("common.back_to_site")})]},"credentials"):t.jsxs("form",{onSubmit:J,style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[t.jsxs("div",{children:[t.jsx("label",{style:{display:"block",color:"var(--text-secondary)",fontSize:"0.75rem",marginBottom:"0.5rem",fontFamily:"'JetBrains Mono', monospace",textAlign:"center"},children:n("auth.enter_totp_code")}),t.jsx("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"center"},onPaste:E,children:Array.from({length:6}).map((e,r)=>t.jsx("input",{ref:o=>{f.current[r]=o},type:"text",inputMode:"numeric",maxLength:1,value:i[r]||"",onChange:o=>T(r,o.target.value),onKeyDown:o=>D(r,o),autoFocus:r===0,autoComplete:r===0?"one-time-code":"off",style:{width:"2.75rem",height:"3rem",textAlign:"center",backgroundColor:"var(--bg-input)",border:"1px solid var(--border)",borderRadius:"4px",color:"var(--text-primary)",fontSize:"1.25rem",fontFamily:"'JetBrains Mono', monospace",fontWeight:600,outline:"none",boxSizing:"border-box"},onFocus:o=>o.target.style.borderColor="var(--accent)",onBlur:o=>o.target.style.borderColor="var(--border)"},r))})]}),t.jsx("button",{type:"submit",disabled:l||i.length!==6,style:{width:"100%",padding:"0.625rem",backgroundColor:"var(--accent)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.875rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:l||i.length!==6?"not-allowed":"pointer",opacity:l||i.length!==6?.7:1,marginTop:"0.5rem"},children:n(l?"common.verifying":"auth.verify")}),t.jsx("button",{type:"button",onClick:R,style:{width:"100%",padding:"0.5rem",backgroundColor:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},children:n("common.back")})]},"totp")]})})}export{P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as S,j as e,l as I,m as M,d as T,r as x,h as A,f as v,L as G,s as U}from"./index-CluWJF_4.js";import{M as o,T as d}from"./protocol-C4f2G7mk.js";import{A as w}from"./arrow-left-EPKSp1wq.js";function _({isOpen:t,onClose:r,onConfirm:s,machineName:a,isDraining:i,loading:m}){const{t:l}=S();return e.jsx(I,{isOpen:t,onClose:r,onConfirm:s,title:l(i?"machines.undrain_machine_title":"machines.drain_machine_title"),message:i?l("machines.undrain_confirm",{name:a}):l("machines.drain_confirm",{name:a}),confirmLabel:l(i?"machines.undrain":"machines.drain"),confirmVariant:i?"accent":"warning",isLoading:m})}const O={[o.ONLINE]:"var(--accent)",[o.OFFLINE]:"var(--destructive)",[o.DRAINING]:"var(--warning)"},F={[d.QUEUED]:"var(--text-muted)",[d.ASSIGNED]:"#60a5fa",[d.RUNNING]:"var(--accent)",[d.SUSPENDED]:"var(--warning)",[d.COMPLETED]:"var(--accent)",[d.FAILED]:"var(--destructive)",[d.CANCELLED]:"var(--text-muted)"};function k(t){return t?new Date(t).toLocaleString():"n/a"}function R(t){if(!t)return"never";const r=Date.now()-new Date(t).getTime(),s=Math.floor(r/1e3);if(s<60)return`${s}s ago`;const a=Math.floor(s/60);if(a<60)return`${a}m ago`;const i=Math.floor(a/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function D(t){return t>80?"var(--destructive)":t>60?"var(--warning)":"var(--accent)"}function B(){const{id:t}=M(),r=T(),{t:s}=S(),[a,i]=x.useState(null),[m,l]=x.useState([]),[L,E]=x.useState(!0),[g,h]=x.useState(!1),[N,f]=x.useState(!1);A(x.useMemo(()=>!a||a.status===o.OFFLINE||a.status===o.DRAINING?null:e.jsxs("button",{onClick:()=>h(!0),className:"rounded-[4px] border border-[var(--warning)]/40 px-3 py-1.5 text-xs text-[var(--warning)] hover:bg-[var(--warning)]/10 transition-colors",children:["> ",s("machines.drain")]}),[a,s]));const u=x.useCallback(async()=>{if(t)try{const[c,$]=await Promise.all([v.get(`web/machines/${t}`).json(),v.get(`web/machines/${t}/tasks`).json().catch(()=>[])]);i(c),l($)}catch{}finally{E(!1)}},[t]);x.useEffect(()=>{u()},[u]);async function y(){if(a){f(!0);try{const c=a.status===o.DRAINING?"undrain":"drain";await v.post(`web/machines/${a.id}/${c}`),await u()}catch{}finally{f(!1),h(!1)}}}if(L)return e.jsx("div",{className:"mx-auto max-w-5xl px-6 py-8 font-mono",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:s("machines.loading_machine")})});if(!a)return e.jsxs("div",{className:"mx-auto max-w-5xl px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:s("machines.machine_not_found")}),e.jsxs("button",{onClick:()=>r("/machines"),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:["< ",s("machines.back_to_machines")]})]});const b=a.status===o.DRAINING;return b?e.jsxs("div",{className:"mx-auto max-w-5xl font-mono lowercase",children:[e.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 shrink-0 md:hidden",style:{height:56},children:[e.jsx("button",{onClick:()=>r("/machines"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(w,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:a.name})]}),e.jsxs("div",{className:"px-6 py-8",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(G,{to:"/machines",className:"text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:s("machines.title")}),e.jsx("span",{className:"text-[var(--text-muted)]",children:"/"}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:a.name})]}),e.jsxs("button",{onClick:()=>h(!0),className:"rounded-[4px] border border-[var(--accent)] px-4 py-1.5 text-xs text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:["> ",s("machines.undrain")]})]}),e.jsx("div",{className:"mb-4",children:e.jsx("span",{className:"rounded-[4px] bg-[var(--warning)]/20 px-2.5 py-1 text-xs font-medium text-[var(--warning)]",children:s("machines.draining")})}),e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--warning)]/40 bg-[var(--warning)]/10 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(U,{className:"h-3.5 w-3.5 text-[var(--warning)]"}),e.jsx("span",{className:"text-xs text-[var(--warning)]",children:s("machines.draining_warning")})]}),e.jsx("p",{className:"text-xs text-[var(--warning)]/70 ml-5.5",children:s("machines.draining_active_tasks")})]}),e.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-4",children:[e.jsx(p,{label:s("machines.cpu"),value:a.cpuUsage,unit:"%"}),e.jsx(p,{label:s("machines.memory"),value:a.memoryUsage,unit:"%"}),e.jsx(p,{label:s("machines.disk"),value:a.diskUsage,unit:"%"}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("machines.slots")}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[a.activeSlots,"/",a.maxSlots]})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:s("machines.active_tasks")}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:m.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s("machines.no_active_tasks")})]}):e.jsx(C,{tasks:m,navigate:r,t:s})})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:s("machines.capabilities")}),a.capabilities.length>0?e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:a.capabilities.map(c=>e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx("p",{className:"text-xs text-[var(--text-primary)]",children:c})},c))}):e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("machines.no_capabilities_short")})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:s("machines.machine_info")}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsx(n,{label:s("machines.host"),value:a.host}),e.jsx(n,{label:s("machines.port"),value:String(a.port)}),e.jsx(n,{label:s("machines.os"),value:a.os??s("machines.unknown")}),e.jsx(n,{label:s("machines.cpu_cores"),value:a.cpuCores!=null?String(a.cpuCores):s("machines.n_a")}),e.jsx(n,{label:s("machines.memory"),value:a.memoryGb!=null?`${a.memoryGb} gb`:s("machines.n_a")}),e.jsx(n,{label:s("machines.last_heartbeat_label"),value:k(a.lastHeartbeat)}),e.jsx(n,{label:s("machines.slots"),value:`${a.activeSlots}/${a.maxSlots}`}),e.jsx(n,{label:s("machines.status_label"),value:a.status.toLowerCase()})]})})]}),e.jsx(_,{isOpen:g,onClose:()=>h(!1),onConfirm:y,machineName:a.name,isDraining:b,loading:N})]})]}):e.jsxs("div",{className:"mx-auto max-w-5xl font-mono lowercase",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 shrink-0 md:hidden",style:{height:56},children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("button",{onClick:()=>r("/machines"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(w,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:a.name})]}),a.status!==o.OFFLINE&&e.jsxs("button",{onClick:()=>h(!0),className:"shrink-0 rounded-[4px] border border-[var(--warning)]/40 px-3 py-1.5 text-xs text-[var(--warning)] hover:bg-[var(--warning)]/10 transition-colors",children:["> ",s("machines.drain")]})]}),e.jsxs("div",{className:"px-6 py-8",children:[e.jsxs("button",{onClick:()=>r("/machines"),className:"mb-4 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:["< ",s("machines.back_to_machines")]}),e.jsxs("h1",{className:"mb-2 text-lg font-bold text-[var(--text-primary)] flex items-center gap-2",children:[a.name,e.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-normal",style:{color:O[a.status]},children:[e.jsx("span",{style:{fontSize:"0.5rem"},children:"●"}),a.status.toLowerCase()]})]}),e.jsx("p",{className:"mb-6 text-xs text-[var(--text-muted)]",children:s("machines.last_heartbeat",{time:R(a.lastHeartbeat)})}),e.jsxs("div",{className:"mb-6 grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:s("machines.resource_usage")}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(j,{label:s("machines.cpu"),value:a.cpuUsage}),e.jsx(j,{label:s("machines.mem"),value:a.memoryUsage}),e.jsx(j,{label:s("machines.disk"),value:a.diskUsage})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:s("machines.connection_info")}),e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsx(n,{label:s("machines.host"),value:a.host}),e.jsx(n,{label:s("machines.port"),value:String(a.port)}),e.jsx(n,{label:s("machines.os"),value:a.os??s("machines.unknown")}),e.jsx(n,{label:s("machines.cpu_cores"),value:a.cpuCores!=null?String(a.cpuCores):s("machines.n_a")}),e.jsx(n,{label:s("machines.memory"),value:a.memoryGb!=null?`${a.memoryGb} gb`:s("machines.n_a")}),e.jsx(n,{label:s("machines.last_heartbeat_label"),value:k(a.lastHeartbeat)}),e.jsx(n,{label:s("machines.slots"),value:`${a.activeSlots}/${a.maxSlots}`})]})]})]}),a.capabilities.length>0&&e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:s("machines.capabilities")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:a.capabilities.map(c=>e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)]",children:c},c))})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsxs("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:[s("machines.current_tasks")," (",m.length,")"]}),m.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s("machines.no_active_tasks")})]}):e.jsx(C,{tasks:m,navigate:r,t:s})]}),e.jsx(_,{isOpen:g,onClose:()=>h(!1),onConfirm:y,machineName:a.name,isDraining:b,loading:N})]})]})}function C({tasks:t,navigate:r,t:s}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-row)]",children:[e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:s("machines.id")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:s("machines.description")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:s("machines.status_label")}),e.jsx("th",{className:"py-2 text-left font-normal text-[var(--text-muted)]",children:s("machines.stage")})]})}),e.jsx("tbody",{children:t.map(a=>e.jsxs("tr",{onClick:()=>r(`/tasks/${a.id}`),className:"cursor-pointer border-b border-[var(--border-row)] hover:bg-[var(--bg-input)] transition-colors",children:[e.jsxs("td",{className:"py-2 pr-4 text-[var(--text-primary)]",children:["#",a.id]}),e.jsx("td",{className:"max-w-xs truncate py-2 pr-4 text-[var(--text-secondary)]",children:a.description}),e.jsx("td",{className:"py-2 pr-4",children:e.jsxs("span",{style:{color:F[a.status]},children:["● ",a.status.toLowerCase()]})}),e.jsx("td",{className:"py-2 text-[var(--text-secondary)]",children:a.currentStage??"-"})]},a.id))})]})})}function p({label:t,value:r,unit:s}){return e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:t}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[r,s]}),e.jsx("div",{className:"mt-3 h-1.5 w-full rounded-sm bg-[var(--bg-input)]",children:e.jsx("div",{className:"h-full rounded-sm transition-all",style:{width:`${r}%`,backgroundColor:D(r)}})})]})}function j({label:t,value:r}){return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-[var(--text-secondary)]",children:t}),e.jsxs("span",{className:"text-[var(--text-primary)]",children:[r,"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-sm bg-[var(--bg-input)]",children:e.jsx("div",{className:"h-full rounded-sm transition-all",style:{width:`${r}%`,backgroundColor:D(r)}})})]})}function n({label:t,value:r}){return e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:t}),e.jsx("span",{className:"truncate text-[var(--text-primary)]",children:r})]})}export{B as default};
|
|
1
|
+
import{a as S,j as e,l as I,m as M,d as T,r as x,h as A,f as v,L as G,s as U}from"./index-bdjBPTjT.js";import{M as o,T as d}from"./protocol-C4f2G7mk.js";import{A as w}from"./arrow-left-R4PVWL3u.js";function _({isOpen:t,onClose:r,onConfirm:s,machineName:a,isDraining:i,loading:m}){const{t:l}=S();return e.jsx(I,{isOpen:t,onClose:r,onConfirm:s,title:l(i?"machines.undrain_machine_title":"machines.drain_machine_title"),message:i?l("machines.undrain_confirm",{name:a}):l("machines.drain_confirm",{name:a}),confirmLabel:l(i?"machines.undrain":"machines.drain"),confirmVariant:i?"accent":"warning",isLoading:m})}const O={[o.ONLINE]:"var(--accent)",[o.OFFLINE]:"var(--destructive)",[o.DRAINING]:"var(--warning)"},F={[d.QUEUED]:"var(--text-muted)",[d.ASSIGNED]:"#60a5fa",[d.RUNNING]:"var(--accent)",[d.SUSPENDED]:"var(--warning)",[d.COMPLETED]:"var(--accent)",[d.FAILED]:"var(--destructive)",[d.CANCELLED]:"var(--text-muted)"};function k(t){return t?new Date(t).toLocaleString():"n/a"}function R(t){if(!t)return"never";const r=Date.now()-new Date(t).getTime(),s=Math.floor(r/1e3);if(s<60)return`${s}s ago`;const a=Math.floor(s/60);if(a<60)return`${a}m ago`;const i=Math.floor(a/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function D(t){return t>80?"var(--destructive)":t>60?"var(--warning)":"var(--accent)"}function B(){const{id:t}=M(),r=T(),{t:s}=S(),[a,i]=x.useState(null),[m,l]=x.useState([]),[L,E]=x.useState(!0),[g,h]=x.useState(!1),[N,f]=x.useState(!1);A(x.useMemo(()=>!a||a.status===o.OFFLINE||a.status===o.DRAINING?null:e.jsxs("button",{onClick:()=>h(!0),className:"rounded-[4px] border border-[var(--warning)]/40 px-3 py-1.5 text-xs text-[var(--warning)] hover:bg-[var(--warning)]/10 transition-colors",children:["> ",s("machines.drain")]}),[a,s]));const u=x.useCallback(async()=>{if(t)try{const[c,$]=await Promise.all([v.get(`web/machines/${t}`).json(),v.get(`web/machines/${t}/tasks`).json().catch(()=>[])]);i(c),l($)}catch{}finally{E(!1)}},[t]);x.useEffect(()=>{u()},[u]);async function y(){if(a){f(!0);try{const c=a.status===o.DRAINING?"undrain":"drain";await v.post(`web/machines/${a.id}/${c}`),await u()}catch{}finally{f(!1),h(!1)}}}if(L)return e.jsx("div",{className:"mx-auto max-w-5xl px-6 py-8 font-mono",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:s("machines.loading_machine")})});if(!a)return e.jsxs("div",{className:"mx-auto max-w-5xl px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:s("machines.machine_not_found")}),e.jsxs("button",{onClick:()=>r("/machines"),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:["< ",s("machines.back_to_machines")]})]});const b=a.status===o.DRAINING;return b?e.jsxs("div",{className:"mx-auto max-w-5xl font-mono lowercase",children:[e.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 shrink-0 md:hidden",style:{height:56},children:[e.jsx("button",{onClick:()=>r("/machines"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(w,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:a.name})]}),e.jsxs("div",{className:"px-6 py-8",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(G,{to:"/machines",className:"text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:s("machines.title")}),e.jsx("span",{className:"text-[var(--text-muted)]",children:"/"}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:a.name})]}),e.jsxs("button",{onClick:()=>h(!0),className:"rounded-[4px] border border-[var(--accent)] px-4 py-1.5 text-xs text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:["> ",s("machines.undrain")]})]}),e.jsx("div",{className:"mb-4",children:e.jsx("span",{className:"rounded-[4px] bg-[var(--warning)]/20 px-2.5 py-1 text-xs font-medium text-[var(--warning)]",children:s("machines.draining")})}),e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--warning)]/40 bg-[var(--warning)]/10 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(U,{className:"h-3.5 w-3.5 text-[var(--warning)]"}),e.jsx("span",{className:"text-xs text-[var(--warning)]",children:s("machines.draining_warning")})]}),e.jsx("p",{className:"text-xs text-[var(--warning)]/70 ml-5.5",children:s("machines.draining_active_tasks")})]}),e.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-4",children:[e.jsx(p,{label:s("machines.cpu"),value:a.cpuUsage,unit:"%"}),e.jsx(p,{label:s("machines.memory"),value:a.memoryUsage,unit:"%"}),e.jsx(p,{label:s("machines.disk"),value:a.diskUsage,unit:"%"}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("machines.slots")}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[a.activeSlots,"/",a.maxSlots]})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:s("machines.active_tasks")}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:m.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s("machines.no_active_tasks")})]}):e.jsx(C,{tasks:m,navigate:r,t:s})})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:s("machines.capabilities")}),a.capabilities.length>0?e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:a.capabilities.map(c=>e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx("p",{className:"text-xs text-[var(--text-primary)]",children:c})},c))}):e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("machines.no_capabilities_short")})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:s("machines.machine_info")}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsx(n,{label:s("machines.host"),value:a.host}),e.jsx(n,{label:s("machines.port"),value:String(a.port)}),e.jsx(n,{label:s("machines.os"),value:a.os??s("machines.unknown")}),e.jsx(n,{label:s("machines.cpu_cores"),value:a.cpuCores!=null?String(a.cpuCores):s("machines.n_a")}),e.jsx(n,{label:s("machines.memory"),value:a.memoryGb!=null?`${a.memoryGb} gb`:s("machines.n_a")}),e.jsx(n,{label:s("machines.last_heartbeat_label"),value:k(a.lastHeartbeat)}),e.jsx(n,{label:s("machines.slots"),value:`${a.activeSlots}/${a.maxSlots}`}),e.jsx(n,{label:s("machines.status_label"),value:a.status.toLowerCase()})]})})]}),e.jsx(_,{isOpen:g,onClose:()=>h(!1),onConfirm:y,machineName:a.name,isDraining:b,loading:N})]})]}):e.jsxs("div",{className:"mx-auto max-w-5xl font-mono lowercase",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 shrink-0 md:hidden",style:{height:56},children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("button",{onClick:()=>r("/machines"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(w,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:a.name})]}),a.status!==o.OFFLINE&&e.jsxs("button",{onClick:()=>h(!0),className:"shrink-0 rounded-[4px] border border-[var(--warning)]/40 px-3 py-1.5 text-xs text-[var(--warning)] hover:bg-[var(--warning)]/10 transition-colors",children:["> ",s("machines.drain")]})]}),e.jsxs("div",{className:"px-6 py-8",children:[e.jsxs("button",{onClick:()=>r("/machines"),className:"mb-4 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:["< ",s("machines.back_to_machines")]}),e.jsxs("h1",{className:"mb-2 text-lg font-bold text-[var(--text-primary)] flex items-center gap-2",children:[a.name,e.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-normal",style:{color:O[a.status]},children:[e.jsx("span",{style:{fontSize:"0.5rem"},children:"●"}),a.status.toLowerCase()]})]}),e.jsx("p",{className:"mb-6 text-xs text-[var(--text-muted)]",children:s("machines.last_heartbeat",{time:R(a.lastHeartbeat)})}),e.jsxs("div",{className:"mb-6 grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:s("machines.resource_usage")}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(j,{label:s("machines.cpu"),value:a.cpuUsage}),e.jsx(j,{label:s("machines.mem"),value:a.memoryUsage}),e.jsx(j,{label:s("machines.disk"),value:a.diskUsage})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:s("machines.connection_info")}),e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsx(n,{label:s("machines.host"),value:a.host}),e.jsx(n,{label:s("machines.port"),value:String(a.port)}),e.jsx(n,{label:s("machines.os"),value:a.os??s("machines.unknown")}),e.jsx(n,{label:s("machines.cpu_cores"),value:a.cpuCores!=null?String(a.cpuCores):s("machines.n_a")}),e.jsx(n,{label:s("machines.memory"),value:a.memoryGb!=null?`${a.memoryGb} gb`:s("machines.n_a")}),e.jsx(n,{label:s("machines.last_heartbeat_label"),value:k(a.lastHeartbeat)}),e.jsx(n,{label:s("machines.slots"),value:`${a.activeSlots}/${a.maxSlots}`})]})]})]}),a.capabilities.length>0&&e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:s("machines.capabilities")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:a.capabilities.map(c=>e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)]",children:c},c))})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsxs("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:[s("machines.current_tasks")," (",m.length,")"]}),m.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s("machines.no_active_tasks")})]}):e.jsx(C,{tasks:m,navigate:r,t:s})]}),e.jsx(_,{isOpen:g,onClose:()=>h(!1),onConfirm:y,machineName:a.name,isDraining:b,loading:N})]})]})}function C({tasks:t,navigate:r,t:s}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-row)]",children:[e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:s("machines.id")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:s("machines.description")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:s("machines.status_label")}),e.jsx("th",{className:"py-2 text-left font-normal text-[var(--text-muted)]",children:s("machines.stage")})]})}),e.jsx("tbody",{children:t.map(a=>e.jsxs("tr",{onClick:()=>r(`/tasks/${a.id}`),className:"cursor-pointer border-b border-[var(--border-row)] hover:bg-[var(--bg-input)] transition-colors",children:[e.jsxs("td",{className:"py-2 pr-4 text-[var(--text-primary)]",children:["#",a.id]}),e.jsx("td",{className:"max-w-xs truncate py-2 pr-4 text-[var(--text-secondary)]",children:a.description}),e.jsx("td",{className:"py-2 pr-4",children:e.jsxs("span",{style:{color:F[a.status]},children:["● ",a.status.toLowerCase()]})}),e.jsx("td",{className:"py-2 text-[var(--text-secondary)]",children:a.currentStage??"-"})]},a.id))})]})})}function p({label:t,value:r,unit:s}){return e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:t}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[r,s]}),e.jsx("div",{className:"mt-3 h-1.5 w-full rounded-sm bg-[var(--bg-input)]",children:e.jsx("div",{className:"h-full rounded-sm transition-all",style:{width:`${r}%`,backgroundColor:D(r)}})})]})}function j({label:t,value:r}){return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-[var(--text-secondary)]",children:t}),e.jsxs("span",{className:"text-[var(--text-primary)]",children:[r,"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-sm bg-[var(--bg-input)]",children:e.jsx("div",{className:"h-full rounded-sm transition-all",style:{width:`${r}%`,backgroundColor:D(r)}})})]})}function n({label:t,value:r}){return e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:t}),e.jsx("span",{className:"truncate text-[var(--text-primary)]",children:r})]})}export{B as default};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as G,a as S,j as e,r as s,f as w,X as U,o as B,d as R,u as D,h as q,q as L}from"./index-bdjBPTjT.js";import{M as b}from"./protocol-C4f2G7mk.js";import W from"./WorkerSetupGuidePage-jvt8Z6j1.js";import{C as H}from"./copy-fRb9wi57.js";import{L as K}from"./loader-circle-DyfiwA3n.js";import{S as V}from"./Select-DobTn2ab.js";import{E as X}from"./EmptyState-B5jMtmkr.js";import{C as J}from"./Skeleton-D-ZoNR01.js";import{P as Q}from"./plus-CS3VSUw-.js";import"./key-BZHp4zSH.js";import"./settings-DDZ75kV_.js";/**
|
|
2
|
+
* @license lucide-react v0.469.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const Y=G("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]),T={[b.ONLINE]:"var(--accent)",[b.OFFLINE]:"var(--destructive)",[b.DRAINING]:"var(--warning)"};function Z(a){return a>80?"var(--destructive)":a>60?"var(--warning)":"var(--accent)"}function ee({machine:a,onPress:r}){const{t:l}=S();return e.jsxs("div",{onClick:r,className:`rounded border border-[var(--border)] bg-[var(--bg-card)] p-4 font-mono lowercase transition-colors ${r?"cursor-pointer hover:border-[var(--accent)]/40 hover:bg-[var(--bg-input)]":""}`,children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("h3",{className:"truncate text-sm text-[var(--text-primary)]",children:[e.jsx("span",{style:{color:T[a.status],fontSize:"0.6rem"},children:"●"})," ",a.name]}),e.jsx("span",{className:"text-xs",style:{color:T[a.status]},children:a.status})]}),e.jsxs("div",{className:"mb-3 text-xs text-[var(--text-muted)]",children:[a.host,":",a.port]}),e.jsxs("div",{className:"mb-3 flex flex-col gap-2",children:[e.jsx(k,{label:l("machines.cpu"),value:a.cpuUsage}),e.jsx(k,{label:l("machines.mem"),value:a.memoryUsage}),e.jsx(k,{label:l("machines.disk"),value:a.diskUsage})]}),e.jsx("div",{className:"flex items-center justify-between text-xs",children:e.jsx("span",{className:"text-[var(--text-secondary)]",children:l("machines.tasks_slots",{active:String(a.activeSlots),max:String(a.maxSlots)})})}),a.capabilities.length>0&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:a.capabilities.map(t=>e.jsx("span",{className:"rounded border border-[var(--border)] px-1.5 py-0.5 text-[10px] text-[var(--text-muted)]",children:t},t))})]})}function k({label:a,value:r}){return e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-8 text-[var(--text-muted)]",children:a}),e.jsx("div",{className:"h-1.5 flex-1 rounded-sm bg-[var(--bg-input)]",children:e.jsx("div",{className:"h-full rounded-sm transition-all",style:{width:`${r}%`,backgroundColor:Z(r)}})}),e.jsxs("span",{className:"w-8 text-right text-[var(--text-secondary)]",children:[r,"%"]})]})}function te({isOpen:a,onClose:r,onRegistered:l}){const{t}=S(),[c,m]=s.useState(1),[d,u]=s.useState(!1),[o,v]=s.useState(""),[h,g]=s.useState(null),[f,j]=s.useState(""),[i,x]=s.useState(""),[y,_]=s.useState(!1),[O,C]=s.useState(""),[I,E]=s.useState(""),p=s.useRef(null),z={1:t("machines.reg_step_generate_token"),2:t("machines.reg_step_install_worker"),3:t("machines.reg_step_waiting_activation"),4:t("machines.reg_step_activated")};s.useEffect(()=>(a&&(m(1),v(""),g(null),j(""),x(""),_(!1),C(""),E(""),u(!1)),()=>{p.current&&clearInterval(p.current)}),[a]);const $=async()=>{const n=f.trim();if(!n){x(t("admin.pat_label_required"));return}x(""),u(!0);try{const N=await w.post("admin/worker-tokens",{json:{label:n}}).json();v(N.token),g(N.tokenId),m(2)}catch{}finally{u(!1)}},F=typeof window<"u"?window.location.origin:"https://overlord.example.com",M=o?`overlord setup worker --token ${o} --server ${F}`:"",P=()=>{navigator.clipboard.writeText(M),_(!0),setTimeout(()=>_(!1),2e3)},A=s.useCallback(()=>{h&&(m(3),p.current=setInterval(async()=>{try{const n=await w.get(`admin/worker-tokens/${h}/status`).json();n.used&&n.machineName&&(C(n.machineName),E(n.machineId??""),m(4),p.current&&clearInterval(p.current),l==null||l())}catch{}},3e3))},[h,l]);return s.useEffect(()=>()=>{p.current&&clearInterval(p.current)},[]),a?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center font-mono lowercase",children:[e.jsx("div",{className:"absolute inset-0 bg-[var(--bg-primary)]/60 backdrop-blur-sm",onClick:r}),e.jsxs("div",{className:"relative z-10 w-full max-w-[1080px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-8",children:[e.jsx("button",{type:"button",onClick:r,className:"absolute right-4 top-4 text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:e.jsx(U,{className:"h-4 w-4"})}),e.jsx("h2",{className:"text-lg font-bold text-[var(--accent)]",children:t("machines.reg_title")}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:t("machines.reg_subtitle")}),e.jsx("div",{className:"mt-6 flex items-center justify-center gap-2",children:[1,2,3,4].map((n,N)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:`rounded-[4px] px-3 py-1.5 text-[11px] font-bold ${n===c?"bg-[var(--accent)] text-black":n<c?"bg-[var(--accent)]/20 text-[var(--accent)]":"border border-[var(--border)] bg-[var(--bg-primary)] text-[var(--text-muted)]"}`,children:[n,". ",z[n]]}),N<3&&e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"→"})]},n))}),e.jsxs("div",{className:"mt-6 grid grid-cols-1 gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:`rounded-[4px] border p-4 ${c===1?"border-[var(--accent)] bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--accent)]",children:["> ",t("machines.reg_step_generate_token")]}),c===1&&!o?e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:t("machines.reg_click_to_generate")}),i&&e.jsx("p",{className:"text-[10px] text-red-400",children:i}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:t("admin.label")}),e.jsx("input",{type:"text",placeholder:t("admin.pat_label_placeholder"),value:f,onChange:n=>j(n.target.value),onKeyDown:n=>{n.key==="Enter"&&$()},className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-1.5 text-[11px] text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none"})]}),e.jsx("button",{type:"button",onClick:$,disabled:d,className:"rounded-[4px] bg-[var(--accent)] px-4 py-1.5 text-xs font-bold text-black disabled:opacity-50",children:t(d?"admin.generating":"machines.reg_step_generate_token")})]}):o?e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:t("machines.reg_token_generated")}),e.jsxs("p",{className:"text-[10px] text-[var(--text-muted)]",children:["1. ",t("machines.reg_install_command")]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2",children:e.jsx("p",{className:"text-[10px] text-[var(--text-primary)]",children:"$ npm install -g @overlordai/cli @overlordai/worker"})}),e.jsxs("p",{className:"text-[10px] text-[var(--text-muted)]",children:["2. ",t("machines.reg_run_setup")]}),e.jsxs("div",{className:"relative rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2 pr-16",children:[e.jsxs("code",{className:"block break-all text-[10px] text-[var(--accent)]",children:["$ ",M]}),e.jsx("button",{type:"button",onClick:P,className:"absolute right-2 top-1.5 text-[10px] text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:y?e.jsx("span",{className:"text-[var(--accent)]",children:t("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(H,{className:"h-3 w-3"})," ",t("common.copy")]})})]}),e.jsx("div",{className:"rounded-[4px] border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-[10px] text-yellow-400",children:t("admin.token_shown_once")})]}):e.jsx("p",{className:"mt-2 text-[10px] text-[var(--text-muted)]",children:t("machines.reg_completed")})]}),e.jsxs("div",{className:`rounded-[4px] border p-4 ${c===2?"border-[var(--accent)] bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--text-primary)]",children:["> ",t("machines.reg_step_install_worker")]}),e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("machines.reg_running_installation")}),c>=2&&e.jsxs("div",{className:"mt-3 space-y-1 rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] p-3",children:[e.jsx("p",{className:"text-[10px] text-[var(--text-primary)]",children:"$ overlord setup worker"}),e.jsx("p",{className:"text-[10px] text-[var(--text-muted)]",children:"server url: https://..."}),e.jsx("p",{className:"text-[10px] text-[var(--text-muted)]",children:"worker token: ovw_..."}),e.jsx("p",{className:"text-[10px] text-[var(--text-muted)]",children:"machine name: my-worker"}),e.jsx("p",{className:"text-[10px] text-[var(--accent)]",children:"config written. starting worker..."}),c===2&&e.jsx("p",{className:"text-[10px] text-[var(--accent)] animate-pulse",children:"█"})]}),c===2&&e.jsx("button",{type:"button",onClick:A,className:"mt-3 rounded-[4px] bg-[var(--accent)] px-4 py-1.5 text-xs font-bold text-black",children:t("machines.reg_installed_wait")})]}),e.jsxs("div",{className:`rounded-[4px] border p-4 ${c===3?"border-amber-500 bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--text-primary)]",children:["> ",t("machines.reg_step_waiting_activation")]}),c>=3?e.jsx("div",{className:"mt-3 flex flex-col items-center justify-center gap-3 py-6",children:c===3?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full border-2 border-amber-500",children:e.jsx(K,{className:"h-5 w-5 animate-spin text-amber-500"})}),e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:t("machines.reg_listening_for_worker")})]}):e.jsx("p",{className:"text-[10px] text-[var(--accent)]",children:t("machines.reg_worker_connected")})}):e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("machines.reg_waiting_for_worker")})]}),e.jsxs("div",{className:`rounded-[4px] border p-4 ${c===4?"border-[var(--accent)] bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--text-primary)]",children:["> ",t("machines.reg_step_activated")]}),c===4?e.jsxs("div",{className:"mt-3 flex flex-col items-center justify-center gap-3 py-6",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-[var(--accent)]/20",children:e.jsx(B,{className:"h-6 w-6 text-[var(--accent)]"})}),e.jsx("p",{className:"text-xs font-bold text-[var(--accent)]",children:t("machines.reg_worker_activated",{name:O})}),I&&e.jsxs("p",{className:"text-[10px] text-[var(--text-muted)]",children:["machine_id: ",I]})]}):e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("machines.reg_worker_registered")})]})]}),c===4&&e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{type:"button",onClick:r,className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-xs font-bold text-black",children:t("machines.reg_done")})})]})]}):null}function pe(){const a=R(),{t:r}=S(),[l,t]=s.useState([]),[c,m]=s.useState(!0),[d,u]=s.useState("all"),[o,v]=s.useState("fleet"),[h,g]=s.useState(!1),f=D(i=>{var x;return(x=i.user)==null?void 0:x.role}),j=s.useMemo(()=>[{value:"all",label:r("machines.all_statuses")},{value:b.ONLINE,label:r("machines.online")},{value:b.OFFLINE,label:r("machines.offline")},{value:b.DRAINING,label:r("machines.draining")}],[r]);return q(s.useMemo(()=>f==="admin"?e.jsxs("button",{type:"button",onClick:()=>g(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",children:[e.jsx(Q,{size:14}),r("machines.register_worker")]}):null,[f,r])),s.useEffect(()=>{async function i(){m(!0);try{const x=new URLSearchParams;d!=="all"&&x.set("status",d);const y=await w.get("web/machines",{searchParams:x}).json();t(y)}catch{}finally{m(!1)}}i()},[d]),e.jsxs("div",{className:"mx-auto max-w-6xl px-6 py-8 font-mono lowercase",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between border-b border-[var(--border)]",children:[e.jsxs("div",{className:"flex",children:[e.jsxs("button",{type:"button",onClick:()=>v("fleet"),className:`flex items-center gap-2 px-4 py-2.5 text-xs transition-colors ${o==="fleet"?"border-b-2 border-[var(--accent)] text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:[e.jsx(L,{size:14}),r("machines.fleet")]}),e.jsxs("button",{type:"button",onClick:()=>v("setup_guide"),className:`flex items-center gap-2 px-4 py-2.5 text-xs transition-colors ${o==="setup_guide"?"border-b-2 border-[var(--accent)] text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:[e.jsx(Y,{size:14}),r("machines.setup_guide")]})]}),o==="fleet"&&e.jsx(V,{value:d,onChange:u,options:j})]}),o==="fleet"?c?e.jsx(J,{cards:6}):l.length===0?e.jsx(X,{icon:L,title:r("machines.no_machines_found"),description:r(d!=="all"?"machines.try_changing_status_filter":"machines.no_machines_registered"),action:e.jsx("button",{type:"button",onClick:()=>v("setup_guide"),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:r("machines.view_setup_guide")})}):e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:l.map(i=>e.jsx(ee,{machine:i,onPress:()=>a(`/machines/${i.id}`)},i.id))}):e.jsx(W,{}),e.jsx(te,{isOpen:h,onClose:()=>g(!1),onRegistered:()=>{u("all")}})]})}export{pe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as a,a as n,j as e,L as o}from"./index-
|
|
1
|
+
import{d as a,a as n,j as e,L as o}from"./index-bdjBPTjT.js";function x(){const r=a(),{t}=n();return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-[var(--bg-primary)] p-8 font-mono",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-12 py-16",children:[e.jsx("span",{className:"text-7xl font-bold text-[var(--border)]",children:t("common.not_found")}),e.jsx("span",{className:"text-base font-bold text-red-500",children:t("common.page_not_found")}),e.jsx("span",{className:"max-w-[340px] text-center text-xs text-[var(--text-muted)]",children:t("common.the_page_does_not_exist")}),e.jsxs("div",{className:"w-full max-w-[380px] rounded-[4px] bg-[#0C0C0C] px-4 py-3",children:[e.jsxs("p",{className:"font-mono text-xs leading-relaxed text-[var(--text-muted)]",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"> overlord $"})," ",e.jsx("span",{className:"text-[#e4e4e4]",children:"page --get /unknown"})]}),e.jsx("p",{className:"mt-1 font-mono text-xs leading-relaxed text-red-500",children:t("common.not_found_terminal_error")})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(o,{to:"/",className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black transition-all hover:brightness-110",children:t("common.go_home")}),e.jsx("button",{type:"button",onClick:()=>r(-1),className:"rounded-[4px] border border-[var(--border)] bg-transparent px-5 py-2 text-[11px] font-bold text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",children:t("common.go_back")})]})]})})}export{x as default};
|