Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: trigger run when pressing Enter key (#3590)
Liu Jic1fe8f8d401f
diff --git a/frontend/src/views/sql-editor/TerminalPanel/CompactSQLEditor.vue b/frontend/src/views/sql-editor/TerminalPanel/CompactSQLEditor.vueindex fc382dc5ef..e0a1b59097 100644--- a/frontend/src/views/sql-editor/TerminalPanel/CompactSQLEditor.vue+++ b/frontend/src/views/sql-editor/TerminalPanel/CompactSQLEditor.vue@@ -177,6 +177,33 @@ const handleEditorReady = async () => {},});+ editor?.addCommand(monaco.KeyCode.Enter, (...args: any[]) => {+ // When+ // - the SQL ends with ";"+ // - and the cursor is at the end of the editor+ // - then press "Enter"+ // We trigger the "execute" event+ if (props.sql.endsWith(";")) {+ const model = editor.getModel();+ if (model) {+ const maxLine = model.getLineCount();+ const maxColumn = model.getLineMaxColumn(maxLine);+ const cursor = editor.getPosition();+ const isCursorAtLast = !!cursor?.equals({+ lineNumber: maxLine,+ column: maxColumn,+ });+ if (isCursorAtLast) {+ emit("execute", props.sql, {+ databaseType: selectedInstanceEngine.value,+ });+ return false;+ }+ }+ }+ return true;+ });+watchEffect(() => {if (selectedInstance.value) {const databaseList = databaseStore.getDatabaseListByInstanceId(