Skip to content

Commit b280939

Browse files
committed
Enable cancel button for non-UI tasks + fix stop causing no result set
Signed-off-by: worksofliam <[email protected]>
1 parent a4048cf commit b280939

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/views/results/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ async function runMultipleHandler(mode: `all`|`selected`|`from`) {
212212
),
213213
group: statementsToRun[i],
214214
qualifier: prefix,
215-
noUi: i < statementsToRun.length - 1, // Only the last one should have a UI
215+
noUi: true
216216
});
217217
}
218218
}
@@ -222,6 +222,9 @@ async function runMultipleHandler(mode: `all`|`selected`|`from`) {
222222
return;
223223
}
224224

225+
// Last statement should have UI
226+
statementInfos[statementInfos.length - 1].noUi = false;
227+
225228
for (let statementInfo of statementInfos) {
226229
try {
227230
await runHandler(statementInfo);
@@ -302,6 +305,7 @@ async function runHandler(options?: StatementInfo) {
302305
if (statementDetail.qualifier === `cl`) {
303306
// TODO: handle noUi
304307
if (options.noUi) {
308+
setCancelButtonVisibility(true);
305309
const command = statementDetail.content.split(` `)[0].toUpperCase();
306310

307311
chosenView.setLoadingText(`Running CL command... (${command})`, false);
@@ -321,6 +325,7 @@ async function runHandler(options?: StatementInfo) {
321325
} else if ([`statement`, `update`].includes(statementDetail.qualifier)) {
322326
// If it's a basic statement, we can let it scroll!
323327
if (statementDetail.noUi) {
328+
setCancelButtonVisibility(true);
324329
chosenView.setLoadingText(`Running SQL statement... (${possibleTitle})`, false);
325330
await JobManager.runSQL(statementDetail.content, undefined, 1);
326331

@@ -460,6 +465,10 @@ async function runHandler(options?: StatementInfo) {
460465
}
461466
}
462467

468+
if (options.noUi) {
469+
setCancelButtonVisibility(false);
470+
}
471+
463472
updateStatusBar();
464473
}
465474
}

0 commit comments

Comments
 (0)