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

Initial components for supporting layers of graph elements in plexus #416

Merged

Conversation

tiffon
Copy link
Member

@tiffon tiffon commented Jul 17, 2019

Which problem is this PR solving?

Adding the first couple of components for supporting layers of graph elements in plexus.

Short description of the changes

Add LayeredDigraph, HtmlLayersGroup, MeasurableNodesLayer and MeasurableHtmlNode to plexus.

Also, update TypeScript to 3.5.3.

From the demo:

<LayeredDigraph
  zoom
  minimap
  className="DemoGraph--dag"
  layoutManager={new LayoutManager({ useDotEdges: true })}
  minimapClassName="Demo--miniMap"
  setOnGraph={layeredClassNameIsSmall}
  measurableNodesKey="nodes"
  layers={[
    {
      key: 'nodes-layers',
      html: true,
      layers: [
        {
          setOnNode,
          key: 'nodes',
          measurable: true,
          nodeRender: getLargeNodeLabel,
        },
      ],
    },
  ]}
  {...largeDag}
/>

TODO:

  • Allow MeasurableNodesLayer as a standalone layer, i.e. not as a layer within a HtmlLayersGroup

Node layout comparison

LayeredDigraph (component under development)

Screen Shot 2019-07-16 at 7 53 47 PM


DirectedGraph (the current component)

Screen Shot 2019-07-16 at 7 54 37 PM

tiffon added 2 commits July 16, 2019 18:27
Signed-off-by: Joe Farro <joef@uber.com>
Signed-off-by: Joe Farro <joef@uber.com>
@tiffon tiffon added the plexus Specific to packages/plexus label Jul 17, 2019
@tiffon tiffon requested a review from everett980 July 17, 2019 00:06
@tiffon tiffon changed the title Layered digraph htmlgroup measurable nodes Initial components for supporting layers of graph elements in plexus Jul 17, 2019
@codecov
Copy link

codecov bot commented Jul 17, 2019

Codecov Report

Merging #416 into master will decrease coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #416      +/-   ##
==========================================
- Coverage   91.46%   91.41%   -0.06%     
==========================================
  Files         174      174              
  Lines        3915     3915              
  Branches      897      897              
==========================================
- Hits         3581     3579       -2     
- Misses        296      298       +2     
  Partials       38       38
Impacted Files Coverage Δ
...s/jaeger-ui/src/components/SearchTracePage/url.tsx 80% <ø> (ø) ⬆️
...kages/jaeger-ui/src/model/trace-dag/DenseTrace.tsx 96.96% <ø> (ø) ⬆️
.../components/TracePage/TraceTimelineViewer/duck.tsx 98.4% <100%> (ø) ⬆️
packages/jaeger-ui/src/model/link-patterns.tsx 91.54% <100%> (ø) ⬆️
...eViewer/TimelineHeaderRow/TimelineViewingLayer.tsx 88.13% <0%> (-3.39%) ⬇️

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 1969210...608ba03. Read the comment docs.

@tiffon
Copy link
Member Author

tiffon commented Jul 17, 2019

@everett980 I finished the TODO for this; it's ready for review.

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.

Couple questions that mostly relate to Plexus moreso than the layers portion, otherwise it seems to be measuring up nicely.

@@ -31,7 +31,7 @@ export function matches(path: string) {
return Boolean(matchPath(path, ROUTE_MATCHER));
}

export function getUrl(query?: Object | null | undefined) {
export function getUrl(query?: { [key: string]: unknown } | null | undefined) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Record<string, unknown>?


export type TFromGraphStateFn<T = {}, U = {}> = (input: TExposedGraphState<T, U>) => TAnyProps | null;

export type TPropsFactory<PropNames extends string, FactoryFn extends TPropFactoryFn> = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why does PropNames extends string? Should/could this just be <PropNames: string | string[]>?

};

type TStandaloneEdgesLayer<T = {}, U = {}> = TEdgesLayer<T, U> & {
layerType: TLayerType;
Copy link
Collaborator

Choose a reason for hiding this comment

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

What would HTML edges look like?

Done = 'Done',
}

export type TLayerType = 'html' | 'svg';
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do we need both the TLayerType and the ELayerType? It seems as though the enum should be sufficient?

/>
</div>
</div>
<h1>LayeredDigraph with standalone layers</h1>
Copy link
Collaborator

Choose a reason for hiding this comment

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

If possible, the distinction between this and the previous graph should be more apparent. It seems like one has a layersGroup that contains a single html nodes layer, meanwhile they other just has that single html nodes layer as a standalone.

This example should showcase the value provided by layersGroups.

constructor(props: TLayeredDigraphProps<T, U>) {
super(props);
const { edges, vertices, zoom: zoomEnabled } = props;
if (Array.isArray(edges) && edges.length && Array.isArray(vertices) && vertices.length) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

what should this do if there aren't edges and vertices?

}
if (zoomEnabled) {
this.zoomManager = new ZoomManager(this.onZoomUpdated);
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this else is necessary based on the assignment before the constructor.

this.setState({ sizeVertices });
const { layout } = layoutManager.getLayout(edges, sizeVertices);
// const { positions, layout } = layoutManager.getLayout(edges, sizeVertices);
// positions.then(this._onPositionsDone);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not well versed in the LayoutManager, what is the difference between this and the next line? Is this commented out to implement/enable later?


private setSizeVertices = (senderKey: string, sizeVertices: TSizeVertex<T>[]) => {
const { edges, layoutManager, measurableNodesKey: expectedKey } = this.props;
if (senderKey !== expectedKey) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this implemented to prevent multiple measurable layers?

};

private renderLayers() {
const { classNamePrefix, layers: topLayers } = this.props;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm looking at topLayers v layer the latter of which can be a group of layers. Can that group of layers have more groups of layers within it? or is it exclusively a one or two depth array?

@tiffon tiffon merged commit bda2051 into jaegertracing:master Jul 19, 2019
@tiffon tiffon deleted the layered-digraph-htmlgroup-measurableNodes branch July 19, 2019 04:09
@tiffon tiffon restored the layered-digraph-htmlgroup-measurableNodes branch July 19, 2019 04:09
vvvprabhakar pushed a commit to vvvprabhakar/jaeger-ui that referenced this pull request Jul 5, 2021
…egertracing#416)

Initial components for supporting layers of graph elements in plexus
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