From 3a4c955474bdb3fdeadb9f49d3eed1587dd618c2 Mon Sep 17 00:00:00 2001 From: Andrew Watkins Date: Thu, 30 Mar 2017 14:00:18 -0700 Subject: [PATCH] Remove MultiTable --- ui/src/data_explorer/components/MultiTable.js | 94 ------------------- .../data_explorer/components/QueryBuilder.js | 14 +-- ui/src/data_explorer/components/Table.js | 6 +- .../data_explorer/components/Visualization.js | 20 ++-- .../data_explorer/containers/DataExplorer.js | 1 - 5 files changed, 16 insertions(+), 119 deletions(-) delete mode 100644 ui/src/data_explorer/components/MultiTable.js diff --git a/ui/src/data_explorer/components/MultiTable.js b/ui/src/data_explorer/components/MultiTable.js deleted file mode 100644 index a129e9fc2..000000000 --- a/ui/src/data_explorer/components/MultiTable.js +++ /dev/null @@ -1,94 +0,0 @@ -import React, {PropTypes} from 'react' -import Table from './Table' -import classNames from 'classnames' - -const { - arrayOf, - bool, - func, - number, - shape, - string, -} = PropTypes - -const MultiTable = React.createClass({ - propTypes: { - queries: arrayOf(shape({ - host: arrayOf(string.isRequired).isRequired, - text: string.isRequired, - })), - height: number, - onEditRawStatus: func.isRequired, - activeQueryIndex: number, - onSetActiveQueryIndex: func.isRequired, - }, - - getActiveQuery() { - const {queries, activeQueryIndex} = this.props - const activeQuery = queries[activeQueryIndex] - const defaultQuery = queries[0] - - return activeQuery || defaultQuery - }, - - render() { - return ( -
- {this.renderTabs()} - {this.renderTable()} -
- ) - }, - - renderTable() { - const {height, onEditRawStatus} = this.props - const query = this.getActiveQuery() - const noQuery = !query || !query.text - if (noQuery) { - return null - } - - return - }, - - renderTabs() { - const {queries, onSetActiveQueryIndex} = this.props - return ( -
- {queries.map((q, i) => { - return ( - onSetActiveQueryIndex(i)} - /> - ) - })} -
- ) - }, -}) - -const TabItem = React.createClass({ - propTypes: { - query: shape({ - text: string.isRequired, - id: string.isRequired, - host: arrayOf(string.isRequired).isRequired, - }).isRequired, - onSelect: func.isRequired, - isActive: bool.isRequired, - }, - - render() { - const {isActive, onSelect} = this.props - return ( -
- {"Query"} -
- ) - }, -}) - -export default MultiTable diff --git a/ui/src/data_explorer/components/QueryBuilder.js b/ui/src/data_explorer/components/QueryBuilder.js index f0d93466c..b1c1946c9 100644 --- a/ui/src/data_explorer/components/QueryBuilder.js +++ b/ui/src/data_explorer/components/QueryBuilder.js @@ -3,6 +3,7 @@ import React, {PropTypes} from 'react' import QueryEditor from './QueryEditor' import QueryTabItem from './QueryTabItem' import SimpleDropdown from 'src/shared/components/SimpleDropdown' +import buildInfluxQLQuery from 'utils/influxql' const { arrayOf, @@ -98,7 +99,7 @@ const QueryBuilder = React.createClass({ }, renderQueryTabList() { - const {queries, activeQueryIndex, onDeleteQuery} = this.props + const {queries, activeQueryIndex, onDeleteQuery, timeRange} = this.props return (
@@ -106,15 +107,6 @@ const QueryBuilder = React.createClass({ {this.renderAddQuery()}
{queries.map((q, i) => { - let queryTabText - if (q.rawText) { - queryTabText = 'Query Editor' - } else if (q.measurement && q.fields.length !== 0) { - queryTabText = `${q.measurement}.${q.fields[0].field}` - } else { - queryTabText = 'Query Builder' - } - return ( ) })} diff --git a/ui/src/data_explorer/components/Table.js b/ui/src/data_explorer/components/Table.js index 708bfe54a..957295764 100644 --- a/ui/src/data_explorer/components/Table.js +++ b/ui/src/data_explorer/components/Table.js @@ -102,7 +102,7 @@ const ChronoTable = React.createClass({ // Table data as a list of array. render() { - const {containerWidth, height} = this.props + const {containerWidth, height, query} = this.props const {cellData, columnWidths, isLoading} = this.state const {columns, values} = cellData @@ -117,6 +117,10 @@ const ChronoTable = React.createClass({ const minWidth = 70 const styleAdjustedHeight = height - stylePixelOffset + if (!query) { + return
Please add a query below
+ } + if (!isLoading && !values.length) { return
Your query returned no data
} diff --git a/ui/src/data_explorer/components/Visualization.js b/ui/src/data_explorer/components/Visualization.js index 39bc74cb4..9e1ec2fdb 100644 --- a/ui/src/data_explorer/components/Visualization.js +++ b/ui/src/data_explorer/components/Visualization.js @@ -4,7 +4,7 @@ import classNames from 'classnames' import AutoRefresh from 'shared/components/AutoRefresh' import LineGraph from 'shared/components/LineGraph' import SingleStat from 'shared/components/SingleStat' -import MultiTable from './MultiTable' +import Table from './Table' import VisHeader from 'src/data_explorer/components/VisHeader' const RefreshingLineGraph = AutoRefresh(LineGraph) @@ -36,7 +36,6 @@ const Visualization = React.createClass({ height: string, heightPixels: number, onEditRawStatus: func.isRequired, - onSetActiveQueryIndex: func.isRequired, }, contextTypes: { @@ -77,7 +76,7 @@ const Visualization = React.createClass({ }, render() { - const {queryConfigs, timeRange, height, heightPixels, onEditRawStatus, activeQueryIndex, onSetActiveQueryIndex} = this.props + const {queryConfigs, timeRange, height, heightPixels, onEditRawStatus, activeQueryIndex} = this.props const {source} = this.context const proxyLink = source.links.proxy const {view} = this.state @@ -94,24 +93,21 @@ const Visualization = React.createClass({
- {this.renderVisualization(view, queries, heightPixels, onEditRawStatus, activeQueryIndex, onSetActiveQueryIndex)} + {this.renderVisualization(view, queries, heightPixels, onEditRawStatus, activeQueryIndex)}
) }, - renderVisualization(view, queries, heightPixels, onEditRawStatus, activeQueryIndex, onSetActiveQueryIndex) { + renderVisualization(view, queries, heightPixels, onEditRawStatus, activeQueryIndex) { + const activeQuery = queries[activeQueryIndex] + const defaultQuery = queries[0] + switch (view) { case GRAPH: return this.renderGraph(queries) case TABLE: - return () + return (
) default: this.renderGraph(queries) } diff --git a/ui/src/data_explorer/containers/DataExplorer.js b/ui/src/data_explorer/containers/DataExplorer.js index d2cff3907..83dda828a 100644 --- a/ui/src/data_explorer/containers/DataExplorer.js +++ b/ui/src/data_explorer/containers/DataExplorer.js @@ -89,7 +89,6 @@ const DataExplorer = React.createClass({ queryConfigs={queryConfigs} activeQueryIndex={activeQueryIndex} onEditRawStatus={queryConfigActions.editRawQueryStatus} - onSetActiveQueryIndex={this.handleSetActiveQueryIndex} />