join wizard

This commit is contained in:
Jan Prochazka
2020-05-28 18:23:55 +02:00
parent a11b3773ce
commit 2d78146cda
2 changed files with 20 additions and 16 deletions

View File

@@ -103,17 +103,20 @@ export default function InsertJoinModal({ sql, modalState, engine, dbinfo, onIns
if (event.keyCode == keycodes.leftArrow) {
targetRef.current.focus();
}
if (event.keyCode == keycodes.enter || event.keyCode == keycodes.rightArrow) {
if (event.keyCode == keycodes.enter) {
aliasRef.current.focus();
}
}, []);
const aliasKeyDown = React.useCallback((event) => {
if (event.keyCode == keycodes.enter) {
event.preventDefault();
modalState.close();
onInsert(sqlPreview);
}
}, []);
const aliasKeyDown = React.useCallback(
(event) => {
if (event.keyCode == keycodes.enter) {
event.preventDefault();
modalState.close();
onInsert(sqlPreview);
}
},
[onInsert, sqlPreview]
);
return (
<ModalBase modalState={modalState}>

View File

@@ -18,14 +18,15 @@ export default function analyseQuerySources(sql, sourceNames) {
res.push({
name: word,
});
}
if (/^(where)|(inner)|(left)|(right)|(on)$/i.test(postWord)) {
continue;
}
res.push({
name: word,
alias: postWord,
});
} else if (/^(where)|(inner)|(left)|(right)|(on)$/i.test(postWord)) {
res.push({
name: word,
});
} else
res.push({
name: word,
alias: postWord,
});
}
}
}