Skip to content

Commit

Permalink
Renamed and moved resource view components
Browse files Browse the repository at this point in the history
  • Loading branch information
fbarl committed Mar 17, 2017
1 parent ff16b3a commit 65fb838
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 25 deletions.
1 change: 0 additions & 1 deletion client/app/scripts/components/cachable-zoom-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ class CachableZoomWrapper extends React.Component {

zoomed() {
if (!this.props.disabled) {
console.log('Current zoom', d3Event.transform.x, d3Event.transform.k);
const updatedState = this.cachableState({
scaleX: d3Event.transform.k,
scaleY: d3Event.transform.k,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import { connect } from 'react-redux';

import Logo from '../components/logo';
import Logo from './logo';
import { layersTopologyIdsSelector } from '../selectors/resource-view/layers';
import CachableZoomWrapper from '../components/cachable-zoom-wrapper';
import NodesResourcesLayer from './nodes-resources-layer';
import CachableZoomWrapper from './cachable-zoom-wrapper';
import NodesResourcesLayer from './nodes-resources/node-resources-layer';


class NodesResources extends React.Component {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';
import { fromJS } from 'immutable';

import NodeResourceInfo from './node-resource-info';
import { applyTransformX, applyTransformY } from '../utils/transform-utils';
import NodeResourcesMetricBoxInfo from './node-resources-metric-box-info';
import { applyTransformX, applyTransformY } from '../../utils/transform-utils';
import {
RESOURCES_LAYER_TITLE_WIDTH,
RESOURCES_LABEL_MIN_SIZE,
RESOURCES_LABEL_PADDING,
} from '../constants/styles';
} from '../../constants/styles';


export default class LayerLabelsOverlay extends React.Component {
Expand Down Expand Up @@ -39,7 +39,7 @@ export default class LayerLabelsOverlay extends React.Component {
return (
<g className="labels-overlay">
{this.positionedLabels().map(label => (
<NodeResourceInfo
<NodeResourcesMetricBoxInfo
key={label.getIn(['node', 'id'])}
node={label.get('node')}
width={label.get('width')}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';

import { RESOURCES_LAYER_TITLE_WIDTH, RESOURCES_LAYER_HEIGHT } from '../constants/styles';
import { applyTransformY } from '../utils/transform-utils';
import { RESOURCES_LAYER_TITLE_WIDTH, RESOURCES_LAYER_HEIGHT } from '../../constants/styles';
import { applyTransformY } from '../../utils/transform-utils';

export default class LayerTopologyName extends React.Component {
render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import React from 'react';
import { connect } from 'react-redux';
import { Map as makeMap } from 'immutable';

import NodeResourceBox from './node-resource-box';
import LayerLabelsOverlay from './layer-labels-overlay';
import LayerTopologyName from './layer-topology-name';
import NodeResourcesMetricBox from './node-resources-metric-box';
import NodeResourcesLayerLabelsOverlay from './node-resources-layer-labels-overlay';
import NodeResourcesLayerTopology from './node-resources-layer-topology';
import {
layersVerticalPositionSelector,
positionedNodesByTopologySelector,
} from '../selectors/resource-view/layers';
} from '../../selectors/resource-view/layers';


// const stringifiedTransform = ({ scaleX = 1, scaleY = 1, translateX = 0, translateY = 0 }) => (
Expand All @@ -23,7 +23,7 @@ class NodesResourcesLayer extends React.Component {
<g className="node-resource-layer">
<g>
{nodes.toIndexedSeq().map(node => (
<NodeResourceBox
<NodeResourcesMetricBox
key={node.get('id')}
color={node.get('color')}
width={node.get('width')}
Expand All @@ -36,12 +36,12 @@ class NodesResourcesLayer extends React.Component {
/>
))}
</g>
<LayerLabelsOverlay
<NodeResourcesLayerLabelsOverlay
verticalOffset={layerVerticalPosition}
transform={transform}
nodes={nodes}
/>
{!nodes.isEmpty() && <LayerTopologyName
{!nodes.isEmpty() && <NodeResourcesLayerTopology
verticalOffset={layerVerticalPosition}
transform={transform}
topologyId={topologyId}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';

import { getHumanizedMetricInfo } from '../utils/metric-utils';
import { getHumanizedMetricInfo } from '../../utils/metric-utils';


const HEIGHT = '45px';

export default class NodeResourceInfo extends React.Component {
export default class NodeResourcesMetricBoxInfo extends React.Component {
render() {
const { node, width, x, y } = this.props;
const humanizedMetricInfo = getHumanizedMetricInfo(node.get('activeMetric'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { connect } from 'react-redux';


class NodeResourceBox extends React.Component {
class NodeResourcesMetricBox extends React.Component {
defaultRectProps(relativeHeight = 1) {
const { translateX, translateY, scaleX, scaleY } = this.props.transform;
const innerTranslateY = this.props.height * scaleY * (1 - relativeHeight);
Expand Down Expand Up @@ -41,4 +41,4 @@ function mapStateToProps(state) {
};
}

export default connect(mapStateToProps)(NodeResourceBox);
export default connect(mapStateToProps)(NodeResourcesMetricBox);
2 changes: 1 addition & 1 deletion client/app/scripts/components/nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { debounce } from 'lodash';

import NodesChart from '../charts/nodes-chart';
import NodesGrid from '../charts/nodes-grid';
import NodesResources from '../charts/nodes-resources';
import NodesResources from '../components/nodes-resources';
import NodesError from '../charts/nodes-error';
import DelayedShow from '../utils/delayed-show';
import { Loading, getNodeType } from './loading';
Expand Down
2 changes: 1 addition & 1 deletion client/app/scripts/decorators/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function nodeActiveMetricDecorator(node) {

export function nodeResourceBoxDecorator(node) {
const widthCriterion = node.get('withCapacity') ? 'totalCapacity' : 'absoluteConsumption';
const width = node.getIn(['activeMetric', widthCriterion]) * 1e-4;
const width = node.getIn(['activeMetric', widthCriterion]);
const height = RESOURCES_LAYER_HEIGHT;

return node.merge(makeMap({ width, height }));
Expand Down
2 changes: 0 additions & 2 deletions client/app/scripts/selectors/resource-view/layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ const decoratedNodesByTopologySelector = createSelector(
.filter(node => node.get('parentNodeId') || index === 0)
.filter(node => node.get('width'));

// console.log('Max width', filteredTopologyNodes.map(n => n.get('width')).max());
// console.log('Min width', filteredTopologyNodes.map(n => n.get('width')).min());
nodesByTopology = nodesByTopology.set(layerTopologyId, filteredTopologyNodes);
lastLayerTopologyId = layerTopologyId;
});
Expand Down

0 comments on commit 65fb838

Please sign in to comment.