Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# jenkins-tinderbox

### To test locally

Run `node server.js` then `node run.js`

Open [tinderbox](http://localhost:3000).
14 changes: 14 additions & 0 deletions run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var express = require('express');
var fs = require('fs')
var app = express();

app.use(express.static(__dirname));
app.get('/', function(req, res){
fs.readFile('test.html', function(err, text) {
res.setHeader('Content-Type', 'text/html');
res.end(text);
})
});

app.listen(3000);
console.log('Listening on port 3000');
18 changes: 17 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

function getJSON(path, callback) {
var xmlhttp = new XMLHttpRequest();
// var url = "origin" + path;
origin = location.hostname === 'localhost' ? origin.replace('3000','8000') : origin; // use proxy for localhost to avoid CORS
var url = origin + path;

xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
Expand Down Expand Up @@ -177,4 +178,19 @@ getJSON('/api/json?tree=jobs[name,lastCompletedBuild[result,timestamp,url,descri

generateTable(tableData);
document.body.appendChild(document.createTextNode("Last updated: " + new Date()));
var cb_id = 'cb_ar';
var checkbox = document.createElement('input');
checkbox.id = cb_id;
checkbox.type = 'checkbox';
checkbox.checked = true;
checkbox.style.marginLeft = '100px';
document.body.appendChild(checkbox);
document.body.appendChild(document.createTextNode("Auto Refresh"));

setInterval(function() {
if (document.getElementById(cb_id).checked){
location.reload();
}
}, 30000);
});

3 changes: 2 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ var request = require('request');
http.createServer(function (req, res) {
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization");
req.pipe(request('http://localhost:8180' + req.url)).pipe(res);
req.pipe(request("https://ci.freebsd.org" + req.url)).pipe(res);
}).listen(8000);
console.log('Proxy running on port 8000');
2 changes: 1 addition & 1 deletion test.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<html>
<head>
<link rel="stylesheet" href="style.css" />
<title>FreeBSD CI TinderBox</title>
</head>
<body>

<script src="script.js"></script>
</body>
</html>