Skip to content

Commit

Permalink
Tackling late-arriving comments from #5186 (#5626)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch authored Aug 14, 2018
1 parent be04c98 commit d601ff4
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
8 changes: 5 additions & 3 deletions superset/assets/src/CRUD/CollectionTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -29,6 +28,8 @@ const defaultProps = {
emptyMessage: 'No entries',
allowAddItem: false,
itemGenerator: () => ({}),
expandFieldset: null,
extraButtons: null,
};
const Frame = props => (
<div className="frame">
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions superset/assets/src/CRUD/Field.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -19,6 +19,7 @@ const defaultProps = {
controlProps: {},
onChange: () => {},
compact: false,
desc: null,
};

export default class Field extends React.PureComponent {
Expand Down
7 changes: 4 additions & 3 deletions superset/assets/src/CRUD/Fieldset.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions superset/assets/src/components/EditableTitle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const defaultProps = {
showTooltip: true,
onSaveTitle: () => {},
emptyText: '<empty>',
style: null,
};

export default class EditableTitle extends React.PureComponent {
Expand Down
11 changes: 8 additions & 3 deletions superset/assets/src/datasource/DatasourceModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -22,6 +22,7 @@ const defaultProps = {
onChange: () => {},
onHide: () => {},
onDatasourceSave: () => {},
show: false,
};

class DatasourceModal extends React.PureComponent {
Expand All @@ -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({
Expand Down Expand Up @@ -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 });
}
Expand Down Expand Up @@ -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>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down

0 comments on commit d601ff4

Please sign in to comment.