import{f as g,j as e,s as C}from"./vendor-tanstack-CvGXetsl.js";import{dO as F,C as B,o as S,i as p,p as i,q as d,y as u,B as P,g as J,h as c,bC as x,bM as b,bO as E,dP as L,c9 as W}from"./index-D51s66kn.js";import{o as _,r as R,n as O,s as I,u as U,c as $}from"./vendor-forms-BVeRYtt6.js";import{a as M}from"./zod-CwzzXHlJ.js";import{F as Q,b as j,c as h,d as y,e as k,a as v}from"./form-D2Aou2qB.js";import{T as V}from"./textarea-PiPsveor.js";import{B as q}from"./base-job-template-form-section-Ci_8QMZB.js";import"./vendor-react-HBv6Kpyp.js";import"./vendor-radix-y_Ik_hIG.js";import"./vendor-recharts-heKD2IVO.js";import"./vendor-date-GSGg4LXF.js";import"./schema-form-input-string-format-datetime-Clw2ur0E.js";import"./use-debounce-callback-BLKy1Dnx.js";import"./timezone-select-CZ0VB4eH.js";import"./dropdown-menu-0GXqpEoR.js";import"./schema-form-odF9PHdj.js";import"./block-type-logo-DE7MqOhA.js";const D=_({description:I().nullable().optional(),concurrencyLimit:O().min(0).nullable().optional(),baseJobTemplate:R(U()).optional()}),G=({workPool:s})=>{const a=g(),{updateWorkPool:n,isPending:l}=F(),r=$({resolver:M(D),defaultValues:{description:s.description??"",concurrencyLimit:s.concurrency_limit??null,baseJobTemplate:s.base_job_template}}),w=r.watch("baseJobTemplate"),f=s.type!=="prefect-agent",N=()=>{a.history.back()},T=o=>{n({name:s.name,workPool:{description:o.description||null,concurrency_limit:o.concurrencyLimit,base_job_template:o.baseJobTemplate}},{onSuccess:()=>{u.success("Work pool updated"),a.navigate({to:"/work-pools/work-pool/$workPoolName",params:{workPoolName:s.name}})},onError:t=>{u.error(`Failed to update work pool: ${t instanceof Error?t.message:"Unknown error"}`)}})};return e.jsx(Q,{...r,children:e.jsxs("form",{onSubmit:o=>{r.handleSubmit(T)(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(p,{htmlFor:"work-pool-name",children:"Name"}),e.jsx(i,{id:"work-pool-name",value:s.name,disabled:!0})]}),e.jsx(j,{control:r.control,name:"description",render:({field:o})=>e.jsxs(h,{children:[e.jsx(y,{children:"Description (Optional)"}),e.jsx(k,{children:e.jsx(V,{...o,value:o.value??"",rows:7,placeholder:"Enter a description for your work pool"})}),e.jsx(v,{})]})}),e.jsx(j,{control:r.control,name:"concurrencyLimit",render:({field:o})=>e.jsxs(h,{children:[e.jsx(y,{children:"Flow Run Concurrency (Optional)"}),e.jsx(k,{children:e.jsx(i,{...o,type:"number",min:0,placeholder:"Unlimited",value:o.value??"",onChange:t=>{const m=t.target.value;o.onChange(m===""?null:Number(m))}})}),e.jsx(v,{})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"work-pool-type",children:"Type"}),e.jsx(i,{id:"work-pool-type",value:s.type,disabled:!0})]})]})}),f&&e.jsx(q,{baseJobTemplate:w,onBaseJobTemplateChange:o=>{r.setValue("baseJobTemplate",o)}}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(d,{type:"button",variant:"outline",onClick:N,disabled:l,children:"Cancel"}),e.jsx(d,{type:"submit",disabled:l,children:l?"Saving...":"Save"})]})]})})},H=({workPool:s})=>e.jsx("header",{className:"mb-6",children:e.jsx(P,{children:e.jsxs(J,{children:[e.jsx(c,{children:e.jsx(x,{to:"/work-pools",className:"text-xl font-semibold",children:"Work Pools"})}),e.jsx(b,{}),e.jsx(c,{children:e.jsx(x,{to:"/work-pools/work-pool/$workPoolName",params:{workPoolName:s.name},className:"text-xl font-semibold",children:s.name})}),e.jsx(b,{}),e.jsx(c,{className:"text-xl font-semibold",children:e.jsx(E,{children:"Edit"})})]})})}),pe=function(){const{workPoolName:a}=L.useParams(),{data:n}=C(W(a));return e.jsxs("div",{className:"container max-w-4xl py-6",children:[e.jsx(H,{workPool:n}),e.jsx(G,{workPool:n})]})};export{pe as component};
//# sourceMappingURL=work-pool_._workPoolName.edit-Bw-zIKVc.js.map
