Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema for configuring layers in plexus graphs #414

Merged
merged 7 commits into from
Jul 18, 2019

Conversation

tiffon
Copy link
Member

@tiffon tiffon commented Jul 16, 2019

Which problem is this PR solving?

This is the first PR of a series of PRs that will enhance plexus by adding the ability to specify elements of a directed graph as a series of layers.

This PR adds the types necessary to configure layers, which is a large part of the public API of the new functionality.

Short description of the changes

This covers the types for the layers prop on the not-yet-created LayeredDirectedGraph component.

See TLayer for the implementation.

An example use of the component and layers prop:

<LayeredDigraph
  minimap
  zoom
  className="DdgGraph"
  minimapClassName="u-plexusMiniMap"
  layoutManager={this.layoutManager}
  setOnGraph={classNameIsSmall}
  edges={edges}
  vertices={vertices}
  measurableNodesKey="nodes"
  layers={[
    {
      key: 'find-match-nodes-outline-layer',
      html: true,
      nodeRender: this.renderNodeOutline, 
    },
    {
      key: 'svg-layers',
      svg: true,
      defs: [
        {
          type: plexus.ArrowMarkerEnd,
          scaleDampener: 0.8,
          setOnMarker: { className: 'DdgGraph--edgeMarkerEnd' },
          localId: 'arrow'
        },
        {
          type: plexus.ArrowMarkerEnd,
          scaleDampener: 0.8,
          setOnMarker: { className: 'DdgGraph--edgeMarkerEnd is-hovered' },
          localId: 'hoveredArrow'
        }
      ],
      layers: [
        {
          key: 'nodes-outline',
          nodeRender: this.renderNodeOutline,
        },
        {
          key: 'edges-visible-path',
          edges: true,
          setOnContainer: [{ className: 'DdgGraph--edges' }, this.scaleOpacity],
          setOnEdge: this.setOnEdge,
        },
        {
          key: 'edges-pointer-area',
          edges: true,
          setOnContainer: { className: 'DdgGraph--edgesPointerArea' },
          setOnEdge: { onMouseOver: console.log },
        }
      ],
    },
    {
      key: 'nodes',
      html: true,
      nodeRender: this.renderNode,
      measurable: true,
    }
  ]}
/>

@tiffon tiffon added the plexus Specific to packages/plexus label Jul 16, 2019
@tiffon tiffon requested a review from everett980 July 16, 2019 21:15
@codecov
Copy link

codecov bot commented Jul 16, 2019

Codecov Report

Merging #414 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #414   +/-   ##
=======================================
  Coverage   91.46%   91.46%           
=======================================
  Files         174      174           
  Lines        3915     3915           
  Branches      897      897           
=======================================
  Hits         3581     3581           
  Misses        296      296           
  Partials       38       38

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b816a5...72b4e7a. Read the comment docs.

Copy link
Collaborator

@everett980 everett980 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me. Some questions but they may not lead to code changes just my own understanding of TypeScript.

packages/plexus/src/LayeredDigraph/types.tsx Show resolved Hide resolved
packages/plexus/src/LayeredDigraph/types.tsx Show resolved Hide resolved
packages/plexus/src/LayeredDigraph/utils.tsx Show resolved Hide resolved
// limitations under the License.

export type TOneOf<A, B, C = {}, D = {}, E = {}> =
| { [P in Exclude<keyof (B & C & D & E), keyof A>]?: null } & A
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, but: would undefined be better than null?

@everett980 everett980 merged commit 1969210 into jaegertracing:master Jul 18, 2019
vvvprabhakar pushed a commit to vvvprabhakar/jaeger-ui that referenced this pull request Jul 5, 2021
Schema for configuring layers in plexus graphs
Signed-off-by: vvvprabhakar <vvvprabhakar@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plexus Specific to packages/plexus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants