@pinpoint-fe/server-map
Advanced tools
Comparing version 0.0.9 to 0.0.10-rc.1
@@ -1,13 +0,13 @@ | ||
var Ee=Object.defineProperty,Ne=Object.defineProperties;var Me=Object.getOwnPropertyDescriptors;var se=Object.getOwnPropertySymbols;var ke=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable;var re=(i,r,o)=>r in i?Ee(i,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[r]=o,S=(i,r)=>{for(var o in r||(r={}))ke.call(r,o)&&re(i,o,r[o]);if(se)for(var o of se(r))be.call(r,o)&&re(i,o,r[o]);return i},R=(i,r)=>Ne(i,Me(r));import C from"react";import le from"cytoscape";import xe from"cytoscape-dagre";import F from"lodash";var L={transactionStatus:{default:{stroke:"transparent",strokeWidth:10},good:{stroke:"#32BA94",strokeWidth:10},slow:{stroke:"#E48022",strokeWidth:10},bad:{stroke:"#F0515B",strokeWidth:10}},node:{default:{"background-color":"#FFF","border-width":"3","border-color":"#ddd","text-valign":"bottom","text-halign":"center","text-margin-y":4,"overlay-opacity":0,"font-family":"Helvetica, Arial, avn85, NanumGothic, ng, dotum, AppleGothic, sans-serif","font-size":12,"font-weight":"normal","text-wrap":"wrap","text-max-width":"200","line-height":1.5,color:"#000"},highlight:{"font-weight":"bold","font-size":14,"border-color":"#4A61D1"},main:{"font-weight":"bold","font-size":14}},edge:{default:{width:1.5,"font-size":"12px","font-weight":"normal","line-color":"#C0C3C8","target-arrow-color":"#C0C3C8","target-arrow-shape":"triangle","curve-style":"bezier","text-background-color":"white","text-background-opacity":.7,"text-background-padding":"5px","text-background-shape":"roundrectangle","overlay-opacity":0},highlight:{"font-size":"14px","font-weight":"bold","line-color":"#4763d0","target-arrow-color":"#4763d0"},loop:{"control-point-step-size":70,"loop-direction":"0deg","loop-sweep":"-90deg"}}};var ne=.05,de=47,K=2*Math.PI*de,ae=i=>{let{transactionInfo:r}=i;return"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(` | ||
var ye=Object.defineProperty,Ee=Object.defineProperties;var Ne=Object.getOwnPropertyDescriptors;var oe=Object.getOwnPropertySymbols;var Me=Object.prototype.hasOwnProperty,ke=Object.prototype.propertyIsEnumerable;var se=(i,r,s)=>r in i?ye(i,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[r]=s,b=(i,r)=>{for(var s in r||(r={}))Me.call(r,s)&&se(i,s,r[s]);if(oe)for(var s of oe(r))ke.call(r,s)&&se(i,s,r[s]);return i},W=(i,r)=>Ee(i,Ne(r));import A from"react";import ge from"cytoscape";import we from"cytoscape-dagre";import K from"lodash";var G={transactionStatus:{default:{stroke:"transparent",strokeWidth:10},good:{stroke:"#32BA94",strokeWidth:10},slow:{stroke:"#E48022",strokeWidth:10},bad:{stroke:"#F0515B",strokeWidth:10}},node:{default:{"background-color":"#FFF","border-width":"3","border-color":"#ddd","text-valign":"bottom","text-halign":"center","text-margin-y":4,"overlay-opacity":0,"font-family":"Helvetica, Arial, avn85, NanumGothic, ng, dotum, AppleGothic, sans-serif","font-size":12,"font-weight":"normal","text-wrap":"wrap","text-max-width":"200","line-height":1.5,color:"#000"},highlight:{"font-weight":"bold","font-size":14,"border-color":"#4A61D1"},main:{"font-weight":"bold","font-size":14}},edge:{default:{width:1.5,"font-size":"12px","font-weight":"normal","line-color":"#C0C3C8","target-arrow-color":"#C0C3C8","target-arrow-shape":"triangle","curve-style":"bezier","text-background-color":"white","text-background-opacity":.7,"text-background-padding":"5px","text-background-shape":"roundrectangle","overlay-opacity":0},highlight:{"font-size":"14px","font-weight":"bold","line-color":"#4763d0","target-arrow-color":"#4763d0"},loop:{"control-point-step-size":70,"loop-direction":"0deg","loop-sweep":"-90deg"}}};var re=.05,ie=47,U=2*Math.PI*ie,de=i=>{let{transactionInfo:r}=i;return"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(` | ||
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" xmlns:xlink="http://www.w3.org/1999/xlink"> | ||
${Se(r,!r)} | ||
${be(r,!r)} | ||
</svg> | ||
`)},U=i=>{let{stroke:r,strokeWidth:o,strokeDashOffset:E=0,strokeDashArray:T="none"}=i;return` | ||
<circle cx="50" cy="50" r="${de}" | ||
`)},L=i=>{let{stroke:r,strokeWidth:s,strokeDashOffset:y=0,strokeDashArray:S="none"}=i;return` | ||
<circle cx="50" cy="50" r="${ie}" | ||
style="fill:none; | ||
stroke:${r}; | ||
stroke-width:${o}; | ||
stroke-dashoffset:${E}; | ||
stroke-dasharray:${T} 1000" | ||
stroke-width:${s}; | ||
stroke-dashoffset:${y}; | ||
stroke-dasharray:${S} 1000" | ||
/> | ||
`},ie=(i,r)=>r===0?0:r/i<ne?K*ne:r/i*K,Se=(i,r)=>{let{transactionStatus:o}=L;if(r||!i)return U({stroke:o.default.stroke,strokeWidth:o.default.strokeWidth});{let E=Object.keys(i).reduce((p,b)=>p+i[b],0),T=ie(E,i.slow),v=ie(E,i.bad),B=-1*(.75*K-(T+v)),w=-1*(.75*K-v);return U({stroke:o.good.stroke,strokeWidth:o.good.strokeWidth})+U({stroke:o.slow.stroke,strokeWidth:o.slow.strokeWidth,strokeDashOffset:B,strokeDashArray:T})+U({stroke:o.bad.stroke,strokeWidth:o.bad.strokeWidth,strokeDashOffset:w,strokeDashArray:v})}};var ce=i=>{let{edges:r,nodes:o}=i,E=new Set,w=r.map(t=>t.target).filter(t=>!r.some(n=>n.source===t)).filter(t=>{var n,d;return!((d=(n=o.find(u=>t===u.id))==null?void 0:n.shouldNotMerge)!=null&&d.call(n))}).reduce((t,n)=>t[n]?R(S({},t),{[n]:t[n]+1}):R(S({},t),{[n]:1}),{}),p=Object.entries(w).reduce((t,[n,d])=>{let u=S({},t);return d>1?u.multi.push(n):u.single.push(n),u},{single:[],multi:[]}),b=p.single.reduce((t,n)=>{let{source:d}=r.find(u=>u.target===n);return t[d]?t[d].push(n):t[d]=[n],t},{}),D=p.multi.reduce((t,n)=>{let d=r.filter(u=>u.target===n).map(u=>u.source).sort().toString();return t[d]?t[d].push(n):t[d]=[n],t},{}),W=t=>Object.entries(t).reduce((n,[d,u])=>{let h=S({},n);return u.forEach(m=>{let g=o.find(e=>e.id===m);h[d]?g!=null&&g.type&&h[d][g.type]?h[d][g.type].push(m):g!=null&&g.type&&(h[d][g.type]=[m]):g!=null&&g.type&&(h[d]={},h[d][g.type]=[m])}),h},{}),j=W(b),X=W(D),_=(()=>{let t=[...o],n=[...r];return Object.entries(j).forEach(([d,u])=>{Object.entries(u).forEach(([h,m])=>{var g;if(m.length>1){E.add(h);let e=`${d}_${h}_MergeSingleNodesByServerMap`,s=(g=t.find(y=>y.id===m[0]))==null?void 0:g.imgPath,[M,c]=F.partition(t,y=>!m.includes(y.id));t=[...M,{id:e,imgPath:s,type:h,label:`total: ${m.length}`,nodes:c}];let[a,f]=F.partition(n,y=>!m.includes(y.target));n=[...a,{source:d,target:e,id:`${d}_${h}_MergeSingleEdgesByServerMap`,edges:f}]}})}),{nodes:t,edges:n}})(),Y=(()=>{let t=[..._.nodes],n=[..._.edges];return Object.entries(X).forEach(([d,u])=>{Object.entries(u).forEach(([h,m])=>{var g;if(m.length>1){E.add(h);let e=`${d}_${h}_MergeMultiNodesByServerMap`,s=(g=t.find(k=>k.id===m[0]))==null?void 0:g.imgPath,[M,c]=F.partition(t,k=>!m.includes(k.id));t=[...M,{id:e,imgPath:s,type:h,label:`total: ${m.length}`,nodes:c}];let a=d.split(","),[f,y]=F.partition(n,k=>!(a.includes(k.source)&&m.includes(k.target))),N=y.reduce((k,O,P)=>(k[O.source]?k[O.source].edges.push(O):k[O.source]={target:e,source:O.source,id:`${O.source}_${h}_MergeMultiEdgesByServerMap`,edges:[O]},S({},k)),{});n=[...f,...Object.values(N)]}})}),{nodes:t,edges:n}})();return{nodes:[...Y.nodes.map(t=>({data:R(S({},t),{imgArr:[t==null?void 0:t.imgPath,ae(t)]})}))],edges:[...Y.edges.map(t=>({data:S({},t)}))],mergeInfo:{types:Array.from(E)}}};import we from"lodash";var ge=i=>we.merge({},L,i),Q=({cy:i,theme:r,edgeLabelRenderer:o,nodeLabelRenderer:E})=>{var T,v,B;return[{selector:"node",style:R(S({},(T=r.node)==null?void 0:T.default),{width:100,height:100,label:w=>{var b,D;let p=(D=i.data((b=w.data())==null?void 0:b.id))==null?void 0:D.data;return(E==null?void 0:E(p))||(p==null?void 0:p.label)||""},"background-image":w=>{var b,D;let p=(D=i.data((b=w.data())==null?void 0:b.id))==null?void 0:D.data;return p==null?void 0:p.imgArr},"background-fit":"contain","background-offset-y":"-5px"})},{selector:"edge",style:R(S({},(v=r.edge)==null?void 0:v.default),{label:w=>{var b,D;let p=(D=i.data((b=w.data())==null?void 0:b.id))==null?void 0:D.data;return(o==null?void 0:o(p))||""}})},{selector:"edge:loop",style:S({},(B=r.edge)==null?void 0:B.loop)}]};import{keyBy as ve}from"lodash";import{jsx as Oe}from"react/jsx-runtime";le.use(xe);var De=({data:i,customTheme:r={},baseNodeId:o,onClickNode:E,onClickEdge:T,onClickBackground:v,onDataMerged:B,renderNodeLabel:w,renderEdgeLabel:p,className:b,style:D,cy:W})=>{let j=C.useRef(null),X=C.useRef(),l=C.useRef(),_=C.useRef(),x=ge(r),[Y,t]=C.useState(o);C.useEffect(()=>()=>{var e;(e=l==null?void 0:l.current)==null||e.destroy()},[]),C.useEffect(()=>{var e,s;X.current=o,l.current&&((e=_.current)==null||e.removeAllListeners(),(s=_.current)==null||s.stop(),_.current=void 0,l.current.removeData(),l.current.removeAllListeners(),l.current.destroy(),l.current=void 0),l.current=le({zoom:1,minZoom:.1,maxZoom:3,wheelSensitivity:.2,container:j.current}),W==null||W(l.current),l.current.style(Q({cy:l.current,theme:x,edgeLabelRenderer:p,nodeLabelRenderer:w})),h()},[o]),C.useEffect(()=>{let e=l.current;e&&e.style(Q({cy:e,theme:x,edgeLabelRenderer:p,nodeLabelRenderer:w}))},[w,p]),C.useEffect(()=>{if(i){let e=l.current;if(e){let{nodes:s,edges:M,mergeInfo:c}=ce(i),a;if(B==null||B(c),e.batch(()=>{e.removeData(),e.data(ve([...s,...M],"data.id"));let f=e.nodes().map(N=>N.id()),y=s.map(({data:N})=>N.id);new Set([...f,...y]).forEach(N=>{let k=f.includes(N),O=y.includes(N),P=k&&!O,$=!k&&O;if(P){let I=e.getElementById(N);I.remove(),I.connectedEdges().remove()}else if($){let{data:I}=s.find(({data:A})=>A.id===N),V=M.filter(({data:A})=>A.source===N||A.target===N);a=a?[...a,e.add({data:I})]:[e.add({data:I})],V.forEach(({data:A})=>{let z=e.getElementById(A.source),ee=e.getElementById(A.target);z.inside()&&ee.inside()&&e.add({data:A})})}else return})}),!_.current)_.current=e==null?void 0:e.layout({name:"dagre",fit:!1,rankDir:"LR",rankSep:200}),_.current.run();else if(a&&a.length>0){let f=e.getElementById(o),{x:y,y:N}=f.position(),{y1:k,y2:O}=f.boundingBox(),P;a.forEach(I=>{P=0;let V=I.predecessors(),A=I.successors(),z=V.contains(f);P=(z?V:A).nodes().toArray().findIndex(H=>H.id()===o)+1;let te=y+P*(200+100)*(z?1:-1),{y:ue}=I.position(),{h:Z,y1:me}=I.boundingBox(),fe=Z-(ue-me)*2,oe=e.nodes().filter(H=>{let G=H.same(I),{x:J}=H.position(),he=H.width(),ye=Math.abs(te-J)<=he;return!G&&ye}),q;Math.random()>=.5?q=Math.min(...oe.map(J=>J.position().y-50),N-50)-50-Z:q=Math.max(...oe.map(G=>G.boundingBox().y2),O)+50;let pe=(Z-fe)/2+q;I.position({x:te,y:pe})});let $=e.getElementById(Y);$.isNode()?m($):g($)}}}},[i]);let n=e=>{E==null||E(e)},d=e=>{T==null||T(e)},u=e=>{v==null||v(e)},h=C.useCallback(()=>{let e=l==null?void 0:l.current;e&&e.on("layoutready",()=>{m(e.getElementById(o));let s=e.getElementById(o);e.resize(),e.center(s)}).on("mouseover",({target:s})=>{e.container().style.cursor=s===e?"default":"pointer"}).on("mouseout",()=>{e.container().style.cursor="default"}).on("tap",({target:s,originalEvent:M,renderedPosition:c})=>{let a=c?"left":"programmatic",f={x:c==null?void 0:c.x,y:c==null?void 0:c.y};s===e?u({eventType:a,position:f}):s.isNode()?(m(s),n({eventType:a,position:f,data:s.data()})):s.isEdge()&&(g(s),d({eventType:a,position:f,data:s.data()}))}).on("cxttap",({target:s,renderedPosition:M})=>{let c="right",a={x:M.x,y:M.y};s===e?u({eventType:c,position:a}):s.isNode()?n({eventType:c,position:a,data:s.data()}):s.isEdge()&&d({eventType:c,position:a,data:s.data()})})},[E,T,v]),m=e=>{var M,c,a,f,y;let s=l.current;s.nodes().style((M=x.node)==null?void 0:M.default),s.edges().style((c=x.edge)==null?void 0:c.default),s.getElementById(o).style((a=x.node)==null?void 0:a.main),e.style((f=x.node)==null?void 0:f.highlight),e.connectedEdges().style((y=x.edge)==null?void 0:y.highlight)},g=e=>{var M,c,a,f,y,N;let s=l.current;s.nodes().style((M=x.node)==null?void 0:M.default),s.edges().style((c=x.edge)==null?void 0:c.default),s.getElementById(o).style((a=x.node)==null?void 0:a.main),e.connectedNodes().style({"border-color":(y=(f=x.node)==null?void 0:f.highlight)==null?void 0:y["border-color"]}),e.style((N=x.edge)==null?void 0:N.highlight)};return Oe("div",{style:S({width:"100%",height:"100%",overflow:"hidden"},D),className:b,ref:j})};export{De as ServerMap}; | ||
`},ne=(i,r)=>r===0?0:r/i<re?U*re:r/i*U,be=(i,r)=>{let{transactionStatus:s}=G;if(r||!i)return L({stroke:s.default.stroke,strokeWidth:s.default.strokeWidth});{let y=Object.keys(i).reduce((f,M)=>f+i[M],0),S=ne(y,i.slow),v=ne(y,i.bad),C=-1*(.75*U-(S+v)),T=-1*(.75*U-v);return L({stroke:s.good.stroke,strokeWidth:s.good.strokeWidth})+L({stroke:s.slow.stroke,strokeWidth:s.slow.strokeWidth,strokeDashOffset:C,strokeDashArray:S})+L({stroke:s.bad.stroke,strokeWidth:s.bad.strokeWidth,strokeDashOffset:T,strokeDashArray:v})}};var ae=i=>{let{edges:r,nodes:s}=i,y=new Set,T=r.map(t=>t.target).filter(t=>!r.some(n=>n.source===t)).filter(t=>{var n,d;return!((d=(n=s.find(p=>t===p.id))==null?void 0:n.shouldNotMerge)!=null&&d.call(n))}).reduce((t,n)=>t[n]?W(b({},t),{[n]:t[n]+1}):W(b({},t),{[n]:1}),{}),f=Object.entries(T).reduce((t,[n,d])=>{let p=b({},t);return d>1?p.multi.push(n):p.single.push(n),p},{single:[],multi:[]}),M=f.single.reduce((t,n)=>{let{source:d}=r.find(p=>p.target===n);return t[d]?t[d].push(n):t[d]=[n],t},{}),D=f.multi.reduce((t,n)=>{let d=r.filter(p=>p.target===n).map(p=>p.source).sort().toString();return t[d]?t[d].push(n):t[d]=[n],t},{}),P=t=>Object.entries(t).reduce((n,[d,p])=>{let l=b({},n);return p.forEach(h=>{let e=s.find(o=>o.id===h);l[d]?e!=null&&e.type&&l[d][e.type]?l[d][e.type].push(h):e!=null&&e.type&&(l[d][e.type]=[h]):e!=null&&e.type&&(l[d]={},l[d][e.type]=[h])}),l},{}),j=P(M),F=P(D),B=(()=>{let t=[...s],n=[...r];return Object.entries(j).forEach(([d,p])=>{Object.entries(p).forEach(([l,h])=>{var e;if(h.length>1){y.add(l);let o=`${d}_${l}_MergeSingleNodesByServerMap`,E=(e=t.find(g=>g.id===h[0]))==null?void 0:e.imgPath,[c,a]=K.partition(t,g=>!h.includes(g.id));t=[...c,{id:o,imgPath:E,type:l,label:`total: ${h.length}`,nodes:a}];let[m,k]=K.partition(n,g=>!h.includes(g.target));n=[...m,{source:d,target:o,id:`${d}_${l}_MergeSingleEdgesByServerMap`,edges:k}]}})}),{nodes:t,edges:n}})(),_=(()=>{let t=[...B.nodes],n=[...B.edges];return Object.entries(F).forEach(([d,p])=>{Object.entries(p).forEach(([l,h])=>{var e;if(h.length>1){y.add(l);let o=`${d}_${l}_MergeMultiNodesByServerMap`,E=(e=t.find(N=>N.id===h[0]))==null?void 0:e.imgPath,[c,a]=K.partition(t,N=>!h.includes(N.id));t=[...c,{id:o,imgPath:E,type:l,label:`total: ${h.length}`,nodes:a}];let m=d.split(","),[k,g]=K.partition(n,N=>!(m.includes(N.source)&&h.includes(N.target))),$=g.reduce((N,x,R)=>(N[x.source]?N[x.source].edges.push(x):N[x.source]={target:o,source:x.source,id:`${x.source}_${l}_MergeMultiEdgesByServerMap`,edges:[x]},b({},N)),{});n=[...k,...Object.values($)]}})}),{nodes:t,edges:n}})();return{nodes:[..._.nodes.map(t=>({data:W(b({},t),{imgArr:[t==null?void 0:t.imgPath,de(t)]})}))],edges:[..._.edges.map(t=>({data:b({},t)}))],mergeInfo:{types:Array.from(y)}}};import Te from"lodash";var ce=i=>Te.merge({},G,i),J=({cy:i,theme:r,edgeLabelRenderer:s,nodeLabelRenderer:y})=>{var S,v,C;return[{selector:"node",style:W(b({},(S=r.node)==null?void 0:S.default),{width:100,height:100,label:T=>{var M,D;let f=(D=i.data((M=T.data())==null?void 0:M.id))==null?void 0:D.data;return(y==null?void 0:y(f))||(f==null?void 0:f.label)||""},"background-image":T=>{var M,D;let f=(D=i.data((M=T.data())==null?void 0:M.id))==null?void 0:D.data;return f==null?void 0:f.imgArr},"background-fit":"contain","background-offset-y":"-5px"})},{selector:"edge",style:W(b({},(v=r.edge)==null?void 0:v.default),{label:T=>{var M,D;let f=(D=i.data((M=T.data())==null?void 0:M.id))==null?void 0:D.data;return(s==null?void 0:s(f))||""}})},{selector:"edge:loop",style:b({},(C=r.edge)==null?void 0:C.loop)}]};import{keyBy as xe}from"lodash";import{jsx as De}from"react/jsx-runtime";ge.use(we);var ve=({data:i,customTheme:r={},baseNodeId:s,onClickNode:y,onClickEdge:S,onClickBackground:v,onDataMerged:C,renderNodeLabel:T,renderEdgeLabel:f,className:M,style:D,cy:P})=>{let j=A.useRef(null),F=A.useRef(),u=A.useRef(),B=A.useRef(),w=ce(r),_=A.useRef("");A.useEffect(()=>()=>{var e;(e=u==null?void 0:u.current)==null||e.destroy()},[]),A.useEffect(()=>{var e,o;F.current=s,_.current=s,u.current&&((e=B.current)==null||e.removeAllListeners(),(o=B.current)==null||o.stop(),B.current=void 0,u.current.removeData(),u.current.removeAllListeners(),u.current.destroy(),u.current=void 0),u.current=ge({zoom:1,minZoom:.1,maxZoom:3,wheelSensitivity:.2,container:j.current}),P==null||P(u.current),u.current.style(J({cy:u.current,theme:w,edgeLabelRenderer:f,nodeLabelRenderer:T})),p()},[s]),A.useEffect(()=>{let e=u.current;e&&e.style(J({cy:e,theme:w,edgeLabelRenderer:f,nodeLabelRenderer:T}))},[T,f]),A.useEffect(()=>{if(i){let e=u.current;if(e){let{nodes:o,edges:E,mergeInfo:c}=ae(i),a;if(C==null||C(c),e.batch(()=>{e.removeData(),e.data(xe([...o,...E],"data.id"));let m=e.nodes().map(g=>g.id()),k=o.map(({data:g})=>g.id);new Set([...m,...k]).forEach(g=>{let $=m.includes(g),N=k.includes(g),x=$&&!N,R=!$&&N;if(x){let O=e.getElementById(g);O.remove(),O.connectedEdges().remove()}else if(R){let{data:O}=o.find(({data:I})=>I.id===g),Y=E.filter(({data:I})=>I.source===g||I.target===g);a=a?[...a,e.add({data:O})]:[e.add({data:O})],Y.forEach(({data:I})=>{let V=e.getElementById(I.source),Q=e.getElementById(I.target);V.inside()&&Q.inside()&&e.add({data:I})})}else return})}),!B.current)B.current=e==null?void 0:e.layout({name:"dagre",fit:!1,rankDir:"LR",rankSep:200}),B.current.run();else if(a&&a.length>0){let m=e.getElementById(s),{x:k,y:g}=m.position(),{y1:$,y2:N}=m.boundingBox(),x;a.forEach(O=>{x=0;let Y=O.predecessors(),I=O.successors(),V=Y.contains(m);x=(V?Y:I).nodes().toArray().findIndex(H=>H.id()===s)+1;let ee=k+x*(200+100)*(V?1:-1),{y:le}=O.position(),{h:X,y1:ue}=O.boundingBox(),me=X-(le-ue)*2,te=e.nodes().filter(H=>{let z=H.same(O),{x:q}=H.position(),pe=H.width(),he=Math.abs(ee-q)<=pe;return!z&&he}),Z;Math.random()>=.5?Z=Math.min(...te.map(q=>q.position().y-50),g-50)-50-X:Z=Math.max(...te.map(z=>z.boundingBox().y2),N)+50;let fe=(X-me)/2+Z;O.position({x:ee,y:fe})});let R=e.getElementById(_.current);R.inside()?R.isNode()?l(R):h(R):e.getElementById(s).emit("tap")}}}},[i]);let t=e=>{y==null||y(e)},n=e=>{S==null||S(e)},d=e=>{v==null||v(e)},p=A.useCallback(()=>{let e=u==null?void 0:u.current;e&&e.on("layoutready",()=>{l(e.getElementById(s));let o=e.getElementById(s);e.resize(),e.center(o)}).on("mouseover",({target:o})=>{e.container().style.cursor=o===e?"default":"pointer"}).on("mouseout",()=>{e.container().style.cursor="default"}).on("tap",({target:o,originalEvent:E,renderedPosition:c})=>{let a=c?"left":"programmatic",m={x:c==null?void 0:c.x,y:c==null?void 0:c.y};o===e?d({eventType:a,position:m}):o.isNode()?(l(o),t({eventType:a,position:m,data:o.data()}),_.current=o.id()):o.isEdge()&&(h(o),n({eventType:a,position:m,data:o.data()}),_.current=o.id())}).on("cxttap",({target:o,renderedPosition:E})=>{let c="right",a={x:E.x,y:E.y};o===e?d({eventType:c,position:a}):o.isNode()?t({eventType:c,position:a,data:o.data()}):o.isEdge()&&n({eventType:c,position:a,data:o.data()})})},[y,S,v]),l=e=>{var E,c,a,m,k;let o=u.current;o.nodes().style((E=w.node)==null?void 0:E.default),o.edges().style((c=w.edge)==null?void 0:c.default),o.getElementById(s).style((a=w.node)==null?void 0:a.main),e.style((m=w.node)==null?void 0:m.highlight),e.connectedEdges().style((k=w.edge)==null?void 0:k.highlight)},h=e=>{var E,c,a,m,k,g;let o=u.current;o.nodes().style((E=w.node)==null?void 0:E.default),o.edges().style((c=w.edge)==null?void 0:c.default),o.getElementById(s).style((a=w.node)==null?void 0:a.main),e.connectedNodes().style({"border-color":(k=(m=w.node)==null?void 0:m.highlight)==null?void 0:k["border-color"]}),e.style((g=w.edge)==null?void 0:g.highlight)};return De("div",{style:b({width:"100%",height:"100%",overflow:"hidden"},D),className:M,ref:j})};export{ve as ServerMap}; |
{ | ||
"name": "@pinpoint-fe/server-map", | ||
"version": "0.0.9", | ||
"version": "0.0.10-rc.1", | ||
"description": "Open-source network-map library, specifically for application topology, written in React.js", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/pinpoint-apm/pinpoint/blob/frontend-v3/web-frontend/src/main/v3/packages/server-map/README.md", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27668