Merge pull request #1845 from influxdata/bugfix/no-table-scroll

BUGFIX: DataExplorer Table scrollbar hidden
pull/1860/head
Andrew Watkins 2017-08-09 13:44:11 -07:00 committed by GitHub
commit 793d4e9741
5 changed files with 29 additions and 12 deletions

View File

@ -1,5 +1,6 @@
## v1.3.7.0 [unreleased] ## v1.3.7.0 [unreleased]
### Bug Fixes ### Bug Fixes
1. [#1845](https://github.com/influxdata/chronograf/pull/1845): Fix no-scroll bar appearing in the Data Explorer table
### Features ### Features

View File

@ -12,7 +12,6 @@ import {Table, Column, Cell} from 'fixed-data-table'
const {arrayOf, bool, func, number, oneOfType, shape, string} = PropTypes const {arrayOf, bool, func, number, oneOfType, shape, string} = PropTypes
const defaultTableHeight = 1000
const emptySeries = {columns: [], values: []} const emptySeries = {columns: [], values: []}
const CustomCell = React.createClass({ const CustomCell = React.createClass({
@ -64,7 +63,7 @@ const ChronoTable = React.createClass({
getDefaultProps() { getDefaultProps() {
return { return {
height: defaultTableHeight, height: 500,
} }
}, },
@ -139,11 +138,11 @@ const ChronoTable = React.createClass({
const maximumTabsCount = 11 const maximumTabsCount = 11
// adjust height to proper value by subtracting the heights of the UI around it // adjust height to proper value by subtracting the heights of the UI around it
// tab height, graph-container vertical padding, graph-heading height, multitable-header height // tab height, graph-container vertical padding, graph-heading height, multitable-header height
const stylePixelOffset = 136
const rowHeight = 34
const defaultColumnWidth = 200
const headerHeight = 30
const minWidth = 70 const minWidth = 70
const rowHeight = 34
const headerHeight = 30
const stylePixelOffset = 125
const defaultColumnWidth = 200
const styleAdjustedHeight = height - stylePixelOffset const styleAdjustedHeight = height - stylePixelOffset
const width = const width =
columns && columns.length > 1 ? defaultColumnWidth : containerWidth columns && columns.length > 1 ? defaultColumnWidth : containerWidth

View File

@ -13,6 +13,7 @@ const VisView = ({
heightPixels, heightPixels,
editQueryStatus, editQueryStatus,
activeQueryIndex, activeQueryIndex,
resizerBottomHeight,
}) => { }) => {
const activeQuery = queries[activeQueryIndex] const activeQuery = queries[activeQueryIndex]
const defaultQuery = queries[0] const defaultQuery = queries[0]
@ -30,7 +31,7 @@ const VisView = ({
return ( return (
<Table <Table
query={query} query={query}
height={heightPixels} height={resizerBottomHeight}
editQueryStatus={editQueryStatus} editQueryStatus={editQueryStatus}
/> />
) )
@ -60,6 +61,7 @@ VisView.propTypes = {
heightPixels: number, heightPixels: number,
editQueryStatus: func.isRequired, editQueryStatus: func.isRequired,
activeQueryIndex: number, activeQueryIndex: number,
resizerBottomHeight: number,
} }
export default VisView export default VisView

View File

@ -31,6 +31,7 @@ const Visualization = React.createClass({
bounds: arrayOf(string), bounds: arrayOf(string),
}), }),
}), }),
resizerBottomHeight: number,
}, },
contextTypes: { contextTypes: {
@ -95,6 +96,7 @@ const Visualization = React.createClass({
editQueryStatus, editQueryStatus,
activeQueryIndex, activeQueryIndex,
isInDataExplorer, isInDataExplorer,
resizerBottomHeight,
} = this.props } = this.props
const {source: {links: {proxy}}} = this.context const {source: {links: {proxy}}} = this.context
const {view} = this.state const {view} = this.state
@ -134,6 +136,7 @@ const Visualization = React.createClass({
editQueryStatus={editQueryStatus} editQueryStatus={editQueryStatus}
activeQueryIndex={activeQueryIndex} activeQueryIndex={activeQueryIndex}
isInDataExplorer={isInDataExplorer} isInDataExplorer={isInDataExplorer}
resizerBottomHeight={resizerBottomHeight}
/> />
</div> </div>
</div> </div>

View File

@ -31,6 +31,12 @@ class ResizeContainer extends Component {
initialBottomHeight: defaultInitialBottomHeight, initialBottomHeight: defaultInitialBottomHeight,
} }
componentDidMount() {
this.setState({
bottomHeightPixels: this.bottom.getBoundingClientRect().height,
})
}
handleStartDrag() { handleStartDrag() {
this.setState({isDragging: true}) this.setState({isDragging: true})
} }
@ -51,7 +57,7 @@ class ResizeContainer extends Component {
const {minTopHeight, minBottomHeight} = this.props const {minTopHeight, minBottomHeight} = this.props
const oneHundred = 100 const oneHundred = 100
const containerHeight = parseInt( const containerHeight = parseInt(
getComputedStyle(this.refs.resizeContainer).height, getComputedStyle(this.resizeContainer).height,
10 10
) )
// verticalOffset moves the resize handle as many pixels as the page-heading is taking up. // verticalOffset moves the resize handle as many pixels as the page-heading is taking up.
@ -85,11 +91,12 @@ class ResizeContainer extends Component {
this.setState({ this.setState({
topHeight: `${newTopPanelPercent}%`, topHeight: `${newTopPanelPercent}%`,
bottomHeight: `${newBottomPanelPercent}%`, bottomHeight: `${newBottomPanelPercent}%`,
bottomHeightPixels,
}) })
} }
render() { render() {
const {topHeight, bottomHeight, isDragging} = this.state const {bottomHeightPixels, topHeight, bottomHeight, isDragging} = this.state
const {containerClass, children} = this.props const {containerClass, children} = this.props
if (React.Children.count(children) > maximumNumChildren) { if (React.Children.count(children) > maximumNumChildren) {
@ -107,10 +114,12 @@ class ResizeContainer extends Component {
onMouseLeave={this.handleMouseLeave} onMouseLeave={this.handleMouseLeave}
onMouseUp={this.handleStopDrag} onMouseUp={this.handleStopDrag}
onMouseMove={this.handleDrag} onMouseMove={this.handleDrag}
ref="resizeContainer" ref={r => (this.resizeContainer = r)}
> >
<div className="resize--top" style={{height: topHeight}}> <div className="resize--top" style={{height: topHeight}}>
{React.cloneElement(children[0])} {React.cloneElement(children[0], {
resizerBottomHeight: bottomHeightPixels,
})}
</div> </div>
<ResizeHandle <ResizeHandle
isDragging={isDragging} isDragging={isDragging}
@ -120,8 +129,11 @@ class ResizeContainer extends Component {
<div <div
className="resize--bottom" className="resize--bottom"
style={{height: bottomHeight, top: topHeight}} style={{height: bottomHeight, top: topHeight}}
ref={r => (this.bottom = r)}
> >
{React.cloneElement(children[1])} {React.cloneElement(children[1], {
resizerBottomHeight: bottomHeightPixels,
})}
</div> </div>
</div> </div>
) )