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) { if (event.keyCode == keycodes.leftArrow) {
targetRef.current.focus(); targetRef.current.focus();
} }
if (event.keyCode == keycodes.enter || event.keyCode == keycodes.rightArrow) { if (event.keyCode == keycodes.enter) {
aliasRef.current.focus(); aliasRef.current.focus();
} }
}, []); }, []);
const aliasKeyDown = React.useCallback((event) => { const aliasKeyDown = React.useCallback(
(event) => {
if (event.keyCode == keycodes.enter) { if (event.keyCode == keycodes.enter) {
event.preventDefault(); event.preventDefault();
modalState.close(); modalState.close();
onInsert(sqlPreview); onInsert(sqlPreview);
} }
}, []); },
[onInsert, sqlPreview]
);
return ( return (
<ModalBase modalState={modalState}> <ModalBase modalState={modalState}>

View File

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