Pull out ternary into separate function property
parent
d6e8a2180b
commit
ff50a00917
|
@ -102,17 +102,24 @@ const Visualization = React.createClass({
|
||||||
renderVisualization(view, queries, heightPixels, onEditRawStatus, activeQueryIndex) {
|
renderVisualization(view, queries, heightPixels, onEditRawStatus, activeQueryIndex) {
|
||||||
const activeQuery = queries[activeQueryIndex]
|
const activeQuery = queries[activeQueryIndex]
|
||||||
const defaultQuery = queries[0]
|
const defaultQuery = queries[0]
|
||||||
const q = activeQuery || defaultQuery
|
|
||||||
|
|
||||||
switch (view) {
|
switch (view) {
|
||||||
case TABLE:
|
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:
|
case GRAPH:
|
||||||
default:
|
default:
|
||||||
this.renderGraph(queries)
|
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) {
|
renderGraph(queries) {
|
||||||
const {cellType, autoRefresh, activeQueryIndex} = this.props
|
const {cellType, autoRefresh, activeQueryIndex} = this.props
|
||||||
const isInDataExplorer = true
|
const isInDataExplorer = true
|
||||||
|
|
Loading…
Reference in New Issue