graphdb-workbench
Version:
The web application for GraphDB APIs
2 lines • 5.67 kB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[56],{56:function(e,t,s){(function(e){const t={WAIT:"WAIT",NO_REPO:"NO_REPO",READY:"READY",IN_PROGRESS:"IN_PROGRESS",ERROR:"ERROR"},s={contextID:{type:"all",value:"All graphs",uri:""}};function n(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 r(e,n,r,o,i,a,l,c,u,d){let p=null;e.status=r.getActiveRepository()?t.WAIT:t.NO_REPO;let f=s;const R=function(){d.resolveGraphs().success((function(t){e.graphsInRepo=t.results.bindings,h(),e.isSystemRepository()?"READY"!==e.status&&m():(e.status="WAIT",m(!0))})).error((function(t){e.repositoryError=getError(t),o.error(getError(t),"Error getting graphs")}))},h=function(){const t=u.get(`dependencies-selectedGraph-${r.getActiveRepository()}`);null!==t&&e.graphsInRepo.some(e=>e.contextID.uri===t.contextID.uri)?f=t:u.set(`dependencies-selectedGraph-${r.getActiveRepository()}`,f)},g=function(s){d3.select("#dependencies-chord").html(""),e.status=t.WAIT,a.getRelationshipsData(s,e.direction,f.contextID.uri).success((function(s){e.dependenciesData={matrix:s.right,nodes:s.left,hasLinks:_.sum(_.map(s.right,(function(e){return _.sum(e)})))>0,direction:e.direction},e.status=t.READY})).error((function(s){e.status=t.READY,o.error(getError(s),"Could not get dependencies count")}))},m=function(s){(e.status!==t.READY||s)&&(e.status=t.WAIT,a.getRelationshipsStatus(f.contextID.uri).success((function(s){if(e.status=s,e.status===t.IN_PROGRESS){if(null!==p)return;p=i(m,2e3)}e.status===t.READY&&(null!==p&&(i.cancel(p),p=null),a.getRelationshipsClasses(e.direction,f.contextID.uri).success((function(t,s){e.allClasses.items=_.filter(t,v),e.allNotFilteredClasses=t,e.selectedClasses=void 0,angular.isUndefined(e.selectedClasses)&&(e.selectedClasses=t.slice(0,10)),g(e.selectedClasses),207===s&&o.warning("You can update the diagram by pressing the reload button.","Repository data has changed")}))),0===e.status.indexOf("ERROR;")&&(e.status=t.ERROR,o.error("There was an error while calculating dependencies: "+e.status.substring("ERROR;".length)))})).error((function(s){e.status=t.ERROR,o.error(getError(s),"Could not get dependencies count status!")})))};e.allClasses={},e.allClasses.items=[],e.allNotFilteredClasses=[],e.direction="all";const C={};let y=0,E=0;function v(t){return-1!==t.name.toLowerCase().indexOf(e.classQuery.query.toLowerCase())}n.key="",C.get=function(t,s,n){return l.initLazyList(t,s,n,y,e.allClasses.items)},n.$watch((function(){return n.key}),(function(){y=0,_.each(e.allClasses.items,(function(e){n.key>e&&y++})),E++})),C.revision=function(){return E},e.datasource=C,e.adapterContainer={adapter:{remain:!0}},e.classQuery={},e.classQuery.query="",e.classFilterFunc=v,e.$watch("allClasses.items",(function(){e.allClasses.items.length>0&&i((function(){e.adapterContainer.adapter.reload()}),30)})),e.$watch("direction",(function(){!r.getActiveRepository()||e.isSystemRepository()||r.isActiveRepoFedXType()||R()})),e.$on("$destroy",(function(){i.cancel(p)})),e.isLoading=function(){return e.status===t.IN_PROGRESS||e.status===t.WAIT},e.confirmCalculateDependencies=function(){c.openSimpleModal({title:"Confirm operation",message:"Calculating relationships data may take some time. Are you sure?",warning:!0}).result.then((function(){e.calculateDependencies()}))},e.calculateDependencies=function(){e.status=t.WAIT,e.selectedClasses=void 0,a.calculateRelationships(f.contextID.uri).success((function(e){0===e.indexOf("ERROR;")?o.error("There was an error while calculating dependencies: "+e.substring("ERROR;".length)):m()})).error((function(e){o.error("Could not force dependencies count"+getError(e))}))},e.addClass=function(t){e.selectedClasses.push(t),g(e.selectedClasses)},e.removeClass=function(t){_.remove(e.selectedClasses,(function(e){return e.name===t.name})),g(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})),g(e.selectedClasses)},e.removeClassByName=function(t){_.remove(e.selectedClasses,(function(e){return e.name===t})),g(e.selectedClasses)},e.removeAllClasses=function(){e.selectedClasses=[],g(e.selectedClasses)},e.isSystemRepository=function(){return"SYSTEM"===r.getActiveRepository()};const A=e.$on("repositoryIsSet",(function(){e.classQuery={},e.classQuery.query="",e.repositoryError=null,f=s,r.getActiveRepository()&&!r.isActiveRepoFedXType()?R():e.status=t.NO_REPO}));window.addEventListener("beforeunload",(function e(){A(),window.removeEventListener("beforeunload",e)})),e.selectGraph=function(e){f=e,m(!0),u.set(`dependencies-selectedGraph-${r.getActiveRepository()}`,f)},e.getSelectedGraphValue=function(){return f.contextID.value},e.isAllGraphsSelected=function(){return"All graphs"===e.getSelectedGraphValue()}}Object.defineProperty(e,"allGraphs",{get:()=>s}),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",r).config(["$uibTooltipProvider",function(e){e.options({appendToBody:!0})}]).filter("humanize",(function(){return n})),r.$inject=["$scope","$rootScope","$repositories","toastr","$timeout","GraphDataRestService","UiScrollService","ModalService","LocalStorageAdapter","RDF4JRepositoriesRestService"]}).call(this,s(3))}}]);
//# sourceMappingURL=56.dae3cb719fcb013d7a06.bundle.js.map