Handle rebase
parent
5cd7d9e26f
commit
32c0e6f1cf
|
@ -4,11 +4,23 @@ import LayoutCell from 'shared/components/LayoutCell'
|
|||
import RefreshingGraph from 'shared/components/RefreshingGraph'
|
||||
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 = ({
|
||||
host,
|
||||
cell,
|
||||
cell: {h, axes, type},
|
||||
source,
|
||||
sources,
|
||||
onZoom,
|
||||
templates,
|
||||
timeRange,
|
||||
|
@ -41,7 +53,12 @@ const Layout = ({
|
|||
autoRefresh={autoRefresh}
|
||||
synchronizer={synchronizer}
|
||||
resizeCoords={resizeCoords}
|
||||
queries={buildQueriesForLayouts(cell, source, timeRange, host)}
|
||||
queries={buildQueriesForLayouts(
|
||||
cell,
|
||||
getSource(cell, source, sources),
|
||||
timeRange,
|
||||
host
|
||||
)}
|
||||
/>}
|
||||
</LayoutCell>
|
||||
|
||||
|
@ -87,6 +104,7 @@ Layout.propTypes = {
|
|||
onCancelEditCell: func,
|
||||
resizeCoords: shape(),
|
||||
onZoom: func,
|
||||
sources: arrayOf(shape()),
|
||||
}
|
||||
|
||||
export default Layout
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import React, {Component, PropTypes} from 'react'
|
||||
import ReactGridLayout, {WidthProvider} from 'react-grid-layout'
|
||||
import Resizeable from 'react-component-resizable'
|
||||
|
||||
import _ from 'lodash'
|
||||
|
||||
import Layout from 'src/shared/components/Layout'
|
||||
|
@ -67,6 +68,7 @@ class LayoutRenderer extends Component {
|
|||
host,
|
||||
cells,
|
||||
source,
|
||||
sources,
|
||||
onZoom,
|
||||
templates,
|
||||
timeRange,
|
||||
|
@ -83,7 +85,7 @@ class LayoutRenderer extends Component {
|
|||
const isDashboard = !!this.props.onPositionChange
|
||||
|
||||
return (
|
||||
<Resizeable onResize={this.updateWindowDimensions}>
|
||||
<Resizeable onResize={this.handleCellResize}>
|
||||
<GridLayout
|
||||
layout={cells}
|
||||
cols={12}
|
||||
|
@ -97,7 +99,8 @@ class LayoutRenderer extends Component {
|
|||
isDraggable={isDashboard}
|
||||
isResizable={isDashboard}
|
||||
>
|
||||
{cells.map(cell =>
|
||||
{cells.map(cell => {
|
||||
return (
|
||||
<div key={cell.i}>
|
||||
<Layout
|
||||
key={cell.i}
|
||||
|
@ -105,6 +108,7 @@ class LayoutRenderer extends Component {
|
|||
host={host}
|
||||
source={source}
|
||||
onZoom={onZoom}
|
||||
sources={sources}
|
||||
templates={templates}
|
||||
timeRange={timeRange}
|
||||
isEditable={isEditable}
|
||||
|
@ -117,7 +121,8 @@ class LayoutRenderer extends Component {
|
|||
onSummonOverlayTechnologies={onSummonOverlayTechnologies}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
)
|
||||
})}
|
||||
</GridLayout>
|
||||
</Resizeable>
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue