Tackling late-arriving comments from #5186 (#5626)

This commit is contained in:
Maxime Beauchemin 2018-08-14 16:30:50 -07:00 committed by GitHub
parent be04c98cd3
commit d601ff4747
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 13 deletions

View File

@ -8,11 +8,10 @@ import { recurseReactClone } from './utils';
import './styles.css';
const propTypes = {
collection: PropTypes.array,
collection: PropTypes.arrayOf(PropTypes.object).isRequired,
itemGenerator: PropTypes.func,
columnLabels: PropTypes.object,
tableColumns: PropTypes.array,
columns: PropTypes.array,
tableColumns: PropTypes.array.isRequired,
onChange: PropTypes.func,
itemRenderers: PropTypes.object,
allowDeletes: PropTypes.bool,
@ -29,6 +28,8 @@ const defaultProps = {
emptyMessage: 'No entries',
allowAddItem: false,
itemGenerator: () => ({}),
expandFieldset: null,
extraButtons: null,
};
const Frame = props => (
<div className="frame">
@ -100,6 +101,7 @@ export default class CRUDCollection extends React.PureComponent {
const { columnLabels } = this.props;
let label = columnLabels[col] ? columnLabels[col] : col;
if (label.startsWith('__')) {
// special label-free columns (ie: caret for expand, delete cross)
label = '';
}
return label;

View File

@ -7,8 +7,8 @@ import {
import './styles.less';
const propTypes = {
value: PropTypes.any,
label: PropTypes.string,
value: PropTypes.any.isRequired,
label: PropTypes.string.isRequired,
descr: PropTypes.node,
fieldKey: PropTypes.string.isRequired,
control: PropTypes.node.isRequired,
@ -19,6 +19,7 @@ const defaultProps = {
controlProps: {},
onChange: () => {},
compact: false,
desc: null,
};
export default class Field extends React.PureComponent {

View File

@ -6,14 +6,15 @@ import { recurseReactClone } from './utils';
import Field from './Field';
const propTypes = {
children: PropTypes.node,
onChange: PropTypes.func,
item: PropTypes.object,
children: PropTypes.node.isRequired,
onChange: PropTypes.func.isRequired,
item: PropTypes.object.isRequired,
title: PropTypes.node,
compact: PropTypes.bool,
};
const defaultProps = {
compact: false,
title: null,
};
export default class Fieldset extends React.PureComponent {

View File

@ -19,6 +19,7 @@ const defaultProps = {
showTooltip: true,
onSaveTitle: () => {},
emptyText: '<empty>',
style: null,
};
export default class EditableTitle extends React.PureComponent {

View File

@ -2,16 +2,16 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Alert, Button, Modal } from 'react-bootstrap';
import Dialog from 'react-bootstrap-dialog';
import $ from 'jquery';
import { t } from '../locales';
import DatasourceEditor from '../datasource/DatasourceEditor';
import withToasts from '../messageToasts/enhancers/withToasts';
const $ = window.$ = require('jquery');
const propTypes = {
onChange: PropTypes.func,
datasource: PropTypes.object,
datasource: PropTypes.object.isRequired,
show: PropTypes.bool.isRequired,
onHide: PropTypes.func,
onDatasourceSave: PropTypes.func,
@ -22,6 +22,7 @@ const defaultProps = {
onChange: () => {},
onHide: () => {},
onDatasourceSave: () => {},
show: false,
};
class DatasourceModal extends React.PureComponent {
@ -41,6 +42,7 @@ class DatasourceModal extends React.PureComponent {
this.onDatasourceChange = this.onDatasourceChange.bind(this);
this.onClickSave = this.onClickSave.bind(this);
this.onConfirmSave = this.onConfirmSave.bind(this);
this.setDialogRef = this.setDialogRef.bind(this);
}
onClickSave() {
this.dialog.show({
@ -90,6 +92,9 @@ class DatasourceModal extends React.PureComponent {
setSearchRef(searchRef) {
this.searchRef = searchRef;
}
setDialogRef(ref) {
this.dialog = ref;
}
toggleShowDatasource() {
this.setState({ showDatasource: !this.state.showDatasource });
}
@ -149,7 +154,7 @@ class DatasourceModal extends React.PureComponent {
{t('Save')}
</Button>
<Button bsSize="sm" onClick={this.props.onHide}>{t('Cancel')}</Button>
<Dialog ref={(el) => { this.dialog = el; }} />
<Dialog ref={this.setDialogRef} />
</span>
</Modal.Footer>
</Modal>);

View File

@ -4,10 +4,8 @@ import ControlHeader from '../ControlHeader';
import Checkbox from '../../../components/Checkbox';
const propTypes = {
name: PropTypes.string,
value: PropTypes.bool,
label: PropTypes.string,
description: PropTypes.string,
onChange: PropTypes.func,
};