Deprecate database attribute allow_run_sync (#4961)

* Deprecate database attribute allow_run_sync

There's really 2 modes of operations in SQL Lab, sync or async
though currently there are 2 boolean flags: allow_run_sync and
allow_run_async, leading to 4 potential combinations, only 2 of which
actually makes sense.

The original vision is that we'd expose the choice to users and they
would decide which `Run` or `Run Async` button to hit.
Later on we decided to have a
single button and for each database to be either sync or async.

This PR cleans up allow_run_sync by removing references to it.

* Fix build

* Add db migration

* using batch_op
This commit is contained in:
Maxime Beauchemin
2018-11-27 21:08:44 -08:00
committed by GitHub
parent 529cb5cab1
commit 2931baa294
8 changed files with 80 additions and 64 deletions

View File

@@ -29,7 +29,28 @@ export default function RunQueryActionButton(props) {
disabled: !(props.dbId),
};
const syncBtn = (
if (shouldShowStopBtn) {
return (
<Button
{...commonBtnProps}
onClick={props.stopQuery}
>
<i className="fa fa-stop" /> {t('Stop')}
</Button>
);
} else if (props.allowAsync) {
return (
<Button
{...commonBtnProps}
onClick={() => props.runQuery(true)}
key="run-async-btn"
tooltip={t('Run query asynchronously')}
disabled={!props.sql.trim()}
>
<i className="fa fa-table" /> {runBtnText}
</Button>);
}
return (
<Button
{...commonBtnProps}
onClick={() => props.runQuery(false)}
@@ -40,37 +61,6 @@ export default function RunQueryActionButton(props) {
<i className="fa fa-refresh" /> {runBtnText}
</Button>
);
const asyncBtn = (
<Button
{...commonBtnProps}
onClick={() => props.runQuery(true)}
key="run-async-btn"
tooltip={t('Run query asynchronously')}
disabled={!props.sql.trim()}
>
<i className="fa fa-table" /> {runBtnText}
</Button>
);
const stopBtn = (
<Button
{...commonBtnProps}
onClick={props.stopQuery}
>
<i className="fa fa-stop" /> {t('Stop')}
</Button>
);
let button;
if (shouldShowStopBtn) {
button = stopBtn;
} else if (props.allowAsync) {
button = asyncBtn;
} else {
button = syncBtn;
}
return button;
}
RunQueryActionButton.propTypes = propTypes;