import{F as f,j as e,s as g}from"./vendor-tanstack-BVzzyDEt.js";import{dE as B,ad as C,aj as S,G as P,K as E,j as m,ao as l,ak as d,al as p,am as u,an as b,ap as x,q as j,w as h,B as J,a as L,b as i,bq as y,bz as k,bB as W,dF as _,bY as R}from"./index-BJkJ93Lr.js";import{b as I,r as U,n as $,c as q,h as G,d as O}from"./vendor-forms-BN3tpxM2.js";import{T as Q}from"./textarea-BWNxlLo9.js";import{B as V}from"./base-job-template-form-section-DiW18Fhk.js";import"./vendor-react-Bce9NwRC.js";import"./vendor-radix-CTAic6HB.js";import"./vendor-recharts-Mwm2qLZp.js";import"./vendor-date-2jFo9aCm.js";import"./primitives-BxgEGUr4.js";import"./schema-form-savMxoOe.js";import"./use-debounce-callback-K3TIomWn.js";import"./toggle-group-B18EYoB-.js";const z=I({description:q().nullable().optional(),concurrencyLimit:$().min(0).nullable().optional(),baseJobTemplate:U(G()).optional()}),D=({workPool:s})=>{const r=f(),{updateWorkPool:v,isPending:t}=B(),a=O({resolver:C(z),defaultValues:{description:s.description??"",concurrencyLimit:s.concurrency_limit??null,baseJobTemplate:s.base_job_template}}),w=a.watch("baseJobTemplate"),N=s.type!=="prefect-agent",T=()=>{r.history.back()},F=o=>{v({name:s.name,workPool:{description:o.description||null,concurrency_limit:o.concurrencyLimit,base_job_template:o.baseJobTemplate}},{onSuccess:()=>{h.success("Work pool updated"),r.navigate({to:"/work-pools/work-pool/$workPoolName",params:{workPoolName:s.name}})},onError:n=>{h.error(`Failed to update work pool: ${n instanceof Error?n.message:"Unknown error"}`)}})};return e.jsx(S,{...a,children:e.jsxs("form",{onSubmit:o=>{a.handleSubmit(F)(o)},className:"space-y-6",children:[e.jsx(P,{children:e.jsxs(E,{className:"pt-6 space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"work-pool-name",children:"Name"}),e.jsx(l,{id:"work-pool-name",value:s.name,disabled:!0})]}),e.jsx(d,{control:a.control,name:"description",render:({field:o})=>e.jsxs(p,{children:[e.jsx(u,{children:"Description (Optional)"}),e.jsx(b,{children:e.jsx(Q,{...o,value:o.value??"",rows:7,placeholder:"Enter a description for your work pool"})}),e.jsx(x,{})]})}),e.jsx(d,{control:a.control,name:"concurrencyLimit",render:({field:o})=>e.jsxs(p,{children:[e.jsx(u,{children:"Flow Run Concurrency (Optional)"}),e.jsx(b,{children:e.jsx(l,{...o,type:"number",min:0,placeholder:"Unlimited",value:o.value??"",onChange:n=>{const c=n.target.value;o.onChange(c===""?null:Number(c))}})}),e.jsx(x,{})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"work-pool-type",children:"Type"}),e.jsx(l,{id:"work-pool-type",value:s.type,disabled:!0})]})]})}),N&&e.jsx(V,{baseJobTemplate:w,onBaseJobTemplateChange:o=>{a.setValue("baseJobTemplate",o)}}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(j,{type:"button",variant:"outline",onClick:T,disabled:t,children:"Cancel"}),e.jsx(j,{type:"submit",disabled:t,children:t?"Saving...":"Save"})]})]})})},H=({workPool:s})=>e.jsx("header",{className:"mb-6",children:e.jsx(J,{children:e.jsxs(L,{children:[e.jsx(i,{children:e.jsx(y,{to:"/work-pools",className:"text-xl font-semibold",children:"Work Pools"})}),e.jsx(k,{}),e.jsx(i,{children:e.jsx(y,{to:"/work-pools/work-pool/$workPoolName",params:{workPoolName:s.name},className:"text-xl font-semibold",children:s.name})}),e.jsx(k,{}),e.jsx(i,{className:"text-xl font-semibold",children:e.jsx(W,{children:"Edit"})})]})})});function le(){const{workPoolName:s}=_.useParams(),{data:r}=g(R(s));return e.jsxs("div",{className:"container max-w-4xl py-6",children:[e.jsx(H,{workPool:r}),e.jsx(D,{workPool:r})]})}export{le as component};
//# sourceMappingURL=work-pool_._workPoolName.edit-CwIAaRci.js.map
