diff --git a/src/dashboard/dashboard.js b/src/dashboard/dashboard.js index 9c3590b..584a4f2 100644 --- a/src/dashboard/dashboard.js +++ b/src/dashboard/dashboard.js @@ -73,7 +73,10 @@ class Dashboard extends Component { return thisWidgetHeight > maxHeightSoFar? thisWidgetHeight : maxHeightSoFar; }, 0); - if(dashboard.height === 0 || maxHeight + 80 > dashboard.height) + if(dashboard.height === 0){ + dashboard.height = 400; + } + else if(maxHeight + 80 > dashboard.height) { dashboard.height = maxHeight + 80; } @@ -367,11 +370,12 @@ class Dashboard extends Component { return absolutHeight > currentHeight ? absolutHeight : currentHeight; }, 0); let dashboard = this.state.dashboard; + if(value === -1){ let tempHeight = this.state.dashboard.height - 50; - if(tempHeight > (maxHeight + 80)){ + if(tempHeight >= 400 && tempHeight >= (maxHeight + 80)){ dashboard.height = tempHeight; this.setState({dashboard}); } @@ -420,7 +424,7 @@ class Dashboard extends Component {
e.preventDefault() }> {this.state.editing && - + } {!draggable?( diff --git a/src/widget/widget-toolbox.js b/src/widget/widget-toolbox.js index 5236ece..f8d6390 100644 --- a/src/widget/widget-toolbox.js +++ b/src/widget/widget-toolbox.js @@ -35,7 +35,23 @@ class WidgetToolbox extends React.Component { } }; + disableDecrease(){ + const maxHeight = Object.values(this.props.widgets).reduce((currentHeight, widget) => { + const absolutHeight = widget.y + widget.height; + + return absolutHeight > currentHeight ? absolutHeight : currentHeight; + }, 0); + + if(this.props.dashboard.height <= 400 || this.props.dashboard.height <= maxHeight + 80){ + return true; + } + + return false; + } + render() { + + const disableDecrease = this.disableDecrease(); // Only one topology widget at the time is supported const iconStyle = { color: '#007bff', @@ -82,7 +98,7 @@ class WidgetToolbox extends React.Component { Decrease dashboard height } > -