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 {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

View File

@ -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,27 +99,30 @@ class LayoutRenderer extends Component {
isDraggable={isDashboard}
isResizable={isDashboard}
>
{cells.map(cell =>
<div key={cell.i}>
<Layout
key={cell.i}
cell={cell}
host={host}
source={source}
onZoom={onZoom}
templates={templates}
timeRange={timeRange}
isEditable={isEditable}
onEditCell={onEditCell}
resizeCoords={resizeCoords}
autoRefresh={autoRefresh}
onDeleteCell={onDeleteCell}
synchronizer={synchronizer}
onCancelEditCell={onCancelEditCell}
onSummonOverlayTechnologies={onSummonOverlayTechnologies}
/>
</div>
)}
{cells.map(cell => {
return (
<div key={cell.i}>
<Layout
key={cell.i}
cell={cell}
host={host}
source={source}
onZoom={onZoom}
sources={sources}
templates={templates}
timeRange={timeRange}
isEditable={isEditable}
onEditCell={onEditCell}
resizeCoords={resizeCoords}
autoRefresh={autoRefresh}
onDeleteCell={onDeleteCell}
synchronizer={synchronizer}
onCancelEditCell={onCancelEditCell}
onSummonOverlayTechnologies={onSummonOverlayTechnologies}
/>
</div>
)
})}
</GridLayout>
</Resizeable>
)