[Explore] highlighting run query when chart is stale on explore view (#4459)

* highlighting run query when chart is stale on explore view

* refactoring control changed code
This commit is contained in:
Gabe Lyons
2018-02-26 10:57:20 -08:00
committed by Maxime Beauchemin
parent 2932585c65
commit 56f65158a2
2 changed files with 31 additions and 8 deletions

View File

@@ -11,6 +11,7 @@ const propTypes = {
onSave: PropTypes.func,
onStop: PropTypes.func,
loading: PropTypes.bool,
chartIsStale: PropTypes.bool,
errorMessage: PropTypes.node,
};
@@ -21,11 +22,18 @@ const defaultProps = {
};
export default function QueryAndSaveBtns(
{ canAdd, onQuery, onSave, onStop, loading, errorMessage }) {
{ canAdd, onQuery, onSave, onStop, loading, chartIsStale, errorMessage }) {
const saveClasses = classnames({
'disabled disabledButton': canAdd !== 'True',
});
const qryButtonStyle = errorMessage ? 'danger' : 'primary';
let qryButtonStyle = 'default';
if (errorMessage) {
qryButtonStyle = 'danger';
} else if (chartIsStale) {
qryButtonStyle = 'primary';
}
const saveButtonDisabled = errorMessage ? true : loading;
const qryOrStopButton = loading ? (
<Button