Commit eff1fc16 authored by PiTrem's avatar PiTrem
Browse files

FE warning fixes:

- StructureEditorModal fix proptype for editorlist

- fix warning iterator each child has unique key prop

- fix unsupported style property white-space
parent dbec748d
......@@ -151,13 +151,14 @@ export default class ElementsTable extends React.Component {
let items = [];
const minPage = Math.max(page - 2, 1);
const maxPage = Math.min(minPage + 4, pages);
items.push(<Pagination.First onClick={() => this.handlePaginationSelect(1)} />);
items.push(<Pagination.First key="First" onClick={() => this.handlePaginationSelect(1)} />);
if (page>1) {
items.push(<Pagination.Prev onClick={() => this.handlePaginationSelect(page - 1)} />);
items.push(<Pagination.Prev key="Prev" onClick={() => this.handlePaginationSelect(page - 1)} />);
}
for (let _page = minPage; _page <= maxPage; _page=_page+1) {
items.push(
<Pagination.Item
key={`eltPage${_page}`}
active={_page === page}
onClick={() => this.handlePaginationSelect(_page)}>
{_page}
......@@ -166,12 +167,12 @@ export default class ElementsTable extends React.Component {
}
if (pages > maxPage) {
items.push(<Pagination.Ellipsis />);
items.push(<Pagination.Ellipsis key="Ell" />);
}
if (page==pages) {
items.push(<Pagination.Next onClick={() => this.handlePaginationSelect(page+1)} />);
items.push(<Pagination.Next key="Next" onClick={() => this.handlePaginationSelect(page+1)} />);
}
items.push(<Pagination.Last onClick={() => this.handlePaginationSelect(pages)} />);
items.push(<Pagination.Last key="Last" onClick={() => this.handlePaginationSelect(pages)} />);
return (
<div className="list-pagination">
......
......@@ -521,7 +521,7 @@ export default class SampleDetails extends React.Component {
const textAreaStyle = {
height: '35px',
overflow: 'auto',
'white-space': 'pre',
whiteSpace: 'pre',
};
return (
......@@ -850,7 +850,7 @@ export default class SampleDetails extends React.Component {
width: '500px',
height: '640px',
margin: '30px',
'white-space': 'pre-line',
whiteSpace: 'pre-line',
};
if (this.state.showMolfileModal) {
let molfile = this.molfileInput.value;
......
import alt from 'alt';
import React from 'react';
import { Glyphicon, ButtonGroup, Button, DropdownButton, MenuItem,
Form, FormControl, Radio, Grid, Row, Col } from 'react-bootstrap';
import {
Glyphicon, ButtonGroup, Button, DropdownButton, MenuItem,
Form, FormControl, Radio, Grid, Row, Col
} from 'react-bootstrap';
import PropTypes from 'prop-types';
import AutoCompleteInput from './AutoCompleteInput';
......@@ -23,6 +24,7 @@ export default class Search extends React.Component {
tanimotoThreshold: 0.7
};
this.handleClearSearchSelection = this.handleClearSearchSelection.bind(this);
this.handleStructureEditorCancel = this.handleStructureEditorCancel.bind(this);
}
handleSelectionChange(selection) {
......@@ -225,7 +227,7 @@ export default class Search extends React.Component {
<StructureEditorModal
showModal={this.state.showStructureEditor}
onSave={this.props.noSubmit ? null : this.handleStructureEditorSave.bind(this)}
onCancel={this.handleStructureEditorCancel.bind(this)}
onCancel={this.handleStructureEditorCancel}
molfile={this.state.queryMolfile}
submitBtnText="Search"
submitAddons={submitAddons}
......
......@@ -121,8 +121,7 @@ export default class StructureEditorModal extends React.Component {
render() {
const handleSaveBtn = !this.props.onSave ? null : this.handleSaveBtn.bind(this);
const cancelBtnText = this.props.cancelBtnText ? this.props.cancelBtnText : 'Cancel';
const submitBtnText = this.props.submitBtnText ? this.props.submitBtnText : 'Save';
const { cancelBtnText, submitBtnText } = this.props;
const submitAddons = this.props.submitAddons ? this.props.submitAddons : '';
const { editor, showWarning } = this.state;
......@@ -185,19 +184,23 @@ export default class StructureEditorModal extends React.Component {
}
StructureEditorModal.propTypes = {
editors: PropTypes.objectOf(StructureEditor),
editors: PropTypes.objectOf(PropTypes.instanceOf(StructureEditor)),
molfile: PropTypes.string,
showModal: PropTypes.bool,
hasChildren: PropTypes.bool,
hasParent: PropTypes.bool,
onCancel: PropTypes.func,
onSave: PropTypes.func,
submitBtnText: PropTypes.string,
cancelBtnText: PropTypes.string,
};
StructureEditorModal.defaultProps = {
editors: EditorList,
molfile: "\n noname\n\n 0 0 0 0 0 0 0 0 0 0999 V2000\nM END\n",
molfile: "\n noname\n\n 0 0 0 0 0 0 0 0 0 0999 V2000\nM END\n",
showModal: false,
hasChildren: false,
hasParent: false,
submitBtnText: 'Save',
cancelBtnText: 'Cancel',
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment