graphdb-workbench
Version:
The web application for GraphDB APIs
2 lines • 4.64 kB
JavaScript
export const __webpack_id__=58239;export const __webpack_ids__=[21466,58239];export const __webpack_modules__={21466:(e,t,n)=>{n.r(t),n.d(t,{CLICK_IN_VIEW:()=>r,CREATE_CLUSTER:()=>c,DELETE_CLUSTER:()=>s,MODEL_UPDATED:()=>i,NODE_SELECTED:()=>a,UPDATE_CLUSTER:()=>o});const o="updateCluster",s="deleteCluster",r="clickInView",a="nodeSelected",c="createCluster",i="modelUpdated"},58239:(e,t,n)=>{n.r(t),n(32150),n(94519);var o=n(57952),s=n(98980),r=n(21466);const a={select:n(93462).select};let c=240;const i={no_cluster_configured:"",create_cluster_btn:"",legend_node_state:"",legend_link_state:"",node_state_leader:"Leader",node_state_follower:"Follower",node_state_candidate:"Candidate",node_state_no_cluster:"No cluster",node_state_out_of_sync:"Out of sync",node_state_no_connection:"No connection",node_state_read_only:"Read only",node_state_restricted:"Restricted",link_state_in_sync:"In sync",link_state_syncing:"Syncing",link_state_out_of_sync:"Out of sync",recovery_state:{searching_for_node:"Searching for node",waiting_for_snapshot:"Waiting for snapshot from node",receiving_snapshot:"Receiving a snapshot from node",applying_snapshot:"Applying a snapshot",building_snapshot:"Building a snapshot for node",sending_snapshot:"Sending a snapshot to node",recovery_operation_failure_warning:"Node unable to recover. Action required"}},l={node_state:"legend_node_state",link_state:"legend_link_state"};angular.module("graphdb.framework.clustermanagement.directives.cluster-graphical-view",["graphdb.framework.utils.localstorageadapter","graphdb.framework.clustermanagement.directives.cluster-legend"]).directive("clusterGraphicalView",["$window","LocalStorageAdapter","LSKeys","UriUtils","$translate","$jwtAuth","$rootScope","ClusterViewContextService",function(e,t,n,d,u,_,p,g){return{restrict:"E",scope:{clusterModel:"="},link:function(f,h){const E=angular.element(e),m=[];let C,w,y,v,S,k=T(),L=O(),A=Math.min(k,L)/2-100,b=k/2,M=L/2;function D(){const e=g.getClusterViewD3Container();k=T(),L=O(),e.attr("width",k),e.attr("height",L),I()}function N(e,t=""){Object.keys(e).forEach(n=>{let o="";t&&(o+=t),o+=`.${n}`;const s=e[n];"string"==typeof s?e[n]=u.instant(`cluster_management.cluster_graphical_view${o}`):"object"==typeof s&&N(s,o)})}function T(){const o="collapsedMenu"===t.get(n.MENU_STATE);return c=o?70:240,Math.max(Math.floor(.95*(e.innerWidth-c)),600)}function O(){return Math.max(.95*(e.innerHeight-250),675)}function R(e){f.$emit(r.CLICK_IN_VIEW,e.target)}function I(){A=Math.min(k,L)/2-100,b=k/2,M=L/2,o.moveElement(y,b,M),y.select(".cluster-zone").attr("r",A),w!==f.clusterModel.hasCluster&&(w=!!f.clusterModel.hasCluster,function(e){o.setCreateClusterZone(e,y,i,C),!e&&C&&y.on("mouseup",()=>{f.$emit(r.CREATE_CLUSTER)})}(w));const e=function(){const e=(0,s.cloneDeep)(f.clusterModel.nodes)||[];return e.forEach(e=>{if(e.hostname=d.shortenIri(e.endpoint),!(0,s.isEmpty)(e.recoveryStatus)){let t=`cluster_management.cluster_graphical_view.recovery_state.${e.recoveryStatus.state.toLowerCase()}`;e.recoveryStatus.affectedNodes&&e.recoveryStatus.affectedNodes.length>0&&(t+="_with_affected_node"),e.recoveryStatus.message=u.instant(t,{node:e.recoveryStatus.affectedNodes.join(", ")})}}),e}();!function(e){const t=v.selectAll("#node-group").data(e,e=>e.address),n=o.createNodes(t,45);n.on("click",(e,t)=>{f.$emit(r.NODE_SELECTED,t);const n=a.select(".nodetooltip"),o=$(window).width();e.pageX<o/2?(n.style("left",e.pageX+"px"),n.style("right","")):(n.style("left",""),n.style("right",o-e.pageX+"px")),n.style("top",e.pageY-28+"px")}),o.updateNodes(n),o.positionNodesOnClusterZone(n,b,M,A)}(e),function(e,t){const n=S.selectAll(".link").data(e,e=>e.id);o.createLinks(n),o.updateLinks(n,t)}((0,s.cloneDeep)(f.clusterModel.links)||[],e)}f.width=function(){return k},f.height=function(){return L},f.$on("$destroy",function(){E.unbind("resize",D),E.unbind("mousedown",R),o.removeEventListeners(),m.forEach(e=>e())}),C=_.isAdmin(),E.bind("resize",D),E.bind("mousedown",R),m.push(p.$on("$translateChangeSuccess",function(){N(i),o.updateClusterZoneLabels(w,y,i),Object.keys(l).forEach(e=>{a.select(`#${e}`).text(function(e){return i[l[e]]}(e))})})),m.push(f.$on(r.MODEL_UPDATED,function(){I()})),N(i),function(e){const t=o.createClusterSvgElement(h[0]).attr("width",k).attr("height",L);y=o.createClusterZone(t,e),S=t.append("g").attr("id","links-group"),v=t.append("g").attr("id","nodes-group"),o.addArrowHead(t,o.ARROW_CONFIG.BIG),o.addArrowHead(t,o.ARROW_CONFIG.SMALL),g.updateClusterViewD3Container(t)}(!(!f.clusterModel.nodes||!f.clusterModel.nodes.length)),I()}}}])}};
//# sourceMappingURL=58239.f763f8933f7218d15896.bundle.js.map