D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
local
/
psa
/
admin
/
cp
/
public
/
javascript
/
components
/
pages
/
Filename :
OdbcAddPage.js
back
Copy
(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["components/pages/OdbcAddPage"],{1406:(e,n,i)=>{"use strict";i.r(n),i.d(n,{default:()=>d});var t=i(285),a=i(580),o=i(286);const d=({onClose:e,isOpen:n=!0,closeOnFormSuccess:i=!0,closeUrl:d="..",form:c,...r})=>{const s=(0,a.useNavigate)(),[u,l]=(0,t.useState)(n),m=(0,t.useRef)(null),f=(0,t.useCallback)(((...n)=>{const i=e??(()=>s(d,{preventScrollReset:!0}));l(!1),m.current=setTimeout((()=>{i(...n),m.current=null}),300)}),[d,s,e]);(0,t.useEffect)((()=>()=>{m.current&&clearTimeout(m.current)}),[]),(0,t.useEffect)((()=>{n?m.current&&clearTimeout(m.current):l(n)}),[n]);const p=(0,t.useMemo)((()=>{if(c&&i){if((0,t.isValidElement)(c))return(0,t.cloneElement)(c,{onSuccess:(...e)=>{c.props.onSuccess?.(...e),f()}});if("object"==typeof c)return{...c,onSuccess:(...e)=>{c.onSuccess?.(...e),f()}}}return c}),[i,f,c]);return(0,t.jsx)(o.Drawer,{...r,form:p,onClose:f,isOpen:u})}},2638:(e,n,i)=>{"use strict";i.r(n),i.d(n,{default:()=>h});var t=i(285),a=i(596),o=i.n(a),d=i(580),c=i(588),r=i(628),s=i(89),u=i(286),l=i(1406),m=i(1289),f=i(594),p=i(2633),v=i(1114),b=i.n(v),k=i(2639),S=i.n(k);const g=s.Locale.getTranslate("components.pages.OdbcAdd"),O=({domainId:e,drivers:n})=>{const i=(0,c.useApolloClient)(),a=(0,d.useNavigate)(),[o,s]=(0,t.useState)({name:"",description:"",driver:n[0]}),[v]=(0,r.useMutation)(S(),{update(e){(0,p.evictOdbcDsnConnectionsCache)(e)},onCompleted({addOdbcDsnConnection:{connection:e}}){i.writeQuery({query:b(),data:{connection:e},variables:{id:e.id}}),a(`../${(0,f.getId)(e.id)}/edit`)}});return(0,t.jsx)(l.default,{isOpen:!0,"data-type":"add-odbc",title:(0,t.jsx)(g,{content:"title"}),size:"xs",closeOnFormSuccess:!1,form:(0,t.jsxs)(m.default,{values:o,onFieldChange:(e,n)=>{s((i=>(0,u.setIn)(i,e,n)))},onSubmit:n=>({domainId:e??null,...n}),mutation:v,applyButton:!1,submitButton:{children:(0,t.jsx)(g,{content:"submit"})},vertical:!0,children:[(0,t.jsx)(u.FormFieldText,{name:"name",label:(0,t.jsx)(g,{content:"nameLabel"}),required:!0,autoFocus:!0,inputProps:{maxLength:"32"}}),(0,t.jsx)(u.FormFieldText,{name:"description",label:(0,t.jsx)(g,{content:"descriptionLabel"}),inputProps:{maxLength:"32"}}),(0,t.jsx)(u.FormFieldSelect,{label:(0,t.jsx)(g,{content:"driver"}),name:"driver",children:n.map((e=>(0,t.jsx)("option",{value:e,children:e},e)))})]})})};O.propTypes={domainId:o().string,drivers:o().arrayOf(o().string).isRequired};const h=O},2637:(e,n,i)=>{"use strict";i.r(n),i.d(n,{default:()=>t.default});var t=i(2638)},2633:(e,n,i)=>{"use strict";i.r(n),i.d(n,{evictOdbcDsnConnectionsCache:()=>t});const t=e=>{e.evict({id:e.identify({__typename:"Server"}),fieldName:"odbcDsnConnections"}),Object.values(e.extract()).filter((({__typename:e})=>"Domain"===e)).map((n=>e.evict({id:e.identify(n),fieldName:"odbcDsnConnections"})))}},2639:(e,n,i)=>{var t={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"AddOdbcDsnConnection"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"input"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"AddOdbcDsnConnectionInput"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"addOdbcDsnConnection"},arguments:[{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"Variable",name:{kind:"Name",value:"input"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"domain"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"FragmentSpread",name:{kind:"Name",value:"DomainSubscriptionOdbcLimitFragment"},directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"connection"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"OdbcEditFragment"},directives:[]}]}}]}}]}}],loc:{start:0,end:380}};t.loc.source={body:'#import "queries/OdbcEditFragment.graphql"\n#import "queries/DomainSubscriptionOdbcLimitFragment.graphql"\n\nmutation AddOdbcDsnConnection($input: AddOdbcDsnConnectionInput!) {\n addOdbcDsnConnection(input: $input) {\n domain {\n id\n ...DomainSubscriptionOdbcLimitFragment\n }\n connection {\n ...OdbcEditFragment\n }\n }\n}\n',name:"GraphQL request",locationOffset:{line:1,column:1}};var a={};function o(e){return e.filter((function(e){if("FragmentDefinition"!==e.kind)return!0;var n=e.name.value;return!a[n]&&(a[n]=!0,!0)}))}function d(e,n){if("FragmentSpread"===e.kind)n.add(e.name.value);else if("VariableDefinition"===e.kind){var i=e.type;"NamedType"===i.kind&&n.add(i.name.value)}e.selectionSet&&e.selectionSet.selections.forEach((function(e){d(e,n)})),e.variableDefinitions&&e.variableDefinitions.forEach((function(e){d(e,n)})),e.definitions&&e.definitions.forEach((function(e){d(e,n)}))}t.definitions=t.definitions.concat(o(i(1115).definitions)),t.definitions=t.definitions.concat(o(i(1155).definitions));var c={};function r(e,n){for(var i=0;i<e.definitions.length;i++){var t=e.definitions[i];if(t.name&&t.name.value==n)return t}}t.definitions.forEach((function(e){if(e.name){var n=new Set;d(e,n),c[e.name.value]=n}})),e.exports=t,e.exports.AddOdbcDsnConnection=function(e,n){var i={kind:e.kind,definitions:[r(e,n)]};e.hasOwnProperty("loc")&&(i.loc=e.loc);var t=c[n]||new Set,a=new Set,o=new Set;for(t.forEach((function(e){o.add(e)}));o.size>0;){var d=o;o=new Set,d.forEach((function(e){a.has(e)||(a.add(e),(c[e]||new Set).forEach((function(e){o.add(e)})))}))}return a.forEach((function(n){var t=r(e,n);t&&i.definitions.push(t)})),i}(t,"AddOdbcDsnConnection")}}]); //# sourceMappingURL=OdbcAddPage.js.map?ab23a76c1018cffc0e78