Skip to content

Commit

Permalink
upgrade to react-bootstrap v0.33.1 (#9372)
Browse files Browse the repository at this point in the history
* upgrade to react-bootstrap v0.33.1

* fix test

* simplify proptypes

Co-Authored-By: Evan Rusackas <evan@preset.io>

* simplify more proptypes

Co-Authored-By: Evan Rusackas <evan@preset.io>

Co-authored-by: Evan Rusackas <evan@preset.io>
  • Loading branch information
suddjian and rusackas authored Mar 26, 2020
1 parent ccff6be commit cfa7868
Show file tree
Hide file tree
Showing 16 changed files with 413 additions and 328 deletions.
94 changes: 69 additions & 25 deletions superset-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion superset-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"re-resizable": "^4.3.1",
"react": "^16.13.0",
"react-ace": "^5.10.0",
"react-bootstrap": "^0.31.5",
"react-bootstrap": "^0.33.1",
"react-bootstrap-dialog": "^0.10.0",
"react-bootstrap-slider": "2.1.5",
"react-checkbox-tree": "^1.5.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('ControlPanelSection', () => {
it('renders a label if present', () => {
expect(
wrapper
.find(Panel)
.find(Panel.Title)
.dive()
.text(),
).toContain('my label');
Expand Down
95 changes: 50 additions & 45 deletions superset-frontend/src/addSlice/AddSliceContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,53 +80,58 @@ export default class AddSliceContainer extends React.PureComponent {
render() {
return (
<div className="container">
<Panel header={<h3>{t('Create a new chart')}</h3>}>
<div>
<p>{t('Choose a datasource')}</p>
<div style={styleSelectWidth}>
<Select
clearable={false}
ignoreAccents={false}
name="select-datasource"
onChange={this.changeDatasource}
options={this.props.datasources}
placeholder={t('Choose a datasource')}
style={styleSelectWidth}
value={this.state.datasourceValue}
width={600}
<Panel>
<Panel.Heading>
<h3>{t('Create a new chart')}</h3>
</Panel.Heading>
<Panel.Body>
<div>
<p>{t('Choose a datasource')}</p>
<div style={styleSelectWidth}>
<Select
clearable={false}
ignoreAccents={false}
name="select-datasource"
onChange={this.changeDatasource}
options={this.props.datasources}
placeholder={t('Choose a datasource')}
style={styleSelectWidth}
value={this.state.datasourceValue}
width={600}
/>
</div>
<p className="text-muted">
{t(
'If the datasource you are looking for is not ' +
'available in the list, ' +
'follow the instructions on the how to add it on the ',
)}
<a href="https://superset.apache.org/tutorial.html">
{t('Superset tutorial')}
</a>
</p>
</div>
<br />
<div>
<p>{t('Choose a visualization type')}</p>
<VizTypeControl
name="select-vis-type"
onChange={this.changeVisType}
value={this.state.visType}
/>
</div>
<p className="text-muted">
{t(
'If the datasource you are looking for is not ' +
'available in the list, ' +
'follow the instructions on the how to add it on the ',
)}
<a href="https://superset.apache.org/tutorial.html">
{t('Superset tutorial')}
</a>
</p>
</div>
<br />
<div>
<p>{t('Choose a visualization type')}</p>
<VizTypeControl
name="select-vis-type"
onChange={this.changeVisType}
value={this.state.visType}
/>
</div>
<br />
<hr />
<Button
bsStyle="primary"
disabled={this.isBtnDisabled()}
onClick={this.gotoSlice}
>
{t('Create new chart')}
</Button>
<br />
<br />
<br />
<hr />
<Button
bsStyle="primary"
disabled={this.isBtnDisabled()}
onClick={this.gotoSlice}
>
{t('Create new chart')}
</Button>
<br />
<br />
</Panel.Body>
</Panel>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import renderFilterFieldTreeNodes from './renderFilterFieldTreeNodes';
import { filterScopeSelectorTreeNodePropShape } from '../../util/propShapes';

const propTypes = {
activeKey: PropTypes.oneOfType([null, PropTypes.string]),
activeKey: PropTypes.string,
nodes: PropTypes.arrayOf(filterScopeSelectorTreeNodePropShape).isRequired,
checked: PropTypes.arrayOf(
PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const propTypes = {
).isRequired,
onCheck: PropTypes.func.isRequired,
onExpand: PropTypes.func.isRequired,
selectedChartId: PropTypes.oneOfType([null, PropTypes.number]),
selectedChartId: PropTypes.number,
};

const defaultProps = {
Expand Down
13 changes: 9 additions & 4 deletions superset-frontend/src/explore/components/ControlPanelSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default class ControlPanelSection extends React.Component {
constructor(props) {
super(props);
this.state = { expanded: this.props.startExpanded };
this.toggleExpand = this.toggleExpand.bind(this);
}
toggleExpand() {
this.setState({ expanded: !this.state.expanded });
Expand All @@ -50,7 +51,7 @@ export default class ControlPanelSection extends React.Component {
label && (
<div>
<span>
<span onClick={this.toggleExpand.bind(this)}>{label}</span>{' '}
<span onClick={this.toggleExpand}>{label}</span>{' '}
{description && (
<InfoTooltipWithTrigger label={label} tooltip={description} />
)}
Expand All @@ -77,11 +78,15 @@ export default class ControlPanelSection extends React.Component {
return (
<Panel
className="control-panel-section"
collapsible
expanded={this.state.expanded}
header={this.renderHeader()}
onToggle={this.toggleExpand}
>
{this.props.children}
<Panel.Heading>
<Panel.Title>{this.renderHeader()}</Panel.Title>
</Panel.Heading>
<Panel.Collapse>
<Panel.Body>{this.props.children}</Panel.Body>
</Panel.Collapse>
</Panel>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ class ExploreChartPanel extends React.PureComponent {
);
return (
<div className="chart-container">
<Panel style={{ height: this.props.height }} header={header}>
{this.renderChart()}
<Panel style={{ height: this.props.height }}>
<Panel.Heading>{header}</Panel.Heading>
<Panel.Body>{this.renderChart()}</Panel.Body>
</Panel>
</div>
);
Expand Down
Loading

0 comments on commit cfa7868

Please sign in to comment.