This is an automated email from the ASF dual-hosted git repository.
michellet 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 ead3d48 Adding warning message for sqllab save query (#7028)
ead3d48 is described below
commit ead3d48133e7e1ab8b91d51e561544a544b4eaad
Author: michellethomas <[email protected]>
AuthorDate: Mon Mar 18 10:14:26 2019 -0700
Adding warning message for sqllab save query (#7028)
---
superset/assets/src/SqlLab/components/SaveQuery.jsx | 14 ++++++++++++++
superset/assets/src/SqlLab/components/SqlEditor.jsx | 3 +++
superset/assets/src/SqlLab/components/TabbedSqlEditors.jsx | 4 ++++
superset/config.py | 3 +++
superset/views/base.py | 1 +
5 files changed, 25 insertions(+)
diff --git a/superset/assets/src/SqlLab/components/SaveQuery.jsx
b/superset/assets/src/SqlLab/components/SaveQuery.jsx
index 4a3ac1b..6ae2508 100644
--- a/superset/assets/src/SqlLab/components/SaveQuery.jsx
+++ b/superset/assets/src/SqlLab/components/SaveQuery.jsx
@@ -31,11 +31,13 @@ const propTypes = {
dbId: PropTypes.number,
animation: PropTypes.bool,
onSave: PropTypes.func,
+ saveQueryWarning: PropTypes.string,
};
const defaultProps = {
defaultLabel: t('Undefined'),
animation: true,
onSave: () => {},
+ saveQueryWarning: null,
};
class SaveQuery extends React.PureComponent {
@@ -108,6 +110,18 @@ class SaveQuery extends React.PureComponent {
</Col>
</Row>
<br />
+ {this.props.saveQueryWarning && (
+ <div>
+ <Row>
+ <Col md={12}>
+ <small>
+ {this.props.saveQueryWarning}
+ </small>
+ </Col>
+ </Row>
+ <br />
+ </div>
+ )}
<Row>
<Col md={12}>
<Button
diff --git a/superset/assets/src/SqlLab/components/SqlEditor.jsx
b/superset/assets/src/SqlLab/components/SqlEditor.jsx
index bd6a3f5..cf142b2 100644
--- a/superset/assets/src/SqlLab/components/SqlEditor.jsx
+++ b/superset/assets/src/SqlLab/components/SqlEditor.jsx
@@ -60,12 +60,14 @@ const propTypes = {
hideLeftBar: PropTypes.bool,
defaultQueryLimit: PropTypes.number.isRequired,
maxRow: PropTypes.number.isRequired,
+ saveQueryWarning: PropTypes.string,
};
const defaultProps = {
database: null,
latestQuery: null,
hideLeftBar: false,
+ saveQueryWarning: null,
};
class SqlEditor extends React.PureComponent {
@@ -309,6 +311,7 @@ class SqlEditor extends React.PureComponent {
onSave={this.props.actions.saveQuery}
schema={qe.schema}
dbId={qe.dbId}
+ saveQueryWarning={this.props.saveQueryWarning}
/>
</span>
<span className="m-r-5">
diff --git a/superset/assets/src/SqlLab/components/TabbedSqlEditors.jsx
b/superset/assets/src/SqlLab/components/TabbedSqlEditors.jsx
index a0a991c..0d4fc5f 100644
--- a/superset/assets/src/SqlLab/components/TabbedSqlEditors.jsx
+++ b/superset/assets/src/SqlLab/components/TabbedSqlEditors.jsx
@@ -40,10 +40,12 @@ const propTypes = {
tabHistory: PropTypes.array.isRequired,
tables: PropTypes.array.isRequired,
offline: PropTypes.bool,
+ saveQueryWarning: PropTypes.string,
};
const defaultProps = {
queryEditors: [],
offline: false,
+ saveQueryWarning: null,
};
let queryCount = 1;
@@ -247,6 +249,7 @@ class TabbedSqlEditors extends React.PureComponent {
hideLeftBar={this.state.hideLeftBar}
defaultQueryLimit={this.props.defaultQueryLimit}
maxRow={this.props.maxRow}
+ saveQueryWarning={this.props.saveQueryWarning}
/>
)}
</div>
@@ -289,6 +292,7 @@ function mapStateToProps({ sqlLab, common }) {
offline: sqlLab.offline,
defaultQueryLimit: common.conf.DEFAULT_SQLLAB_LIMIT,
maxRow: common.conf.SQL_MAX_ROW,
+ saveQueryWarning: common.conf.SQLLAB_SAVE_WARNING_MESSAGE,
};
}
function mapDispatchToProps(dispatch) {
diff --git a/superset/config.py b/superset/config.py
index 7f08fc3..96ccb09 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -354,6 +354,9 @@ DEFAULT_SQLLAB_LIMIT = 1000
# Maximum number of tables/views displayed in the dropdown window in SQL Lab.
MAX_TABLE_NAMES = 3000
+# Adds a warning message on sqllab save query modal.
+SQLLAB_SAVE_WARNING_MESSAGE = None
+
# If defined, shows this text in an alert-warning box in the navbar
# one example use case may be "STAGING" to make it clear that this is
# not the production version of the site.
diff --git a/superset/views/base.py b/superset/views/base.py
index 4f3c8e8..071f2b3 100644
--- a/superset/views/base.py
+++ b/superset/views/base.py
@@ -43,6 +43,7 @@ FRONTEND_CONF_KEYS = (
'DEFAULT_SQLLAB_LIMIT',
'SQL_MAX_ROW',
'SUPERSET_WEBSERVER_DOMAINS',
+ 'SQLLAB_SAVE_WARNING_MESSAGE',
)