????
Current Path : C:/inetpub/vhost/dbadm.gdtsolutions.vn/web/js/ |
Current File : C:/inetpub/vhost/dbadm.gdtsolutions.vn/web/js/plugin-sql-generator-57a790bf3a9c3cce675a.js |
/*! For license information please see ../license.txt */ "use strict";(self.webpackChunk_cloudbeaver_product_default=self.webpackChunk_cloudbeaver_product_default||[]).push([[12145],{59621:(e,t,r)=>{r.r(t),r.d(t,{GeneratorMenuBootstrap:()=>_});var o=r(1118),i=r(82103),s=r(5576),n=r(43974),a=r(79023),c=r(72877),l=r(33399),d=r(84823),u=r(26500),p=r(49418),h=r(35173);const v=(0,r(19102).V)("sql-generate",{label:"data_viewer_script_preview",tooltip:"data_viewer_script_preview",icon:"sql-script-preview"});var g=r(60398);let _=class GeneratorMenuBootstrap extends i.j{constructor(e,t,r){super(),this.scriptPreviewService=e,this.actionService=t,this.menuService=r}register(){this.menuService.addCreator({menus:[l.N],contexts:[d.i,u.$],isApplicable:e=>{const t=e.get(d.i),r=e.get(u.$),o=e.get(p.$);return!(t.isReadonly(r)||t.source.getResult(r)?.dataFormat!==n.fev.Resultset||o?.readonly||o&&o.type!==p.N.Data)},getItems:(e,t)=>[...t,v]}),this.actionService.addHandler({id:"data-sql-tools-handler",menus:[l.N],actions:[v],contexts:[d.i,u.$],isDisabled(e){const t=e.get(d.i),r=e.get(u.$);if(t.isLoading()||t.isDisabled(r)||!t.source.hasResult(r))return!0;const o=t.source.getActionImplementation(r,h.M);return!o?.isEdited()},handler:e=>{this.scriptPreviewService.open(e.get(d.i),e.get(u.$))}})}};_=(0,o.Cg)([(0,s._)(),(0,o.Sn)("design:paramtypes",[g.ScriptPreviewService,a.ActionService,c.MenuService])],_)},7891:(e,t,r)=>{r.r(t),r.d(t,{LocaleService:()=>a});var o=r(1118),i=r(82103),s=r(5576),n=r(34227);let a=class LocaleService extends i.j{constructor(e){super(),this.localizationService=e}register(){this.localizationService.addProvider(this.provider.bind(this))}load(){}async provider(e){switch(e){case"ru":return(await Promise.all([r.e(92436),r.e(84846)]).then(r.bind(r,47649))).default;case"it":return(await Promise.all([r.e(32756),r.e(62465)]).then(r.bind(r,96901))).default;case"zh":return(await Promise.all([r.e(52041),r.e(29608)]).then(r.bind(r,42302))).default;case"fr":return(await Promise.all([r.e(29671),r.e(7227)]).then(r.bind(r,85328))).default;default:return(await Promise.all([r.e(41114),r.e(74370)]).then(r.bind(r,79831))).default}}};a=(0,o.Cg)([(0,s._)(),(0,o.Sn)("design:paramtypes",[n.LocalizationService])],a)},51431:(e,t,r)=>{r.r(t),r.d(t,{ScriptPreviewDialog:()=>C});var o=r(41773),i=r(7838),s=r(17675),n=r(51299),a=r(64928),c=r(84383),l=r(51477),d=r(62204),u=r(92659),p=r(7167),h=r(9428),v=r(89232),g=r(68426),_=r(13225),S=r(927),m=r(49690),f=r(18699),y=r(42453),w=r(49759),x=r(2293);const q={wrapper:"wrapper___vdbaG",sqlCodeEditorLoader:"sqlCodeEditorLoader___Dqy8A",footer:"footer___LVaeF"},C=(0,i.PA)((function ScriptPreviewDialog({rejectDialog:e,payload:t}){const r=(0,s.W)(),i=(0,n.i)(),C=(0,a.d)(q),j=(0,f.h)(_.ConnectionExecutionContextService).get(t.model.source.executionContext?.context?.id??""),G=j?.context,D=(0,c.q)(ScriptPreviewDialog,S.ConnectionDialectResource,G?(0,m.createConnectionParam)(G.projectId,G.connectionId):null),b=(0,w.n)(D.data),I=(0,y.s)();I.set(...b);return(0,o.jsxs)(l.n,{size:"large",children:[(0,o.jsx)(d.D,{title:"data_viewer_script_preview_dialog_title",icon:"sql-script",onReject:e}),(0,o.jsx)(u.a,{noBodyPadding:!0,noOverflow:!0,children:(0,o.jsx)("div",{className:(0,p.s)(C,{wrapper:!0}),children:(0,o.jsx)(x.m,{className:(0,p.s)(C,{sqlCodeEditorLoader:!0}),value:t.script,extensions:I,lineNumbers:!0,readonly:!0})})}),(0,o.jsxs)(h.Z,{className:(0,p.s)(C,{footer:!0}),children:[(0,o.jsx)(v.$,{mod:["unelevated"],onClick:async()=>{try{await t.model.save(),e()}catch{}},children:r("ui_apply")}),(0,o.jsx)(g.S,{}),(0,o.jsx)(v.$,{mod:["outlined"],onClick:()=>i(t.script,!0),children:r("ui_copy_to_clipboard")}),(0,o.jsx)(v.$,{mod:["unelevated"],onClick:e,children:r("ui_close")})]})]})}))},60398:(e,t,r)=>{r.r(t),r.d(t,{ScriptPreviewService:()=>h});var o=r(1118),i=r(50420),s=r(5576),n=r(71635),a=r(14452),c=r(43974),l=r(83336),d=r(78186),u=r(84941);const p=(0,i.j)((()=>Promise.all([r.e(11502),r.e(7542),r.e(97493),r.e(67557),r.e(70639),r.e(89814),r.e(88761),r.e(46696),r.e(12145),r.e(11116),r.e(62570),r.e(95860),r.e(1525)]).then(r.bind(r,51431)).then((e=>e.ScriptPreviewDialog))));let h=class ScriptPreviewService{constructor(e,t,r){this.graphQLService=e,this.commonDialogService=t,this.notificationService=r}async open(e,t){try{const r=await e.source.runTask((()=>this.tryGetScript(e,t)));this.commonDialogService.open(p,{script:r,model:e})}catch(e){this.notificationService.logException(e,"data_viewer_script_preview_error_title")}}async tryGetScript(e,t){const r=e.source.executionContext?.context;if(!r)throw new Error("Execution context is not provided");const o=e.source.getResult(t);if(!o||!o.id)throw new Error(`There is no result for provided result index: '${t}'`);const i={projectId:r.projectId,connectionId:r.connectionId,contextId:r.id,resultsId:o.id};let s;o.dataFormat===c.fev.Resultset?(s=e.source.getAction(o,d.G),s.fillBatch(i)):o.dataFormat===c.fev.Document&&(s=e.source.getAction(o,u.q),s.fillBatch(i));return(await this.graphQLService.sdk.updateResultsDataBatchScript(i)).result}};h=(0,o.Cg)([(0,s._)(),(0,o.Sn)("design:paramtypes",[l.GraphQLService,n.CommonDialogService,a.NotificationService])],h)},8926:(e,t,r)=>{r.r(t),r.d(t,{GeneratedSqlDialog:()=>I});var o=r(41773),i=r(94866),s=r(7838),n=r(15993),a=r(17675),c=r(51299),l=r(64928),d=r(28347),u=r(90447),p=r(51477),h=r(62204),v=r(92659),g=r(7167),_=r(69519),S=r(9428),m=r(20272),f=r(89232),y=r(49690),w=r(18699),x=r(18408),q=r(42453),C=r(56735),j=r(49759),G=r(2293);const D={footerContainer:"footerContainer___Ro92C",buttons:"buttons___LA3PW",errorMessage:"errorMessage___GNxyi theme-background-secondary theme-text-on-secondary",wrapper:"wrapper___BEbKI",sqlCodeEditorLoader:"sqlCodeEditorLoader___oTug7"};var b=r(28933);const I=(0,s.PA)((function GeneratedSqlDialog({rejectDialog:e,payload:t}){const r=(0,a.W)(),s=(0,c.i)(),I=(0,l.d)(D),R=(0,w.h)(C.SqlDialectInfoService),E=(0,w.h)(b.SqlGeneratorsResource),P=(0,w.h)(y.ConnectionInfoResource).getConnectionForNode(t.pathId),L=(0,d.G)((()=>({query:"",loading:!0,error:new x.R,get dialect(){if(this.connection?.connected)return this.sqlDialectInfoService.getDialectInfo((0,y.createConnectionParam)(this.connection))},async load(){this.error.clear();try{this.query=await E.generateEntityQuery(t.generatorId,t.pathId)}catch(e){this.error.catch(e)}finally{this.loading=!1}}})),{query:i.sH.ref,loading:i.sH.ref,connection:i.sH.ref,dialect:i.EW},{connection:P,sqlDialectInfoService:R}),N=(0,j.n)(L.dialect),A=(0,q.s)();A.set(...N);const k=(0,u.s)(L.error.exception);return(0,n.useEffect)((()=>{L.load()}),[]),(0,n.useEffect)((()=>{P&&R.loadSqlDialectInfo((0,y.createConnectionParam)(P)).catch((e=>{console.error(e),console.warn(`Can't get dialect for connection: '${P.id}'. Default dialect will be used`)}))})),(0,o.jsxs)(p.n,{size:"large",children:[(0,o.jsx)(h.D,{title:"app_shared_sql_generators_dialog_title",icon:"sql-script",onReject:e}),(0,o.jsx)(v.a,{noOverflow:!0,noBodyPadding:!0,children:(0,o.jsx)("div",{className:(0,g.s)(I,{wrapper:!0}),children:(0,o.jsx)(_.a,{loading:L.loading,children:()=>(0,o.jsx)(G.m,{className:(0,g.s)(I,{sqlCodeEditorLoader:!0}),value:L.query,extensions:A,readonly:!0})})})}),(0,o.jsx)(S.Z,{children:(0,o.jsxs)("div",{className:(0,g.s)(I,{footerContainer:!0}),children:[L.error.responseMessage&&(0,o.jsx)(m.K,{className:(0,g.s)(I,{errorMessage:!0}),text:L.error.responseMessage,hasDetails:k.hasDetails,onShowDetails:k.open}),(0,o.jsxs)("div",{className:(0,g.s)(I,{buttons:!0}),children:[(0,o.jsx)(f.$,{mod:["outlined"],onClick:()=>s(L.query,!0),children:r("ui_copy_to_clipboard")}),(0,o.jsx)(f.$,{mod:["unelevated"],onClick:e,children:r("ui_close")})]})]})})]})}))},51598:(e,t,r)=>{r.r(t),r.d(t,{SqlGeneratorsBootstrap:()=>_});var o=r(1118),i=r(50420),s=r(82103),n=r(5576),a=r(71635),c=r(14841),l=r(3942),d=r(40813),u=r(6767),p=r(72877);const h=(0,r(85240).E)("node-sql-generators","app_shared_sql_generators_panel_title");var v=r(28933);const g=(0,i.j)((()=>Promise.all([r.e(11502),r.e(7542),r.e(97493),r.e(67557),r.e(70639),r.e(89814),r.e(36821),r.e(88761),r.e(46696),r.e(12145),r.e(11116),r.e(62570),r.e(95860),r.e(51989)]).then(r.bind(r,8926)).then((e=>e.GeneratedSqlDialog))));let _=class SqlGeneratorsBootstrap extends s.j{constructor(e,t,r){super(),this.sqlGeneratorsResource=e,this.commonDialogService=t,this.menuService=r}register(){this.menuService.setHandler({id:"node-sql-generators",menus:[h],contexts:[c.G],isDisabled:e=>{const t=e.get(c.G);return 0===this.sqlGeneratorsResource.get(t.id)?.length},getLoader:(e,t)=>{const r=e.get(c.G);return(0,d.pd)(this.sqlGeneratorsResource,(()=>r.id))}}),this.menuService.addCreator({root:!0,contexts:[c.G],isApplicable:e=>{const t=e.get(c.G);return!(!t.objectFeatures.includes(l.v.entity)&&!t.objectFeatures.includes(l.v.script))},getItems:(e,t)=>[...t,h]}),this.menuService.addCreator({menus:[h],contexts:[c.G],getItems:(e,t)=>{const r=e.get(c.G);return[...t,...(this.sqlGeneratorsResource.get(r.id)||[]).map((e=>new u.y({id:e.id,label:e.label,tooltip:e.description},{onSelect:()=>{this.commonDialogService.open(g,{generatorId:e.id,pathId:r.id})}})))]}})}};_=(0,o.Cg)([(0,n._)(),(0,o.Sn)("design:paramtypes",[v.SqlGeneratorsResource,a.CommonDialogService,p.MenuService])],_)},28933:(e,t,r)=>{r.r(t),r.d(t,{MAX_GENERATORS_LENGTH:()=>u,SqlGeneratorsResource:()=>p});var o=r(1118),i=r(5576),s=r(30819),n=r(40813),a=r(57985),c=r(85213),l=r(7278),d=r(83336);const u=15;let p=class SqlGeneratorsResource extends n.nG{constructor(e,t){super(),this.graphQLService=e,this.navNodeInfoResource=t,this.navNodeInfoResource.outdateResource(this),this.navNodeInfoResource.deleteInResource(this)}async generateEntityQuery(e,t){return(await this.graphQLService.sdk.sqlGenerateEntityQuery({generatorId:e,nodePathList:t,options:{}})).sqlGenerateEntityQuery}async loader(e){if((0,a.l)(e))throw new Error("Aliases not supported by this resource.");const t=new Map;return await c.F.forEachAsync(e,(async e=>{const{generators:r}=await this.graphQLService.sdk.sqlEntityQueryGenerators({nodePathList:e});t.set(e,r)})),this.set((0,l.OU)(Array.from(t.keys())),Array.from(t.values())),this.data}validateKey(e){return"string"==typeof e}};p=(0,o.Cg)([(0,i._)(),(0,o.Sn)("design:paramtypes",[d.GraphQLService,s.NavNodeInfoResource])],p)}}]);