????

Your IP : 3.134.253.166


Current Path : C:/inetpub/vhost/dbadm.gdtsolutions.vn/web/js/
Upload File :
Current File : C:/inetpub/vhost/dbadm.gdtsolutions.vn/web/js/plugin-data-import-0413ae4585bc1326ed98.js

/*! For license information please see ../license.txt */
"use strict";(self.webpackChunk_cloudbeaver_product_default=self.webpackChunk_cloudbeaver_product_default||[]).push([[41439],{37499:(e,t,s)=>{s.r(t),s.d(t,{DataImportBootstrap:()=>S});var i=s(1118),a=s(82103),r=s(5576),o=s(71635),n=s(91920),c=s(77495),l=s(72877),d=s(79023),u=s(84823),p=s(26500),m=s(33399),h=s(49418),g=s(70199);const v=(0,s(50420).j)((()=>Promise.all([s.e(11502),s.e(67557),s.e(41439),s.e(95860),s.e(41405)]).then(s.bind(s,48938)).then((e=>e.DataImportDialog))));var f=s(31888);let S=class DataImportBootstrap extends a.j{constructor(e,t,s,i){super(),this.menuService=e,this.actionService=t,this.commonDialogService=s,this.dataImportService=i}register(){this.actionService.addHandler({id:"data-import-base-handler",contexts:[u.i,p.$],actions:[n.$],isDisabled(e){const t=e.get(u.i),s=e.get(p.$);return t.isLoading()||t.isDisabled(s)||!t.getResult(s)},getActionInfo:(e,t)=>t===n.$?{...t.info,icon:"/icons/data-import.svg"}:t.info,handler:async(e,t)=>{const s=e.get(u.i),i=e.get(p.$);if(t===n.$){const e=s.getResult(i);if(!e?.id)throw new Error("Result must be provided");const t=s.source.executionContext?.context;if(!t)throw new Error("Execution context must be provided");const a=await this.commonDialogService.open(v,{tableName:s.name??s.id});if(a===o.DialogueStateResult.Rejected||a===o.DialogueStateResult.Resolved)return;await this.dataImportService.importData(t.connectionId,t.id,t.projectId,e.id,a.processorId,a.file)&&await s.refresh()}}}),this.menuService.addCreator({menus:[m.N],contexts:[u.i,p.$],isApplicable:e=>{const t=e.get(u.i),s=e.get(p.$),i=e.get(h.$),a=t.source instanceof g.B;return!t.isReadonly(s)&&a&&!this.dataImportService.disabled&&!i?.readonly&&(!i||i.type===h.N.Data)},getItems:(e,t)=>[...t,n.$],orderItems(e,t){const s=(0,c.H)(t,[n.$]);return[...t,...s]}})}};S=(0,i.Cg)([(0,r._)(),(0,i.Sn)("design:paramtypes",[l.MenuService,d.ActionService,o.CommonDialogService,f.DataImportService])],S)},48938:(e,t,s)=>{s.r(t),s.d(t,{DataImportDialog:()=>G});var i=s(41773),a=s(7838),r=s(17675),o=s(51477),n=s(62204),c=s(92659),l=s(9428),d=s(89232),u=s(68426),p=s(76652),m=s(64928),h=s(16101),g=s(84349),v=s(74842),f=s(48286),S=s(7167),x=s(26487),_=s(85289),b=s(50453),I=s(15682),P=s(74508);const D={tableColumnValue:"tableColumnValue___SspLZ"},j=(0,a.PA)((function DataImportFileItem({id:e,name:t,tooltip:s,disabled:a,className:r,onDelete:o}){const n=(0,m.d)(D);return(0,i.jsxs)(b.O,{item:e,title:s,disabled:a,selectDisabled:a,className:r,children:[(0,i.jsx)(I.E,{className:(0,S.s)(n,{tableColumnValue:!0}),children:t}),(0,i.jsxs)(I.E,{className:(0,S.s)(n,{tableColumnValue:!0}),flex:!0,centerContent:!0,children:[(0,i.jsx)(p.m,{zeroBasis:!0}),(0,i.jsx)(P.G,{name:"cross-bold",onClick:()=>o(e)})]})]})})),y={columnHeader:"columnHeader___TAfZD"},k=(0,a.PA)((function DataImportFileSelector({state:e,onDelete:t}){const s=(0,r.W)(),a=(0,m.d)(y);const o=e.selectedProcessor?.fileExtension?`.${e.selectedProcessor.fileExtension}`:void 0;return(0,i.jsx)(h.Y,{box:!0,overflow:!0,children:(0,i.jsxs)(g.X,{children:[(0,i.jsxs)(v.A,{fixed:!0,children:[(0,i.jsx)(f.u,{className:(0,S.s)(a,{columnHeader:!0}),heightBig:!0,children:s("ui_name")}),(0,i.jsxs)(f.u,{className:(0,S.s)(a,{columnHeader:!0}),heightBig:!0,flex:!0,children:[(0,i.jsx)(p.m,{zeroBasis:!0}),(0,i.jsx)(x.C,{accept:o,hideTags:!0,keepSize:!0,onChange:function handleFileSelect(t){t&&(e.file=t[0])}})]})]}),(0,i.jsx)(_.B,{children:e.file&&(0,i.jsx)(j,{id:e.file.name,name:e.file.name,tooltip:e.file.name,onDelete:t})})]})})}));var C;!function(e){e[e.Processor=0]="Processor",e[e.File=1]="File"}(C||(C={}));var w=s(84383),R=s(23089),$=s(10041),N=s(44880),L=s(7994),F=s(60233),B=s(66079),A=s(40813),z=s(39070);const T="staticImage___dEx01",E=(0,a.PA)((function ImportProcessorList({onSelect:e,className:t}){const s=(0,w.q)(ImportProcessorList,z.DataImportProcessorsResource,A.fZ,{forceSuspense:!0});return(0,i.jsx)(R.k,{className:t,children:s.resource.values.map((t=>(0,i.jsxs)($.c,{onClick:()=>e(t),children:[(0,i.jsx)(N.L,{children:(0,i.jsx)(L.i,{className:T,icon:t.icon})}),(0,i.jsx)(F.z,{children:t.name}),(0,i.jsx)(B.U,{title:t.description,children:t.description})]},t.id)))})}));var H=s(94866),Q=s(28347);const DEFAULT_STATE_GETTER=()=>({step:C.Processor,file:null,selectedProcessor:null});const G=(0,a.PA)((function DataImportDialog({payload:e,resolveDialog:t,rejectDialog:s}){const a=(0,r.W)(),m=function useDataImportDialog(e){return(0,Q.G)((()=>({state:e??DEFAULT_STATE_GETTER(),stepBack(){this.state.step===C.File&&(this.state.step=C.Processor)},selectProcessor(e){this.state.selectedProcessor&&this.state.selectedProcessor.id!==e.id&&this.reset(),this.state.selectedProcessor=e,this.state.step=C.File},deleteFile(){this.state.file=null},reset(){this.state=DEFAULT_STATE_GETTER()}})),{state:H.sH,stepBack:H.XI.bound,selectProcessor:H.XI.bound,deleteFile:H.XI.bound,reset:H.XI.bound},!1)}(e.initialState);let h=a("plugin_data_import_title"),g="/icons/data-import.svg";return m.state.step===C.File&&m.state.selectedProcessor&&(h+=` (${m.state.selectedProcessor.name??m.state.selectedProcessor.id})`,g=m.state.selectedProcessor.icon??g),(0,i.jsxs)(o.n,{size:"large",fixedSize:!0,children:[(0,i.jsx)(n.D,{title:h,subTitle:e.tableName,icon:g,onReject:s}),(0,i.jsxs)(c.a,{noBodyPadding:!0,children:[m.state.step===C.Processor&&(0,i.jsx)(E,{onSelect:m.selectProcessor}),m.state.step===C.File&&(0,i.jsx)(k,{state:m.state,onDelete:m.deleteFile})]}),(0,i.jsxs)(l.Z,{children:[(0,i.jsx)(d.$,{type:"button",mod:["outlined"],onClick:s,children:a("ui_processing_cancel")}),(0,i.jsx)(u.S,{}),m.state.step===C.File&&(0,i.jsxs)(p.m,{noWrap:!0,keepSize:!0,gap:!0,children:[(0,i.jsx)(d.$,{type:"button",mod:["outlined"],onClick:m.stepBack,children:a("ui_stepper_back")}),(0,i.jsx)(d.$,{type:"button",mod:["unelevated"],disabled:!m.state.file||!m.state.selectedProcessor,onClick:()=>t({file:m.state.file,processorId:m.state.selectedProcessor.id}),children:a("ui_import")})]})]})]})}))},39070:(e,t,s)=>{s.r(t),s.d(t,{DataImportProcessorsResource:()=>l});var i=s(1118),a=s(5576),r=s(40813),o=s(7278),n=s(40601),c=s(83336);let l=class DataImportProcessorsResource extends r.nG{constructor(e,t){super((()=>new Map)),this.graphQLService=e,this.sync(t,(()=>{}),(()=>r.fZ))}async loader(){const{processors:e}=await this.graphQLService.sdk.getDataTransferImportProcessors();return this.replace((0,o.OU)(e.map((e=>e.id))),e),this.data}validateKey(e){return"string"==typeof e}};l=(0,i.Cg)([(0,a._)(),(0,i.Sn)("design:paramtypes",[c.GraphQLService,n.ServerConfigResource])],l)},31888:(e,t,s)=>{s.r(t),s.d(t,{DataImportService:()=>h});var i=s(1118),a=s(94866),r=s(16851),o=s(5576),n=s(14452),c=s(72755),l=s(19462),d=s(83336),u=s(45764),p=s(20185),m=s(65027);let h=class DataImportService{get disabled(){return!this.sessionPermissionsResource.has(c.y.admin)&&this.dataImportSettingsService.disabled}constructor(e,t,s,i,r){this.dataImportSettingsService=e,this.notificationService=t,this.graphQLService=s,this.asyncTaskInfoService=i,this.sessionPermissionsResource=r,(0,a.Gn)(this,{disabled:a.EW})}async importData(e,t,s,i,a,o){const n=new AbortController;let c;function cancel(){c?.()}const{controller:l,notification:d}=this.notificationService.processNotification((()=>r.N),{onCancel:cancel},{title:"plugin_data_import_process_title",message:o.name,onClose:cancel});try{c=()=>n.abort();const r=await this.graphQLService.sdk.uploadResultData(e,t,s,i,a,o,(e=>{if(void 0!==e.total){const t=(0,p.R)(e.loaded,e.total);d.message&&l.setMessage(`${t}%\n${d.message}`)}}),n.signal),u=this.asyncTaskInfoService.create((async()=>{const{taskInfo:e}=await this.graphQLService.sdk.getAsyncTaskInfo({taskId:r.id,removeOnFinish:!1});return e}));return c=()=>this.asyncTaskInfoService.cancel(u.id),l.setMessage("plugin_data_import_process_file_processing_step_message"),await this.asyncTaskInfoService.run(u),l.resolve("plugin_data_import_process_success"),!0}catch(e){return l.reject(e,"plugin_data_import_process_fail"),!1}finally{c=null}}};h=(0,i.Cg)([(0,o._)(),(0,i.Sn)("design:paramtypes",[m.DataImportSettingsService,n.NotificationService,d.GraphQLService,u.AsyncTaskInfoService,l.SessionPermissionsResource])],h)},65027:(e,t,s)=>{s.r(t),s.d(t,{DataImportSettingsService:()=>l});var i=s(1118),a=s(5576),r=s(83916),o=s(3065),n=s(31038);const c=o.Ik({"plugin.data-import.disabled":n.W.stringedBoolean().default(!1)});let l=class DataImportSettingsService{get disabled(){return this.settings.getValue("plugin.data-import.disabled")}constructor(e){this.settingsProviderService=e,this.settings=this.settingsProviderService.createSettings(c)}};l=(0,i.Cg)([(0,a._)(),(0,i.Sn)("design:paramtypes",[r.SettingsProviderService])],l)},6185:(e,t,s)=>{s.r(t),s.d(t,{LocaleService:()=>n});var i=s(1118),a=s(82103),r=s(5576),o=s(34227);let n=class LocaleService extends a.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([s.e(92436),s.e(11062)]).then(s.bind(s,24735))).default;case"it":return(await Promise.all([s.e(32756),s.e(30929)]).then(s.bind(s,14495))).default;case"zh":return(await Promise.all([s.e(52041),s.e(53310)]).then(s.bind(s,77348))).default;case"fr":return(await Promise.all([s.e(29671),s.e(75691)]).then(s.bind(s,11610))).default;default:return(await Promise.all([s.e(41114),s.e(98072)]).then(s.bind(s,6117))).default}}};n=(0,i.Cg)([(0,r._)(),(0,i.Sn)("design:paramtypes",[o.LocalizationService])],n)}}]);