"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["components/pages/MoveDatabasePage"],{1420:(e,s,t)=>{t.r(s),t.d(s,{default:()=>o});var n=t(295),a=t(598),r=t(296);const o=({onClose:e,isOpen:s=!0,closeOnFormSuccess:t=!0,closeUrl:o="..",form:c,...u})=>{const l=(0,a.useNavigate)(),[i,m]=(0,n.useState)(s),d=(0,n.useRef)(null),p=(0,n.useCallback)((...s)=>{const t=e??(()=>l(o,{preventScrollReset:!0}));m(!1),d.current=setTimeout(()=>{t(...s),d.current=null},300)},[o,l,e]);(0,n.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]),(0,n.useEffect)(()=>{s?d.current&&clearTimeout(d.current):m(s)},[s]);const f=(0,n.useMemo)(()=>{if(c&&t){if((0,n.isValidElement)(c))return(0,n.cloneElement)(c,{onSuccess:(...e)=>{c.props.onSuccess?.(...e),p()}});if("object"==typeof c)return{...c,onSuccess:(...e)=>{c.onSuccess?.(...e),p()}}}return c},[t,p,c]);return(0,n.jsx)(r.Drawer,{...u,form:f,onClose:p,isOpen:i})}},2408:(e,s,t)=>{t.r(s),t.d(s,{default:()=>n.default});var n=t(2409)},2409:(e,s,t)=>{t.r(s),t.d(s,{default:()=>m});var n=t(295),a=t(598),r=t(296),o=t(1420),c=t(90),u=t(1294),l=t(545);const i=c.Locale.getTranslate("components.pages.MoveDatabasePage"),m=({url:e,ids:s,database:t,viewer:{client:{subscriptions:{nodes:c}}}})=>{const{reloadDatabaseList:m}=(0,a.useOutletContext)(),[d,p]=(0,n.useState)({domainName:"",ids:s.map(Number)});return(0,n.jsx)(o.default,{size:"sm",title:(0,n.jsx)(i,{content:"title"}),subtitle:t&&(0,n.jsx)(i,{content:"description",params:{name:(0,n.jsx)("b",{children:t.name})}}),form:(0,n.jsxs)(u.default,{action:e,onFieldChange:(e,s)=>{p(t=>(0,r.setIn)(t,e,s))},values:d,applyButton:!1,onSuccess:({statusMessages:e})=>{e.forEach(({content:e,status:s})=>{(0,l.addToast)({intent:"error"===s?"danger":"success",message:(0,n.jsx)("span",{dangerouslySetInnerHTML:{__html:e}})})}),m?.()},submitButton:{children:(0,n.jsx)(i,{content:"save"}),"data-action-name":"submit"},children:[(0,n.jsx)(r.Paragraph,{children:(0,n.jsx)(i,{content:"hint"})}),(0,n.jsx)(r.FormFieldSelect,{"data-action-name":"assignToSubscriptionSelect",size:"fill",name:"domainName",label:(0,n.jsx)(i,{content:"subscriptionName"}),searchable:!0,required:!0,children:c.map(({mainDomain:{name:e}})=>(0,n.jsx)("option",{value:e,children:e},e))})]})})}}}]);
//# sourceMappingURL=MoveDatabasePage.js.map?305f8e611e0593de0b1f