[sql-lab] fix react warnings in dev (#1232)

* rename file to match class

* fix react warnings

* fix proptype typo

* add missing keys
This commit is contained in:
Alanna Scott 2016-10-03 23:58:47 -07:00 committed by GitHub
parent e6e902e8df
commit ae54ac9d58
6 changed files with 12 additions and 7 deletions

View File

@ -54,8 +54,8 @@ class SouthPane extends React.Component {
} }
return ( return (
<div className="SouthPane"> <div className="SouthPane">
<Tabs bsStyle="tabs"> <Tabs bsStyle="tabs" id={shortid.generate()}>
<Tab title="Results" eventKey={1}> <Tab title="Results" eventKey={1} id={shortid.generate()}>
<div style={{ overflow: 'auto' }}> <div style={{ overflow: 'auto' }}>
{results} {results}
</div> </div>

View File

@ -28,7 +28,7 @@ import shortid from 'shortid';
import SouthPane from './SouthPane'; import SouthPane from './SouthPane';
import Timer from './Timer'; import Timer from './Timer';
import SqlEditorLeft from './SqlEditorLeft'; import SqlEditorTopToolbar from './SqlEditorTopToolbar';
class SqlEditor extends React.Component { class SqlEditor extends React.Component {
constructor(props) { constructor(props) {
@ -155,6 +155,7 @@ class SqlEditor extends React.Component {
style={{ width: '100px' }} style={{ width: '100px' }}
onClick={this.runQuery.bind(this, false)} onClick={this.runQuery.bind(this, false)}
disabled={!(this.props.queryEditor.dbId)} disabled={!(this.props.queryEditor.dbId)}
key={shortid.generate()}
> >
<i className="fa fa-table" /> Run Query <i className="fa fa-table" /> Run Query
</Button> </Button>
@ -168,6 +169,7 @@ class SqlEditor extends React.Component {
style={{ width: '100px' }} style={{ width: '100px' }}
onClick={this.runQuery.bind(this, true)} onClick={this.runQuery.bind(this, true)}
disabled={!(this.props.queryEditor.dbId)} disabled={!(this.props.queryEditor.dbId)}
key={shortid.generate()}
> >
<i className="fa fa-table" /> Run Async <i className="fa fa-table" /> Run Async
</Button> </Button>
@ -250,7 +252,7 @@ class SqlEditor extends React.Component {
<div className="SqlEditor" style={{ minHeight: this.sqlEditorHeight() }}> <div className="SqlEditor" style={{ minHeight: this.sqlEditorHeight() }}>
<Row> <Row>
<Col md={3}> <Col md={3}>
<SqlEditorLeft queryEditor={this.props.queryEditor} /> <SqlEditorTopToolbar queryEditor={this.props.queryEditor} />
</Col> </Col>
<Col md={9}> <Col md={9}>
<AceEditor <AceEditor

View File

@ -142,7 +142,7 @@ class SqlEditorTopToolbar extends React.Component {
<hr /> <hr />
<div className="m-t-5"> <div className="m-t-5">
{tables.map((table) => ( {tables.map((table) => (
<TableElement table={table} queryEditor={this.props.queryEditor} /> <TableElement table={table} queryEditor={this.props.queryEditor} key={table.id} />
))} ))}
</div> </div>
{shouldShowReset && {shouldShowReset &&

View File

@ -100,6 +100,7 @@ class TabbedSqlEditors extends React.Component {
<DropdownButton <DropdownButton
bsSize="small" bsSize="small"
id={'ddbtn-tab-' + i} id={'ddbtn-tab-' + i}
title=""
> >
<MenuItem eventKey="1" onClick={this.props.actions.removeQueryEditor.bind(this, qe)}> <MenuItem eventKey="1" onClick={this.props.actions.removeQueryEditor.bind(this, qe)}>
<i className="fa fa-close" /> close tab <i className="fa fa-close" /> close tab
@ -118,6 +119,7 @@ class TabbedSqlEditors extends React.Component {
key={qe.id} key={qe.id}
title={tabTitle} title={tabTitle}
eventKey={qe.id} eventKey={qe.id}
id={`a11y-query-editor-${qe.id}`}
> >
<div className="panel panel-default"> <div className="panel panel-default">
<div className="panel-body"> <div className="panel-body">
@ -135,6 +137,7 @@ class TabbedSqlEditors extends React.Component {
bsStyle="tabs" bsStyle="tabs"
activeKey={this.props.tabHistory[this.props.tabHistory.length - 1]} activeKey={this.props.tabHistory[this.props.tabHistory.length - 1]}
onSelect={this.handleSelect.bind(this)} onSelect={this.handleSelect.bind(this)}
id="a11y-query-editor-tabs"
> >
{editors} {editors}
<Tab title={<div><i className="fa fa-plus-circle" />&nbsp;</div>} eventKey="add_tab" /> <Tab title={<div><i className="fa fa-plus-circle" />&nbsp;</div>} eventKey="add_tab" />

View File

@ -64,7 +64,7 @@ class TableElement extends React.Component {
metadata = ( metadata = (
<div> <div>
{this.props.table.columns.map((col) => ( {this.props.table.columns.map((col) => (
<div className="clearfix"> <div className="clearfix" key={shortid.generate()}>
<div className="pull-left m-l-10"> <div className="pull-left m-l-10">
{col.name} {col.name}
</div> </div>

View File

@ -209,7 +209,7 @@ class VisualizeModal extends React.Component {
VisualizeModal.propTypes = { VisualizeModal.propTypes = {
query: React.PropTypes.object, query: React.PropTypes.object,
show: React.PropTypes.bool, show: React.PropTypes.bool,
onHide: React.PropTypes.function, onHide: React.PropTypes.func,
}; };
VisualizeModal.defaultProps = { VisualizeModal.defaultProps = {
show: false, show: false,