Change Execute Action Parameter
Summary: `'Execute'` action was previously used only for execute tab which assumed the input will come from the state. This changes so that it can take any input attached to parameters (more explanation about the design in <insert diff number>) Reviewed By: jknoxville Differential Revision: D21788244 fbshipit-source-id: 8fb8ecb8f8df84f4854f70432e7a1fdb531403e9
This commit is contained in:
committed by
Facebook GitHub Bot
parent
df480bd57a
commit
d6b617a952
@@ -219,6 +219,7 @@ type PreviousPageEvent = {
|
|||||||
|
|
||||||
type ExecuteEvent = {
|
type ExecuteEvent = {
|
||||||
type: 'Execute';
|
type: 'Execute';
|
||||||
|
query: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type RefreshEvent = {
|
type RefreshEvent = {
|
||||||
@@ -602,18 +603,12 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
|||||||
'Execute',
|
'Execute',
|
||||||
(
|
(
|
||||||
state: DatabasesPluginState,
|
state: DatabasesPluginState,
|
||||||
_results: ExecuteEvent,
|
event: ExecuteEvent,
|
||||||
): DatabasesPluginState => {
|
): DatabasesPluginState => {
|
||||||
const timeBefore = Date.now();
|
const timeBefore = Date.now();
|
||||||
if (
|
const {query} = event;
|
||||||
this.state.query !== null &&
|
|
||||||
typeof this.state.query !== 'undefined'
|
|
||||||
) {
|
|
||||||
this.databaseClient
|
this.databaseClient
|
||||||
.getExecution({
|
.getExecution({databaseId: state.selectedDatabase, value: query})
|
||||||
databaseId: state.selectedDatabase,
|
|
||||||
value: this.state.query.value,
|
|
||||||
})
|
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
error: null,
|
error: null,
|
||||||
@@ -640,7 +635,6 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
|||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
this.setState({error: e});
|
this.setState({error: e});
|
||||||
});
|
});
|
||||||
}
|
|
||||||
let newHistory = this.state.queryHistory;
|
let newHistory = this.state.queryHistory;
|
||||||
const newQuery = this.state.query;
|
const newQuery = this.state.query;
|
||||||
if (
|
if (
|
||||||
@@ -964,7 +958,9 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
|||||||
};
|
};
|
||||||
|
|
||||||
onExecuteClicked = () => {
|
onExecuteClicked = () => {
|
||||||
this.dispatchAction({type: 'Execute'});
|
if (this.state.query !== null) {
|
||||||
|
this.dispatchAction({type: 'Execute', query: this.state.query.value});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onQueryTextareaKeyPress = (event: KeyboardEvent) => {
|
onQueryTextareaKeyPress = (event: KeyboardEvent) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user