UNPKG

graphdb-workbench

Version:
2 lines 9.26 kB
export const __webpack_id__=57952;export const __webpack_ids__=[48581,57952,70962];export const __webpack_modules__={57952:(t,e,n)=>{n.r(e),n.d(e,{ARROW_CONFIG:()=>R,addArrowHead:()=>T,createClusterSvgElement:()=>u,createClusterZone:()=>O,createHexagon:()=>w,createLinks:()=>g,createNodes:()=>h,moveElement:()=>_,positionNodesOnClusterZone:()=>L,removeEventListeners:()=>G,setArrowLink:()=>m,setCreateClusterZone:()=>S,setLinkColor:()=>v,setLinkStyle:()=>x,updateClusterZoneLabels:()=>E,updateLinks:()=>C,updateNodes:()=>f});var o=n(70962),a=n(98980),r=n(93462);const s={line:r.line,select:r.select},i={ontoOrange:"var(--gw-primary-base)",ontoBlue:"var(--gw-secondary-base)",ontoGreen:"var(--gw-tertiary-base)",ontoGrey:"var(--gw-neutral-base)"},c={[o.LinkState.IN_SYNC]:i.ontoBlue,[o.LinkState.SYNCING]:i.ontoBlue,[o.LinkState.OUT_OF_SYNC]:i.ontoGrey,[o.LinkState.RECEIVING_SNAPSHOT]:i.ontoBlue},d={[o.LinkState.IN_SYNC]:"none",[o.LinkState.SYNCING]:"10 10",[o.LinkState.OUT_OF_SYNC]:"10 10",[o.LinkState.RECEIVING_SNAPSHOT]:"10 10"},l={FONT_AWESOME:"FONT_AWESOME",ICOMOON:"ICOMOON"},N=40;function u(t){return s.select(t).append("svg").classed("cluster-diagram",!0)}function O(t){const e=t.append("g");return e.append("circle").classed("cluster-zone",!0).style("fill","transparent").style("stroke-width","4"),e}function S(t,e,n,o=!1){if(e.select(".cluster-zone").classed("no-cluster",!t).classed("has-access",o),t)e.selectAll("#no-cluster-zone").remove();else{const t=e.append("g").attr("id","no-cluster-zone");t.append("text").attr("id","no-cluster-label").text(n.no_cluster_configured).attr("y",-50).classed("h2",!0).style("text-anchor","middle"),o&&t.append("text").attr("id","create-cluster-label").classed("h3",!0).text(n.create_cluster_btn).style("text-anchor","middle"),t.append("text").attr("y",130).attr("class","icon-any repo").attr("fill",i.ontoOrange).style("text-anchor","middle").classed("settings-icon",!0).text("")}}function E(t,e,n){t||(e.select("#no-cluster-zone #no-cluster-label").text(n.no_cluster_configured),e.select("#no-cluster-zone #create-cluster-label").text(n.create_cluster_btn))}function _(t,e,n){t.attr("transform",()=>`translate(${e}, ${n})`)}function h(t,e,n){const o=t.enter().append("g").attr("id","node-group").classed("legend",n),a=o.merge(t).attr("id","node-group").classed("legend",n);return w(o,e),t.exit().remove(),o.append("text").attr("class","icon-any node-icon"),n||function(t,e){const n=t.append("g");n.append("rect").attr("class","id-host-background").attr("rx",6),n.append("rect").attr("class","node-info-background").attr("rx",6),n.append("text").attr("y",e+25).attr("class","id id-host"),n.append("text").attr("y",e+55).attr("class","node-info-text")}(o,e),a}function f(t){!function(t){t.select(".node-icon").each(function(t){const e=(n=t,(0,a.isEmpty)(n.recoveryStatus)?function(t){return I[t.nodeState]||{icon:"",font:""}}(t):function(t){const e=t.recoveryStatus;return e&&e.state&&p[e.state]||{icon:"",font:""}}(t));var n;s.select(this).classed("icon-any",e.font===l.ICOMOON).classed("fa-d3",e.font===l.FONT_AWESOME).text(e.icon)})}(t),function(t){t.select(".node.member").classed("leader",t=>t.nodeState===o.NodeState.LEADER).classed("follower",t=>t.nodeState===o.NodeState.FOLLOWER).classed("candidate",t=>t.nodeState===o.NodeState.CANDIDATE).classed("other",t=>t.nodeState!==o.NodeState.LEADER&&t.nodeState!==o.NodeState.FOLLOWER&&t.nodeState!==o.NodeState.CANDIDATE)}(t),function(t){t.select(".id.id-host").each(function(t){t.labelNode=this}).text(function(t){return t.hostname}),t.select(".id-host-background").attr("width",function(t){return s.select(t.labelNode).node().getBBox().width+10}).attr("height",function(t){return s.select(t.labelNode).node().getBBox().height+10}).attr("x",function(t){return s.select(t.labelNode).node().getBBox().x-5}).attr("y",function(t){return s.select(t.labelNode).node().getBBox().y-5})}(t),function(t){let e,n;t.select(".node-info-text").each(function(t){t.infoNode=this}).select(function(){return this.parentNode}).append("foreignObject").attr("width",function(t){let o="";(0,a.isEmpty)(t.recoveryStatus)||(o=y(t));const r=A(o);return e=r.height,n=r.width,n}).attr("height",function(t){return e}).attr("x",function(t){return-n/2}).attr("y",function(t){return 78}).classed("hidden",function(t){return(0,a.isEmpty)(t.recoveryStatus)}).style("font-size","12px").style("font-weight","400").style("text-align","center").style("padding","4px").style("background","#EEEEEE").style("border-radius","6px").attr("class","node-info-fo").append("xhtml:div").html(function(t){return y(t)}),t.select(".node-info-text").remove(),function(t){t.select(".node-info-fo").each(function(t){const e=s.select(this);if((0,a.isEmpty)(t.recoveryStatus))return void e.attr("width",0);const n=y(t),o=t.recoveryStatus.message&&t.recoveryStatus.message.length>N&&n!==t.recoveryStatus.message,r=o?n:t.recoveryStatus.message,i=A(n),c=A(t.recoveryStatus.message);e.on(".tooltip",null),o&&function(t,e,n,o,a){t.on("mouseover.tooltip",()=>{t.attr("width",a.width).attr("height",a.height).attr("x",-a.width/2).html(`<div>${e}</div>`)}),t.on("mouseout.tooltip",()=>{t.attr("width",n.width).attr("height",n.height).attr("x",-n.width/2).html(`<div>${o}</div>`)})}(e,t.recoveryStatus.message,i,r,c),e.attr("width",i.width).attr("height",i.height).attr("x",-i.width/2).html(`<div>${r}</div>`)})}(t)}(t)}const p={[o.RecoveryState.SEARCHING_FOR_NODE]:{icon:"",font:l.FONT_AWESOME},[o.RecoveryState.WAITING_FOR_SNAPSHOT]:{icon:"",font:l.FONT_AWESOME},[o.RecoveryState.RECEIVING_SNAPSHOT]:{icon:"",font:l.FONT_AWESOME},[o.RecoveryState.APPLYING_SNAPSHOT]:{icon:"",font:l.FONT_AWESOME},[o.RecoveryState.BUILDING_SNAPSHOT]:{icon:"",font:l.FONT_AWESOME},[o.RecoveryState.SENDING_SNAPSHOT]:{icon:"",font:l.FONT_AWESOME},[o.RecoveryState.RECOVERY_OPERATION_FAILURE_WARNING]:{icon:"",font:l.ICOMOON}},I={[o.NodeState.CANDIDATE]:{icon:"",font:l.ICOMOON},[o.NodeState.NO_CONNECTION]:{icon:"",font:l.ICOMOON},[o.NodeState.OUT_OF_SYNC]:{icon:"",font:l.ICOMOON},[o.NodeState.READ_ONLY]:{icon:"",font:l.ICOMOON},[o.NodeState.RESTRICTED]:{icon:"",font:l.ICOMOON}};function y(t){return t.recoveryStatus.message&&t.recoveryStatus.message.length>N?t.recoveryStatus.message.substring(0,N)+"...":t.recoveryStatus.message||""}function A(t){const e=document.createElement("div");e.innerHTML=t,e.style.padding="4px",e.style.position="absolute",e.style.visibility="hidden",e.style.fontSize="12px",e.style.fontWeight="400",e.style.textAlign="center",e.style.height="auto",e.style.width="auto",e.style.whiteSpace="nowrap",document.body.appendChild(e);const n=e.getBoundingClientRect(),o=n.height,a=n.width;return document.body.removeChild(e),{height:o,width:a}}function g(t){t.enter().append("path").classed("link",!0),t.exit().remove()}function C(t,e){t.attr("class",t=>`link ${t.id.replaceAll(":","-")}`).attr("stroke",v).style("stroke-dasharray",x).style("marker-mid",t=>m(t,R.BIG)).attr("d",t=>function(t,e){const n=e.find(e=>e.address===t.source),o=e.find(e=>e.address===t.target),a=o.x-n.x,r=o.y-n.y,s=Math.sqrt(a*a+r*r),i=a/s,c=r/s,d=n.x+55*i,l=n.y+55*c,N=o.x-55*i,u=o.y-55*c;return"M"+d+","+l+"L"+(d+N)/2+","+(l+u)/2+"L"+N+","+u}(t,e))}const R={SMALL:{name:"small",size:3},BIG:{name:"big",size:5}};function T(t,e){t.append("svg:defs").append("svg:marker").attr("id",`arrowhead_${e.name}`).attr("viewBox",`0 0 ${2*e.size} ${2*e.size}`).attr("refX",e.size).attr("refY",e.size).attr("markerWidth",e.size).attr("markerHeight",e.size).attr("orient","auto-start-reverse").append("path").attr("d",`M 0 0 L ${2*e.size} ${e.size} L 0 ${2*e.size} z`).style("fill","var(--gw-secondary-base)")}function m(t,e){if(t.status===o.LinkState.RECEIVING_SNAPSHOT)return`url(#arrowhead_${e.name})`}function v(t){return c[t.status]||"none"}function x(t){return d[t.status]||"none"}function L(t,e,n,o){t.attr("transform",(a,r)=>{const s=2*Math.PI*r/t.size(),i=e+Math.cos(s)*o,c=n+Math.sin(s)*o;return a.x=i,a.y=c,`translate(${i}, ${c})`})}function w(t,e){const n=Math.sqrt(3)/2,o=[[e+0,0],[e/2+0,e*n+0],[-e/2+0,e*n+0],[0-e,0],[-e/2+0,-e*n+0],[e/2+0,-e*n+0],[e+0,0],[e/2+0,e*n+0]];return t.selectAll("path.area").data([o]).enter().append("path").attr("class","node member").attr("stroke-width","10").attr("stroke-linejoin","round").attr("d",s.line())}function G(){s.select(document).selectAll(".node-info-fo").on(".tooltip",null)}},70962:(t,e,n)=>{n.r(e),n.d(e,{LinkState:()=>r,NodeState:()=>o,RecoveryState:()=>a,TopologyState:()=>s});const o={LEADER:"LEADER",FOLLOWER:"FOLLOWER",CANDIDATE:"CANDIDATE",OUT_OF_SYNC:"OUT_OF_SYNC",NO_CONNECTION:"NO_CONNECTION",READ_ONLY:"READ_ONLY",RESTRICTED:"RESTRICTED",NO_CLUSTER:"NO_CLUSTER"},a={SEARCHING_FOR_NODE:"SEARCHING_FOR_NODE",WAITING_FOR_SNAPSHOT:"WAITING_FOR_SNAPSHOT",RECEIVING_SNAPSHOT:"RECEIVING_SNAPSHOT",APPLYING_SNAPSHOT:"APPLYING_SNAPSHOT",BUILDING_SNAPSHOT:"BUILDING_SNAPSHOT",SENDING_SNAPSHOT:"SENDING_SNAPSHOT",RECOVERY_OPERATION_FAILURE_WARNING:"RECOVERY_OPERATION_FAILURE_WARNING"},r={IN_SYNC:"IN_SYNC",OUT_OF_SYNC:"OUT_OF_SYNC",SYNCING:"SYNCING",NO_CONNECTION:"NO_CONNECTION",RECEIVING_SNAPSHOT:"RECEIVING_SNAPSHOT"},s={PRIMARY_NODE:"PRIMARY_NODE",SECONDARY_NODE:"SECONDARY_NODE"}}}; //# sourceMappingURL=57952.0ccd75691e680a93f194.bundle.js.map