graphdb-workbench
Version:
The web application for GraphDB APIs
2 lines • 5.9 kB
JavaScript
export const __webpack_id__=55947;export const __webpack_ids__=[55947];export const __webpack_modules__={55947:(e,t,s)=>{s.r(t);var r=s(57962);const n={select:s(93462).select},o="WAIT",a="NO_REPO",i="READY",l="IN_PROGRESS",c="ERROR",u={contextID:{type:"all",value:"all.graphs.label",uri:""}};function p(e){if(e<1e3)return e;const t=Math.floor(Math.log(e)/Math.log(1e3));let s=e/Math.pow(1e3,t);return s=s%1>1/Math.pow(1e3,t-1)?s.toFixed(2):s.toFixed(0),s+["K","M","G","T","P","H"][t-1]}function d(e,t,s,p,d,g,f,h,m,C,y){let R=null;e.hasMoreGraphs=!1,e.status=s.getActiveRepository()?o:a,e.graphsDropdownToggled=t=>{e.hasMoreGraphs&&t&&p.warning(y.instant("dependencies.graphs.too.many.warning",{graphsLimit:r.NumberUtils.formatNumberToLocaleString(1e3,y.use())}))};let v=u;const x=function(){C.resolveGraphs(s.getActiveRepository(),1001).success(function(t){e.graphsInRepo=t.results.bindings,e.hasMoreGraphs=e.graphsInRepo.length>1002,w(),e.isSystemRepository()?"READY"!==e.status&&D():(e.status="WAIT",D(!0))}).error(function(t){e.repositoryError=getError(t),p.error(getError(t),y.instant("graphexplore.error.getting.graph"))})},w=function(){const t=m.get(`dependencies-selectedGraph-${s.getActiveRepository()}`);null!==t&&e.graphsInRepo.some(e=>e.contextID.uri===t.contextID.uri)?v=t:m.set(`dependencies-selectedGraph-${s.getActiveRepository()}`,v)},S=function(t){n.select("#dependencies-chord").html(""),e.status=o,g.getRelationshipsData(t,e.direction,v.contextID.uri).success(function(t){e.dependenciesData={matrix:t.right,nodes:t.left,hasLinks:_.sum(_.map(t.right,function(e){return _.sum(e)}))>0,direction:e.direction},e.status=i}).error(function(t){e.status=i,p.error(getError(t),y.instant("graphexplore.error.dependencies.count"))})},D=function(t){(e.status!==i||t)&&(e.status=o,g.getRelationshipsStatus(v.contextID.uri).success(function(t){if(e.status=t,e.status===l){if(null!==R)return;R=d(D,2e3)}e.status===i&&(null!==R&&(d.cancel(R),R=null),g.getRelationshipsClasses(e.direction,v.contextID.uri).success(function(t,s){e.allClasses.items=_.filter(t,$),e.allNotFilteredClasses=t,e.selectedClasses=void 0,angular.isUndefined(e.selectedClasses)&&(e.selectedClasses=t.slice(0,10)),S(e.selectedClasses),207===s&&p.warning(y.instant("graphexplore.update.diagram"),y.instant("graphexplore.repository.data.changed"))})),0===e.status.indexOf("ERROR;")&&(e.status=c,p.error(y.instant("graphexplore.error.dependencies.calc",{error:e.status.substring(6)})))}).error(function(t){e.status=c,p.error(getError(t),y.instant("graphexplore.error.dependencies.count.status"))}))};e.allClasses={},e.allClasses.items=[],e.allNotFilteredClasses=[],e.direction="all";const b={};let A=0,E=0;function $(t){return-1!==t.name.toLowerCase().indexOf(e.classQuery.query.toLowerCase())}t.key="",b.get=function(t,s,r){f.initLazyList(t,s,r,A,e.allClasses.items)},t.$watch(function(){return t.key},function(){A=0,_.each(e.allClasses.items,function(e){t.key>e&&A++}),E++}),b.revision=function(){return E},e.datasource=b,e.adapterContainer={adapter:{remain:!0}},e.classQuery={},e.classQuery.query="",e.classFilterFunc=$,e.$watch("allClasses.items",function(){e.allClasses.items.length>0&&d(function(){e.adapterContainer.adapter.reload()},30)}),e.$watch("direction",function(){!s.getActiveRepository()||e.isSystemRepository()||s.isActiveRepoFedXType()||x()}),e.$on("$destroy",function(){d.cancel(R)}),e.isLoading=function(){return e.status===l||e.status===o},e.confirmCalculateDependencies=function(){h.openSimpleModal({title:y.instant("confirm.operation"),message:y.instant("graphexplore.calculating.relationships"),warning:!0}).result.then(function(){e.calculateDependencies()})},e.calculateDependencies=function(){e.status=o,e.selectedClasses=void 0,g.calculateRelationships(v.contextID.uri).success(function(t){0===t.indexOf("ERROR;")?p.error(y.instant("graphexplore.error.dependencies.calc",{error:e.status.substring(6)})):D()}).error(function(e){p.error(y.instant("graphexplore.error.could.not.force.count",{error:getError(e)}))})},e.addClass=function(t){e.selectedClasses.push(t),S(e.selectedClasses)},e.removeClass=function(t){_.remove(e.selectedClasses,function(e){return e.name===t.name}),S(e.selectedClasses)},e.showClass=function(t){e.classToShow=t},e.isClassByNameShown=function(t){return void 0!==_.find(e.selectedClasses,{name:t})},e.addClassByName=function(t){e.selectedClasses.push(_.find(e.allClasses.items,{name:t})),S(e.selectedClasses)},e.removeClassByName=function(t){_.remove(e.selectedClasses,function(e){return e.name===t}),S(e.selectedClasses)},e.removeAllClasses=function(){e.selectedClasses=[],S(e.selectedClasses)},e.isSystemRepository=function(){return"SYSTEM"===s.getActiveRepository()};const G=e.$on("repositoryIsSet",function(){e.classQuery={},e.classQuery.query="",e.repositoryError=null,v=u,s.getActiveRepository()&&!s.isActiveRepoFedXType()?x():e.status=a});window.addEventListener("beforeunload",function e(){G(),window.removeEventListener("beforeunload",e)}),e.selectGraph=function(e){v=e,D(!0),m.set(`dependencies-selectedGraph-${s.getActiveRepository()}`,v)},e.getSelectedGraphValue=function(){return v.contextID.value},e.isAllGraphsSelected=function(){return"all.graphs.label"===e.getSelectedGraphValue()}}Object.defineProperty(s.g,"allGraphs",{get:()=>u}),angular.module("graphdb.framework.graphexplore.controllers.dependencies",["ui.scroll.jqlite","ui.scroll","toastr","ui.bootstrap","graphdb.framework.core.services.repositories","graphdb.framework.utils.localstorageadapter"]).controller("DependenciesChordCtrl",d).config(["$uibTooltipProvider",function(e){e.options({appendToBody:!0})}]).filter("humanize",function(){return p}),d.$inject=["$scope","$rootScope","$repositories","toastr","$timeout","GraphDataRestService","UiScrollService","ModalService","LocalStorageAdapter","RDF4JRepositoriesRestService","$translate"]}};
//# sourceMappingURL=55947.1c50c27d8d2583fbfcd2.bundle.js.map