/**
* This file is part of VILLASweb.
*
* VILLASweb is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VILLASweb is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VILLASweb. If not, see .
******************************************************************************/
import React from 'react';
import PropTypes from 'prop-types';
import Slider from 'rc-slider';
import ToolboxItem from './toolbox-item';
class WidgetToolbox extends React.Component {
onGridChange = value => {
// value 0 would block all widgets, set 1 as 'grid disabled'
if (value === 0) {
value = 1;
}
if (this.props.onGridChange != null) {
this.props.onGridChange(value);
}
};
render() {
// Only one topology widget at the time is supported
const thereIsTopologyWidget = this.props.widgets != null && Object.values(this.props.widgets).filter(w => w.type === 'Topology').length > 0;
const topologyItemMsg = thereIsTopologyWidget? 'Currently only one is supported' : '';
return
Grid: { this.props.grid > 1 ? this.props.grid : 'Disabled' }
;
};
}
WidgetToolbox.propTypes = {
widgets: PropTypes.array,
grid: PropTypes.number,
onGridChange: PropTypes.func
};
export default WidgetToolbox;