UNPKG

graphdb-workbench

Version:
2 lines 5.9 kB
export const __webpack_esm_id__=55947;export const __webpack_esm_ids__=[55947];export const __webpack_esm_modules__={55947:(e,t,s)=>{var r=s(57962),n=s(57154);const o={select:s(93462).select},a="WAIT",i="NO_REPO",l="READY",c="IN_PROGRESS",u="ERROR",d={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 g(e,t,s,p,g,h,f,m,C,y,R){const S=(0,n.service)(n.RepositoryContextService);let x=null;e.hasMoreGraphs=!1,e.status=S.getSelectedRepository()?.id?a:i,e.graphsDropdownToggled=t=>{e.hasMoreGraphs&&t&&p.warning(R.instant("dependencies.graphs.too.many.warning",{graphsLimit:r.Z.formatNumberToLocaleString(1e3,R.use())}))};let v=d;const w=function(){y.resolveGraphs(S.getSelectedRepository()?.id,1001).success(function(t){e.graphsInRepo=t.results.bindings,e.hasMoreGraphs=e.graphsInRepo.length>1002,D(),e.isSystemRepository()?"READY"!==e.status&&E():(e.status="WAIT",E(!0))}).error(function(t){e.repositoryError=getError(t),p.error(getError(t),R.instant("graphexplore.error.getting.graph"))})},D=function(){const t=C.get(`dependencies-selectedGraph-${S.getSelectedRepository()?.id}`);null!==t&&e.graphsInRepo.some(e=>e.contextID.uri===t.contextID.uri)?v=t:C.set(`dependencies-selectedGraph-${S.getSelectedRepository()?.id}`,v)},b=function(t){o.select("#dependencies-chord").html(""),e.status=a,h.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=l}).error(function(t){e.status=l,p.error(getError(t),R.instant("graphexplore.error.dependencies.count"))})},E=function(t){(e.status!==l||t)&&(e.status=a,h.getRelationshipsStatus(v.contextID.uri).success(function(t){if(e.status=t,e.status===c){if(null!==x)return;x=g(E,2e3)}e.status===l&&(null!==x&&(g.cancel(x),x=null),h.getRelationshipsClasses(e.direction,v.contextID.uri).success(function(t,s){e.allClasses.items=_.filter(t,M),e.allNotFilteredClasses=t,e.selectedClasses=void 0,angular.isUndefined(e.selectedClasses)&&(e.selectedClasses=t.slice(0,10)),b(e.selectedClasses),207===s&&p.warning(R.instant("graphexplore.update.diagram"),R.instant("graphexplore.repository.data.changed"))})),0===e.status.indexOf("ERROR;")&&(e.status=u,p.error(R.instant("graphexplore.error.dependencies.calc",{error:e.status.substring(6)})))}).error(function(t){e.status=u,p.error(getError(t),R.instant("graphexplore.error.dependencies.count.status"))}))};e.allClasses={},e.allClasses.items=[],e.allNotFilteredClasses=[],e.direction="all";const G={};let $=0,I=0;function M(t){return-1!==t.name.toLowerCase().indexOf(e.classQuery.query.toLowerCase())}t.key="",G.get=function(t,s,r){f.initLazyList(t,s,r,$,e.allClasses.items)},t.$watch(function(){return t.key},function(){$=0,_.each(e.allClasses.items,function(e){t.key>e&&$++}),I++}),G.revision=function(){return I},e.datasource=G,e.adapterContainer={adapter:{remain:!0}},e.classQuery={},e.classQuery.query="",e.classFilterFunc=M,e.$watch("allClasses.items",function(){e.allClasses.items.length>0&&g(function(){e.adapterContainer.adapter.reload()},30)}),e.$watch("direction",function(){const t=S.getSelectedRepository();!t||e.isSystemRepository()||t.isFedx()||w()}),e.$on("$destroy",function(){g.cancel(x),k()}),e.isLoading=function(){return e.status===c||e.status===a},e.confirmCalculateDependencies=function(){m.openSimpleModal({title:R.instant("confirm.operation"),message:R.instant("graphexplore.calculating.relationships"),warning:!0}).result.then(function(){e.calculateDependencies()})},e.calculateDependencies=function(){e.status=a,e.selectedClasses=void 0,h.calculateRelationships(v.contextID.uri).success(function(t){0===t.indexOf("ERROR;")?p.error(R.instant("graphexplore.error.dependencies.calc",{error:e.status.substring(6)})):E()}).error(function(e){p.error(R.instant("graphexplore.error.could.not.force.count",{error:getError(e)}))})},e.addClass=function(t){e.selectedClasses.push(t),b(e.selectedClasses)},e.removeClass=function(t){_.remove(e.selectedClasses,function(e){return e.name===t.name}),b(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})),b(e.selectedClasses)},e.removeClassByName=function(t){_.remove(e.selectedClasses,function(e){return e.name===t}),b(e.selectedClasses)},e.removeAllClasses=function(){e.selectedClasses=[],b(e.selectedClasses)},e.isSystemRepository=function(){return"SYSTEM"===S.getSelectedRepository()?.id};const k=S.onSelectedRepositoryChanged(()=>function(){e.classQuery={},e.classQuery.query="",e.repositoryError=null,v=d;const t=S.getSelectedRepository();t&&!t.isFedx()?w():e.status=i}());e.selectGraph=function(e){v=e,E(!0),C.set(`dependencies-selectedGraph-${S.getSelectedRepository()?.id}`,v)},e.getSelectedGraphValue=function(){return v.contextID.value},e.isAllGraphsSelected=function(){return"all.graphs.label"===e.getSelectedGraphValue()}}Object.defineProperty(s.g,"allGraphs",{get:()=>d}),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",g).config(["$uibTooltipProvider",function(e){e.options({appendToBody:!0})}]).filter("humanize",function(){return p}),g.$inject=["$scope","$rootScope","$repositories","toastr","$timeout","GraphDataRestService","UiScrollService","ModalService","LocalStorageAdapter","RDF4JRepositoriesRestService","$translate"]}}; //# sourceMappingURL=55947.1e72eaa4773c733455f6.bundle.js.map