Skip to content

Commit

Permalink
Show a jenkins view.
Browse files Browse the repository at this point in the history
Signed-off-by: François de Metz <fdemetz@af83.com>
  • Loading branch information
francois2metz committed Apr 21, 2011
1 parent 7f90f6b commit 89b8c54
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions index.html
@@ -0,0 +1,12 @@
<html>
<body>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript" src="jenkins.js"></script>
<script type="text/javascript">
// wanna watch a jenkins project ?
new JenkinsState({project: "jenkins_main_trunk", host: "ci.jenkins-ci.org"});
// wanna watch a jenkins view ?
new JenkinsViewState({view: "Infrastructure", host: "ci.jenkins-ci.org"});
</script>
</body>
</html>
20 changes: 20 additions & 0 deletions jenkins.js
Expand Up @@ -39,4 +39,24 @@
// ask the state to jenkins.
query();
}

/**
* Use to watch a view state on jenkins
*/
win.JenkinsViewState = function(options) {
$.ajax({
url: "http://" + options.host + "/view//" + options.view + "/api/json",
dataType: "jsonp",
jsonp: 'jsonp',
success: function(data) {
$(data.jobs).each(function(i, job) {
new JenkinsState({
project: job.name,
host: options.host
});
});
}
})
}

})(window, jQuery);

0 comments on commit 89b8c54

Please sign in to comment.