diff --git a/ui/src/dashboards/components/CellEditorOverlay.tsx b/ui/src/dashboards/components/CellEditorOverlay.tsx index c12527e4c8..dfabef2954 100644 --- a/ui/src/dashboards/components/CellEditorOverlay.tsx +++ b/ui/src/dashboards/components/CellEditorOverlay.tsx @@ -178,6 +178,7 @@ class CellEditorOverlay extends Component { queryConfigs={queriesWorkingDraft} editQueryStatus={editQueryStatus} staticLegend={isStaticLegend} + isInCEO={true} /> { @@ -49,6 +50,7 @@ const DashVisualization = ( editQueryStatus={editQueryStatus} resizerTopHeight={resizerTopHeight} staticLegend={staticLegend} + isInCEO={isInCEO} /> @@ -78,6 +80,7 @@ DashVisualization.propTypes = { gaugeColors: colorsNumberSchema, lineColors: colorsStringSchema, staticLegend: bool, + isInCEO: bool, } DashVisualization.contextTypes = { diff --git a/ui/src/shared/components/RefreshingGraph.js b/ui/src/shared/components/RefreshingGraph.js index 17d298f2bc..62092a3231 100644 --- a/ui/src/shared/components/RefreshingGraph.js +++ b/ui/src/shared/components/RefreshingGraph.js @@ -40,6 +40,7 @@ const RefreshingGraph = ({ editQueryStatus, handleSetHoverTime, grabDataForDownload, + isInCEO, }) => { const prefix = (axes && axes.y.prefix) || '' const suffix = (axes && axes.y.suffix) || '' @@ -106,6 +107,7 @@ const RefreshingGraph = ({ tableOptions={tableOptions} resizerTopHeight={resizerTopHeight} handleSetHoverTime={handleSetHoverTime} + isInCEO={isInCEO} /> ) } @@ -165,6 +167,7 @@ RefreshingGraph.propTypes = { tableOptions: shape({}), hoverTime: string.isRequired, handleSetHoverTime: func.isRequired, + isInCEO: bool, } RefreshingGraph.defaultProps = { diff --git a/ui/src/shared/components/TableGraph.js b/ui/src/shared/components/TableGraph.js index 914d0ca381..1770b753ea 100644 --- a/ui/src/shared/components/TableGraph.js +++ b/ui/src/shared/components/TableGraph.js @@ -58,22 +58,25 @@ class TableGraph extends Component { } } + handleUpdateTableOptions = (fieldNames, tableOptions) => { + const {isInCEO} = this.props + if (!isInCEO) { + return + } + this.props.handleUpdateTableOptions({...tableOptions, fieldNames}) + } + componentWillReceiveProps(nextProps) { const updatedProps = _.keys(nextProps).filter( k => !_.isEqual(this.props[k], nextProps[k]) ) const {sortField, sortDirection} = this.state - const {tableOptions, handleUpdateTableOptions} = nextProps - const { - sortBy: {internalName}, - fieldNames, - verticalTimeAxis, - timeFormat, - } = tableOptions + const {tableOptions} = nextProps + const {sortBy: {internalName}, verticalTimeAxis, timeFormat} = tableOptions let data let sortedLabels - let computedFieldNames + let fieldNames if ( _.includes(updatedProps, 'data') || @@ -85,15 +88,12 @@ class TableGraph extends Component { ) data = returned.data sortedLabels = returned.sortedLabels - computedFieldNames = computeFieldNames(fieldNames, sortedLabels) - handleUpdateTableOptions({ - ...tableOptions, - fieldNames: computedFieldNames, - }) + fieldNames = computeFieldNames(tableOptions.fieldNames, sortedLabels) + this.handleUpdateTableOptions(fieldNames, tableOptions) } else { data = this.state.data sortedLabels = this.state.sortedLabels - computedFieldNames = computeFieldNames(fieldNames, sortedLabels) + fieldNames = computeFieldNames(tableOptions.fieldNames, sortedLabels) } if (_.isEmpty(data[0])) { @@ -125,7 +125,7 @@ class TableGraph extends Component { sortFieldName, direction, verticalTimeAxis, - computedFieldNames, + fieldNames, timeFormat ) @@ -453,14 +453,11 @@ TableGraph.propTypes = { handleSetHoverTime: func, colors: colorsStringSchema, queryASTs: arrayOf(shape()), -} - -const mapStateToProps = () => { - return {} + isInCEO: bool, } const mapDispatchToProps = dispatch => ({ handleUpdateTableOptions: bindActionCreators(updateTableOptions, dispatch), }) -export default connect(mapStateToProps, mapDispatchToProps)(TableGraph) +export default connect(null, mapDispatchToProps)(TableGraph)