From b5ec30f647f278f5d3e4cfe50524e6156209a1af Mon Sep 17 00:00:00 2001 From: Ricardo Hernandez-Montoya Date: Wed, 10 Jan 2018 16:51:25 +0100 Subject: [PATCH] Restrict to one topology widget at the time --- src/components/toolbox-item.js | 4 ++-- src/containers/visualization.js | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/toolbox-item.js b/src/components/toolbox-item.js index 56b8b73..ff2a7cb 100644 --- a/src/components/toolbox-item.js +++ b/src/components/toolbox-item.js @@ -53,13 +53,13 @@ class ToolboxItem extends React.Component { if (this.props.disabled === false) { return this.props.connectDragSource( - + {this.props.name} , {dropEffect}); } else { return ( - + {this.props.name} ); diff --git a/src/containers/visualization.js b/src/containers/visualization.js index 8ae5856..1f30c13 100644 --- a/src/containers/visualization.js +++ b/src/containers/visualization.js @@ -454,6 +454,10 @@ class Visualization extends React.Component { ); + // Only one topology widget at the time is supported + let thereIsTopologyWidget = current_widgets && Object.values(current_widgets).filter( widget => widget.type === 'Topology').length > 0; + let topologyItemMsg = !thereIsTopologyWidget? '' : 'Currently only one is supported'; + return (
@@ -482,7 +486,7 @@ class Visualization extends React.Component { - +
{ editingControls }