mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
Restrict to one topology widget at the time
This commit is contained in:
parent
3174750fb7
commit
b5ec30f647
2 changed files with 7 additions and 3 deletions
|
@ -53,13 +53,13 @@ class ToolboxItem extends React.Component {
|
|||
|
||||
if (this.props.disabled === false) {
|
||||
return this.props.connectDragSource(
|
||||
<span className={itemClass}>
|
||||
<span className={itemClass} title={this.props.title}>
|
||||
{this.props.name}
|
||||
</span>
|
||||
, {dropEffect});
|
||||
} else {
|
||||
return (
|
||||
<span className={itemClass}>
|
||||
<span className={itemClass} title={this.props.title}>
|
||||
{this.props.name}
|
||||
</span>
|
||||
);
|
||||
|
|
|
@ -454,6 +454,10 @@ class Visualization extends React.Component {
|
|||
</Button>
|
||||
);
|
||||
|
||||
// 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 (
|
||||
<div className={boxClasses} >
|
||||
<div className='section-header box-header'>
|
||||
|
@ -482,7 +486,7 @@ class Visualization extends React.Component {
|
|||
<ToolboxItem name="Gauge" type="widget" />
|
||||
<ToolboxItem name="Box" type="widget" />
|
||||
<ToolboxItem name="HTML" type="html" />
|
||||
<ToolboxItem name="Topology" type="widget" />
|
||||
<ToolboxItem name="Topology" type="widget" disabled={thereIsTopologyWidget} title={topologyItemMsg}/>
|
||||
|
||||
<div className="section-buttons-group-right">
|
||||
{ editingControls }
|
||||
|
|
Loading…
Add table
Reference in a new issue