Skip to content

Commit be47b2f

Browse files
authored
Merge pull request #174 from ty-d/NoProgressBarForCSPPages
No progress bar for csp pages
2 parents 760c290 + 7e06506 commit be47b2f

File tree

1 file changed

+35
-23
lines changed

1 file changed

+35
-23
lines changed

src/commands/studio.ts

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -249,29 +249,41 @@ class StudioActions {
249249
location: vscode.ProgressLocation.Notification,
250250
title: `Executing user action: ${action.label}`,
251251
},
252-
() =>
253-
this.api
254-
.actionQuery(query, parameters)
255-
.then(async (data) => {
256-
if (action.save) {
257-
await this.processSaveFlag(action.save);
258-
}
259-
outputConsole(data.console);
260-
return data.result.content.pop();
261-
})
262-
.then(this.processUserAction)
263-
.then((answer) => {
264-
if (answer) {
265-
return answer.msg || answer.msg === ""
266-
? this.userAction(action, true, answer.answer, answer.msg, type)
267-
: this.userAction(action, true, answer, "", type);
268-
}
269-
})
270-
.catch((err) => {
271-
console.log(err);
272-
outputChannel.appendLine(`Studio Action "${action.label}" not supported`);
273-
outputChannel.show();
274-
})
252+
() => {
253+
return new Promise((resolve) => {
254+
this.api
255+
.actionQuery(query, parameters)
256+
.then(async (data) => {
257+
if (action.save) {
258+
await this.processSaveFlag(action.save);
259+
}
260+
if (!afterUserAction) {
261+
outputConsole(data.console);
262+
}
263+
const actionToProcess = data.result.content.pop();
264+
265+
// CSP pages should not have a progress bar
266+
if (actionToProcess.action === 2) {
267+
resolve();
268+
}
269+
return actionToProcess;
270+
})
271+
.then(this.processUserAction)
272+
.then((answer) => {
273+
if (answer) {
274+
return answer.msg || answer.msg === ""
275+
? this.userAction(action, true, answer.answer, answer.msg, type)
276+
: this.userAction(action, true, answer, "", type);
277+
}
278+
})
279+
.then(() => resolve())
280+
.catch((err) => {
281+
console.log(err);
282+
outputChannel.appendLine(`Studio Action "${action.label}" not supported`);
283+
outputChannel.show();
284+
});
285+
});
286+
}
275287
);
276288
}
277289

0 commit comments

Comments
 (0)