PageSourceSearch

https://diariodecuba.net/cp/javascript/components/pages/DatabasesPage/AddDatabase.js?f4e74144a86b0c5a227f

js diariodecuba.net collected 2026-10-03 22:38:57 UTC 6,069 bytes, 2 lines download raw bytes

1"use strict";(globalThis.webpackChunkPlesk=globalThis.webpackChunkPlesk||[]).push([["components/pages/DatabasesPage/AddDatabase"],{1526(e,s,a){a.r(s),a.d(s,{default:()=>n});var l=a(396),t=a(715),r=a(397);const n=({onClose:e,isOpen:s=!0,closeOnFormSuccess:a=!0,closeUrl:n="..",form:o,...c})=>{const d=(0,t.useNavigate)(),[i,u]=(0,l.useState)(s),m=(0,l.useRef)(null),p=(0,l.useCallback)((...s)=>{const a=e??(()=>d(n,{preventScrollReset:!0}));u(!1),m.current=setTimeout(()=>{a(...s),m.current=null},300)},[n,d,e]);(0,l.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]),(0,l.useEffect)(()=>{s?m.current&&clearTimeout(m.current):u(s)},[s]);const x=(0,l.useMemo)(()=>{if(o&&a){if((0,l.isValidElement)(o))return(0,l.cloneElement)(o,{onSuccess:(...e)=>{o.props.onSuccess?.(...e),p()}});if("object"==typeof o)return{...o,onSuccess:(...e)=>{o.onSuccess?.(...e),p()}}}return o},[a,p,o]);return(0,l.jsx)(r.Drawer,{...c,form:x,onClose:p,isOpen:i})}},2827(e,s,a){a.r(s),a.d(s,{default:()=>t});a(2828);var l=a(396);const t=({prefix:e,children:s})=>(0,l.jsxs)("div",{className:"prefixed-form-element",children:[e&&(0,l.jsx)("span",{className:"prefixed-form-element-prefix",children:e}),s]})},2826(e,s,a){a.r(s),a.d(s,{default:()=>l.default});var l=a(2827)},2825(e,s,a){a.r(s),a.d(s,{default:()=>p});var l=a(1526),t=a(95),r=a(1371),n=a(715),o=a(396),c=a(397),d=a(2826),i=a(663);const u=t.Locale.getTranslate("components.pages.Databases.Add"),m=t.Locale.getSection("components.pages.Databases.Add"),p=({data:e})=>{const{reloadDatabaseList:s}=(0,n.useOutletContext)(),a=(0,n.useParams)(),[t,p]=(0,o.useState)(()=>({general:{name:e.name,dbServer:e.defaultDbServerId,domainId:""},user:{name:"",createUser:"1",password:void 0,allDbAccess:"false",aclRadio:e.aclRadio,aclHosts:e.aclHosts,remoteAccessRadio:"denied"}})),x=(0,o.useMemo)(()=>Object.entries(e.servers).map(([e,s])=>({id:Number(e),name:s})),[e.servers]),b=e.permissions.remoteDbConnection,j=e.aclSupportedServers.includes(t.general.dbServer),v=e.remoteAccessRulesSupportedServers.includes(t.general.dbServer),g=b&&j,h=b&&e.isFirewallSupported&&v,f=h&&j,F=h&&!j,S=e.userNamePrefixes[t.general.dbServer]??"";return(0,o.jsx)(l.default,{size:"sm",title:(0,o.jsx)(u,{content:"title"}),form:(0,o.jsxs)(r.default,{action:`/smb/database/create/domainId/${a.domainId}`,values:t,applyButton:!1,submitButton:{children:(0,o.jsx)(u,{content:"create"}),"data-action-name":"submit"},onSubmit:e=>{"1"===e.user.createUser&&(e.user.passwordConfirmation=e.user.password);const s=g?e.user.aclRadio:void 0,a="custom"===s?e.user.aclHosts:void 0,l=F?e.user.remoteAccessRadio:void 0,t="allowed"===l?e.user.remoteAccessAllowed:void 0;return{...e,user:{...e.user,aclRadio:s,aclHosts:a,remoteAccessRadio:l,remoteAccessAllowed:t}}},onSuccess:({name:e})=>{(0,i.addToast)({intent:"success",message:(0,o.jsx)(u,{content:"databaseCreated",params:{name:e}})}),s?.()},onFieldChange:(e,s)=>{p(a=>(0,c.setIn)(a,e,s))},children:[(0,o.jsx)(c.FormField,{required:!0,name:"general[name]",label:(0,o.jsx)(u,{content:"name"}),children:({getValue:s,setValue:a,getName:l,getId:t,isDisabled:r})=>(0,o.jsx)(d.default,{prefix:e.dbPrefix,children:(0,o.jsx)(c.Input,{id:t(),name:l(),value:s(),disabled:r(),onChange:e=>a(e.target.value)})})}),x.length>1?(0,o.jsx)(c.FormFieldSelect,{name:"general[dbServer]",label:(0,o.jsx)(u,{content:"server"}),"data-testid":"dbserver-select",children:x.map(({id:e,name:s})=>(0,o.jsx)("option",{value:e,children:s},e))}):(0,o.jsx)(c.FormField,{"data-testid":"dbserver-text",label:(0,o.jsx)(u,{content:"server"}),children:x[0]?.name}),(0,o.jsxs)(c.FormFieldSelect,{name:"general[domainId]",label:(0,o.jsx)(u,{content:"relatedDomain"}),children:[(0,o.jsx)("option",{value:"",children:m.lmsg("noDomainRelations")}),e.relatedDomains.map(({id:e,name:s})=>(0,o.jsx)("option",{value:e,children:s},e))]}),(0,o.jsxs)(c.Section,{title:(0,o.jsx)(u,{content:"userSection"}),children:[(0,o.jsx)(c.Paragraph,{children:(0,o.jsx)(u,{content:"userSectionDescription"})}),(0,o.jsx)(c.FormFieldCheckbox,{checkedValue:"1",uncheckedValue:"0",name:"user[createUser]",label:(0,o.jsx)(u,{content:"createUser"})}),"1"===t.user.createUser&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(c.FormField,{name:"user[name]",label:(0,o.jsx)(u,{content:"username"}),required:!0,children:({getValue:e,setValue:s,getName:a,getId:l,isDisabled:t})=>(0,o.jsx)(d.default,{prefix:S,children:(0,o.jsx)(c.Input,{id:l(),name:a(),value:e(),disabled:t(),onChange:e=>s(e.target.value)})})}),(0,o.jsx)(c.FormFieldPassword,{name:"user[password]",autoComplete:"new-password",label:(0,o.jsx)(u,{content:"password"}),required:!0}),(0,o.jsx)(c.FormFieldCheckbox,{checkedValue:"true",uncheckedValue:"false",name:"user[allDbAccess]",label:(0,o.jsx)(u,{content:"allDbAccess"})}),g&&(0,o.jsx)(c.FormFieldRadioButtons,{name:"user[aclRadio]",label:(0,o.jsx)(u,{content:"aclRadio"}),options:[{value:"localhost",label:m.lmsg("aclLocalhost")},{value:"any",label:m.lmsg("aclAny")},{value:"custom",label:m.lmsg("aclCustom"),indentFields:"custom"===t.user.aclRadio?[(0,o.jsx)(c.FormFieldText,{label:null,multiline:!0,name:"user[aclHosts]",size:"lg",inputProps:{"aria-label":m.lmsg("aclHostsLabel")},description:(0,o.jsx)(u,{component:"div",style:{whiteSpace:"pre-line"},content:"example",params:{example:(0,o.jsx)(u,{content:"aclExample"})}})},"aclHosts")]:void 0}]}),f&&(0,o.jsx)(c.Paragraph,{children:(0,o.jsx)(u,{content:"remoteAccessHint"})}),F&&(0,o.jsx)(c.FormFieldRadioButtons,{name:"user[remoteAccessRadio]",label:(0,o.jsx)(u,{content:"remoteAccess"}),options:[{value:"denied",label:m.lmsg("remoteAccessDenied")},{value:"allowed",label:m.lmsg("remoteAccessAllowed"),indentFields:"allowed"===t.user.remoteAccessRadio?[(0,o.jsx)(c.FormFieldText,{label:null,multiline:!0,name:"user[remoteAccessAllowed]",size:"lg",description:(0,o.jsx)(u,{component:"div",style:{whiteSpace:"pre-line"},content:"example",params:{example:(0,o.jsx)(u,{content:"remoteAccessExample"})}})},"remoteAccessAllowed")]:void 0}]})]})]})]})})}},2828(e,s,a){a.r(s)}}]);
2//# sourceMappingURL=AddDatabase.js.map?f4e74144a86b0c5a227f

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.