mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 05:03:57 +00:00
execute command disabled, when query has not connection
This commit is contained in:
@@ -241,6 +241,7 @@ export function registerFileCommands({
|
|||||||
toggleComment = false,
|
toggleComment = false,
|
||||||
findReplace = false,
|
findReplace = false,
|
||||||
undoRedo = false,
|
undoRedo = false,
|
||||||
|
executeAdditionalCondition = null,
|
||||||
}) {
|
}) {
|
||||||
if (save) {
|
if (save) {
|
||||||
registerCommand({
|
registerCommand({
|
||||||
@@ -274,7 +275,10 @@ export function registerFileCommands({
|
|||||||
toolbar: true,
|
toolbar: true,
|
||||||
isRelatedToTab: true,
|
isRelatedToTab: true,
|
||||||
keyText: 'F5 | Ctrl+Enter',
|
keyText: 'F5 | Ctrl+Enter',
|
||||||
testEnabled: () => getCurrentEditor() != null && !getCurrentEditor()?.isBusy(),
|
testEnabled: () =>
|
||||||
|
getCurrentEditor() != null &&
|
||||||
|
!getCurrentEditor()?.isBusy() &&
|
||||||
|
(executeAdditionalCondition == null || executeAdditionalCondition()),
|
||||||
onClick: () => getCurrentEditor().execute(),
|
onClick: () => getCurrentEditor().execute(),
|
||||||
});
|
});
|
||||||
registerCommand({
|
registerCommand({
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
execute: true,
|
execute: true,
|
||||||
toggleComment: true,
|
toggleComment: true,
|
||||||
findReplace: true,
|
findReplace: true,
|
||||||
|
executeAdditionalCondition: () => getCurrentEditor()?.hasConnection(),
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -121,6 +122,10 @@
|
|||||||
return tabid;
|
return tabid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function hasConnection() {
|
||||||
|
return !!conid;
|
||||||
|
}
|
||||||
|
|
||||||
export async function execute() {
|
export async function execute() {
|
||||||
if (busy) return;
|
if (busy) return;
|
||||||
executeNumber++;
|
executeNumber++;
|
||||||
|
|||||||
Reference in New Issue
Block a user