Skip to content
Snippets Groups Projects
Commit 0a061a12 authored by Etienne Kneuss's avatar Etienne Kneuss
Browse files

websocket URL no longer needed

parent 78ce67ae
No related branches found
No related tags found
No related merge requests found
## HOWTO RUN LEON ONLINE
1) go to leon-2.0 main directory
2) sbt package
3) cd web
4) export LD_LIBRARY_PATH=../lib-bin/64
4) play run
...@@ -16,9 +16,8 @@ object Application extends Controller { ...@@ -16,9 +16,8 @@ object Application extends Controller {
def index = Action { implicit request => def index = Action { implicit request =>
val prefix = Play.current.configuration.getString("app.prefix").getOrElse("") val prefix = Play.current.configuration.getString("app.prefix").getOrElse("")
val wsURL = Play.current.configuration.getString("app.wsURL").getOrElse(routes.Application.openConsole().webSocketURL())
Ok(views.html.index(examples, VerificationExamples.default, prefix, wsURL)) Ok(views.html.index(examples, VerificationExamples.default, prefix))
} }
def getExample(id: Int) = Action { def getExample(id: Int) = Action {
......
...@@ -109,6 +109,8 @@ class ConsoleSession extends Actor { ...@@ -109,6 +109,8 @@ class ConsoleSession extends Actor {
pipeline.run(ctx)((code, "--timeout=2" :: Nil)) pipeline.run(ctx)((code, "--timeout=2" :: Nil))
event("stopped")
case "synthesis" => case "synthesis" =>
event("started") event("started")
isStarted = true isStarted = true
......
@(exs: List[examples.Example], default: examples.Example, prefix: String, websocketURL: String)(implicit request: RequestHeader) @(exs: List[examples.Example], default: examples.Example, prefix: String)(implicit request: RequestHeader)
@main("Leon Online", prefix) { @main("Leon Online", prefix) {
<div id="allcontent"> <div id="allcontent">
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<div id="selectcolumn"> <div id="selectcolumn">
<h3>Load an Example:</h3> <h3>Load an Example:</h3>
<div>We provide you with a list of code-examples, select one from the list below to load it:</div> <div>We provide you with a list of code-examples, select one from the list below to load it:</div>
<select id="example-loader" name="codeexample" onchange="loadExample();"> <select id="example-loader" name="codeexample" onchange="loadExample('@prefix');">
<option value="">-- Load Example --</option> <option value="">-- Load Example --</option>
@exs.zipWithIndex.map{ case (ex, i) => @exs.zipWithIndex.map{ case (ex, i) =>
<option value="@i">@ex.title</option> <option value="@i">@ex.title</option>
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<script> <script>
$(document).ready(function() { $(document).ready(function() {
var WS = window['MozWebSocket'] ? MozWebSocket : WebSocket var WS = window['MozWebSocket'] ? MozWebSocket : WebSocket
var leonSocket = new WS("@websocketURL") var leonSocket = new WS("@leon.web.controllers.routes.Application.openConsole().webSocketURL()")
var sendMessage = function() { var sendMessage = function() {
} }
...@@ -40,7 +40,10 @@ ...@@ -40,7 +40,10 @@
if (data.kind == "error") { if (data.kind == "error") {
alert(data.message); alert(data.message);
} else if (data.kind == "log") { } else if (data.kind == "log") {
$("#consolebox").val($("#consolebox").val()+"\n"+data.message); var txt = $("#consolebox")
txt.val(txt.val()+"\n"+data.message);
txt.scrollTop(txt[0].scrollHeight - txt.height())
} else if (data.kind == "event") { } else if (data.kind == "event") {
if (data.event == "started") { if (data.event == "started") {
$("#askbutton").val("... processing ...") $("#askbutton").val("... processing ...")
......
...@@ -46,7 +46,4 @@ logger.play=INFO ...@@ -46,7 +46,4 @@ logger.play=INFO
logger.application=DEBUG logger.application=DEBUG
# This specifies the prefix under which the web page lies, used almost exclusively for the laraserver setup # This specifies the prefix under which the web page lies, used almost exclusively for the laraserver setup
# app.prefix=/leon app.prefix=/leon
# Defines a specific URL to the websocket service
# app.wsURL="ws://laraserver.epfl.ch:9000/openConsole"
...@@ -4,12 +4,12 @@ function appendError(title, msg) { ...@@ -4,12 +4,12 @@ function appendError(title, msg) {
alert(title+": "+msg) alert(title+": "+msg)
} }
function loadExample() { function loadExample(prefix) {
var value = $("#example-loader").val() var value = $("#example-loader").val()
if (value) { if (value) {
$.ajax({ $.ajax({
url: '/ajax/getExample/'+value, url: prefix+'/ajax/getExample/'+value,
dataType: "json", dataType: "json",
success: function(data, textStatus, jqXHR) { success: function(data, textStatus, jqXHR) {
if (data.status == "success") { if (data.status == "success") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment