Skip to content

Commit 64816d6

Browse files
committed
Only allow stopping the current code execution when started
When a code execution is started, we shortly show a spinner on the Run button before it changes to Stop, allowing learners to abort the current code execution. However, previously, the Stop button was shown too early namely when the WebSocket connection was getting initialized. When it was immediately pressed after becoming available, it didn't had any effect. With the changes of this commit, we delay showing the Stop button, so that it will be shown only once the runner is actually beginning with the code execution (as indicated by the `container_running` status).
1 parent f289500 commit 64816d6

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

app/assets/javascripts/editor/editor.js.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,9 @@ var CodeOceanEditor = {
764764

765765
showStatus: function (output) {
766766
switch (output.status) {
767+
case 'container_running':
768+
this.toggleButtonStates();
769+
break;
767770
case 'timeout':
768771
case 'buffer_overflow':
769772
this.showTimeoutMessage();

app/assets/javascripts/editor/submissions.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ CodeOceanEditorSubmissions = {
196196
this.running = true;
197197
this.showSpinner($('#run'));
198198
$('#score_div').addClass('d-none');
199-
this.toggleButtonStates();
200199
await this.socketRunCode(submission.id, CodeOceanEditor.active_file.filename);
201200
},
202201

0 commit comments

Comments
 (0)