Pull out ternary into separate function property

pull/1081/head
Andrew Watkins 2017-04-04 14:55:53 -07:00
parent 48ba07c422
commit 88be3aa6bc
1 changed files with 9 additions and 2 deletions

View File

@ -102,17 +102,24 @@ const Visualization = React.createClass({
renderVisualization(view, queries, heightPixels, onEditRawStatus, activeQueryIndex) {
const activeQuery = queries[activeQueryIndex]
const defaultQuery = queries[0]
const q = activeQuery || defaultQuery
switch (view) {
case TABLE:
return (q ? <Table query={activeQuery || defaultQuery} height={heightPixels} onEditRawStatus={onEditRawStatus} /> : <div className="generic-empty-state">Enter your query below</div>)
return this.renderTable(activeQuery || defaultQuery, heightPixels, onEditRawStatus)
case GRAPH:
default:
this.renderGraph(queries)
}
},
renderTable(query, heightPixels, onEditRawStatus) {
if (!query) {
return <div className="generic-empty-state">Enter your query below</div>
}
return <Table query={query} height={heightPixels} onEditRawStatus={onEditRawStatus} />
},
renderGraph(queries) {
const {cellType, autoRefresh, activeQueryIndex} = this.props
const isInDataExplorer = true