import{d as D,g as v,f as h,t as w,j as l,c as b,k as s,a as C,l as g,o as k,m as c,n as r,c9 as x,ca as I,N as p,cb as m,bo as N,O as B}from"./index-CgvuCQfr.js";import{u as E}from"./usePageTitle-DVT0B9Gy.js";const K=D({__name:"DeploymentDuplicate",setup(S){const a=v(),u=h("deploymentId"),d=w(a.deployments.getDeployment,[u.value],{}),e=l(()=>d.response);function i(t){return"name"in t}async function y(t){try{if(!i(t))throw new Error("Invalid request");const n=await a.deployments.createDeployment(t);p("Deployment created","success"),m.push(N.deployment(n.id))}catch(n){const o=B(n,"Error creating deployment");p(o,"error"),console.warn(n)}}function f(){m.back()}const _=l(()=>e.value?`Duplicate Deployment: ${e.value.name}`:"Duplicate Deployment");return E(_),(t,n)=>{const o=g("p-layout-default");return e.value?(k(),b(o,{key:0,class:"deployment-edit"},{header:s(()=>[c(r(x),{deployment:e.value},null,8,["deployment"])]),default:s(()=>[c(r(I),{deployment:e.value,mode:"duplicate",onCancel:f,onSubmit:y},null,8,["deployment"])]),_:1})):C("",!0)}}});export{K as default};
//# sourceMappingURL=DeploymentDuplicate-Cee3TRkL.js.map
