diff --git a/client/app/scripts/charts/node-container.js b/client/app/scripts/charts/node-container.js index 73b7ed74e..b17a96204 100644 --- a/client/app/scripts/charts/node-container.js +++ b/client/app/scripts/charts/node-container.js @@ -1,33 +1,65 @@ import React from 'react'; -import { Motion } from 'react-motion'; +import { connect } from 'react-redux'; +import { GraphNode } from 'weaveworks-ui-components'; -import { weakSpring } from 'weaveworks-ui-components/lib/utils/animation'; +import { clickNode, enterNode, leaveNode } from '../actions/app-actions'; +import { trackAnalyticsEvent } from '../utils/tracking-utils'; +import { getNodeColor } from '../utils/color-utils'; +import { GRAPH_VIEW_MODE } from '../constants/naming'; -import Node from './node'; +class NodeContainer extends React.Component { + saveRef = (ref) => { + this.ref = ref; + }; + handleMouseClick = (nodeId, ev) => { + ev.stopPropagation(); + trackAnalyticsEvent('scope.node.click', { + layout: GRAPH_VIEW_MODE, + topologyId: this.props.currentTopology.get('id'), + parentTopologyId: this.props.currentTopology.get('parentId'), + }); + this.props.clickNode(nodeId, this.props.label, this.ref.getBoundingClientRect()); + }; -const transformedNode = (otherProps, { x, y, k }) => ( - - - -); - -export default class NodeContainer extends React.PureComponent { render() { - const { - dx, dy, isAnimated, scale, ...forwardedProps - } = this.props; - - if (!isAnimated) { - // Show static node for optimized rendering - return transformedNode(forwardedProps, { x: dx, y: dy, k: scale }); - } + const { rank, label, pseudo } = this.props; + console.log('rerender'); return ( - // Animate the node if the layout is sufficiently small - - {interpolated => transformedNode(forwardedProps, interpolated)} - + ); } } + +function mapStateToProps(state) { + return { + exportingGraph: state.get('exportingGraph'), + showingNetworks: state.get('showingNetworks'), + currentTopology: state.get('currentTopology'), + contrastMode: state.get('contrastMode'), + }; +} + +export default connect( + mapStateToProps, + { clickNode, enterNode, leaveNode } +)(NodeContainer); diff --git a/client/app/scripts/charts/nodes-chart-elements.js b/client/app/scripts/charts/nodes-chart-elements.js index 003a0c16f..ec4fd138e 100644 --- a/client/app/scripts/charts/nodes-chart-elements.js +++ b/client/app/scripts/charts/nodes-chart-elements.js @@ -148,7 +148,7 @@ class NodesChartElements extends React.Component { } renderNode(node) { - const { isAnimated, contrastMode } = this.props; + const { isAnimated } = this.props; return ( ); } diff --git a/client/package.json b/client/package.json index 4c4694623..23dda0451 100644 --- a/client/package.json +++ b/client/package.json @@ -44,7 +44,7 @@ "reselect": "3.0.1", "reselect-map": "1.0.3", "styled-components": "2.2.4", - "weaveworks-ui-components": "0.11.8", + "weaveworks-ui-components": "0.11.14", "whatwg-fetch": "2.0.3", "xterm": "3.3.0" }, diff --git a/client/yarn.lock b/client/yarn.lock index 7d47e3e9b..3ed9021f1 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -8397,9 +8397,9 @@ wd@^0.4.0: underscore.string "~3.0.3" vargs "~0.1.0" -weaveworks-ui-components@0.11.8: - version "0.11.8" - resolved "https://registry.yarnpkg.com/weaveworks-ui-components/-/weaveworks-ui-components-0.11.8.tgz#4e649e418f5fb1746b908cc4edaa77ebadaf75e8" +weaveworks-ui-components@0.11.14: + version "0.11.14" + resolved "https://registry.yarnpkg.com/weaveworks-ui-components/-/weaveworks-ui-components-0.11.14.tgz#5f72f8a5059bc9f28295b91164c17e0780906f9e" dependencies: classnames "2.2.5" d3-drag "1.2.1"