UNPKG

graphdb-workbench

Version:
2 lines 8.47 kB
export const __webpack_esm_id__=57952;export const __webpack_esm_ids__=[48581,57952,70962];export const __webpack_esm_modules__={57952(t,e,n){n.d(e,{$$:()=>A,CQ:()=>v,D6:()=>R,HF:()=>E,Iz:()=>T,J5:()=>N,Wg:()=>D,Xl:()=>h,ZC:()=>m,_D:()=>x,cZ:()=>f,cy:()=>y,dB:()=>_,kI:()=>O,r_:()=>S,ss:()=>Y});var o=n(70962),s=n(98980),r=n(93462);const a={line:r.line,select:r.select},i="var(--gw-secondary-base)",c={[o.gC.IN_SYNC]:i,[o.gC.SYNCING]:i,[o.gC.OUT_OF_SYNC]:"var(--gw-neutral-base)",[o.gC.RECEIVING_SNAPSHOT]:i},d={[o.gC.IN_SYNC]:"none",[o.gC.SYNCING]:"10 10",[o.gC.OUT_OF_SYNC]:"10 10",[o.gC.RECEIVING_SNAPSHOT]:"10 10"},l="REMIXICON",u="ICOMOON";function N(t){return a.select(t).append("svg").classed("cluster-diagram",!0)}function _(t){const e=t.append("g");return e.append("circle").classed("cluster-zone",!0).style("fill","transparent").style("stroke-width","4"),e}function h(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","var(--gw-primary-base)").style("text-anchor","middle").classed("settings-icon",!0).text("")}}function S(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 f(t,e,n){t.attr("transform",()=>`translate(${e}, ${n})`)}function O(t,e,n){const o=t.enter().append("g").attr("id","node-group").classed("legend",n),s=o.merge(t).attr("id","node-group").classed("legend",n);return function(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]];t.selectAll("path.area").data([o]).enter().append("path").attr("class","node member").attr("stroke-width","10").attr("stroke-linejoin","round").attr("d",a.line())}(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),s}function E(t){!function(t){t.select(".node-icon").each(function(t){const e=(n=t,(0,s.isEmpty)(n.recoveryStatus)?function(t){return g[t.nodeState]||{icon:"",font:""}}(t):function(t){const e=t.recoveryStatus;return e&&e.state&&p[e.state]||{icon:"",font:""}}(t));var n;a.select(this).classed("icon-any",e.font===u).classed("remixicon",e.font===l).text(e.icon)})}(t),function(t){t.select(".node.member").classed("leader",t=>t.nodeState===o.UY.LEADER).classed("follower",t=>t.nodeState===o.UY.FOLLOWER).classed("candidate",t=>t.nodeState===o.UY.CANDIDATE).classed("other",t=>t.nodeState!==o.UY.LEADER&&t.nodeState!==o.UY.FOLLOWER&&t.nodeState!==o.UY.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 a.select(t.labelNode).node().getBBox().width+10}).attr("height",function(t){return a.select(t.labelNode).node().getBBox().height+10}).attr("x",function(t){return a.select(t.labelNode).node().getBBox().x-5}).attr("y",function(t){return a.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,s.isEmpty)(t.recoveryStatus)||(o=I(t));const r=C(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,s.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 I(t)}),t.select(".node-info-text").remove(),function(t){t.select(".node-info-fo").each(function(t){const e=a.select(this);if((0,s.isEmpty)(t.recoveryStatus))return void e.attr("width",0);const n=I(t),o=t.recoveryStatus.message&&t.recoveryStatus.message.length>40&&n!==t.recoveryStatus.message,r=o?n:t.recoveryStatus.message,i=C(n),c=C(t.recoveryStatus.message);e.on(".tooltip",null),o&&function(t,e,n,o,s){t.on("mouseover.tooltip",()=>{t.attr("width",s.width).attr("height",s.height).attr("x",-s.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.vQ.SEARCHING_FOR_NODE]:{icon:"",font:l},[o.vQ.WAITING_FOR_SNAPSHOT]:{icon:"",font:l},[o.vQ.RECEIVING_SNAPSHOT]:{icon:"",font:l},[o.vQ.APPLYING_SNAPSHOT]:{icon:"",font:l},[o.vQ.BUILDING_SNAPSHOT]:{icon:"",font:l},[o.vQ.SENDING_SNAPSHOT]:{icon:"",font:l},[o.vQ.RECOVERY_OPERATION_FAILURE_WARNING]:{icon:"",font:u}},g={[o.UY.CANDIDATE]:{icon:"",font:u},[o.UY.NO_CONNECTION]:{icon:"",font:u},[o.UY.OUT_OF_SYNC]:{icon:"",font:u},[o.UY.READ_ONLY]:{icon:"",font:u},[o.UY.RESTRICTED]:{icon:"",font:u}};function I(t){return t.recoveryStatus.message&&t.recoveryStatus.message.length>40?t.recoveryStatus.message.substring(0,40)+"...":t.recoveryStatus.message||""}function C(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,s=n.width;return document.body.removeChild(e),{height:o,width:s}}function y(t){t.enter().append("path").classed("link",!0),t.exit().remove()}function A(t,e){t.attr("class",t=>`link ${t.id.replaceAll(":","-")}`).attr("stroke",x).style("stroke-dasharray",v).style("marker-mid",t=>T(t,m.BIG)).attr("d",t=>function(t,e){const n=e.find(e=>e.address===t.source),o=e.find(e=>e.address===t.target),s=o.x-n.x,r=o.y-n.y,a=Math.sqrt(s*s+r*r),i=s/a,c=r/a,d=n.x+55*i,l=n.y+55*c,u=o.x-55*i,N=o.y-55*c;return"M"+d+","+l+"L"+(d+u)/2+","+(l+N)/2+"L"+u+","+N}(t,e))}const m={SMALL:{name:"small",size:3},BIG:{name:"big",size:5}};function R(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 T(t,e){if(t.status===o.gC.RECEIVING_SNAPSHOT)return`url(#arrowhead_${e.name})`}function x(t){return c[t.status]||"none"}function v(t){return d[t.status]||"none"}function Y(t,e,n,o){t.attr("transform",(s,r)=>{const a=2*Math.PI*r/t.size(),i=e+Math.cos(a)*o,c=n+Math.sin(a)*o;return s.x=i,s.y=c,`translate(${i}, ${c})`})}function D(){a.select(document).selectAll(".node-info-fo").on(".tooltip",null)}},70962(t,e,n){n.d(e,{UY:()=>o,gC:()=>r,vQ:()=>s,zB:()=>a});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"},s={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"},a={PRIMARY_NODE:"PRIMARY_NODE",SECONDARY_NODE:"SECONDARY_NODE"}}}; //# sourceMappingURL=57952.8b8c68625554dce4b040.bundle.js.map