Not display TABLE toggle in CEO

pull/10616/head
Andrew Watkins 2017-04-25 11:47:10 -07:00
parent 3cbd7fc143
commit dda39c171f
5 changed files with 34 additions and 22 deletions

View File

@ -160,6 +160,7 @@ class CellEditorOverlay extends Component {
cellType={cellWorkingType}
cellName={cellWorkingName}
editQueryStatus={editQueryStatus}
views={[]}
/>
<ResizeBottom>
<div

View File

@ -4,26 +4,25 @@ import classNames from 'classnames'
const VisHeader = ({views, view, onToggleView, name}) => (
<div className="graph-heading">
<div className="graph-actions">
<ul className="toggle toggle-sm">
{views.map(v => (
<li
key={v}
onClick={() => onToggleView(v)}
className={classNames('toggle-btn ', {active: view === v})}>
{v}
</li>
))}
</ul>
{views.length
? <ul className="toggle toggle-sm">
{views.map(v => (
<li
key={v}
onClick={() => onToggleView(v)}
className={classNames('toggle-btn ', {active: view === v})}
>
{v}
</li>
))}
</ul>
: null}
</div>
<div className="graph-title">{name}</div>
</div>
)
const {
arrayOf,
func,
string,
} = PropTypes
const {arrayOf, func, string} = PropTypes
VisHeader.propTypes = {
views: arrayOf(string).isRequired,

View File

@ -3,12 +3,9 @@ import buildInfluxQLQuery from 'utils/influxql'
import classNames from 'classnames'
import VisHeader from 'src/data_explorer/components/VisHeader'
import VisView from 'src/data_explorer/components/VisView'
import {GRAPH, TABLE} from 'src/shared/constants'
const GRAPH = 'graph'
const TABLE = 'table'
const VIEWS = [GRAPH, TABLE]
const {func, arrayOf, number, shape, string} = PropTypes
const {arrayOf, func, number, shape, string} = PropTypes
const Visualization = React.createClass({
propTypes: {
@ -24,6 +21,7 @@ const Visualization = React.createClass({
height: string,
heightPixels: number,
editQueryStatus: func.isRequired,
views: arrayOf(string).isRequired,
},
contextTypes: {
@ -49,6 +47,12 @@ const Visualization = React.createClass({
}
},
getDefaultProps() {
return {
cellName: '',
}
},
componentWillReceiveProps(nextProps) {
const {queryConfigs, activeQueryIndex} = nextProps
if (
@ -71,8 +75,10 @@ const Visualization = React.createClass({
render() {
const {
views,
height,
cellType,
cellName,
timeRange,
autoRefresh,
heightPixels,
@ -95,10 +101,10 @@ const Visualization = React.createClass({
return (
<div className="graph" style={{height}}>
<VisHeader
views={VIEWS}
views={views}
view={view}
onToggleView={this.handleToggleView}
name={name || 'Graph'}
name={cellName}
/>
<div
className={classNames({

View File

@ -11,6 +11,7 @@ import ResizeContainer, {
ResizeBottom,
} from 'src/shared/components/ResizeContainer'
import {VIS_VIEWS} from 'src/shared/constants'
import {setAutoRefresh} from 'shared/actions/app'
import * as viewActions from 'src/data_explorer/actions/view'
@ -107,6 +108,7 @@ const DataExplorer = React.createClass({
queryConfigs={queryConfigs}
activeQueryIndex={activeQueryIndex}
editQueryStatus={queryConfigActions.editQueryStatus}
views={VIS_VIEWS}
/>
</ResizeBottom>
</ResizeContainer>

View File

@ -392,3 +392,7 @@ export const HTTP_UNAUTHORIZED = 401
export const HTTP_FORBIDDEN = 403
export const AUTOREFRESH_DEFAULT = 15000 // in milliseconds
export const GRAPH = 'graph'
export const TABLE = 'table'
export const VIS_VIEWS = [GRAPH, TABLE]