import{l as g,j as e,y as F}from"./vendor-tanstack-BpuysabX.js";import{dP as C,C as S,o as B,i as p,p as i,q as d,y as u,B as P,g as J,h as c,bD as x,bQ as b,bS as E,dQ as L,ca as W}from"./index-CREafGO4.js";import{o as _,r as R,u as Q,n as I,s as U,c as $}from"./vendor-forms-Buh7U8Ay.js";import{a as D}from"./zod-CtcMvSO9.js";import{F as O,b as j,c as h,d as y,e as k,a as w}from"./form-DC8L1tSC.js";import{T as V}from"./textarea-Bxh8agz9.js";import{B as q}from"./base-job-template-form-section-BPISCkag.js";import"./vendor-radix-DIu41Ss_.js";import"./vendor-recharts-C2XeLr4O.js";import"./vendor-date-C1t37jsh.js";import"./schema-form-input-string-format-datetime-CtefOb8F.js";import"./use-debounce-callback-Bybo1_Zg.js";import"./timezone-select-DpL0avEm.js";import"./dropdown-menu-DZExFL3b.js";import"./schema-form-DjXuBlAn.js";import"./block-type-logo-BNO1-Opd.js";const G=_({description:U().nullable().optional(),concurrencyLimit:I().min(0).nullable().optional(),baseJobTemplate:R(Q()).optional()}),H=({workPool:s})=>{const r=g(),{updateWorkPool:n,isPending:l}=C(),a=$({resolver:D(G),defaultValues:{description:s.description??"",concurrencyLimit:s.concurrency_limit??null,baseJobTemplate:s.base_job_template}}),v=a.watch("baseJobTemplate"),N=s.type!=="prefect-agent",f=()=>{r.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"),r.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(O,{...a,children:e.jsxs("form",{onSubmit:o=>{a.handleSubmit(T)(o)},className:"space-y-6",children:[e.jsx(S,{children:e.jsxs(B,{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:a.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(w,{})]})}),e.jsx(j,{control:a.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(w,{})]})}),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})]})]})}),N&&e.jsx(q,{baseJobTemplate:v,onBaseJobTemplateChange:o=>{a.setValue("baseJobTemplate",o)}}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(d,{type:"button",variant:"outline",onClick:f,disabled:l,children:"Cancel"}),e.jsx(d,{type:"submit",disabled:l,children:l?"Saving...":"Save"})]})]})})},M=({workPool:s})=>e.jsx("header",{children:e.jsx(P,{className:"min-w-0",children:e.jsxs(J,{className:"flex-nowrap",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,{className:"min-w-0",children:e.jsx(x,{to:"/work-pools/work-pool/$workPoolName",params:{workPoolName:s.name},className:"text-xl font-semibold truncate block",title:s.name,children:s.name})}),e.jsx(b,{}),e.jsx(c,{className:"text-xl font-semibold",children:e.jsx(E,{children:"Edit"})})]})})}),me=function(){const{workPoolName:r}=L.useParams(),{data:n}=F(W(r));return e.jsxs("div",{className:"container max-w-4xl py-6",children:[e.jsx(M,{workPool:n}),e.jsx(H,{workPool:n})]})};export{me as component};
//# sourceMappingURL=work-pool_._workPoolName.edit-DRyR48xC.js.map
