Handle rebase

pull/10616/head
Andrew Watkins 2017-09-29 15:18:22 -07:00
parent 5cd7d9e26f
commit 32c0e6f1cf
2 changed files with 46 additions and 23 deletions

View File

@ -4,11 +4,23 @@ import LayoutCell from 'shared/components/LayoutCell'
import RefreshingGraph from 'shared/components/RefreshingGraph' import RefreshingGraph from 'shared/components/RefreshingGraph'
import {buildQueriesForLayouts} from 'utils/influxql' import {buildQueriesForLayouts} from 'utils/influxql'
import _ from 'lodash'
const getSource = (cell, source, sources) => {
const s = _.get(cell, ['queries', '0', 'source'], null)
if (!s) {
return source
}
return sources.find(src => src.links.self === s)
}
const Layout = ({ const Layout = ({
host, host,
cell, cell,
cell: {h, axes, type}, cell: {h, axes, type},
source, source,
sources,
onZoom, onZoom,
templates, templates,
timeRange, timeRange,
@ -41,7 +53,12 @@ const Layout = ({
autoRefresh={autoRefresh} autoRefresh={autoRefresh}
synchronizer={synchronizer} synchronizer={synchronizer}
resizeCoords={resizeCoords} resizeCoords={resizeCoords}
queries={buildQueriesForLayouts(cell, source, timeRange, host)} queries={buildQueriesForLayouts(
cell,
getSource(cell, source, sources),
timeRange,
host
)}
/>} />}
</LayoutCell> </LayoutCell>
@ -87,6 +104,7 @@ Layout.propTypes = {
onCancelEditCell: func, onCancelEditCell: func,
resizeCoords: shape(), resizeCoords: shape(),
onZoom: func, onZoom: func,
sources: arrayOf(shape()),
} }
export default Layout export default Layout

View File

@ -1,6 +1,7 @@
import React, {Component, PropTypes} from 'react' import React, {Component, PropTypes} from 'react'
import ReactGridLayout, {WidthProvider} from 'react-grid-layout' import ReactGridLayout, {WidthProvider} from 'react-grid-layout'
import Resizeable from 'react-component-resizable' import Resizeable from 'react-component-resizable'
import _ from 'lodash' import _ from 'lodash'
import Layout from 'src/shared/components/Layout' import Layout from 'src/shared/components/Layout'
@ -67,6 +68,7 @@ class LayoutRenderer extends Component {
host, host,
cells, cells,
source, source,
sources,
onZoom, onZoom,
templates, templates,
timeRange, timeRange,
@ -83,7 +85,7 @@ class LayoutRenderer extends Component {
const isDashboard = !!this.props.onPositionChange const isDashboard = !!this.props.onPositionChange
return ( return (
<Resizeable onResize={this.updateWindowDimensions}> <Resizeable onResize={this.handleCellResize}>
<GridLayout <GridLayout
layout={cells} layout={cells}
cols={12} cols={12}
@ -97,27 +99,30 @@ class LayoutRenderer extends Component {
isDraggable={isDashboard} isDraggable={isDashboard}
isResizable={isDashboard} isResizable={isDashboard}
> >
{cells.map(cell => {cells.map(cell => {
<div key={cell.i}> return (
<Layout <div key={cell.i}>
key={cell.i} <Layout
cell={cell} key={cell.i}
host={host} cell={cell}
source={source} host={host}
onZoom={onZoom} source={source}
templates={templates} onZoom={onZoom}
timeRange={timeRange} sources={sources}
isEditable={isEditable} templates={templates}
onEditCell={onEditCell} timeRange={timeRange}
resizeCoords={resizeCoords} isEditable={isEditable}
autoRefresh={autoRefresh} onEditCell={onEditCell}
onDeleteCell={onDeleteCell} resizeCoords={resizeCoords}
synchronizer={synchronizer} autoRefresh={autoRefresh}
onCancelEditCell={onCancelEditCell} onDeleteCell={onDeleteCell}
onSummonOverlayTechnologies={onSummonOverlayTechnologies} synchronizer={synchronizer}
/> onCancelEditCell={onCancelEditCell}
</div> onSummonOverlayTechnologies={onSummonOverlayTechnologies}
)} />
</div>
)
})}
</GridLayout> </GridLayout>
</Resizeable> </Resizeable>
) )