import{d as D,g as v,W as g,e as h,f as l,c as k,i as s,a as w,j as C,o as b,k as r,l as c,c6 as x,c7 as I,P as p,c8 as m,bk as P,Z as W}from"./index-BBlvj0M_.js";import{u as B}from"./usePageTitle-lBdMRcrQ.js";const V=D({__name:"DeploymentDuplicate",setup(E){const a=v(),u=g("deploymentId"),d=h(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(P.deployment(n.id))}catch(n){const o=W(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 B(_),(t,n)=>{const o=C("p-layout-default");return e.value?(b(),k(o,{key:0,class:"deployment-edit"},{header:s(()=>[r(c(x),{deployment:e.value},null,8,["deployment"])]),default:s(()=>[r(c(I),{deployment:e.value,mode:"duplicate",onCancel:f,onSubmit:y},null,8,["deployment"])]),_:1})):w("",!0)}}});export{V as default};
//# sourceMappingURL=DeploymentDuplicate-V7rlH3zg.js.map
