forked from rubenfonseca/map_crowd_reduce
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:rubenfonseca/map_crowd_reduce
Conflicts: views/compute.haml
- Loading branch information
Showing
6 changed files
with
112 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
function smessage(m){ | ||
document.getElementById("status").innerHTML += '<p>' + m + '</p>'; | ||
} | ||
|
||
function supports_web_workers() { return !!window.Worker; } | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
%h1= title | ||
|
||
%link{href:"http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css", rel:"stylesheet", type:"text/css"} | ||
%script{src: "https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"} | ||
%script{src: "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js"} | ||
%script{src: "/socket.io/socket.io.js"} | ||
%script{src: "/mcr.js"} | ||
:javascript | ||
$(function() { | ||
$('#progressbar').progressbar({ value: 0 }); | ||
}); | ||
var socket = new io.Socket(window.location.hostname, {'port': window.location.port}); | ||
socket.on('connect', function(){ | ||
smessage('Connected. Not working, just monitoring...'); | ||
socket.send({message: 'monitor', uuid: "#{uuid}"}); | ||
}); | ||
|
||
socket.on('message', function(data) { | ||
if(data.message == "result" && data.uuid == "#{uuid}") { | ||
smessage('The result of this awesome computation is: ' + data.data ); | ||
$('#progressbar').progressbar({ value: 100 }); | ||
} else if(data.message == "status" && data.uuid == "#{uuid}") { | ||
$('#progressbar').progressbar({ value: data.percentage }); | ||
} | ||
}); | ||
|
||
socket.on('disconnect', function(){ | ||
smessage('Disconnected!'); | ||
}); | ||
|
||
if ( ! supports_web_workers() ) { | ||
smessage('Your browser does not support WebWorkers! But you can still monitor.'); | ||
} | ||
socket.connect(); | ||
|
||
|
||
#progressbar | ||
|
||
#text | ||
If you want to do some work, click | ||
%a{href: '/compute/' + uuid}this link | ||
|
||
#status | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters