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(
if (event.keyCode == keycodes.enter) { (event) => {
event.preventDefault(); if (event.keyCode == keycodes.enter) {
modalState.close(); event.preventDefault();
onInsert(sqlPreview); modalState.close();
} onInsert(sqlPreview);
}, []); }
},
[onInsert, sqlPreview]
);
return ( return (
<ModalBase modalState={modalState}> <ModalBase modalState={modalState}>

View File

@@ -18,14 +18,15 @@ 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,
} });
res.push({ } else
name: word, res.push({
alias: postWord, name: word,
}); alias: postWord,
});
} }
} }
} }