Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: b22a6beec5
Fetching contributors…

Cannot retrieve contributors at this time

199 lines (160 sloc) 4.639 kb
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>Powered by Iron.io</title>
<style type="text/css">
body {
margin-top: 1.0em;
font-family: Helvetica, Arial, FreeSans, san-serif;
}
a:visited {
color: darkblue;
}
/*a:visited#main {*/
/*color: red;*/
/*}*/
#container {
margin: 0 auto;
width: 800px;
}
h1 {
font-size: 3.1em;
margin-bottom: 3px;
/*letter-spacing: -2px;*/
}
h1 .sw {
color: #1e90ff;
}
h1 .iw {
color: #b22222;
}
h1 .small {
font-size: 0.4em;
}
h1 a {
text-decoration: none
}
h2 {
font-size: 1.5em;
color: #1e90ff;
}
h3 {
text-align: center;
color: #1e90ff;
}
a {
color: #1e90ff;
}
.description {
font-size: 1.2em;
margin-bottom: 30px;
margin-top: 30px;
}
.download {
float: right;
}
pre {
background: #000;
color: #fff;
padding: 15px;
}
hr {
border: 0;
width: 80%;
border-bottom: 1px solid #aaa
}
.footer {
text-align: center;
padding-top: 30px;
font-style: italic;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery.ba-dotimeout.min.js"></script>
</head>
<body>
<br/><br/>
<div id="container">
<h1><a href="http://www.iron.io" id="main">Powered by Iron.io</a></h1>
<p>
This is an example application that uses <a href="http://www.iron.io/products/mq">IronMQ</a>
and <a href="http://www.iron.io/products/worker">IronWorker</a> together. If you click
the &quot;Run TweetWorker&quot; button below, that will queue up a
<a href="https://github.com/iron-io/heroku_sinatra_example/blob/master/workers/tweet_worker.rb">TweetWorker</a> task
on IronWorker. TweetWorker is a worker that gets the latest tweet tagged with #cloud and push that
tweet onto a queue on IronMQ.
<br/><br/>
This page you are looking at grabs tweets off the same queue on IronMQ and displays them. To see
more tweets, keep running TweetWorker.
</p>
<div>
<% if @msg %>
Latest Tweet:
<br/>
<span style="font-weight: bold;">
<%= @msg.body %>
</span>
<% else %>
<div style="color: red;">
There are no more tweets in the queue. Run TweetWorker to get another one.
</div>
<% end %>
</div>
<div class="description">
<form action="/run_tweet_worker" method="post">
<button>Run TweetWorker</button>
</form>
</div>
<script>
var keep_going = true;
$.doTimeout(2000, function () {
var jqxhr = $.getJSON("/worker_status", function (json) {
// alert("success");
console.log("json");
console.log(json);
if (json.status != null) {
var msg = "Task status: " + json.status;
if (json.status != "complete") {
// if (json.msg != null) {
msg = msg + "<br/>Percent complete: " + json.percent + "%";
// }
msg = msg + "<br/>" + json.msg;
}
$("#status_div").html(msg);
keep_going = true;
} else {
keep_going = false;
$("#status_indicator").hide();
}
})
// .success(function() { alert("second success"); })
.error(function () {
alert("error");
keep_going = false;
})
// .complete(function() { alert("complete"); });
return keep_going;
});
</script>
<div id="status_container" style="display: none;">
<div id="status_indicator" style="display: inline-block; width: 40px;">
<img src="/images/ajax-loader.gif"/>
</div>
<div id="status_div">
</div>
</div>
<script>
<% if @running %>
$("#status_container").show();
<% else %>
$("#status_container").hide();
<% end %>
</script>
<div class="footer">
Source code for this project is on
<a href="https://github.com/iron-io/heroku_sinatra_example" target="_blank">Github</a>
</div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.