import{g,j as e,s as F}from"./vendor-tanstack-DE4ALVGD.js";import{dC as C,C as B,o as S,i as m,p as l,q as p,y as d,B as P,g as E,h as i,bv as u,bE as x,bG as J,dD as L,c0 as W}from"./index-CNL5pSma.js";import{o as _,r as R,n as I,s as U,u as $,c as D}from"./vendor-forms-BvpM0AtX.js";import{a as G}from"./zod-2_bJZbih.js";import{F as O,b,c as j,d as h,e as y,a as k}from"./form-_6uPI_KA.js";import{T as Q}from"./textarea-CaeS8CF9.js";import{B as V}from"./base-job-template-form-section-8hkpVQYG.js";import"./vendor-react-HBv6Kpyp.js";import"./vendor-radix-K8EF6rBE.js";import"./vendor-recharts-B3wzJa9e.js";import"./vendor-date-Bck8LDfw.js";import"./schema-form-input-string-format-datetime-B98i_B5d.js";import"./use-debounce-callback-_1tAtOwa.js";import"./timezone-select-zsZ2PBlt.js";import"./dropdown-menu-D34zumpn.js";import"./schema-form-CzhA4Rtf.js";import"./block-type-logo-Ab-MB0rX.js";const q=_({description:U().nullable().optional(),concurrencyLimit:I().min(0).nullable().optional(),baseJobTemplate:R($()).optional()}),H=({workPool:s})=>{const a=g(),{updateWorkPool:v,isPending:t}=C(),r=D({resolver:G(q),defaultValues:{description:s.description??"",concurrencyLimit:s.concurrency_limit??null,baseJobTemplate:s.base_job_template}}),w=r.watch("baseJobTemplate"),N=s.type!=="prefect-agent",T=()=>{a.history.back()},f=o=>{v({name:s.name,workPool:{description:o.description||null,concurrency_limit:o.concurrencyLimit,base_job_template:o.baseJobTemplate}},{onSuccess:()=>{d.success("Work pool updated"),a.navigate({to:"/work-pools/work-pool/$workPoolName",params:{workPoolName:s.name}})},onError:n=>{d.error(`Failed to update work pool: ${n instanceof Error?n.message:"Unknown error"}`)}})};return e.jsx(O,{...r,children:e.jsxs("form",{onSubmit:o=>{r.handleSubmit(f)(o)},className:"space-y-6",children:[e.jsx(B,{children:e.jsxs(S,{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(b,{control:r.control,name:"description",render:({field:o})=>e.jsxs(j,{children:[e.jsx(h,{children:"Description (Optional)"}),e.jsx(y,{children:e.jsx(Q,{...o,value:o.value??"",rows:7,placeholder:"Enter a description for your work pool"})}),e.jsx(k,{})]})}),e.jsx(b,{control:r.control,name:"concurrencyLimit",render:({field:o})=>e.jsxs(j,{children:[e.jsx(h,{children:"Flow Run Concurrency (Optional)"}),e.jsx(y,{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(k,{})]})}),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=>{r.setValue("baseJobTemplate",o)}}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(p,{type:"button",variant:"outline",onClick:T,disabled:t,children:"Cancel"}),e.jsx(p,{type:"submit",disabled:t,children:t?"Saving...":"Save"})]})]})})},M=({workPool:s})=>e.jsx("header",{className:"mb-6",children:e.jsx(P,{children:e.jsxs(E,{children:[e.jsx(i,{children:e.jsx(u,{to:"/work-pools",className:"text-xl font-semibold",children:"Work Pools"})}),e.jsx(x,{}),e.jsx(i,{children:e.jsx(u,{to:"/work-pools/work-pool/$workPoolName",params:{workPoolName:s.name},className:"text-xl font-semibold",children:s.name})}),e.jsx(x,{}),e.jsx(i,{className:"text-xl font-semibold",children:e.jsx(J,{children:"Edit"})})]})})});function pe(){const{workPoolName:s}=L.useParams(),{data:a}=F(W(s));return e.jsxs("div",{className:"container max-w-4xl py-6",children:[e.jsx(M,{workPool:a}),e.jsx(H,{workPool:a})]})}export{pe as component};
//# sourceMappingURL=work-pool_._workPoolName.edit-DyC2iKLK.js.map
