Files
codeocean/app/assets/javascripts/editor/execution.js.erb
Alexander Kastius 3fd43fdee2 Sending command 'client_kill' on stop button click now.
Killing a container only if command client_kill was send.
Moved propmpt to prompt.js
2016-09-09 16:41:20 +02:00

49 lines
1.7 KiB
Plaintext

CodeOceanEditorWebsocket = {
websocket: null,
createSocketUrl: function(url) {
return '<%= DockerClient.config['ws_client_protocol'] %>' + window.location.hostname + ':' + window.location.port + url;
},
initializeSocket: function(url) {
this.websocket = new CommandSocket(this.createSocketUrl(url),
function (evt) {
this.resetOutputTab();
}.bind(this)
);
this.websocket.onError(this.showWebsocketError.bind(this));
},
initializeSocketForTesting: function(url) {
this.initializeSocket(url);
this.websocket.on('default',this.handleTestResponse.bind(this));
this.websocket.on('exit', this.handleExitCommand.bind(this));
},
initializeSocketForScoring: function(url) {
this.initializeSocket(url);
this.websocket.on('default',this.handleScoringResponse.bind(this));
this.websocket.on('exit', this.handleExitCommand.bind(this));
},
initializeSocketForRunning: function(url) {
this.initializeSocket(url);
this.websocket.on('input',this.showPrompt.bind(this));
this.websocket.on('write', this.printWebsocketOutput.bind(this));
this.websocket.on('turtle', this.handleTurtleCommand.bind(this));
this.websocket.on('turtlebatch', this.handleTurtlebatchCommand.bind(this));
this.websocket.on('render', this.renderWebsocketOutput.bind(this));
this.websocket.on('exit', this.handleExitCommand.bind(this));
this.websocket.on('timeout', this.showTimeoutMessage.bind(this));
this.websocket.on('status', this.showStatus.bind(this));
},
handleExitCommand: function() {
this.killWebsocket();
this.handleQaApiOutput();
this.handleStderrOutputForFlowr();
this.augmentStacktraceInOutput();
this.cleanUpTurtle();
this.cleanUpUI();
}
};