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} cellType={cellWorkingType}
cellName={cellWorkingName} cellName={cellWorkingName}
editQueryStatus={editQueryStatus} editQueryStatus={editQueryStatus}
views={[]}
/> />
<ResizeBottom> <ResizeBottom>
<div <div

View File

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

View File

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

View File

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

View File

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