@overlordai/server 1.0.27 → 1.0.31
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/dist/database/repositories/machine.repository.d.ts +2 -1
- package/dist/database/repositories/machine.repository.d.ts.map +1 -1
- package/dist/database/repositories/machine.repository.js +17 -5
- package/dist/database/repositories/machine.repository.js.map +1 -1
- package/dist/database/repositories/project-member.repository.d.ts +7 -0
- package/dist/database/repositories/project-member.repository.d.ts.map +1 -1
- package/dist/database/repositories/project-member.repository.js +31 -1
- package/dist/database/repositories/project-member.repository.js.map +1 -1
- package/dist/database/repositories/project.repository.d.ts +1 -0
- package/dist/database/repositories/project.repository.d.ts.map +1 -1
- package/dist/database/repositories/project.repository.js +5 -2
- package/dist/database/repositories/project.repository.js.map +1 -1
- package/dist/database/repositories/task.repository.d.ts +2 -0
- package/dist/database/repositories/task.repository.d.ts.map +1 -1
- package/dist/database/repositories/task.repository.js +15 -0
- package/dist/database/repositories/task.repository.js.map +1 -1
- package/dist/dispatcher/dispatcher.service.d.ts.map +1 -1
- package/dist/dispatcher/dispatcher.service.js +10 -1
- package/dist/dispatcher/dispatcher.service.js.map +1 -1
- package/dist/dispatcher/machine-selector.d.ts.map +1 -1
- package/dist/dispatcher/machine-selector.js +4 -0
- package/dist/dispatcher/machine-selector.js.map +1 -1
- package/dist/dispatcher/reconciler.d.ts +2 -0
- package/dist/dispatcher/reconciler.d.ts.map +1 -1
- package/dist/dispatcher/reconciler.js +7 -3
- package/dist/dispatcher/reconciler.js.map +1 -1
- package/dist/main.js +0 -0
- package/dist/web/admin/admin-machine.controller.d.ts +12 -1
- package/dist/web/admin/admin-machine.controller.d.ts.map +1 -1
- package/dist/web/admin/admin-machine.controller.js +71 -3
- package/dist/web/admin/admin-machine.controller.js.map +1 -1
- package/dist/web/admin/admin-project.controller.d.ts +2 -0
- package/dist/web/admin/admin-project.controller.d.ts.map +1 -1
- package/dist/web/admin/admin-project.controller.js +2 -1
- package/dist/web/admin/admin-project.controller.js.map +1 -1
- package/dist/web/machine.controller.d.ts +12 -0
- package/dist/web/machine.controller.d.ts.map +1 -1
- package/dist/web/machine.controller.js +7 -0
- package/dist/web/machine.controller.js.map +1 -1
- package/dist/web/project.controller.d.ts +34 -2
- package/dist/web/project.controller.d.ts.map +1 -1
- package/dist/web/project.controller.js +18 -3
- package/dist/web/project.controller.js.map +1 -1
- package/package.json +9 -9
- package/public/assets/{AccessTokensPage-DjXg_GcZ.js → AccessTokensPage-Beru3_uy.js} +1 -1
- package/public/assets/{AdminPage-LU3VU8sd.js → AdminPage-C9GCTLmr.js} +1 -1
- package/public/assets/{ApiReferencePage-BMDuk9em.js → ApiReferencePage-D-Fjl8KM.js} +1 -1
- package/public/assets/{AuditLogPage-BQnvLBUm.js → AuditLogPage-Bpgs5-4t.js} +1 -1
- package/public/assets/{BotManage-Is69ZQBf.js → BotManage-ByFUoMlI.js} +1 -1
- package/public/assets/CliReferencePage-CkOKnvml.js +8 -0
- package/public/assets/{DeveloperManage-Ma4FgQXQ.js → DeveloperManage-DX12zFgn.js} +1 -1
- package/public/assets/{EditProjectPage-C78aJ078.js → EditProjectPage-DlK_Ix-g.js} +2 -2
- package/public/assets/{EmptyState-BQ2BNVJS.js → EmptyState-B5qaL1Ft.js} +1 -1
- package/public/assets/HomePage-NfxPPkMz.js +1 -0
- package/public/assets/LandingPage-DWdKl5kd.js +36 -0
- package/public/assets/{LoginPage-CMyyf5ts.js → LoginPage-CjzZ3RX2.js} +1 -1
- package/public/assets/MachineDetailPage-2B713TKQ.js +1 -0
- package/public/assets/MachineListPage-DWiQXnAq.js +6 -0
- package/public/assets/{NotFoundPage-Ck2hYu_B.js → NotFoundPage-CXxb3Nk1.js} +1 -1
- package/public/assets/{PipelineEditorPage-hoXGXxtB.js → PipelineEditorPage-DzgL7Mbc.js} +1 -1
- package/public/assets/{ProfilePage-DQQh-J_f.js → ProfilePage-bdFIMKIC.js} +1 -1
- package/public/assets/ProjectDetailPage-ngZeWsrI.js +7 -0
- package/public/assets/ProjectListPage-BQC9noAd.js +6 -0
- package/public/assets/{QuickAuth-CoRuLOkE.js → QuickAuth-BHBoThUh.js} +1 -1
- package/public/assets/RemoveMemberConfirmDialog-CGkSeDTJ.js +6 -0
- package/public/assets/{Select-cAwdx-J1.js → Select-B2hs4bPZ.js} +2 -2
- package/public/assets/{SettingsPage-vlEdzALt.js → SettingsPage-CXxoYjb1.js} +1 -1
- package/public/assets/{Skeleton-DkwMPaZ1.js → Skeleton-CyWhQxlf.js} +1 -1
- package/public/assets/SkillPage-DlnLHNuI.js +1 -0
- package/public/assets/{TaskDetailPage-CSM2ew4E.js → TaskDetailPage-DUQWe5wB.js} +1 -1
- package/public/assets/{TaskListPage-Dr_IZ2vJ.js → TaskListPage-Cg1ETrwI.js} +1 -1
- package/public/assets/{TaskStatusBadge-B6pZ1mXD.js → TaskStatusBadge-D-fJDHQh.js} +1 -1
- package/public/assets/TokenManage-Bcru_MF_.js +1 -0
- package/public/assets/{TotpSetupPage-CedCLn9b.js → TotpSetupPage-XZCrdH2V.js} +1 -1
- package/public/assets/{WorkerSetupGuidePage-C-faBGTF.js → WorkerSetupGuidePage-B0a3heGA.js} +1 -1
- package/public/assets/{arrow-left-B701wpRZ.js → arrow-left-CxR172-I.js} +1 -1
- package/public/assets/{arrow-right-B4SWX5QX.js → arrow-right-Bxsjp0zK.js} +1 -1
- package/public/assets/{bot-BMG_Lak4.js → bot-LvDZi4g_.js} +1 -1
- package/public/assets/{chevron-right-Dv5NEUXH.js → chevron-right-CoYBbtaS.js} +1 -1
- package/public/assets/{copy-C0vNNRrm.js → copy-BOEo9gzs.js} +1 -1
- package/public/assets/{external-link-CVx7jdXb.js → external-link-DEXczFxv.js} +1 -1
- package/public/assets/index-BiwmRYQP.js +212 -0
- package/public/assets/index-MbPa7F7Y.css +1 -0
- package/public/assets/{key-OwB_ZR3T.js → key-BKYKn-II.js} +1 -1
- package/public/assets/{loader-circle-BN3eQzTt.js → loader-circle-CGl2dNxT.js} +1 -1
- package/public/assets/{pencil-BtnOFy3d.js → pencil-DJx3NobK.js} +1 -1
- package/public/assets/{plus-Cm_mqbAL.js → plus-B1evYZLw.js} +1 -1
- package/public/assets/protocol-C5uQmiiB.js +1 -0
- package/public/assets/{rotate-ccw-Di9lk9Jq.js → rotate-ccw-DIm7zEDs.js} +1 -1
- package/public/assets/{scroll-text-C8HTue-V.js → scroll-text-DXm8XEUQ.js} +1 -1
- package/public/assets/{settings-BxP_lYKz.js → settings-C0zveA0i.js} +1 -1
- package/public/assets/{task.store-CRByTXd0.js → task.store-BT1elMl0.js} +1 -1
- package/public/assets/{trash-2-Bzd6fyHf.js → trash-2-D_ao7mjo.js} +1 -1
- package/public/assets/{users-DmYD60pt.js → users-DNGcsSkr.js} +1 -1
- package/public/favicon.svg +2 -2
- package/public/index.html +3 -3
- package/public/assets/CliReferencePage-DpDJXb2B.js +0 -8
- package/public/assets/HomePage-Bl0KZPgn.js +0 -1
- package/public/assets/LandingPage-Bxv40luT.js +0 -26
- package/public/assets/MachineDetailPage-BARcjlVJ.js +0 -1
- package/public/assets/MachineListPage-C044mEFY.js +0 -6
- package/public/assets/ProjectDetailPage-7wHRY-_7.js +0 -7
- package/public/assets/ProjectListPage-Cpzf-qNq.js +0 -6
- package/public/assets/RemoveMemberConfirmDialog-C-UcPD2-.js +0 -6
- package/public/assets/TokenManage-TLgRE0QO.js +0 -1
- package/public/assets/index-BTxGPsOB.js +0 -207
- package/public/assets/index-v5rpOoDH.css +0 -1
- package/public/assets/protocol-C4f2G7mk.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as E,j as e,l as M,m as H,d as V,r as o,u as z,h as B,f as b,L as Q,s as C}from"./index-BiwmRYQP.js";import{M as i,T as x}from"./protocol-C5uQmiiB.js";import{T as S}from"./trash-2-D_ao7mjo.js";import{A as D}from"./arrow-left-CxR172-I.js";function q({isOpen:t,onClose:r,onConfirm:a,machineName:s,isDraining:l,loading:d}){const{t:m}=E();return e.jsx(M,{isOpen:t,onClose:r,onConfirm:a,title:m(l?"machines.undrain_machine_title":"machines.drain_machine_title"),message:l?m("machines.undrain_confirm",{name:s}):m("machines.drain_confirm",{name:s}),confirmLabel:m(l?"machines.undrain":"machines.drain"),confirmVariant:l?"accent":"warning",isLoading:d})}const J={[i.ONLINE]:"var(--accent)",[i.OFFLINE]:"var(--destructive)",[i.DRAINING]:"var(--warning)",[i.DECOMMISSIONED]:"var(--text-muted)"},K={[x.QUEUED]:"var(--text-muted)",[x.ASSIGNED]:"#60a5fa",[x.RUNNING]:"var(--accent)",[x.SUSPENDED]:"var(--warning)",[x.COMPLETED]:"var(--accent)",[x.FAILED]:"var(--destructive)",[x.CANCELLED]:"var(--text-muted)"};function g(t){return t?new Date(t).toLocaleString():"n/a"}function W(t){if(!t)return"never";const r=Date.now()-new Date(t).getTime(),a=Math.floor(r/1e3);if(a<60)return`${a}s ago`;const s=Math.floor(a/60);if(s<60)return`${s}m ago`;const l=Math.floor(s/60);return l<24?`${l}h ago`:`${Math.floor(l/24)}d ago`}function I(t){return t>80?"var(--destructive)":t>60?"var(--warning)":"var(--accent)"}function se(){const{id:t}=H(),r=V(),{t:a}=E(),[s,l]=o.useState(null),[d,m]=o.useState([]),[L,O]=o.useState(!0),[$,h]=o.useState(!1),[T,y]=o.useState(!1),[A,u]=o.useState(!1),[U,w]=o.useState(!1),p=z(c=>{var v;return(v=c.user)==null?void 0:v.role});B(o.useMemo(()=>!s||s.status===i.DECOMMISSIONED?null:e.jsxs("div",{className:"flex items-center gap-2",children:[s.status===i.ONLINE&&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:["> ",a("machines.drain")]}),p==="admin"&&e.jsxs("button",{onClick:()=>u(!0),className:"flex items-center gap-1 rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-xs text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors",children:[e.jsx(S,{className:"h-3 w-3"}),a("machines.decommission")]})]}),[s,p,a]));const j=o.useCallback(async()=>{if(t)try{const[c,v]=await Promise.all([b.get(`web/machines/${t}`).json(),b.get(`web/machines/${t}/tasks`).json().catch(()=>[])]);l(c),m(v)}catch{}finally{O(!1)}},[t]);o.useEffect(()=>{j()},[j]);async function G(){if(s){y(!0);try{const c=s.status===i.DRAINING?"undrain":"drain";await b.post(`web/machines/${s.id}/${c}`),await j()}catch{}finally{y(!1),h(!1)}}}async function F(){if(s){w(!0);try{await b.delete(`admin/machines/${s.id}`),r("/machines")}catch{}finally{w(!1),u(!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:a("machines.loading_machine")})});if(!s)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:a("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:["< ",a("machines.back_to_machines")]})]});const _=s.status===i.DRAINING,R=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(D,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:s.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(Q,{to:"/machines",className:"text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:a("machines.title")}),e.jsx("span",{className:"text-[var(--text-muted)]",children:"/"}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:s.name})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[s.status!==i.DECOMMISSIONED&&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:["> ",a("machines.undrain")]}),p==="admin"&&s.status!==i.DECOMMISSIONED&&e.jsxs("button",{onClick:()=>u(!0),className:"flex items-center gap-1 rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-xs text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors",children:[e.jsx(S,{className:"h-3 w-3"}),a("machines.decommission")]})]})]}),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:a("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(C,{className:"h-3.5 w-3.5 text-[var(--warning)]"}),e.jsx("span",{className:"text-xs text-[var(--warning)]",children:a("machines.draining_warning")})]}),e.jsx("p",{className:"text-xs text-[var(--warning)]/70 ml-5.5",children:a("machines.draining_active_tasks")})]}),e.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-4",children:[e.jsx(f,{label:a("machines.cpu"),value:s.cpuUsage,unit:"%"}),e.jsx(f,{label:a("machines.memory"),value:s.memoryUsage,unit:"%"}),e.jsx(f,{label:a("machines.disk"),value:s.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:a("machines.slots")}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[s.activeSlots,"/",s.maxSlots]})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:a("machines.active_tasks")}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:d.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:a("machines.no_active_tasks")})]}):e.jsx(k,{tasks:d,navigate:r,t:a})})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:a("machines.capabilities")}),s.capabilities.length>0?e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:s.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:a("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:a("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:a("machines.host"),value:s.host}),e.jsx(n,{label:a("machines.port"),value:String(s.port)}),s.sshUrl&&e.jsx(n,{label:"ssh url",value:s.sshUrl}),e.jsx(n,{label:a("machines.os"),value:s.os??a("machines.unknown")}),e.jsx(n,{label:a("machines.cpu_model"),value:s.cpuModel??a("machines.n_a")}),e.jsx(n,{label:a("machines.cpu_cores"),value:s.cpuCores!=null?String(s.cpuCores):a("machines.n_a")}),e.jsx(n,{label:a("machines.memory"),value:s.memoryGb!=null?`${s.memoryGb} gb`:a("machines.n_a")}),e.jsx(n,{label:a("machines.machine_id"),value:s.id}),e.jsx(n,{label:a("machines.last_heartbeat_label"),value:g(s.lastHeartbeat)}),e.jsx(n,{label:a("machines.slots"),value:`${s.activeSlots}/${s.maxSlots}`}),e.jsx(n,{label:a("machines.status_label"),value:s.status.toLowerCase()}),e.jsx(n,{label:a("machines.worker_version"),value:s.workerVersion??a("machines.n_a")})]})})]})]})]}),P=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(D,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:s.name})]}),s.status!==i.OFFLINE&&s.status!==i.DECOMMISSIONED&&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:["> ",a("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:["< ",a("machines.back_to_machines")]}),e.jsxs("h1",{className:"mb-2 text-lg font-bold text-[var(--text-primary)] flex items-center gap-2",children:[s.name,e.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-normal",style:{color:J[s.status]},children:[e.jsx("span",{style:{fontSize:"0.5rem"},children:"●"}),s.status.toLowerCase()]})]}),e.jsx("p",{className:"mb-6 text-xs text-[var(--text-muted)]",children:a("machines.last_heartbeat",{time:W(s.lastHeartbeat)})}),s.status===i.DECOMMISSIONED&&e.jsx("div",{className:"mb-6 rounded-[4px] border border-[var(--text-muted)]/40 bg-[var(--text-muted)]/10 p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["this machine has been decommissioned",s.decommissionedAt?` on ${g(s.decommissionedAt)}`:""," and can no longer accept tasks."]})]})}),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:a("machines.resource_usage")}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(N,{label:a("machines.cpu"),value:s.cpuUsage}),e.jsx(N,{label:a("machines.mem"),value:s.memoryUsage}),e.jsx(N,{label:a("machines.disk"),value:s.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:a("machines.connection_info")}),e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsx(n,{label:a("machines.machine_id"),value:s.id}),e.jsx(n,{label:a("machines.host"),value:s.host}),e.jsx(n,{label:a("machines.port"),value:String(s.port)}),s.sshUrl&&e.jsx(n,{label:"ssh url",value:s.sshUrl}),e.jsx(n,{label:a("machines.os"),value:s.os??a("machines.unknown")}),e.jsx(n,{label:a("machines.cpu_model"),value:s.cpuModel??a("machines.n_a")}),e.jsx(n,{label:a("machines.cpu_cores"),value:s.cpuCores!=null?String(s.cpuCores):a("machines.n_a")}),e.jsx(n,{label:a("machines.memory"),value:s.memoryGb!=null?`${s.memoryGb} gb`:a("machines.n_a")}),e.jsx(n,{label:a("machines.last_heartbeat_label"),value:g(s.lastHeartbeat)}),e.jsx(n,{label:a("machines.slots"),value:`${s.activeSlots}/${s.maxSlots}`})]})]})]}),s.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:a("machines.capabilities")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.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:[a("machines.current_tasks")," (",d.length,")"]}),d.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:a("machines.no_active_tasks")})]}):e.jsx(k,{tasks:d,navigate:r,t:a})]})]})]});return e.jsxs(e.Fragment,{children:[_?R:P,e.jsx(q,{isOpen:$,onClose:()=>h(!1),onConfirm:G,machineName:s.name,isDraining:_,loading:T}),e.jsx(M,{isOpen:A,onClose:()=>u(!1),onConfirm:F,title:a("machines.decommission_title"),message:a("machines.decommission_confirm",{name:s.name}),confirmLabel:a("machines.decommission"),confirmVariant:"danger",isLoading:U})]})}function k({tasks:t,navigate:r,t:a}){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:a("machines.id")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:a("machines.description")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:a("machines.status_label")}),e.jsx("th",{className:"py-2 text-left font-normal text-[var(--text-muted)]",children:a("machines.stage")})]})}),e.jsx("tbody",{children:t.map(s=>e.jsxs("tr",{onClick:()=>r(`/tasks/${s.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:["#",s.id]}),e.jsx("td",{className:"max-w-xs truncate py-2 pr-4 text-[var(--text-secondary)]",children:s.description}),e.jsx("td",{className:"py-2 pr-4",children:e.jsxs("span",{style:{color:K[s.status]},children:["● ",s.status.toLowerCase()]})}),e.jsx("td",{className:"py-2 text-[var(--text-secondary)]",children:s.currentStage??"-"})]},s.id))})]})})}function f({label:t,value:r,unit:a}){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,a]}),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:I(r)}})})]})}function N({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:I(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{se as default};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as D,a as C,j as e,r as s,f as S,X as G,o as R,d as U,u as B,h as K,q as T}from"./index-BiwmRYQP.js";import{M as u}from"./protocol-C5uQmiiB.js";import q from"./WorkerSetupGuidePage-B0a3heGA.js";import{C as W}from"./copy-BOEo9gzs.js";import{L as H}from"./loader-circle-CGl2dNxT.js";import{S as V}from"./Select-B2hs4bPZ.js";import{E as X}from"./EmptyState-B5qaL1Ft.js";import{C as J}from"./Skeleton-CyWhQxlf.js";import{P as Q}from"./plus-B1evYZLw.js";import"./key-BKYKn-II.js";import"./settings-C0zveA0i.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=D("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"}]]),O={[u.ONLINE]:"var(--accent)",[u.OFFLINE]:"var(--destructive)",[u.DRAINING]:"var(--warning)",[u.DECOMMISSIONED]:"var(--text-muted)"};function Z(r){return r>80?"var(--destructive)":r>60?"var(--warning)":"var(--accent)"}function ee({machine:r,onPress:a}){const{t:i}=C();return e.jsxs("div",{onClick:a,className:`rounded border border-[var(--border)] bg-[var(--bg-card)] p-4 font-mono lowercase transition-colors ${a?"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:O[r.status],fontSize:"0.6rem"},children:"●"})," ",r.name]}),e.jsx("span",{className:"text-xs",style:{color:O[r.status]},children:r.status})]}),e.jsxs("div",{className:"mb-3 text-xs text-[var(--text-muted)]",children:[r.host,r.port?`:${r.port}`:""]}),e.jsxs("div",{className:"mb-3 flex flex-col gap-2",children:[e.jsx(w,{label:i("machines.cpu"),value:r.cpuUsage}),e.jsx(w,{label:i("machines.mem"),value:r.memoryUsage}),e.jsx(w,{label:i("machines.disk"),value:r.diskUsage})]}),e.jsx("div",{className:"flex items-center justify-between text-xs",children:e.jsx("span",{className:"text-[var(--text-secondary)]",children:i("machines.tasks_slots",{active:String(r.activeSlots),max:String(r.maxSlots)})})}),r.capabilities.length>0&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:r.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 w({label:r,value:a}){return e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-8 text-[var(--text-muted)]",children:r}),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:`${a}%`,backgroundColor:Z(a)}})}),e.jsxs("span",{className:"w-8 text-right text-[var(--text-secondary)]",children:[a,"%"]})]})}function te({isOpen:r,onClose:a,onRegistered:i}){const{t}=C(),[c,m]=s.useState(1),[d,h]=s.useState(!1),[o,v]=s.useState(""),[g,f]=s.useState(null),[y,b]=s.useState(""),[j,N]=s.useState(""),[l,x]=s.useState(!1),[k,I]=s.useState(""),[E,M]=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(()=>(r&&(m(1),v(""),f(null),b(""),N(""),x(!1),I(""),M(""),h(!1)),()=>{p.current&&clearInterval(p.current)}),[r]);const $=async()=>{const n=y.trim();if(!n){N(t("admin.pat_label_required"));return}N(""),h(!0);try{const _=await S.post("admin/worker-tokens",{json:{label:n}}).json();v(_.token),f(_.tokenId),m(2)}catch{}finally{h(!1)}},F=typeof window<"u"?window.location.origin:"https://overlord.example.com",L=o?`overlord setup worker --token ${o} --server ${F}`:"",P=()=>{navigator.clipboard.writeText(L),x(!0),setTimeout(()=>x(!1),2e3)},A=s.useCallback(()=>{g&&(m(3),p.current=setInterval(async()=>{try{const n=await S.get(`admin/worker-tokens/${g}/status`).json();n.used&&n.machineName&&(I(n.machineName),M(n.machineId??""),m(4),p.current&&clearInterval(p.current),i==null||i())}catch{}},3e3))},[g,i]);return s.useEffect(()=>()=>{p.current&&clearInterval(p.current)},[]),r?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:a}),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:a,className:"absolute right-4 top-4 text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:e.jsx(G,{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,_)=>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]]}),_<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")}),j&&e.jsx("p",{className:"text-[10px] text-red-400",children:j}),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:y,onChange:n=>b(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:["$ ",L]}),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:l?e.jsx("span",{className:"text-[var(--accent)]",children:t("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(W,{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(H,{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(R,{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:k})}),E&&e.jsxs("p",{className:"text-[10px] text-[var(--text-muted)]",children:["machine_id: ",E]})]}):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:a,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 r=U(),{t:a}=C(),[i,t]=s.useState([]),[c,m]=s.useState(!0),[d,h]=s.useState("all"),[o,v]=s.useState("fleet"),[g,f]=s.useState(!1),[y,b]=s.useState(0),j=B(l=>{var x;return(x=l.user)==null?void 0:x.role}),N=s.useMemo(()=>[{value:"all",label:a("machines.all_statuses")},{value:u.ONLINE,label:a("machines.online")},{value:u.OFFLINE,label:a("machines.offline")},{value:u.DRAINING,label:a("machines.draining")}],[a]);return K(s.useMemo(()=>j==="admin"?e.jsxs("button",{type:"button",onClick:()=>f(!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}),a("machines.register_worker")]}):null,[j,a])),s.useEffect(()=>{async function l(){m(!0);try{const x=new URLSearchParams;d!=="all"&&x.set("status",d);const k=await S.get("web/machines",{searchParams:x}).json();t(k)}catch{}finally{m(!1)}}l()},[d,y]),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"),b(l=>l+1)},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(T,{size:14}),a("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}),a("machines.setup_guide")]})]}),o==="fleet"&&e.jsx(V,{value:d,onChange:h,options:N})]}),o==="fleet"?c?e.jsx(J,{cards:6}):i.length===0?e.jsx(X,{icon:T,title:a("machines.no_machines_found"),description:a(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:a("machines.view_setup_guide")})}):e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:i.map(l=>e.jsx(ee,{machine:l,onPress:()=>r(`/machines/${l.id}`)},l.id))}):e.jsx(q,{}),e.jsx(te,{isOpen:g,onClose:()=>{f(!1),b(l=>l+1)},onRegistered:()=>{b(l=>l+1)}})]})}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-BiwmRYQP.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};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as g,r as p,j as e,m as M,d as T,f as k,t as y}from"./index-
|
|
1
|
+
import{a as g,r as p,j as e,m as M,d as T,f as k,t as y}from"./index-BiwmRYQP.js";import{S as B}from"./Select-B2hs4bPZ.js";const C={timeout:600,retries:0,confirm:!1,irreversible:!1};function D(){return{name:"",command:"",executor:"claude_code",timeout:600,retries:0,confirm:!1}}const F={claude_code:{label:"claude",color:"var(--accent)"},cursor:{label:"cursor",color:"var(--info)"},shell:{label:"shell",color:"var(--warning)"}};function V(t){switch(t){case"claude":case"claude_code":return"var(--accent)";case"cursor":return"var(--info)";case"shell":return"var(--warning)";default:return"#737373"}}function W({executor:t}){const o=F[t??"claude_code"]??F.claude_code;return e.jsx("span",{className:"inline-block rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase leading-none",style:{color:o.color,border:`1px solid ${o.color}`,opacity:.85},children:o.label})}function u({children:t}){return e.jsx("label",{className:"mb-1 block font-mono text-[11px] text-[var(--text-secondary)]",children:t})}function f({value:t,onChange:o,placeholder:n,type:r="text",className:a=""}){return e.jsx("input",{type:r,value:t,onChange:c=>o(c.target.value),placeholder:n,className:`w-full rounded border border-[var(--border)] bg-[var(--bg-primary)] px-2.5 py-1.5 font-mono text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none ${a}`})}function N({value:t,onChange:o,options:n,className:r=""}){return e.jsx(B,{value:t,onChange:o,options:n,className:r})}function $({checked:t,onChange:o}){return e.jsx("button",{type:"button",role:"switch","aria-checked":t,onClick:()=>o(!t),className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-[var(--border)] transition-colors ${t?"bg-[var(--accent)]":"bg-[var(--bg-primary)]"}`,children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white shadow transition-transform ${t?"translate-x-[18px]":"translate-x-[2px]"}`})})}function L({value:t,onChange:o,placeholder:n,rows:r=4}){return e.jsx("textarea",{value:t,onChange:a=>o(a.target.value),placeholder:n,rows:r,className:"w-full rounded border border-[var(--border)] bg-[var(--bg-primary)] px-2.5 py-1.5 font-mono text-xs leading-relaxed text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none"})}function q({stage:t,index:o,selected:n,onSelect:r,onDelete:a}){const{t:c}=g(),l=t.confirm?t.type?`confirm:${t.type}`:"confirm":null;return e.jsxs("button",{type:"button",onClick:r,className:`group relative flex w-full items-start gap-3 rounded-[4px] border px-4 py-3 text-left transition-colors ${n?"border-[var(--accent)] bg-[var(--bg-card)]":"border-[var(--border)] bg-[var(--bg-card)] hover:border-[var(--text-muted)]"}`,style:{borderLeftWidth:3,borderLeftColor:V(t.executor)},children:[e.jsx("span",{className:"mt-0.5 shrink-0 font-mono text-[10px] text-[var(--text-muted)]",children:String(o+1).padStart(2,"0")}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs font-bold text-[var(--text-primary)]",children:t.name||"unnamed"}),e.jsx(W,{executor:t.executor})]}),e.jsxs("div",{className:"mt-1 flex items-center gap-2 font-mono text-[10px] text-[var(--text-muted)]",children:[l&&e.jsx("span",{children:l}),t.timeout!=null&&e.jsxs("span",{children:["timeout:",t.timeout,"s"]})]})]}),e.jsx("button",{type:"button",onClick:x=>{x.stopPropagation(),a()},className:"mt-0.5 shrink-0 rounded p-0.5 text-[var(--text-muted)] opacity-0 transition-opacity hover:text-[var(--destructive)] group-hover:opacity-100","aria-label":c("pipeline.delete_stage"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})}function A({stage:t,onChange:o}){const{t:n}=g();return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"font-mono text-sm font-semibold text-[var(--accent)]",children:n("pipeline.stage_properties")}),e.jsx("p",{className:"font-mono text-[11px] text-[var(--text-muted)]",children:n("pipeline.editing",{name:t.name||n("pipeline.unnamed")})}),e.jsxs("div",{children:[e.jsx(u,{children:n("pipeline.name")}),e.jsx(f,{value:t.name,onChange:r=>o({name:r}),placeholder:n("pipeline.stage_name")})]}),e.jsxs("div",{children:[e.jsx(u,{children:n("pipeline.executor")}),e.jsx(N,{value:t.executor??"claude_code",onChange:r=>o({executor:r}),options:[{value:"claude_code",label:"claude_code"},{value:"cursor",label:"cursor"},{value:"shell",label:"shell"}]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(u,{children:n("pipeline.timeout")}),e.jsx(f,{type:"number",value:String(t.timeout??""),onChange:r=>o({timeout:r?parseInt(r,10):void 0}),placeholder:"600"})]}),e.jsxs("div",{children:[e.jsx(u,{children:n("pipeline.max_turns")}),e.jsx(f,{type:"number",value:String(t.max_turns??""),onChange:r=>o({max_turns:r?parseInt(r,10):void 0}),placeholder:"50"})]})]}),e.jsxs("div",{children:[e.jsx(u,{children:n("pipeline.confirm_mode")}),e.jsx(N,{value:t.confirm?t.type??"confirm":"none",onChange:r=>{o(r==="none"?{confirm:!1,type:void 0}:{confirm:!0,type:r})},options:[{value:"none",label:"none"},{value:"confirm",label:"confirm"},{value:"choice",label:"choice"},{value:"input",label:"input"}]})]}),t.confirm&&e.jsxs("div",{children:[e.jsx(u,{children:n("pipeline.confirm_timeout")}),e.jsx(f,{type:"number",value:String(t.confirm_timeout??""),onChange:r=>o({confirm_timeout:r?parseInt(r,10):void 0}),placeholder:"300"})]}),e.jsxs("div",{className:"border-t border-[var(--border)] pt-3",children:[e.jsx("p",{className:"mb-3 font-mono text-[11px] text-[var(--text-muted)]",children:n("pipeline.overrides")}),e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx(u,{children:n("pipeline.pty_only")}),e.jsx($,{checked:t.pty_only??!1,onChange:r=>o({pty_only:r})})]}),e.jsxs("div",{className:"mb-3",children:[e.jsx(u,{children:n("pipeline.allowed_tools")}),e.jsx(f,{value:t.allowed_tools??"",onChange:r=>o({allowed_tools:r||void 0}),placeholder:"tool1, tool2, ..."})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(u,{children:n("pipeline.irreversible")}),e.jsx($,{checked:t.irreversible??!1,onChange:r=>o({irreversible:r})})]})]}),e.jsxs("div",{className:"border-t border-[var(--border)] pt-3",children:[e.jsx("p",{className:"mb-3 font-mono text-[11px] text-[var(--text-muted)]",children:n("pipeline.on_failure_section")}),e.jsxs("div",{className:"mb-3",children:[e.jsx(u,{children:n("pipeline.on_failure")}),e.jsx(N,{value:t.onFailure?"goto":"stop",onChange:r=>{o(r==="stop"?{onFailure:void 0}:{onFailure:{goto:"",maxLoops:3}})},options:[{value:"stop",label:n("pipeline.stop")},{value:"goto",label:n("pipeline.goto_stage")}]})]}),t.onFailure&&e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(u,{children:n("pipeline.goto")}),e.jsx(f,{value:t.onFailure.goto,onChange:r=>{var a;return o({onFailure:{goto:r,maxLoops:((a=t.onFailure)==null?void 0:a.maxLoops)??3}})},placeholder:n("pipeline.stage_name")})]}),e.jsxs("div",{children:[e.jsx(u,{children:n("pipeline.max_loops")}),e.jsx(f,{type:"number",value:String(t.onFailure.maxLoops),onChange:r=>{var a;return o({onFailure:{goto:((a=t.onFailure)==null?void 0:a.goto)??"",maxLoops:r?parseInt(r,10):3}})},placeholder:"3"})]})]})]}),e.jsxs("div",{className:"border-t border-[var(--border)] pt-3",children:[e.jsx("h4",{className:"mb-2 font-mono text-xs font-semibold text-[var(--accent)]",children:n("pipeline.stage_commands")}),e.jsx(L,{value:t.command??"",onChange:r=>o({command:r}),placeholder:n("pipeline.commands_placeholder"),rows:6})]}),e.jsxs("div",{className:"border-t border-[var(--border)] pt-3",children:[e.jsx("h4",{className:"mb-2 font-mono text-xs font-semibold text-[var(--accent)]",children:n("pipeline.environment")}),e.jsx(L,{value:t.env?Object.entries(t.env).map(([r,a])=>`${r}=${a}`).join(`
|
|
2
2
|
`):"",onChange:r=>{if(!r.trim()){o({env:void 0});return}const a={};r.split(`
|
|
3
3
|
`).forEach(c=>{const l=c.indexOf("=");l>0&&(a[c.slice(0,l).trim()]=c.slice(l+1).trim())}),o({env:a})},placeholder:n("pipeline.env_placeholder"),rows:3})]})]})}function H({value:t,onChange:o,onSave:n,saving:r,projectName:a}){const{t:c}=g(),[l,x]=p.useState(null),[h,j]=p.useState(!1),i=(t==null?void 0:t.stages)??[],_=(t==null?void 0:t.defaults)??C,w=l!=null?i[l]??null:null,b=p.useCallback(s=>{o({stages:s,defaults:_})},[o,_]),E=p.useCallback(()=>{const s=[...i,D()];b(s),x(s.length-1)},[i,b]),I=p.useCallback(s=>{const d=i.filter((m,v)=>v!==s);b(d),l===s?x(d.length>0?Math.min(s,d.length-1):null):l!=null&&l>s&&x(l-1)},[i,l,b]),P=p.useCallback((s,d)=>{const m=i.map((v,O)=>O===s?{...v,...d}:v);b(m)},[i,b]),S=p.useCallback((s,d)=>{const m=d==="up"?s-1:s+1;if(m<0||m>=i.length)return;const v=[...i];[v[s],v[m]]=[v[m],v[s]],b(v),l===s?x(m):l===m&&x(s)},[i,l,b]),J=p.useMemo(()=>JSON.stringify(t??{stages:[],defaults:C},null,2),[t]);return e.jsxs("div",{className:"flex flex-col gap-0",children:[e.jsx("div",{className:"mb-4 flex items-center gap-2",children:e.jsxs("button",{type:"button",onClick:()=>j(s=>!s),className:`rounded-[4px] border px-2 py-1 font-mono text-[10px] transition-colors ${h?"border-[var(--accent)] text-[var(--accent)]":"border-[var(--border)] text-[var(--text-muted)] hover:text-[var(--text-primary)]"}`,children:[c("pipeline.json_toggle")," ⇅"]})}),h&&e.jsx("pre",{className:"mb-4 max-h-[400px] overflow-auto rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] p-3 font-mono text-[11px] leading-relaxed text-[var(--text-primary)]",children:J}),e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[i.map((s,d)=>{var m;return e.jsxs("div",{children:[e.jsx(q,{stage:s,index:d,selected:l===d,onSelect:()=>x(d),onDelete:()=>I(d)}),d<i.length-1&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-2",children:[e.jsx("div",{className:"h-6 w-px bg-[var(--border)]"}),e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:"▼"}),e.jsx("div",{className:"h-6 w-px bg-[var(--border)]"})]}),((m=s.onFailure)==null?void 0:m.goto)&&e.jsx("div",{className:"flex items-center justify-center gap-1.5 py-1",children:e.jsxs("span",{className:"text-[10px] text-[var(--warning)]",children:["↺ loop → ",s.onFailure.goto," (max ",s.onFailure.maxLoops,")"]})})]},`${d}-${s.name}`)}),l!=null&&i.length>1&&e.jsxs("div",{className:"flex items-center gap-1 pl-7 pt-2",children:[e.jsxs("button",{type:"button",disabled:l===0,onClick:()=>S(l,"up"),className:"rounded border border-[var(--border)] px-2 py-0.5 font-mono text-[10px] text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)] disabled:opacity-30",children:["▲ ",c("pipeline.up")]}),e.jsxs("button",{type:"button",disabled:l===i.length-1,onClick:()=>S(l,"down"),className:"rounded border border-[var(--border)] px-2 py-0.5 font-mono text-[10px] text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)] disabled:opacity-30",children:["▼ ",c("pipeline.down")]})]}),e.jsx("div",{className:"flex items-center justify-center py-3",children:e.jsxs("button",{type:"button",onClick:E,className:"flex items-center gap-1.5 rounded-[4px] border border-dashed border-[var(--border)] px-4 py-2 font-mono text-xs text-[var(--accent)] transition-colors hover:border-[var(--accent)] hover:bg-[var(--bg-secondary)]",children:[e.jsx("span",{className:"text-sm leading-none",children:"+"})," ",c("pipeline.add_stage")]})})]}),e.jsx("div",{className:"hidden w-[360px] shrink-0 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5 lg:block",style:{alignSelf:"flex-start",position:"sticky",top:0},children:w?e.jsx(A,{stage:w,onChange:s=>P(l,s)}):e.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:e.jsx("p",{className:"font-mono text-xs text-[var(--text-muted)]",children:c("pipeline.select_stage")})})})]})]})}function G(){const{key:t}=M(),o=T(),{t:n}=g(),[r,a]=p.useState(null),[c,l]=p.useState(!0),[x,h]=p.useState(!1);p.useEffect(()=>{t&&k.get(`web/projects/${t}`).json().then(i=>{if(i.pipeline)try{a(JSON.parse(i.pipeline))}catch{a(null)}}).catch(()=>y.error(n("pipeline.failed_to_load_project"))).finally(()=>l(!1))},[t,n]);const j=p.useCallback(async()=>{if(t){h(!0);try{await k.put(`web/projects/${t}`,{json:{pipeline:r?JSON.stringify(r):null}}),y.success(n("pipeline.saved"))}catch{y.error(n("pipeline.failed_to_save"))}finally{h(!1)}}},[t,r,n]);return c?e.jsx("div",{className:"flex h-full items-center justify-center font-mono",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:n("pipeline.loading_pipeline")})}):e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-8 py-5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-base font-medium text-[var(--text-primary)]",children:n("pipeline.title")}),e.jsx("span",{className:"text-sm text-[var(--text-muted)]",children:n("pipeline.subtitle",{key:t??""})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:j,disabled:x,className:"rounded-[4px] bg-[var(--accent)] px-4 py-1.5 text-xs font-bold text-black disabled:opacity-50",children:n(x?"common.saving":"pipeline.save")}),e.jsx("button",{type:"button",onClick:()=>o(`/projects/${t}`),className:"rounded-[4px] border border-[var(--border)] px-4 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:n("pipeline.cancel")})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-8",children:e.jsx(H,{value:r,onChange:a,onSave:j,saving:x,projectName:t})})]})}export{G as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as L,r as a,f as m,t as i,j as e,L as S,K as R}from"./index-
|
|
1
|
+
import{a as L,r as a,f as m,t as i,j as e,L as S,K as R}from"./index-BiwmRYQP.js";function D(){const{t:r}=L(),[t,k]=a.useState(null),[P,u]=a.useState(!0),[x,f]=a.useState(""),[o,b]=a.useState(""),[v,g]=a.useState(""),[h,j]=a.useState(!1),[_,n]=a.useState(""),[c,w]=a.useState(""),[y,N]=a.useState(!1),p=a.useCallback(async()=>{try{u(!0);const s=await m.get("web/profile").json();k(s)}catch{i.error(r("profile.failed_to_load_profile"))}finally{u(!1)}},[r]);a.useEffect(()=>{p()},[p]);const C=async()=>{if(n(""),!x){n(r("profile.current_password_required"));return}if(!o){n(r("profile.new_password_required"));return}if(o.length<10||o.length>20){n(r("profile.password_length_10_20"));return}if(o!==v){n(r("profile.passwords_do_not_match"));return}try{j(!0),await m.put("web/profile/password",{json:{currentPassword:x,newPassword:o}}),i.success(r("profile.password_changed")),f(""),b(""),g("")}catch(s){const d=s instanceof Error?s.message:r("profile.failed_to_change_password");n(d)}finally{j(!1)}},E=async()=>{if(!c||c.length!==6){i.error(r("profile.totp_code_required"));return}try{N(!0),await m.post("web/profile/totp/regenerate",{json:{code:c}}),i.success(r("profile.two_fa_regenerated")),w(""),p()}catch(s){const d=s instanceof Error?s.message:r("profile.totp_code_invalid");i.error(d)}finally{N(!1)}};return P?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-[var(--border)] border-t-[var(--accent)]"})}):e.jsxs("div",{className:"mx-auto max-w-xl space-y-8 px-6 py-8 font-mono lowercase",children:[e.jsxs("h1",{className:"text-lg text-[var(--text-primary)]",children:[r("profile.title")," ",e.jsx("span",{className:"text-[var(--text-muted)]",children:r("profile.personal_settings")})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.profile_info")}),t?e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{label:r("profile.username"),value:t.name}),e.jsx(l,{label:r("common.role"),value:t.role}),e.jsx(l,{label:r("profile.git_name"),value:t.gitName||r("common.not_set")}),e.jsx(l,{label:r("profile.git_email"),value:t.gitEmail||r("common.not_set")}),e.jsx(l,{label:r("profile.status"),value:t.status}),e.jsx(l,{label:r("profile.created_at"),value:new Date(t.createdAt).toLocaleDateString()})]}):e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:r("profile.unable_to_load_profile")})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.change_password")}),e.jsxs("div",{className:"space-y-4",children:[_&&e.jsx("div",{className:"rounded-[4px] border border-[var(--destructive)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--destructive)]",children:_}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.current_password")}),e.jsx("input",{type:"password",value:x,onChange:s=>f(s.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.new_password")}),e.jsx("input",{type:"password",value:o,onChange:s=>b(s.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:r("profile.password_hint_10_20")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.confirm_password")}),e.jsx("input",{type:"password",value:v,onChange:s=>g(s.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:C,disabled:h,className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-medium text-black disabled:opacity-50",children:r(h?"common.updating":"profile.update_password")})})]})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.two_factor_auth")}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm",children:t!=null&&t.totpEnabled?e.jsxs("span",{className:"text-[var(--accent)]",children:["● ",r("profile.two_fa_enabled")]}):e.jsxs("span",{className:"text-[var(--text-muted)]",children:["● ",r("profile.two_fa_not_setup")]})}),(t==null?void 0:t.totpEnabled)&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("profile.regenerate_2fa_warning")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.current_totp_code")}),e.jsx("input",{type:"text",inputMode:"numeric",maxLength:6,placeholder:r("profile.totp_code_placeholder"),value:c,onChange:s=>{const d=s.target.value.replace(/\D/g,"").slice(0,6);w(d)},className:"w-full max-w-xs rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)] font-mono tracking-widest"})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:E,disabled:y||c.length!==6,className:"rounded-[4px] border border-[var(--warning)] bg-transparent px-4 py-2 text-xs font-medium text-[var(--warning)] hover:bg-[var(--warning)] hover:text-black disabled:opacity-50 transition-colors",children:r(y?"profile.regenerating":"profile.regenerate_2fa")})})]})]})]}),e.jsxs(S,{to:"/access-tokens",className:"flex items-center gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 transition-colors hover:border-[var(--accent)]",children:[e.jsx(R,{size:16,className:"text-[var(--accent)]"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-[var(--text-primary)]",children:r("profile.access_tokens")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("profile.access_tokens_desc")})]})]})]})}function l({label:r,value:t}){return e.jsxs("div",{className:"flex items-center gap-3 py-1",children:[e.jsx("span",{className:"w-28 shrink-0 text-xs text-[var(--text-muted)]",children:r}),e.jsx("span",{className:"text-sm text-[var(--text-primary)]",children:t})]})}export{D as default};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{c as F,a as S,j as e,l as G,m as K,d as q,u as B,r as l,h as H,f as j,v as J}from"./index-BiwmRYQP.js";import{T as d}from"./protocol-C5uQmiiB.js";import{U as Q,A as V,R as z}from"./RemoveMemberConfirmDialog-CGkSeDTJ.js";import{P as W}from"./pencil-DJx3NobK.js";import{T as X}from"./trash-2-D_ao7mjo.js";import{P as Y}from"./plus-B1evYZLw.js";import"./Select-B2hs4bPZ.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 Z=F("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);function ee({isOpen:n,onClose:a,onConfirm:t,projectName:o,loading:p}){const{t:r}=S();return e.jsx(G,{isOpen:n,onClose:a,onConfirm:t,title:`> ${r("projects.delete_project")}`,message:r("projects.delete_project_confirm",{name:o}),confirmLabel:r("projects.delete_project"),confirmVariant:"danger",isLoading:p})}const te={[d.QUEUED]:"var(--text-muted)",[d.ASSIGNED]:"var(--info)",[d.RUNNING]:"var(--info)",[d.SUSPENDED]:"var(--warning)",[d.COMPLETED]:"var(--accent)",[d.FAILED]:"var(--destructive)",[d.CANCELLED]:"var(--text-muted)"};function D(n){return new Date(n).toLocaleString()}function de(){const{key:n}=K(),a=q(),{t}=S(),o=B(s=>s.user),p=(o==null?void 0:o.role)==="admin",[r,M]=l.useState(null),[u,P]=l.useState([]),i=p||u.some(s=>s.developerId===(o==null?void 0:o.id)&&s.role==="maintainer"),[w,L]=l.useState([]),[A,E]=l.useState(!0),[x,f]=l.useState(null),[I,N]=l.useState(!1),[T,k]=l.useState(!1),[$,_]=l.useState(!1),[m,y]=l.useState(null),[O,C]=l.useState(!1);H(l.useMemo(()=>r?e.jsxs(e.Fragment,{children:[i&&e.jsxs("button",{onClick:()=>a(`/projects/${r.key}/edit`),className:"flex items-center gap-1.5 rounded-[4px] border border-[var(--border)] bg-transparent px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:[e.jsx(W,{className:"h-3 w-3"}),t("common.edit")]}),p&&e.jsxs("button",{onClick:()=>N(!0),className:"flex items-center gap-1.5 rounded-[4px] border border-[var(--destructive)] bg-transparent px-3 py-1.5 text-xs text-[var(--destructive)] hover:bg-[var(--destructive)] hover:text-white",children:[e.jsx(X,{className:"h-3 w-3"}),t("common.delete")]})]}):null,[r,i,p,a,t]));const v=l.useCallback(async()=>{if(n)try{const[s,g,b]=await Promise.all([j.get(`web/projects/${n}`).json(),j.get(`web/projects/${n}/members`).json().catch(()=>[]),j.get("web/tasks",{searchParams:{projectKey:n,limit:"20"}}).json().then(h=>h.data).catch(()=>[])]);if(M(s),P(g),L(b),s.pipeline)try{f(JSON.parse(s.pipeline))}catch{f(null)}else f(null)}catch{}finally{E(!1)}},[n]);l.useEffect(()=>{v()},[v]);async function R(){if(r){k(!0);try{await j.delete(`admin/projects/${r.key}`),a("/projects")}catch{}finally{k(!1),N(!1)}}}async function U(){if(!(!r||!m)){C(!0);try{await j.delete(`web/projects/${r.key}/members`,{searchParams:{developerId:String(m.developerId)}}),await v()}catch{}finally{C(!1),y(null)}}}return A?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-[var(--border)] border-t-[var(--accent)]"})}):r?e.jsxs("div",{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:()=>a("/projects"),children:t("projects.title")})," / ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:r.key})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-[1fr_340px]",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"rounded 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:t("projects.project_info")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{label:t("projects.key"),value:r.key}),e.jsx(c,{label:t("projects.name"),value:r.name}),e.jsx(c,{label:t("projects.repo_url"),value:r.repoUrl,href:r.repoUrl}),e.jsx(c,{label:t("projects.git_platform"),value:r.gitPlatform}),e.jsx(c,{label:t("projects.default_branch"),value:r.defaultBranch}),e.jsx(c,{label:t("projects.agent_type"),value:r.agentType}),e.jsx(c,{label:t("projects.max_turns"),value:String(r.maxTurns)}),e.jsx(c,{label:t("projects.allowed_tools"),value:r.allowedTools??"all"}),e.jsx(c,{label:t("projects.auto_merge"),value:r.isDefault?"yes":"no"})]})]}),e.jsxs("section",{className:"rounded 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:t("projects.members")}),i&&e.jsxs("button",{onClick:()=>_(!0),className:"flex items-center gap-1.5 rounded bg-[var(--accent)] px-3 py-1.5 text-xs font-medium text-black",children:[e.jsx(Y,{className:"h-3.5 w-3.5"}),t("projects.add_member")]})]}),u.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:t("projects.no_members_yet")})]}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-row)]",children:[e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:t("projects.name")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:t("projects.role")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:t("projects.added_at")}),i&&e.jsx("th",{className:"pb-2 text-right text-xs font-medium text-[var(--text-muted)]",children:t("common.actions")})]})}),e.jsx("tbody",{children:u.map(s=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] last:border-b-0",children:[e.jsx("td",{className:"py-2.5 text-sm text-[var(--text-primary)]",children:s.developerName??`#${s.developerId}`}),e.jsx("td",{className:"py-2.5 text-sm",style:{color:s.role==="maintainer"?"var(--warning)":"var(--text-secondary)"},children:s.role}),e.jsx("td",{className:"py-2.5 text-sm text-[var(--text-secondary)]",children:D(s.createdAt)}),i&&e.jsx("td",{className:"py-2.5 text-right",children:e.jsx("button",{onClick:()=>y(s),className:"text-[var(--destructive)] hover:underline","aria-label":t("projects.remove_member"),children:e.jsx(Q,{className:"h-3.5 w-3.5"})})})]},s.developerId))})]})})]}),e.jsxs("section",{className:"rounded 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:t("projects.recent_tasks")}),w.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:t("projects.no_tasks_for_project")})]}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-row)]",children:[e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:t("projects.id")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:t("projects.description")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:t("projects.status")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:t("projects.created")})]})}),e.jsx("tbody",{children:w.map(s=>e.jsxs("tr",{className:"cursor-pointer border-b border-[var(--border-row)] last:border-b-0 hover:bg-[var(--bg-input)]",onClick:()=>a(`/tasks/${s.id}`),children:[e.jsxs("td",{className:"py-2.5 text-sm text-[var(--text-secondary)]",children:["#",s.id]}),e.jsx("td",{className:"max-w-xs truncate py-2.5 text-sm text-[var(--text-primary)]",children:s.description}),e.jsx("td",{className:"py-2.5 text-sm",style:{color:te[s.status]},children:s.status}),e.jsx("td",{className:"py-2.5 text-sm text-[var(--text-secondary)]",children:D(s.createdAt)})]},s.id))})]})})]})]}),e.jsx("div",{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-[13px] font-medium text-[var(--accent)]",children:t("projects.pipeline")}),e.jsx("div",{className:"mb-3 h-px bg-[var(--border)]"}),x!=null&&x.stages&&x.stages.length>0?e.jsx("div",{className:"flex flex-col items-center",children:x.stages.map((s,g)=>{var b,h;return e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-input)] px-3 py-2.5 cursor-pointer hover:bg-[var(--bg-secondary)]",style:{borderLeft:"3px solid var(--accent)"},onClick:()=>a(`/projects/${r.key}/pipeline`),children:[e.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[e.jsx("span",{className:"text-xs font-medium text-[var(--text-primary)]",children:s.name}),s.command&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)] truncate",children:["// ",s.command.split(`
|
|
7
|
+
`)[0].slice(0,40)]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.confirm&&e.jsx("span",{className:"rounded-[4px] px-2 py-0.5 text-[10px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:t("projects.confirm_label")}),s.irreversible&&e.jsx("span",{className:"rounded-[4px] px-2 py-0.5 text-[10px] font-medium text-[var(--destructive)]",style:{backgroundColor:"rgba(239,68,68,0.12)"},children:t("pipeline.irreversible")})]})]}),((b=s.onFailure)==null?void 0:b.goto)&&e.jsxs("div",{className:"flex items-center justify-center gap-1.5 py-1",children:[e.jsx(J,{className:"h-3 w-3 text-[var(--warning)]"}),e.jsxs("span",{className:"text-[10px] text-[var(--warning)]",children:["onFailure.goto: ",s.onFailure.goto,", maxLoops: ",s.onFailure.maxLoops]})]}),g<x.stages.length-1&&!((h=s.onFailure)!=null&&h.goto)&&e.jsx("div",{className:"flex justify-center py-1",children:e.jsx(Z,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"})})]},s.name)})}):e.jsx("div",{className:"py-6 text-center text-xs text-[var(--text-muted)]",children:t("projects.no_pipeline_configured")}),i&&e.jsx("button",{onClick:()=>a(`/projects/${r.key}/pipeline`),className:"mt-3 flex w-full items-center justify-center gap-1.5 py-2 text-xs text-[var(--accent)] hover:text-[var(--accent)]",children:t("projects.add_stage")})]})})]}),e.jsx(ee,{isOpen:I,onClose:()=>N(!1),onConfirm:R,projectName:r.name,loading:T}),e.jsx(V,{isOpen:$,onClose:()=>_(!1),projectKey:r.key,existingMemberIds:u.map(s=>s.developerId),onAdded:v}),e.jsx(z,{isOpen:!!m,onClose:()=>y(null),onConfirm:U,memberName:m?m.developerName??`#${m.developerId}`:"",loading:O})]}):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:t("projects.project_not_found")}),e.jsx("button",{onClick:()=>a("/projects"),className:"mt-4 rounded border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:t("projects.back_to_projects")})]})}function c({label:n,value:a,href:t}){return e.jsxs("div",{className:"flex items-center gap-3 py-1",children:[e.jsx("span",{className:"w-32 shrink-0 text-xs text-[var(--text-muted)]",children:n}),t?e.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"truncate text-sm text-[var(--accent)] hover:underline",children:a}):e.jsx("span",{className:"truncate text-sm text-[var(--text-primary)]",children:a})]})}export{de as default};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as L,a as E,r as a,j as e,f as z,d as D,h as R}from"./index-BiwmRYQP.js";import{G as h,A as m}from"./protocol-C5uQmiiB.js";import{S as F}from"./Select-B2hs4bPZ.js";import{E as G}from"./EmptyState-B5qaL1Ft.js";import{T as I}from"./Skeleton-CyWhQxlf.js";import{P as H}from"./plus-B1evYZLw.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 O=L("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),v={width:"100%",padding:"0.5rem 0.75rem",backgroundColor:"var(--bg-input)",border:"1px solid var(--border)",borderRadius:"4px",color:"var(--text-primary)",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",outline:"none",boxSizing:"border-box"},p={display:"block",color:"var(--text-secondary)",fontSize:"0.7rem",marginBottom:"0.25rem",fontFamily:"'JetBrains Mono', monospace"};function J({isOpen:l,onClose:s,onCreated:c}){const{t:r}=E(),[n,b]=a.useState(""),[d,x]=a.useState(""),[i,g]=a.useState(""),[o,f]=a.useState(""),[u,S]=a.useState("main"),[k,N]=a.useState(h.GITHUB),[B,T]=a.useState(m.CLAUDE),[j,w]=a.useState(!1),[U,C]=a.useState("");a.useEffect(()=>{l&&A()},[l]);function A(){b(""),x(""),g(""),f(""),S("main"),N(h.GITHUB),T(m.CLAUDE),C("")}function _(){A(),s()}async function M(t){t.preventDefault(),C(""),w(!0);try{const y=await z.post("admin/projects",{json:{name:n,key:d,repoUrl:i,sshUrl:o||void 0,defaultBranch:u,gitPlatform:k,agentType:B}}).json();c(y),_()}catch(y){const P=y instanceof Error?y.message:r("projects.failed_to_create_project");C(P)}finally{w(!1)}}return l?e.jsx("div",{onClick:_,style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{onClick:t=>t.stopPropagation(),style:{width:"100%",maxWidth:"480px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"1.5rem",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{style:{marginBottom:"1.25rem"},children:[e.jsxs("div",{style:{color:"var(--accent)",fontSize:"0.875rem",fontWeight:600},children:["> ",r("projects.create_project")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:r("projects.add_project_desc")})]}),U&&e.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.7rem"},children:U}),e.jsxs("form",{onSubmit:M,style:{display:"flex",flexDirection:"column",gap:"0.875rem"},children:[e.jsxs("div",{children:[e.jsx("label",{style:p,children:r("projects.project_name")}),e.jsx("input",{type:"text",value:n,onChange:t=>b(t.target.value),placeholder:r("projects.project_name_placeholder"),required:!0,autoFocus:!0,style:v,onFocus:t=>t.target.style.borderColor="var(--accent)",onBlur:t=>t.target.style.borderColor="var(--border)"})]}),e.jsxs("div",{children:[e.jsx("label",{style:p,children:r("projects.project_key")}),e.jsx("input",{type:"text",value:d,onChange:t=>x(t.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),placeholder:r("projects.project_key_placeholder"),required:!0,style:v,onFocus:t=>t.target.style.borderColor="var(--accent)",onBlur:t=>t.target.style.borderColor="var(--border)"}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",marginTop:"0.25rem"},children:r("projects.project_key_hint")})]}),e.jsxs("div",{children:[e.jsx("label",{style:p,children:r("projects.repo_url")}),e.jsx("input",{type:"text",value:i,onChange:t=>g(t.target.value),placeholder:r("projects.repo_url_placeholder"),required:!0,style:v,onFocus:t=>t.target.style.borderColor="var(--accent)",onBlur:t=>t.target.style.borderColor="var(--border)"})]}),e.jsxs("div",{children:[e.jsx("label",{style:p,children:r("projects.ssh_url")}),e.jsx("input",{type:"text",value:o,onChange:t=>f(t.target.value),placeholder:r("projects.ssh_url_placeholder"),style:v,onFocus:t=>t.target.style.borderColor="var(--accent)",onBlur:t=>t.target.style.borderColor="var(--border)"}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",marginTop:"0.25rem"},children:r("projects.ssh_url_hint")})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:"0.75rem"},children:[e.jsxs("div",{children:[e.jsx("label",{style:p,children:r("projects.default_branch")}),e.jsx("input",{type:"text",value:u,onChange:t=>S(t.target.value),placeholder:r("projects.main"),style:v,onFocus:t=>t.target.style.borderColor="var(--accent)",onBlur:t=>t.target.style.borderColor="var(--border)"})]}),e.jsxs("div",{children:[e.jsx("label",{style:p,children:r("projects.git_platform")}),e.jsx(F,{value:k,onChange:t=>N(t),options:[{value:h.GITHUB,label:r("projects.github")},{value:h.GITLAB,label:r("projects.gitlab")},{value:h.GITEA,label:r("projects.gitea")}]})]}),e.jsxs("div",{children:[e.jsx("label",{style:p,children:r("projects.agent_type")}),e.jsx(F,{value:B,onChange:t=>T(t),options:[{value:m.CLAUDE,label:r("projects.claude")},{value:m.CURSOR,label:r("projects.cursor")},{value:m.CODEX,label:r("projects.codex")},{value:m.CUSTOM,label:r("projects.custom")}]})]})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem",marginTop:"0.5rem"},children:[e.jsx("button",{type:"button",onClick:_,disabled:j,style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer",transition:"color 0.15s, border-color 0.15s"},className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",children:r("common.cancel")}),e.jsx("button",{type:"submit",disabled:j||!n||!d||!i,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--accent)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:j||!n||!d||!i?"not-allowed":"pointer",opacity:j||!n||!d||!i?.7:1},children:r(j?"common.creating":"common.create")})]})]})]})}):null}function $(l){if(!l)return"-";const s=Date.now()-new Date(l).getTime(),c=Math.floor(s/1e3);if(c<60)return`${c}s ago`;const r=Math.floor(c/60);if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function Y(){const l=D(),{t:s}=E(),[c,r]=a.useState([]),[n,b]=a.useState(!0),[d,x]=a.useState(!1);R(a.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 font-medium text-black",children:[e.jsx(H,{className:"h-3.5 w-3.5"}),s("projects.create_project")]}),[s]));async function i(){b(!0);try{const o=await z.get("web/projects").json();r(o)}catch{}finally{b(!1)}}a.useEffect(()=>{i()},[]);function g(o){i()}return e.jsxs("div",{className:"mx-auto max-w-5xl px-6 py-8",children:[n?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(I,{rows:4})}):c.length===0?e.jsx(G,{icon:O,title:s("projects.no_projects_yet"),description:s("projects.create_first_project"),actionLabel:s("projects.create_project"),onAction:()=>x(!0)}):e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"grid grid-cols-[36px_90px_1fr_120px_60px_80px] gap-3 border-b border-[var(--border-row)] px-4 py-2.5 text-xs font-medium text-[var(--text-muted)]",children:[e.jsx("span",{children:"#"}),e.jsx("span",{children:s("projects.key")}),e.jsx("span",{children:s("projects.name")}),e.jsx("span",{children:s("projects.members")}),e.jsx("span",{children:s("projects.tasks_count")}),e.jsx("span",{children:s("projects.last_activity")})]}),c.map((o,f)=>e.jsxs("div",{onClick:()=>l(`/projects/${o.key}`),className:"grid cursor-pointer grid-cols-[36px_90px_1fr_120px_60px_80px] gap-3 border-b border-[var(--border-row)] px-4 py-3 last:border-b-0 hover:bg-[var(--bg-input)] transition-colors items-center",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:f+1}),e.jsx("span",{className:"truncate text-xs text-[var(--accent)]",children:o.key}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate text-xs text-[var(--text-primary)]",children:o.name}),e.jsxs("span",{className:"block truncate text-[10px] text-[var(--text-muted)]",children:[o.agentType," · ",o.repoUrl.replace(/^https?:\/\//,"").split("/").slice(-2).join("/")]})]}),e.jsx("div",{className:"flex items-center",children:e.jsxs("div",{className:"flex -space-x-1.5",children:[(o.members??[]).map(u=>e.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full border-2 border-[var(--bg-card)] bg-[var(--accent)]/20 text-[9px] font-bold text-[var(--accent)]",title:u.name,children:u.name.charAt(0).toUpperCase()},u.id)),(o.memberCount??0)>5&&e.jsxs("div",{className:"flex h-6 w-6 items-center justify-center rounded-full border-2 border-[var(--bg-card)] bg-[var(--bg-input)] text-[9px] text-[var(--text-muted)]",children:["+",o.memberCount-5]})]})}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:o.taskCount??0}),e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:$(o.lastActivity??null)})]},o.key))]}),e.jsx(J,{isOpen:d,onClose:()=>x(!1),onCreated:g})]})}export{Y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b,r as s,f as h,j as e,C as v}from"./index-
|
|
1
|
+
import{a as b,r as s,f as h,j as e,C as v}from"./index-BiwmRYQP.js";import{C as f}from"./copy-BOEo9gzs.js";function k({mode:l}){const{t:o}=b(),[n,d]=s.useState([]),[x,c]=s.useState(null),[u,i]=s.useState(!1);s.useEffect(()=>{h.get("web/profile/tokens").json().then(t=>{const r=t.filter(m=>m.status==="active");d(r),r.length>0&&c(r[0].id)}).catch(()=>{})},[]);const a=l==="cli"?"ov login --token <your-token>":'curl -H "authorization: bearer <your-token>" http://localhost:9000/api/web/tasks',p=s.useCallback(()=>{navigator.clipboard.writeText(a),i(!0),setTimeout(()=>i(!1),2e3)},[a]);return n.length===0?null:e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--accent)]/20 bg-[var(--bg-card)] p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:o("docs.quick_start_with_token")}),e.jsx("select",{value:x??"",onChange:t=>c(Number(t.target.value)),className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-2 py-1 text-xs text-[var(--text-primary)]",children:n.map(t=>e.jsx("option",{value:t.id,children:t.label},t.id))})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsx("code",{className:"text-xs text-[var(--accent)] break-all",children:a}),e.jsx("button",{onClick:p,className:"shrink-0 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:u?e.jsx(v,{size:14}):e.jsx(f,{size:14})})]}),e.jsx("p",{className:"mt-2 text-[10px] text-[var(--text-muted)]",children:o("docs.replace_token_hint")})]})}export{k as Q};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as w,a as _,r as s,j as e,X as R,f as g,l as C}from"./index-BiwmRYQP.js";import{P as l}from"./protocol-C5uQmiiB.js";import{S as N}from"./Select-B2hs4bPZ.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 L=w("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);function $({isOpen:a,onClose:i,projectKey:d,existingMemberIds:m=[],onAdded:x}){const{t}=_(),[E,M]=s.useState([]),[o,u]=s.useState(""),[v,j]=s.useState(l.MEMBER),[p,f]=s.useState(!1),[y,b]=s.useState("");s.useEffect(()=>{if(!a)return;async function r(){try{const c=await g.get("web/projects/-/developers").json();M(c)}catch{}}r()},[a]);function n(){u(""),j(l.MEMBER),b(""),i()}async function k(r){if(r.preventDefault(),!!o){b(""),f(!0);try{await g.post(`web/projects/${d}/members`,{json:{developerId:parseInt(o,10),role:v}}),x(),n()}catch(c){const h=c instanceof Error?c.message:"",S=h.includes("409")?t("projects.member_already_exists"):h||t("projects.failed_to_add_member");b(S)}finally{f(!1)}}}return a?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]",onClick:n}),e.jsx("div",{className:"relative z-10 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:e.jsxs("form",{onSubmit:k,children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsx("h3",{className:"text-sm text-[var(--text-primary)]",children:t("projects.add_member_title")}),e.jsx("button",{type:"button",className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",onClick:n,children:e.jsx(R,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-4 px-5 py-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:t("projects.developer")}),e.jsx(N,{value:o,onChange:u,options:E.filter(r=>!m.includes(r.id)).map(r=>({value:String(r.id),label:`${r.name} (${r.gitEmail})`})),placeholder:t("projects.select_developer")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:t("projects.role")}),e.jsx(N,{value:v,onChange:r=>j(r),options:[{value:l.MEMBER,label:t("projects.member_role")},{value:l.MAINTAINER,label:t("projects.maintainer_role")}]})]}),y&&e.jsx("div",{className:"rounded-[4px] border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400",children:y})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",disabled:p,onClick:n,children:t("common.cancel")}),e.jsx("button",{type:"submit",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:p||!o,children:t(p?"projects.adding":"projects.add_member")})]})]})})]}):null}function B({isOpen:a,onClose:i,onConfirm:d,memberName:m,loading:x}){const{t}=_();return e.jsx(C,{isOpen:a,onClose:i,onConfirm:d,title:`> ${t("projects.remove_member")}`,message:t("projects.remove_member_confirm",{name:m}),confirmLabel:t("common.remove"),confirmVariant:"danger",isLoading:x})}export{$ as A,B as R,L as U};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{c as f,r as c,j as t}from"./index-
|
|
1
|
+
import{c as f,r as c,j as t}from"./index-BiwmRYQP.js";/**
|
|
2
2
|
* @license lucide-react v0.469.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const b=f("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);function h({value:r,onChange:
|
|
6
|
+
*/const b=f("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);function h({value:r,onChange:u,options:l,placeholder:x,disabled:a=!1,className:d=""}){var i;const[n,s]=c.useState(!1),o=c.useRef(null),m=((i=l.find(e=>e.value===r))==null?void 0:i.label)??x??"";return c.useEffect(()=>{function e(v){o.current&&!o.current.contains(v.target)&&s(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),t.jsxs("div",{ref:o,className:`relative ${d}`,children:[t.jsxs("button",{type:"button",disabled:a,onClick:()=>!a&&s(!n),className:`flex w-full items-center justify-between rounded-[4px] border bg-[var(--bg-input)] px-3 py-2 font-mono text-xs outline-none transition-colors ${n?"border-[var(--accent)] text-[var(--text-primary)]":"border-[var(--border)] text-[var(--text-primary)] hover:border-[var(--text-muted)]"} ${a?"cursor-not-allowed opacity-50":"cursor-pointer"}`,children:[t.jsx("span",{className:r?"":"text-[var(--text-muted)]",children:m}),t.jsx(b,{size:12,className:`ml-2 shrink-0 text-[var(--text-muted)] transition-transform ${n?"rotate-180":""}`})]}),n&&t.jsx("div",{className:"absolute right-0 z-50 mt-1 max-h-48 min-w-full w-max overflow-auto rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] py-1 shadow-lg",children:l.map(e=>t.jsxs("button",{type:"button",onClick:()=>{u(e.value),s(!1)},className:`flex w-full items-center px-3 py-1.5 text-left font-mono text-xs transition-colors ${e.value===r?"bg-[var(--accent)]/10 text-[var(--accent)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-input)] hover:text-[var(--text-primary)]"}`,children:[e.value===r&&t.jsx("span",{className:"mr-2 text-[var(--accent)]",children:">"}),e.label]},e.value))})]})}export{h as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./index-
|
|
1
|
+
import{j as e}from"./index-BiwmRYQP.js";const n="rounded-[4px] bg-[var(--border)] animate-pulse";function c({rows:r=5}){const a=[[60,200,80,120],[60,160,100,80],[60,220,70,140],[60,180,90,100],[60,190,110,90]];return e.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:r}).map((s,l)=>{const t=a[l%a.length];return e.jsx("div",{className:"flex gap-4",children:t.map((i,o)=>e.jsx("div",{className:n,style:{width:i,height:12}},o))},l)})})}function m({cards:r=4}){return e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Array.from({length:r}).map((a,s)=>e.jsx("div",{className:`${n} h-20`},s))})}export{m as C,c as T};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as c,j as e,r as n,C as o}from"./index-BiwmRYQP.js";import{E as i}from"./external-link-DEXczFxv.js";import{C as d}from"./copy-BOEo9gzs.js";function a({text:t}){const[s,r]=n.useState(!1);return e.jsx("button",{onClick:async()=>{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)},className:"rounded-[4px] p-1 text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:s?e.jsx(o,{className:"h-3 w-3 text-[var(--accent)]"}):e.jsx(d,{className:"h-3 w-3"})})}function x({text:t}){return 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:t}),e.jsx(a,{text:t})]})}const l=[{action:"create tasks",desc:"describe what you want done, overlord dispatches to a worker"},{action:"list & monitor tasks",desc:"check status, read execution logs, track progress"},{action:"cancel & retry tasks",desc:"manage task lifecycle"},{action:"confirm pipeline stages",desc:"approve or provide input for suspended stages"},{action:"manage projects",desc:"list projects, view members"},{action:"check cluster health",desc:"see machine status, online workers, queue depth"},{action:"search",desc:"find tasks, projects, and machines by keyword"},{action:"read notifications",desc:"check and clear your notification inbox"}],m=['create a task in project "frontend" to fix the login page styling',"what tasks are running right now?","show me the logs for task 42","how many machines are online?","cancel task 15"],p=[{name:"claude code",url:"https://claude.com/claude-code"},{name:"cursor",url:"https://cursor.com"},{name:"windsurf",url:"https://windsurf.com"},{name:"codex",url:"https://openai.com/codex"}];function b(){c();const t=typeof window<"u"?window.location.origin:"https://your-server";return 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:"// use overlord from your ai coding assistant — claude code, cursor, windsurf, codex, and more. install the skill and your assistant can create tasks, monitor execution, and manage your fleet."})}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// install"}),e.jsx(x,{text:"npx skills add overlord-run/skill"})]}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// configure — set these environment variables"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsxs("code",{className:"text-xs text-[var(--text-primary)]",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"export "}),"OVERLORD_SERVER=",e.jsx("span",{className:"text-[var(--accent)]",children:t})]}),e.jsx(a,{text:`export OVERLORD_SERVER=${t}`})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsxs("code",{className:"text-xs text-[var(--text-primary)]",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"export "}),"OVERLORD_TOKEN=",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"your-token"})]}),e.jsx(a,{text:"export OVERLORD_TOKEN=your-token"})]})]}),e.jsxs("p",{className:"text-[10px] text-[var(--text-muted)]",children:["// create a token at ",e.jsx("a",{href:"/access-tokens",className:"text-[var(--accent)] hover:underline",children:"/access-tokens"})]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> capabilities"}),e.jsx("div",{className:"space-y-2",children:l.map(s=>e.jsxs("div",{className:"flex items-start gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",children:[e.jsx("span",{className:"shrink-0 text-xs font-medium text-[var(--text-primary)]",children:s.action}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// ",s.desc]})]},s.action))})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> example usage"}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-2",children:[e.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:"// just ask your ai agent naturally"}),m.map(s=>e.jsx("div",{className:"rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:e.jsxs("code",{className:"text-xs text-[var(--text-secondary)]",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"> "}),s]})},s))]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> compatible tools"}),e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:p.map(s=>e.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-1.5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2.5 text-xs text-[var(--text-primary)] transition-colors hover:border-[var(--accent)]",children:[s.name,e.jsx(i,{className:"h-3 w-3 text-[var(--text-muted)]"})]},s.name))}),e.jsx("p",{className:"mt-2 text-[10px] text-[var(--text-muted)]",children:"// and any ai coding assistant that supports the skills protocol"})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["// open source:"," ",e.jsx("a",{href:"https://github.com/overlord-run/skill",target:"_blank",rel:"noopener noreferrer",className:"text-[var(--accent)] hover:underline",children:"github.com/overlord-run/skill"})]})})]})}export{b as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var He=Object.defineProperty;var Fe=(G,$,F)=>$ in G?He(G,$,{enumerable:!0,configurable:!0,writable:!0,value:F}):G[$]=F;var ve=(G,$,F)=>Fe(G,typeof $!="symbol"?$+"":$,F);import{c as pe,r as z,u as We,f as ce,j as C,a as be,l as Ie,m as Ue,d as $e,n as ze,X as we,o as Ke,t as ke,i as qe}from"./index-
|
|
1
|
+
var He=Object.defineProperty;var Fe=(G,$,F)=>$ in G?He(G,$,{enumerable:!0,configurable:!0,writable:!0,value:F}):G[$]=F;var ve=(G,$,F)=>Fe(G,typeof $!="symbol"?$+"":$,F);import{c as pe,r as z,u as We,f as ce,j as C,a as be,l as Ie,m as Ue,d as $e,n as ze,X as we,o as Ke,t as ke,i as qe}from"./index-BiwmRYQP.js";import{u as Ve}from"./task.store-BT1elMl0.js";import{S as Ge}from"./Select-B2hs4bPZ.js";import{A as Xe}from"./arrow-left-CxR172-I.js";import{R as Je}from"./rotate-ccw-DIm7zEDs.js";import{E as Ye}from"./external-link-DEXczFxv.js";import{L as Ee}from"./loader-circle-CGl2dNxT.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 I,j as e,g as T,a as P,r as n,X as U,h as O,f as K,H as Q,i as W,k as R}from"./index-BTxGPsOB.js";import{u as G}from"./task.store-CRByTXd0.js";import{T as B}from"./TaskStatusBadge-B6pZ1mXD.js";import{S as F}from"./Select-cAwdx-J1.js";import{C as V}from"./copy-C0vNNRrm.js";import{E as $}from"./EmptyState-BQ2BNVJS.js";import{T as z}from"./Skeleton-DkwMPaZ1.js";import{P as X}from"./plus-Cm_mqbAL.js";function Z(s,t){return s.length<=t?s:s.slice(0,t)+"..."}function Y(s){const t=Date.now(),m=new Date(s).getTime(),d=t-m,c=Math.floor(d/6e4);if(c<1)return T("common.just_now");if(c<60)return T("common.m_ago",{n:c});const o=Math.floor(c/60);if(o<24)return T("common.h_ago",{n:o});const a=Math.floor(o/24);return T("common.d_ago",{n:a})}function ee({task:s}){const t=I();return e.jsxs("tr",{onClick:()=>t(`/tasks/${s.id}`),className:"cursor-pointer border-b border-[var(--border-row)] transition-colors hover:bg-[var(--bg-input)]",children:[e.jsxs("td",{className:"w-16 py-3 pr-4 font-mono text-xs font-medium text-[var(--text-secondary)] text-right tabular-nums",children:["#",s.id]}),e.jsx("td",{className:"py-3 pr-4 text-sm text-[var(--text-primary)]",children:Z(s.description,80)}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(B,{status:s.status})}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.projectKey}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.machineName??"—"}),e.jsx("td",{className:"py-3 font-mono text-xs text-[var(--text-muted)]",children:Y(s.createdAt)})]})}function te({isOpen:s,onClose:t,projects:m,projectsLoading:d,onSubmit:c,isSubmitting:o}){const{t:a}=P(),[l,g]=n.useState(""),[x,u]=n.useState(""),[b,p]=n.useState(""),[M,k]=n.useState(""),[N,f]=n.useState("");n.useEffect(()=>{s&&(g(""),u(""),p(""),k(""),f(""))},[s]),n.useEffect(()=>{if(!s)return;function i(v){v.key==="Escape"&&t()}return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[s,t]);async function _(i){if(i.preventDefault(),f(""),!l||!x.trim()){f(a("tasks.project_and_description_required"));return}try{await c({projectKey:l,description:x.trim(),machineId:b||void 0,agentType:void 0})}catch(v){const y=v instanceof Error?v.message:a("tasks.failed_to_create_task");f(y)}}return s?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center font-mono",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:i=>{i.target===i.currentTarget&&t()},children:e.jsxs("div",{className:"w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:i=>i.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",a("tasks.new_task")]}),e.jsx("button",{onClick:t,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(U,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:_,className:"px-6 py-5",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.task_description")}),e.jsx("textarea",{value:x,onChange:i=>u(i.target.value),placeholder:a("tasks.describe_task_placeholder"),rows:4,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.project")}),e.jsx(F,{value:l,onChange:g,options:m.map(i=>({value:i.key,label:i.name})),placeholder:a(d?"common.loading":"tasks.select_project"),disabled:d})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.target_machine")}),e.jsx("input",{type:"text",value:b,onChange:i=>p(i.target.value),placeholder:a("tasks.any_able"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.assign_developer")}),e.jsx(F,{value:M,onChange:k,options:[],placeholder:a("tasks.select_developer")})]}),N&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:N})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:t,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]",children:a("common.cancel")}),e.jsx("button",{type:"submit",disabled:o||!l||!x.trim(),className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs text-black transition-opacity hover:opacity-90 disabled:opacity-40",children:a(o?"common.creating":"tasks.create_task")})]})]})]})}):null}function se({isOpen:s,onClose:t,onForceCreate:m,onViewExisting:d,similarTask:c,isLoading:o}){const{t:a}=P();return!c||!s?null:e.jsx("div",{onClick:t,style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{onClick:l=>l.stopPropagation(),style:{width:"100%",maxWidth:"480px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"1.5rem",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{style:{marginBottom:"1.25rem"},children:[e.jsxs("div",{style:{color:"var(--accent)",fontSize:"0.875rem",fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx(V,{style:{width:"1rem",height:"1rem"}}),a("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:a("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",c.id," · ",c.status]}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"0.75rem",marginTop:"0.375rem",lineHeight:"1.5"},children:c.description})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[e.jsx("button",{type:"button",onClick:t,disabled:o,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:o?"not-allowed":"pointer",opacity:o?.7:1,transition:"color 0.15s, border-color 0.15s"},children:a("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>d(c.id),style:{flex:1,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:a("tasks.view_existing")}),e.jsx("button",{type:"button",onClick:m,disabled:o,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--warning)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:o?"not-allowed":"pointer",opacity:o?.7:1},children:a(o?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function re(s){const t=Date.now(),m=new Date(s).getTime(),d=t-m,c=Math.floor(d/6e4);if(c<1)return"just now";if(c<60)return`${c}m ago`;const o=Math.floor(c/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function ae({task:s}){const t=I();return e.jsxs("div",{onClick:()=>t(`/tasks/${s.id}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",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(B,{status:s.status})})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[9px] text-[var(--text-muted)]",children:[e.jsx("span",{children:re(s.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:s.projectKey}),s.machineName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:s.machineName})]})]})]})}const oe=[{key:"all",labelKey:"tasks.tab_all"},{key:"RUNNING",labelKey:"tasks.tab_running"},{key:"QUEUED",labelKey:"tasks.tab_queued"},{key:"COMPLETED",labelKey:"tasks.tab_completed"},{key:"FAILED",labelKey:"tasks.tab_failed"},{key:"CANCELLED",labelKey:"tasks.tab_cancelled"}],E=20;function ue(){const s=I(),{t}=P(),{tasks:m,loading:d,fetchTasks:c}=G(),[o,a]=n.useState("all"),[l,g]=n.useState(""),[x,u]=n.useState(1),[b,p]=n.useState(!1);O(n.useMemo(()=>e.jsxs("button",{onClick:()=>p(!0),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(X,{className:"h-3.5 w-3.5"}),t("tasks.new_task")]}),[t]));const[M,k]=n.useState([]),[N,f]=n.useState(!1),[_,i]=n.useState(!1),[v,y]=n.useState(!1),[A,q]=n.useState(null),[j,H]=n.useState(null);n.useEffect(()=>{const r={limit:String(E)};o!=="all"&&(r.status=o),c(r),u(1)},[o,c]),n.useEffect(()=>{u(1)},[l]),n.useEffect(()=>{b&&(f(!0),K.get("web/projects").json().then(r=>k(r)).catch(()=>{}).finally(()=>f(!1)))},[b]);const J=n.useCallback(async r=>{i(!0);try{const h=await K.post("web/tasks",{json:{projectKey:r.projectKey,description:r.description,machineId:r.machineId}}).json();p(!1),s(`/tasks/${h.task.id}`)}catch(h){if(h instanceof Q&&h.response.status===409){try{const D=await h.response.json();if(D.confirmRequired){q({id:D.confirmRequired.taskId,description:D.confirmRequired.message,status:"active"}),H(r),p(!1),y(!0);return}}catch{}alert(t("tasks.similar_task_exists"))}else throw h}finally{i(!1)}},[s]),L=n.useCallback(async()=>{if(j){i(!0);try{const r=await K.post("web/tasks",{json:{projectKey:j.projectKey,description:j.description,machineId:j.machineId,force:!0}}).json();y(!1),s(`/tasks/${r.task.id}`)}finally{i(!1)}}},[j,s]),w=l.trim()?m.filter(r=>r.description.toLowerCase().includes(l.toLowerCase())||String(r.id).includes(l)):m,C=Math.max(1,Math.ceil(w.length/E)),S=w.slice((x-1)*E,x*E);return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-3 md:gap-4 md:flex-row md:items-center",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1 md:pb-0 no-scrollbar",children:oe.map(r=>e.jsx("button",{onClick:()=>a(r.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-8 text-xs transition-colors ${o===r.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:t(r.labelKey)},r.key))}),e.jsxs("div",{className:"relative md:ml-auto md:w-64",children:[e.jsx(W,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:t("tasks.search_tasks"),value:l,onChange:r=>g(r.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] py-1.5 pl-8 pr-3 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"}),l&&e.jsx("button",{onClick:()=>g(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)]",children:"x"})]})]}),e.jsx("div",{className:"hidden md:block rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] font-medium text-[#525252]",children:[e.jsx("th",{className:"w-16 px-4 py-2.5 text-right",children:t("tasks.id")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.description_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.status_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.project_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.worker")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.time")})]})}),e.jsxs("tbody",{children:[d&&S.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"p-4",children:e.jsx(z,{rows:5})})}),!d&&w.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"p-4",children:e.jsx($,{icon:R,title:t("tasks.no_tasks_found"),description:t(l?"tasks.try_adjusting_search":"tasks.create_first_task"),action:l?void 0:e.jsx("button",{onClick:()=>p(!0),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:t("tasks.create_task")})})})}),S.map(r=>e.jsx(ee,{task:r},r.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[d&&S.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(z,{rows:5})}),!d&&w.length===0&&e.jsx($,{icon:R,title:t("tasks.no_tasks_found"),description:t(l?"tasks.try_adjusting_search":"tasks.create_first_task"),action:l?void 0:e.jsx("button",{onClick:()=>p(!0),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:t("tasks.create_task")})}),S.map(r=>e.jsx(ae,{task:r},r.id))]}),C>1&&e.jsxs("div",{className:"mt-6 flex items-center justify-center gap-1",children:[e.jsx("button",{onClick:()=>u(Math.max(1,x-1)),disabled:x===1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30",children:t("tasks.prev")}),Array.from({length:C},(r,h)=>h+1).map(r=>e.jsx("button",{onClick:()=>u(r),className:`rounded-[4px] px-2.5 py-1 text-xs transition-colors ${x===r?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:r},r)),e.jsx("button",{onClick:()=>u(Math.min(C,x+1)),disabled:x===C,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30",children:t("common.next")})]}),e.jsx(te,{isOpen:b,onClose:()=>p(!1),projects:M,projectsLoading:N,onSubmit:J,isSubmitting:_}),e.jsx(se,{isOpen:v,onClose:()=>y(!1),onForceCreate:L,onViewExisting:r=>{y(!1),s(`/tasks/${r}`)},similarTask:A,isLoading:_})]})}export{ue as default};
|
|
1
|
+
import{d as I,j as e,g as T,a as P,r as n,X as U,h as O,f as K,H as Q,i as W,k as R}from"./index-BiwmRYQP.js";import{u as G}from"./task.store-BT1elMl0.js";import{T as B}from"./TaskStatusBadge-D-fJDHQh.js";import{S as F}from"./Select-B2hs4bPZ.js";import{C as V}from"./copy-BOEo9gzs.js";import{E as $}from"./EmptyState-B5qaL1Ft.js";import{T as z}from"./Skeleton-CyWhQxlf.js";import{P as X}from"./plus-B1evYZLw.js";function Z(s,t){return s.length<=t?s:s.slice(0,t)+"..."}function Y(s){const t=Date.now(),m=new Date(s).getTime(),d=t-m,c=Math.floor(d/6e4);if(c<1)return T("common.just_now");if(c<60)return T("common.m_ago",{n:c});const o=Math.floor(c/60);if(o<24)return T("common.h_ago",{n:o});const a=Math.floor(o/24);return T("common.d_ago",{n:a})}function ee({task:s}){const t=I();return e.jsxs("tr",{onClick:()=>t(`/tasks/${s.id}`),className:"cursor-pointer border-b border-[var(--border-row)] transition-colors hover:bg-[var(--bg-input)]",children:[e.jsxs("td",{className:"w-16 py-3 pr-4 font-mono text-xs font-medium text-[var(--text-secondary)] text-right tabular-nums",children:["#",s.id]}),e.jsx("td",{className:"py-3 pr-4 text-sm text-[var(--text-primary)]",children:Z(s.description,80)}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(B,{status:s.status})}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.projectKey}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.machineName??"—"}),e.jsx("td",{className:"py-3 font-mono text-xs text-[var(--text-muted)]",children:Y(s.createdAt)})]})}function te({isOpen:s,onClose:t,projects:m,projectsLoading:d,onSubmit:c,isSubmitting:o}){const{t:a}=P(),[l,g]=n.useState(""),[x,u]=n.useState(""),[b,p]=n.useState(""),[M,k]=n.useState(""),[N,f]=n.useState("");n.useEffect(()=>{s&&(g(""),u(""),p(""),k(""),f(""))},[s]),n.useEffect(()=>{if(!s)return;function i(v){v.key==="Escape"&&t()}return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[s,t]);async function _(i){if(i.preventDefault(),f(""),!l||!x.trim()){f(a("tasks.project_and_description_required"));return}try{await c({projectKey:l,description:x.trim(),machineId:b||void 0,agentType:void 0})}catch(v){const y=v instanceof Error?v.message:a("tasks.failed_to_create_task");f(y)}}return s?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center font-mono",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:i=>{i.target===i.currentTarget&&t()},children:e.jsxs("div",{className:"w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:i=>i.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",a("tasks.new_task")]}),e.jsx("button",{onClick:t,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(U,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:_,className:"px-6 py-5",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.task_description")}),e.jsx("textarea",{value:x,onChange:i=>u(i.target.value),placeholder:a("tasks.describe_task_placeholder"),rows:4,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.project")}),e.jsx(F,{value:l,onChange:g,options:m.map(i=>({value:i.key,label:i.name})),placeholder:a(d?"common.loading":"tasks.select_project"),disabled:d})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.target_machine")}),e.jsx("input",{type:"text",value:b,onChange:i=>p(i.target.value),placeholder:a("tasks.any_able"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.assign_developer")}),e.jsx(F,{value:M,onChange:k,options:[],placeholder:a("tasks.select_developer")})]}),N&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:N})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:t,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]",children:a("common.cancel")}),e.jsx("button",{type:"submit",disabled:o||!l||!x.trim(),className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs text-black transition-opacity hover:opacity-90 disabled:opacity-40",children:a(o?"common.creating":"tasks.create_task")})]})]})]})}):null}function se({isOpen:s,onClose:t,onForceCreate:m,onViewExisting:d,similarTask:c,isLoading:o}){const{t:a}=P();return!c||!s?null:e.jsx("div",{onClick:t,style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{onClick:l=>l.stopPropagation(),style:{width:"100%",maxWidth:"480px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"1.5rem",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{style:{marginBottom:"1.25rem"},children:[e.jsxs("div",{style:{color:"var(--accent)",fontSize:"0.875rem",fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx(V,{style:{width:"1rem",height:"1rem"}}),a("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:a("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",c.id," · ",c.status]}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"0.75rem",marginTop:"0.375rem",lineHeight:"1.5"},children:c.description})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[e.jsx("button",{type:"button",onClick:t,disabled:o,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:o?"not-allowed":"pointer",opacity:o?.7:1,transition:"color 0.15s, border-color 0.15s"},children:a("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>d(c.id),style:{flex:1,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:a("tasks.view_existing")}),e.jsx("button",{type:"button",onClick:m,disabled:o,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--warning)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:o?"not-allowed":"pointer",opacity:o?.7:1},children:a(o?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function re(s){const t=Date.now(),m=new Date(s).getTime(),d=t-m,c=Math.floor(d/6e4);if(c<1)return"just now";if(c<60)return`${c}m ago`;const o=Math.floor(c/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function ae({task:s}){const t=I();return e.jsxs("div",{onClick:()=>t(`/tasks/${s.id}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",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(B,{status:s.status})})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[9px] text-[var(--text-muted)]",children:[e.jsx("span",{children:re(s.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:s.projectKey}),s.machineName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:s.machineName})]})]})]})}const oe=[{key:"all",labelKey:"tasks.tab_all"},{key:"RUNNING",labelKey:"tasks.tab_running"},{key:"QUEUED",labelKey:"tasks.tab_queued"},{key:"COMPLETED",labelKey:"tasks.tab_completed"},{key:"FAILED",labelKey:"tasks.tab_failed"},{key:"CANCELLED",labelKey:"tasks.tab_cancelled"}],E=20;function ue(){const s=I(),{t}=P(),{tasks:m,loading:d,fetchTasks:c}=G(),[o,a]=n.useState("all"),[l,g]=n.useState(""),[x,u]=n.useState(1),[b,p]=n.useState(!1);O(n.useMemo(()=>e.jsxs("button",{onClick:()=>p(!0),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(X,{className:"h-3.5 w-3.5"}),t("tasks.new_task")]}),[t]));const[M,k]=n.useState([]),[N,f]=n.useState(!1),[_,i]=n.useState(!1),[v,y]=n.useState(!1),[A,q]=n.useState(null),[j,H]=n.useState(null);n.useEffect(()=>{const r={limit:String(E)};o!=="all"&&(r.status=o),c(r),u(1)},[o,c]),n.useEffect(()=>{u(1)},[l]),n.useEffect(()=>{b&&(f(!0),K.get("web/projects").json().then(r=>k(r)).catch(()=>{}).finally(()=>f(!1)))},[b]);const J=n.useCallback(async r=>{i(!0);try{const h=await K.post("web/tasks",{json:{projectKey:r.projectKey,description:r.description,machineId:r.machineId}}).json();p(!1),s(`/tasks/${h.task.id}`)}catch(h){if(h instanceof Q&&h.response.status===409){try{const D=await h.response.json();if(D.confirmRequired){q({id:D.confirmRequired.taskId,description:D.confirmRequired.message,status:"active"}),H(r),p(!1),y(!0);return}}catch{}alert(t("tasks.similar_task_exists"))}else throw h}finally{i(!1)}},[s]),L=n.useCallback(async()=>{if(j){i(!0);try{const r=await K.post("web/tasks",{json:{projectKey:j.projectKey,description:j.description,machineId:j.machineId,force:!0}}).json();y(!1),s(`/tasks/${r.task.id}`)}finally{i(!1)}}},[j,s]),w=l.trim()?m.filter(r=>r.description.toLowerCase().includes(l.toLowerCase())||String(r.id).includes(l)):m,C=Math.max(1,Math.ceil(w.length/E)),S=w.slice((x-1)*E,x*E);return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-3 md:gap-4 md:flex-row md:items-center",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1 md:pb-0 no-scrollbar",children:oe.map(r=>e.jsx("button",{onClick:()=>a(r.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-8 text-xs transition-colors ${o===r.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:t(r.labelKey)},r.key))}),e.jsxs("div",{className:"relative md:ml-auto md:w-64",children:[e.jsx(W,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:t("tasks.search_tasks"),value:l,onChange:r=>g(r.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] py-1.5 pl-8 pr-3 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"}),l&&e.jsx("button",{onClick:()=>g(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)]",children:"x"})]})]}),e.jsx("div",{className:"hidden md:block rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] font-medium text-[#525252]",children:[e.jsx("th",{className:"w-16 px-4 py-2.5 text-right",children:t("tasks.id")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.description_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.status_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.project_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.worker")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.time")})]})}),e.jsxs("tbody",{children:[d&&S.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"p-4",children:e.jsx(z,{rows:5})})}),!d&&w.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"p-4",children:e.jsx($,{icon:R,title:t("tasks.no_tasks_found"),description:t(l?"tasks.try_adjusting_search":"tasks.create_first_task"),action:l?void 0:e.jsx("button",{onClick:()=>p(!0),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:t("tasks.create_task")})})})}),S.map(r=>e.jsx(ee,{task:r},r.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[d&&S.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(z,{rows:5})}),!d&&w.length===0&&e.jsx($,{icon:R,title:t("tasks.no_tasks_found"),description:t(l?"tasks.try_adjusting_search":"tasks.create_first_task"),action:l?void 0:e.jsx("button",{onClick:()=>p(!0),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:t("tasks.create_task")})}),S.map(r=>e.jsx(ae,{task:r},r.id))]}),C>1&&e.jsxs("div",{className:"mt-6 flex items-center justify-center gap-1",children:[e.jsx("button",{onClick:()=>u(Math.max(1,x-1)),disabled:x===1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30",children:t("tasks.prev")}),Array.from({length:C},(r,h)=>h+1).map(r=>e.jsx("button",{onClick:()=>u(r),className:`rounded-[4px] px-2.5 py-1 text-xs transition-colors ${x===r?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:r},r)),e.jsx("button",{onClick:()=>u(Math.min(C,x+1)),disabled:x===C,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30",children:t("common.next")})]}),e.jsx(te,{isOpen:b,onClose:()=>p(!1),projects:M,projectsLoading:N,onSubmit:J,isSubmitting:_}),e.jsx(se,{isOpen:v,onClose:()=>y(!1),onForceCreate:L,onViewExisting:r=>{y(!1),s(`/tasks/${r}`)},similarTask:A,isLoading:_})]})}export{ue as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n,j as e}from"./index-
|
|
1
|
+
import{a as n,j as e}from"./index-BiwmRYQP.js";const r={QUEUED:{labelKey:"tasks.status_queued",color:"var(--text-muted)"},ASSIGNED:{labelKey:"tasks.status_assigned",color:"#60a5fa"},RUNNING:{labelKey:"tasks.status_running",color:"var(--accent)"},SUSPENDED:{labelKey:"tasks.status_suspended",color:"var(--warning)"},COMPLETED:{labelKey:"tasks.status_completed",color:"var(--accent)"},FAILED:{labelKey:"tasks.status_failed",color:"var(--destructive)"},CANCELLED:{labelKey:"tasks.status_cancelled",color:"var(--text-muted)"}};function u({status:t}){const{t:a}=n(),s=r[t]??null,l=s?a(s.labelKey):t.toLowerCase(),o=(s==null?void 0:s.color)??"var(--text-muted)";return e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs",style:{color:o},children:[e.jsx("span",{style:{fontSize:"0.6rem"},children:"●"}),l]})}export{u as T};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as S,r as s,j as e,f as k,d as T,o as L,K as E,x as M,l as D}from"./index-BiwmRYQP.js";import{K as R}from"./key-BKYKn-II.js";import{C as F}from"./copy-BOEo9gzs.js";import{E as A}from"./external-link-DEXczFxv.js";import{E as I}from"./EmptyState-B5qaL1Ft.js";import{T as O}from"./Skeleton-CyWhQxlf.js";import{P as $}from"./plus-B1evYZLw.js";function P({isOpen:a,onClose:v,onCreated:j}){const{t:n}=S(),[r,c]=s.useState(""),[i,x]=s.useState(!1),[m,p]=s.useState(""),u=()=>{c(""),p(""),v()},d=async()=>{if(p(""),!r.trim()){p(n("admin.pat_label_required"));return}try{x(!0);const o=await k.post("admin/worker-tokens",{json:{label:r.trim()}}).json();c(""),j({token:o.token,id:o.id})}catch(o){const l=o instanceof Error?o.message:n("admin.pat_failed_to_generate");p(l)}finally{x(!1)}};return a?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:o=>{o.target===o.currentTarget&&u()},children:e.jsxs("div",{className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{maxWidth:"480px",borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:[e.jsx(R,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:n("admin.generate_worker_token_title")})]}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[m&&e.jsx("div",{className:"border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400",style:{borderRadius:"4px"},children:m}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:n("admin.create_one_time_token")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:n("admin.label")}),e.jsx("input",{type:"text",placeholder:n("admin.pat_label_placeholder"),value:r,onChange:o=>c(o.target.value),className:"w-full border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},onKeyDown:o=>{o.key==="Enter"&&d()}}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:n("admin.label_identifies_machine")})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[e.jsx("button",{onClick:u,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:n("common.cancel")}),e.jsx("button",{onClick:d,disabled:i,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-[#0C0C0C] transition-opacity hover:opacity-80 disabled:opacity-50",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:n(i?"admin.generating":"admin.generate")})]})]})}):null}const B=3e3,J=600*1e3;function K({isOpen:a,token:v,tokenId:j,onClose:n}){const{t:r}=S(),[c,i]=s.useState("command"),[x,m]=s.useState(!1),[p,u]=s.useState(""),[d,o]=s.useState(null),l=s.useRef(void 0),g=s.useRef(Date.now()),h=T(),N=typeof window<"u"?window.location.origin:"https://overlord.example.com",y=`overlord setup worker --token ${v} --server ${N}`,w=async()=>{try{await navigator.clipboard.writeText(y),m(!0),setTimeout(()=>m(!1),2e3)}catch{}},_=s.useCallback(async()=>{try{const f=await k.get(`admin/worker-tokens/${j}/status`).json();f.status==="used"&&f.machine_name&&(i("success"),u(f.machine_name),o(f.machine_id??null),l.current&&clearInterval(l.current))}catch{}Date.now()-g.current>J&&(i("timeout"),l.current&&clearInterval(l.current))},[j]),C=()=>{i("waiting"),g.current=Date.now(),l.current=setInterval(_,B)};s.useEffect(()=>()=>{l.current&&clearInterval(l.current)},[]);const t=()=>{n(),d&&h(`/machines/${d}`)};if(!a)return null;const b={fontFamily:"'JetBrains Mono', monospace",borderRadius:"4px"};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:f=>{f.target===f.currentTarget&&n()},children:e.jsxs("div",{className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{...b,maxWidth:"480px"},children:[e.jsx("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:c==="success"?e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:r("admin.worker_registered")})]}):e.jsxs(e.Fragment,{children:[e.jsx(R,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:r("admin.worker_token_generated")})]})}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[c!=="success"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("admin.run_command_desc")}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-4",style:{borderRadius:"4px"},children:[e.jsxs("code",{className:"block break-all pr-20 text-xs text-[var(--accent)]",children:["$ ",y]}),e.jsx("button",{onClick:w,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:x?e.jsx("span",{className:"text-[var(--accent)]",children:r("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(F,{className:"h-3 w-3"})," ",r("common.copy")]})})]}),e.jsx("div",{className:"border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-xs text-yellow-400",style:{borderRadius:"4px"},children:r("admin.token_shown_once")})]}),c==="waiting"&&e.jsxs("div",{className:"flex items-center gap-3 border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-[var(--accent)] border-t-transparent"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("admin.waiting_for_worker")})]}),c==="timeout"&&e.jsx("div",{className:"border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3 text-xs text-[var(--text-muted)]",style:{borderRadius:"4px"},children:r("admin.token_not_yet_used")}),c==="success"&&e.jsxs("div",{className:"border border-[var(--accent)]/30 bg-[var(--accent)]/10 px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("p",{className:"text-xs text-[var(--accent)]",children:r("admin.worker_registered_success")}),e.jsxs("p",{className:"mt-1 text-xs text-[var(--text-primary)]",children:[r("admin.machine"),": ",e.jsx("span",{className:"text-[var(--accent)]",children:p})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[c==="command"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:n,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:r("common.close")}),e.jsx("button",{onClick:C,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-[#0C0C0C] transition-opacity hover:opacity-80",style:b,children:r("admin.copied_wait_for_worker")})]}),c==="waiting"&&e.jsx("button",{onClick:n,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:r("admin.close_worker_can_register")}),c==="timeout"&&e.jsx("button",{onClick:n,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:r("common.close")}),c==="success"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:n,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:r("common.close")}),e.jsxs("button",{onClick:t,className:"flex items-center gap-1.5 bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-[#0C0C0C] transition-opacity hover:opacity-80",style:b,children:[e.jsx(A,{className:"h-3 w-3"}),r("admin.view_machine")]})]})]})]})})}function H(){const{t:a}=S(),[v,j]=s.useState([]),[n,r]=s.useState(!0),[c,i]=s.useState(!1),[x,m]=s.useState(null),[p,u]=s.useState(!1),[d,o]=s.useState(null),[l,g]=s.useState(!1),[h,N]=s.useState(!1),y=s.useCallback(async()=>{try{r(!0);const t=await k.get("admin/worker-tokens").json();j(t)}catch{}finally{r(!1)}},[]);s.useEffect(()=>{y()},[y]);const w=async()=>{if(d){g(!0);try{await k.post(`admin/worker-tokens/${d.id}/revoke`),u(!1),o(null),y()}catch{}finally{g(!1)}}},_=t=>{i(!1),m(t),y()},C=t=>{switch(t){case"active":return"text-green-400";case"used":return"text-blue-400";case"revoked":return"text-red-400";case"expired":return"text-[var(--text-muted)]";default:return"text-[var(--text-muted)]"}};return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("admin.tokens_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.tokens_subtitle")})]}),e.jsxs("button",{type:"button",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",onClick:()=>i(!0),children:[e.jsx($,{className:"h-3.5 w-3.5"}),a("admin.generate_token")]})]}),!n&&v.some(t=>t.status==="revoked")&&e.jsx("div",{className:"mb-4 flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>N(!h),className:`text-xs transition-colors ${h?"text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:a(h?"admin.hide_revoked":"admin.show_revoked")})}),n?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(O,{rows:3})}):v.filter(t=>h||t.status!=="revoked").length===0?e.jsx(I,{icon:E,title:a("admin.no_worker_tokens"),description:a("admin.generate_token_desc"),actionLabel:a("admin.generate_token"),onAction:()=>i(!0)}):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)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.label")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.purpose")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.status")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("common.created_at")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.expires_at")}),e.jsx("th",{className:"pb-2 font-normal",children:a("common.actions")})]})}),e.jsx("tbody",{children:v.filter(t=>h||t.status!=="revoked").map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:t.label}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.purpose}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:C(t.status),children:t.status})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-2.5 pr-4",children:t.expiresAt?e.jsx("span",{className:"text-[var(--text-secondary)]",children:new Date(t.expiresAt).toLocaleDateString()}):e.jsx("span",{className:"text-[var(--text-muted)]",children:"—"})}),e.jsx("td",{className:"py-2.5",children:t.status==="active"&&e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{o(t),u(!0)},children:[e.jsx(M,{className:"h-3.5 w-3.5"}),a("admin.revoke")]})})]},t.id))})]})}),e.jsx(P,{isOpen:c,onClose:()=>i(!1),onCreated:_}),x&&e.jsx(K,{isOpen:!!x,token:x.token,tokenId:x.id,onClose:()=>m(null)}),e.jsx(D,{isOpen:p,onClose:()=>{u(!1),o(null)},onConfirm:w,title:a("admin.revoke_token"),message:a("admin.revoke_token_confirm",{label:(d==null?void 0:d.label)??""}),confirmLabel:a("admin.revoke"),confirmVariant:"danger",isLoading:l})]})}export{H as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{R as A,d as he,u as Y,a as fe,r as F,j as v,f as J,t as me}from"./index-
|
|
1
|
+
import{R as A,d as he,u as Y,a as fe,r as F,j as v,f as J,t as me}from"./index-BiwmRYQP.js";var ge=Object.defineProperty,T=Object.getOwnPropertySymbols,V=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,W=(u,a,i)=>a in u?ge(u,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[a]=i,j=(u,a)=>{for(var i in a||(a={}))V.call(a,i)&&W(u,i,a[i]);if(T)for(var i of T(a))X.call(a,i)&&W(u,i,a[i]);return u},k=(u,a)=>{var i={};for(var c in u)V.call(u,c)&&a.indexOf(c)<0&&(i[c]=u[c]);if(u!=null&&T)for(var c of T(u))a.indexOf(c)<0&&X.call(u,c)&&(i[c]=u[c]);return i};/**
|
|
2
2
|
* @license QR Code generator library (TypeScript)
|
|
3
3
|
* Copyright (c) Project Nayuki.
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c,d as x,a as d,j as e,o as a}from"./index-
|
|
1
|
+
import{c,d as x,a as d,j as e,o as a}from"./index-BiwmRYQP.js";import{K as l}from"./key-BKYKn-II.js";import{S as m}from"./settings-C0zveA0i.js";/**
|
|
2
2
|
* @license lucide-react v0.469.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|