export const __webpack_esm_id__=23775;export const __webpack_esm_ids__=[3345,23775];export const __webpack_esm_modules__={23775(e,t,i){i(6861);var s=i(3345),n=i(19698),o=i(91256),r=i(67806);const l=i(71315).I.logger;function a(e,t,i,a,p,d,u,_){const h=[".zip",".yaml",".yml"];e.allowedFileTypesString=h.join(","),e.ImportStatus=s.yB,e.repositoryId=d.repositoryId,e.definitionFiles=new s.tL,e.progress=void 0,e.uploadFinished=!1,e.onFilesChange=(t,i,o,r,a)=>{let p=o||[];const d=p.filter(e=>{const t="."+e.name.split(".").pop().toLowerCase();return!h.includes(t)});if(d.length&&l.error(`The following files have invalid extensions: ${d.map(e=>e.name).join(", ")}`),p=p.filter(e=>{const t="."+e.name.split(".").pop().toLowerCase();return h.includes(t)}),!p||!p.length)return;e.progress=void 0;const u=new Set(e.definitionFiles.getFileNames()),_=p.filter(e=>!u.has(e.name));e.definitionFiles.appendFiles((0,n.O$)(_,s.yB.PENDING).list)},e.onImport=()=>{e.uploadFinished=!1;const t=m();u.importEndpointDefinition(e.repositoryId,t).progress(t=>{e.uploadFinished||(e.progress=Math.min(100,parseInt(100*t.loaded/t.total)))}).success(t=>{e.progress=void 0,e.uploadFinished=!0,e.definitionFiles=(0,n.Zw)(t,e.repositoryId,e.definitionFiles)}).error(t=>{e.progress=void 0,e.uploadFinished=!0,i.error(getError(t))})},e.onRemoveFile=t=>{e.definitionFiles.removeFile(t),0===e.definitionFiles.size&&(e.progress=void 0)},e.onExploreEndpoint=e=>{const t=(0,o.I)(e);_.setSelectedEndpoint(new r.v({endpointId:e})),window.open(t,"_blank","noopener,noreferrer")},e.onOpenReport=(e,t)=>(e.preventDefault(),a.open({templateUrl:"js/angular/graphql/templates/modal/endpoint-generation-failure-result-modal.html",controller:"EndpointGenerationResultFailureModalController",windowClass:"endpoint-generation-failure-result-modal",size:"lg",backdrop:"static",keyboard:!1,resolve:{data:()=>({endpointReport:t})}}).result),e.close=()=>{p.dismiss("cancel")};const m=()=>{const t=new FormData;return e.definitionFiles.processWith(e=>{t.append("importFiles",e.file,e.file.name)}),t}}angular.module("graphdb.framework.graphql.controllers.import-endpoint-definition-modal",["ngFileUpload","graphdb.framework.core.services.graphql-service"]).controller("ImportEndpointDefinitionModalController",a),a.$inject=["$scope","$q","toastr","$uibModal","$uibModalInstance","data","GraphqlService","GraphqlContextService"]},19698(e,t,i){i.d(t,{O$:()=>o,Zw:()=>l});var s=i(3345),n=i(63991);const o=(e,t)=>{const i=e.map(e=>r(e,t));return new s.tL(i)},r=(e,t)=>new s.re(e,t,s.El[t]),l=(e,t,i)=>{if(!e||!e.length)return new s.tL;const o=e=>{const r=e.id,l=e.filename,a=e.status.toUpperCase();let p=i.findDefinitionFileByName(l)||new s.re;if(p.endpointId=r,p.filename=l,p.status=a,p.statusMessage=s.El[a],p.report=(0,n.Zv)(e,r,t),e.subFiles){const t=e.subFiles.map(o);p.list=new s.tL(t)}return p};return e.forEach(o),new s.tL([...i.list])}},3345(e,t,i){i.d(t,{El:()=>n,re:()=>l,tL:()=>r,yB:()=>s});const s={PENDING:"PENDING",SUCCESS:"SUCCESS",FAIL:"FAIL",SKIP:"SKIP"},n={[s.PENDING]:"graphql.endpoints_management.import_definition_modal.status.pending",[s.SUCCESS]:"graphql.endpoints_management.import_definition_modal.status.completed",[s.FAIL]:"graphql.endpoints_management.import_definition_modal.status.failed",[s.SKIP]:"graphql.endpoints_management.import_definition_modal.status.not_allowed"},o={[s.PENDING]:"tag-warning",[s.SUCCESS]:"tag-success",[s.FAIL]:"tag-danger",[s.SKIP]:"tag-info"};class r{_list;_size;constructor(e=[]){this._list=e,this._size=e.length}processWith(e){this.list.forEach(e)}findDefinitionFileByName(e){return this.list.find(t=>t.file.name===e)}getFileNames(){return this.list.map(e=>e.file.name)}appendFiles(e){this.list.push(...e),this._size=this.list.length}removeFile(e){this.list=this.list.filter(t=>t.file!==e.file)}get size(){return this._size}set size(e){this._size=e}set list(e){this._list=e,this._size=e.length}get list(){return this._list}}class l{_list;_file;_filename;_status;_viewStatus;_statusMessage;_endpointId;_report;constructor(e,t,i,s){this._file=e,this._status=t,this._viewStatus=o[t],this._statusMessage=i,this._list=s}set file(e){this._file=e}get file(){return this._file}set filename(e){this._filename=e}get filename(){return this._filename}set status(e){this._status=e,this._viewStatus=o[e]}get status(){return this._status}set viewStatus(e){this._viewStatus=e}get viewStatus(){return this._viewStatus}set statusMessage(e){this._statusMessage=e}get statusMessage(){return this._statusMessage}set endpointId(e){this._endpointId=e}get endpointId(){return this._endpointId}set report(e){this._report=e}get report(){return this._report}get list(){return this._list}set list(e){this._list=e}}}};
//# sourceMappingURL=23775.d31d46b7c763e5ff8614.bundle.js.map