Adding warning message for sqllab save query (#7028)
This commit is contained in:
parent
c771625f10
commit
ead3d48133
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ FRONTEND_CONF_KEYS = (
|
|||
'DEFAULT_SQLLAB_LIMIT',
|
||||
'SQL_MAX_ROW',
|
||||
'SUPERSET_WEBSERVER_DOMAINS',
|
||||
'SQLLAB_SAVE_WARNING_MESSAGE',
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue