Created
August 21, 2012 05:04
-
-
Save yasuoza/3411816 to your computer and use it in GitHub Desktop.
Jenkins websocket XFD
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
<html> | |
<style> | |
.project { | |
height: 150px; | |
padding-top: 50px; | |
margin-bottom: 10px; | |
} | |
.project_label { | |
width: 600px; | |
line-height: 100px; | |
text-align: center; | |
margin: auto; | |
vertical-align: middle; | |
background-color: white; | |
} | |
</style> | |
<body> | |
<script> | |
var ws = new WebSocket('ws://localhost:8802/jenkins'); | |
ws.onmessage = function(msg) { | |
var obj = JSON.parse(msg.data); | |
var proj_id = obj.project.toLowerCase(), | |
proj_elem = document.getElementById(proj_id); | |
if (proj_elem == undefined) { | |
proj_elem = document.createElement('div'); | |
proj_elem.id = proj_id; | |
proj_elem.className = 'project'; | |
document.body.appendChild(proj_elem); | |
var proj_label = document.createElement('h1'); | |
proj_label.className = 'project_label'; | |
proj_label.textContent = obj.project; | |
proj_elem.appendChild(proj_label); | |
} | |
if(obj.result == 'SUCCESS'){ | |
proj_elem.style.backgroundColor = 'green'; | |
} else { | |
proj_elem.style.backgroundColor = 'red'; | |
} | |
}; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment