-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[explorev2] adding support for client side validators on controls (#1920
) * Adding support for client side validators on controls * Applying validators to more fields * Addressing comments
- Loading branch information
1 parent
fc74fbe
commit 470a6e9
Showing
20 changed files
with
237 additions
and
105 deletions.
There are no files selected for viewing
64 changes: 41 additions & 23 deletions
64
superset/assets/javascripts/explore/components/QueryAndSaveBtns.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
superset/assets/javascripts/explorev2/components/ControlHeader.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React, { PropTypes } from 'react'; | ||
import { ControlLabel, OverlayTrigger, Tooltip } from 'react-bootstrap'; | ||
import InfoTooltipWithTrigger from '../../components/InfoTooltipWithTrigger'; | ||
|
||
const propTypes = { | ||
label: PropTypes.string.isRequired, | ||
description: PropTypes.string, | ||
validationErrors: PropTypes.array, | ||
}; | ||
|
||
const defaultProps = { | ||
description: null, | ||
validationErrors: [], | ||
}; | ||
|
||
export default function ControlHeader({ label, description, validationErrors }) { | ||
const hasError = (validationErrors.length > 0); | ||
return ( | ||
<ControlLabel> | ||
{hasError ? | ||
<strong className="text-danger">{label}</strong> : | ||
<span>{label}</span> | ||
} | ||
{' '} | ||
{(validationErrors.length > 0) && | ||
<span> | ||
<OverlayTrigger | ||
placement="right" | ||
overlay={ | ||
<Tooltip id={'error-tooltip'}> | ||
{validationErrors.join(' ')} | ||
</Tooltip> | ||
} | ||
> | ||
<i className="fa fa-exclamation-circle text-danger" /> | ||
</OverlayTrigger> | ||
{' '} | ||
</span> | ||
} | ||
{description && | ||
<InfoTooltipWithTrigger label={label} tooltip={description} /> | ||
} | ||
</ControlLabel> | ||
); | ||
} | ||
|
||
ControlHeader.propTypes = propTypes; | ||
ControlHeader.defaultProps = defaultProps; |
26 changes: 0 additions & 26 deletions
26
superset/assets/javascripts/explorev2/components/ControlLabelWithTooltip.jsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.