import{aA as r,l as d,k as l,j as a,E as u,G as m,az as h,ax as p,a9 as o}from"./app-BgLa5dit.js";import{D as b}from"./BE59vaMU.chunk.js";import{u as x}from"./kHNgJL0M.chunk.js";import"./KIVqng-q.chunk.js";const y=r.object().shape({name:r.string().required("Name is required")});function F(s){const e=x(s.dashboardId),t=d(),n=l();function i({name:c}){n(b.copyDashboard(e.data,c)).then(()=>{t.success(`Successfully created a copy of <strong>${e.data.name}</strong>.`)}).catch(()=>{t.error(`Something went wrong while we were trying to copy <strong>${e.data.name}</strong>. Please try again.`)}).finally(()=>s.closePopup())}return a.jsx(u,{title:"Copy dashboard",showLoadingSpinner:!e.data,closePopup:s.closePopup,children:!!e.data&&a.jsxs(a.Fragment,{children:[a.jsx("p",{children:"Enter a name for your new dashboard."}),a.jsx(m,{onSubmit:i,validationSchema:y,initialValues:{name:e.data.name},allowInitialSubmit:!0,children:a.jsxs(h,{children:[a.jsx(p,{label:"Name",placeholder:"Enter a name",name:"name",autoFocus:!0}),a.jsxs(o,{children:[a.jsx(o.Cancel,{onClick:s.closePopup}),a.jsx(o.Submit,{text:"Copy dashboard",variant:"dark"})]})]})})]})})}export{F as CopyDashboardView};
//# sourceMappingURL=SBD7tMj3.chunk.js.map
