This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new d4e8d57 Using TextAreaControl for WHERE and HAVING clause section
(#4090)
d4e8d57 is described below
commit d4e8d57fc4377f1eede8fdc62e20ede73aa963d0
Author: Maxime Beauchemin <[email protected]>
AuthorDate: Tue Dec 19 12:11:35 2017 -0800
Using TextAreaControl for WHERE and HAVING clause section (#4090)
---
.../components/controls/TextAreaControl.jsx | 31 +++++++++++++---------
.../assets/javascripts/explore/stores/controls.jsx | 12 +++++++--
2 files changed, 29 insertions(+), 14 deletions(-)
diff --git
a/superset/assets/javascripts/explore/components/controls/TextAreaControl.jsx
b/superset/assets/javascripts/explore/components/controls/TextAreaControl.jsx
index bf789b6..47b5454 100644
---
a/superset/assets/javascripts/explore/components/controls/TextAreaControl.jsx
+++
b/superset/assets/javascripts/explore/components/controls/TextAreaControl.jsx
@@ -22,6 +22,9 @@ const propTypes = {
value: PropTypes.string,
height: PropTypes.number,
language: PropTypes.oneOf([null, 'json', 'html', 'sql', 'markdown']),
+ minLines: PropTypes.number,
+ maxLines: PropTypes.number,
+ offerEditInModal: PropTypes.bool,
};
const defaultProps = {
@@ -30,6 +33,9 @@ const defaultProps = {
onChange: () => {},
value: '',
height: 250,
+ minLines: 10,
+ maxLines: 10,
+ offerEditInModal: true,
};
export default class TextAreaControl extends React.Component {
@@ -46,8 +52,8 @@ export default class TextAreaControl extends React.Component {
mode={this.props.language}
theme="textmate"
style={{ border: '1px solid #CCC' }}
- minLines={inModal ? 40 : 10}
- maxLines={inModal ? 1000 : 10}
+ minLines={inModal ? 40 : this.props.minLines}
+ maxLines={inModal ? 1000 : this.props.maxLines}
onChange={this.onAceChange.bind(this)}
width="100%"
editorProps={{ $blockScrolling: true }}
@@ -73,16 +79,17 @@ export default class TextAreaControl extends
React.Component {
<div>
{controlHeader}
{this.renderEditor()}
- <ModalTrigger
- bsSize="large"
- modalTitle={controlHeader}
- triggerNode={
- <Button bsSize="small" className="m-t-5">
- {t('Edit')} <strong>{this.props.language}</strong> {t('in
modal')}
- </Button>
- }
- modalBody={this.renderEditor(true)}
- />
+ {this.props.offerEditInModal &&
+ <ModalTrigger
+ bsSize="large"
+ modalTitle={controlHeader}
+ triggerNode={
+ <Button bsSize="small" className="m-t-5">
+ {t('Edit')} <strong>{this.props.language}</strong> {t('in
modal')}
+ </Button>
+ }
+ modalBody={this.renderEditor(true)}
+ />}
</div>
);
}
diff --git a/superset/assets/javascripts/explore/stores/controls.jsx
b/superset/assets/javascripts/explore/stores/controls.jsx
index 006a1b4..5c18b4d 100644
--- a/superset/assets/javascripts/explore/stores/controls.jsx
+++ b/superset/assets/javascripts/explore/stores/controls.jsx
@@ -910,9 +910,13 @@ export const controls = {
},
where: {
- type: 'TextControl',
+ type: 'TextAreaControl',
label: t('Custom WHERE clause'),
default: '',
+ language: 'sql',
+ minLines: 2,
+ maxLines: 10,
+ offerEditInModal: false,
description: t('The text in this box gets included in your query\'s WHERE
' +
'clause, as an AND to other criteria. You can include ' +
'complex expression, parenthesis and anything else ' +
@@ -920,9 +924,13 @@ export const controls = {
},
having: {
- type: 'TextControl',
+ type: 'TextAreaControl',
label: t('Custom HAVING clause'),
default: '',
+ language: 'sql',
+ minLines: 2,
+ maxLines: 10,
+ offerEditInModal: false,
description: t('The text in this box gets included in your query\'s HAVING
' +
'clause, as an AND to other criteria. You can include ' +
'complex expression, parenthesis and anything else ' +
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].