0

I am using backstage catalog graph to show the relation between different nodes

this is the offical demo of backstage graph: https://demo.backstage.io/catalog-graph?rootEntityRefs%5B%5D=component%3Adefault%2Fplayback-order&maxDepth=%E2%88%9E&unidirectional=true&mergeRelations=true&direction=LR&showFilters=true

and the file which I am customizing is: https://github.com/backstage/backstage/blob/master/plugins/catalog-graph/src/components/EntityRelationsGraph/CustomNode.tsx

below is the customized code which I have done basically I have added text below node and above node:

<g onClick={onClick} className={classNames(onClick && classes.clickable)}>
  <text>
    {type}
  </text>
  <rect
    className={classNames(
      classes.node,
      color === 'primary' && 'primary',
      color === 'secondary' && 'secondary',
    )}
    width={paddedWidth}
    height={paddedHeight}
    rx={10}
  />
  {kind && (
    <EntityKindIcon
      kind={kind}
      y={padding}
      x={padding}
      width={iconSize}
      height={iconSize}
      className={classNames(
        classes.text,
        focused && 'focused',
        color === 'primary' && 'primary',
        color === 'secondary' && 'secondary',
      )}
    />
  )}
  <text
    ref={idRef}
    className={classNames(
      classes.text,
      focused && 'focused',
      color === 'primary' && 'primary',
      color === 'secondary' && 'secondary',
    )}
    y={paddedHeight / 2}
    x={paddedIconWidth + (width + padding * 2) / 2}
    textAnchor="middle"
    alignmentBaseline="middle"
  >
    {displayTitle}
  </text>
<text>
{kind?.toUpperCase()}
</text>
</g>

I found the root cause of the issue is below text tags which I added(when I comment this everything works fine)

 <text>
    {type}
  </text>

 <text>
    {kind?.toUpperCase()}
  </text>

sample output which I am getting: enter image description here

sample output which I am getting on commenting: enter image description here

please help me with the same.

Vishal
  • 139
  • 1
  • 5
  • 12
  • Please don't make more work for other people by vandalizing your posts. By posting on the Stack Exchange network, you've granted a non-revocable right, under the [CC BY-SA 4.0 license](//creativecommons.org/licenses/by-sa/4.0/), for Stack Exchange to distribute that content (i.e. regardless of your future choices). By Stack Exchange policy, the non-vandalized version of the post is the one which is distributed. Thus, any vandalism will be reverted. If you want to know more about deleting a post please see: [How does deleting work?](//meta.stackexchange.com/q/5221) – Machavity May 11 '23 at 13:54

0 Answers0