"use strict";(globalThis.webpackChunkPlesk=globalThis.webpackChunkPlesk||[]).push([["components/pages/MoveDatabasePage"],{1528(e,s,t){t.r(s),t.d(s,{default:()=>o});var n=t(372),a=t(693),r=t(373);const o=({onClose:e,isOpen:s=!0,closeOnFormSuccess:t=!0,closeUrl:o="..",form:c,...l})=>{const u=(0,a.useNavigate)(),[i,m]=(0,n.useState)(s),d=(0,n.useRef)(null),p=(0,n.useCallback)((...s)=>{const t=e??(()=>u(o,{preventScrollReset:!0}));m(!1),d.current=setTimeout(()=>{t(...s),d.current=null},300)},[o,u,e]);(0,n.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]),(0,n.useEffect)(()=>{s?d.current&&clearTimeout(d.current):m(s)},[s]);const b=(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,{...l,form:b,onClose:p,isOpen:i})}},2583(e,s,t){t.r(s),t.d(s,{default:()=>m});var n=t(372),a=t(693),r=t(373),o=t(1528),c=t(95),l=t(1402),u=t(639);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)(l.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,u.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))})]})})}},2582(e,s,t){t.r(s),t.d(s,{default:()=>n.default});var n=t(2583)}}]);
//# sourceMappingURL=MoveDatabasePage.js.map?ab3abf52072a52c55a19