mirror of
https://github.com/apache/superset.git
synced 2026-04-10 11:55:24 +00:00
As I altered QueryAndSaveBtns to add the `disabled` prop I also moved it to using react-boostrap
49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
import React, { PropTypes } from 'react';
|
|
import { Button, ButtonGroup } from 'react-bootstrap';
|
|
import classnames from 'classnames';
|
|
|
|
const propTypes = {
|
|
canAdd: PropTypes.string.isRequired,
|
|
onQuery: PropTypes.func.isRequired,
|
|
onSave: PropTypes.func,
|
|
disabled: PropTypes.bool,
|
|
};
|
|
|
|
const defaultProps = {
|
|
onSave: () => {},
|
|
disabled: false,
|
|
};
|
|
|
|
export default function QueryAndSaveBtns({ canAdd, onQuery, onSave, disabled }) {
|
|
const saveClasses = classnames({
|
|
'disabled disabledButton': canAdd !== 'True',
|
|
});
|
|
|
|
return (
|
|
<ButtonGroup className="query-and-save">
|
|
<Button
|
|
id="query_button"
|
|
onClick={onQuery}
|
|
bsSize="small"
|
|
disabled={disabled}
|
|
bsStyle="primary"
|
|
>
|
|
<i className="fa fa-bolt" /> Query
|
|
</Button>
|
|
<Button
|
|
className={saveClasses}
|
|
bsSize="small"
|
|
data-target="#save_modal"
|
|
data-toggle="modal"
|
|
disabled={disabled}
|
|
onClick={onSave}
|
|
>
|
|
<i className="fa fa-plus-circle"></i> Save as
|
|
</Button>
|
|
</ButtonGroup>
|
|
);
|
|
}
|
|
|
|
QueryAndSaveBtns.propTypes = propTypes;
|
|
QueryAndSaveBtns.defaultProps = defaultProps;
|