-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build request web page and improved navigation topbar.
- Loading branch information
Showing
4 changed files
with
176 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
<body> | ||
|
||
<div class="navbar navbar-inverse navbar-fixed-top"> | ||
<div class="navbar-inner"> | ||
<div class="container-fluid"> | ||
<a class="brand" href="http://cms-sw.github.com/cmssw/faq.html">CMS Topic Collector</a> | ||
<ul class="nav"> | ||
<li><a href=".">Pull requests</a></li> | ||
<li><a href="externals">Externals</a></li> | ||
<li class="active"><a href="buildrequests">Build requests</a></li> | ||
</ul> | ||
<ul class="nav pull-right"> | ||
<li> | ||
<form id="formbox" class="navbar-search pull-left" target="_blank" action="https://github.com/cms-sw/cmssw/search"> | ||
<input name="q" type="text" class="search-query" placeholder="Search"/> | ||
</form> | ||
<li> | ||
<li class="dropdown"> | ||
<a id="userInfo" class="dropdown-toggle" data-toggle="dropdown" href="#"></a> | ||
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"> | ||
<li id="userCern"></li> | ||
<li id="userGithub"></li> | ||
<li class="divider"></li> | ||
<li><a href="https://login.cern.ch/adfs/ls/?wa=wsignout1.0">Logout</a></li> | ||
</ul> | ||
</li> | ||
<li><a href="http://cms-sw.github.com/cmssw/faq.html">Help</a></li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row-fluid"> | ||
<div class="container-fluid"> | ||
<div id="myAlert" class="span12" style='padding: 15px;'></div> | ||
</div> | ||
</div> | ||
<div class="row-fluid"> | ||
<div class="container-fluid"> | ||
<div id="stateTabs" class="span12"></div> | ||
</div> | ||
</div> | ||
<div class="row-fluid"> | ||
<div class="container-fluid"> | ||
<table id="buildrequests" class="table"> | ||
<thead> | ||
<tr><th>Id</th><th>Release</th><th>Package</th><th>Repository</th><th>Architecture</th><th>PKGTOOLS</th><th>CMSDIST</th><th>Machine</th></tr> | ||
</thead> | ||
<tbody> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script> | ||
<script src="js/bootstrap.min.js"></script> | ||
<script src="js/mustache.min.js"></script> | ||
<script> | ||
|
||
function mainLoop() { | ||
var currentState = window.location.hash.slice(1, window.location.hash.length); | ||
$("#stateTabs li.active").removeClass("active"); | ||
$.get("../buildrequests?state=" + currentState).done(function(d,a,b) { | ||
$("#myAlert").html(""); | ||
var table = ""; | ||
var tableRow = "<tr><td>{{id}}</td><td>{{release}}</td><td>{{payload.package}}</td><td>{{payload.repository}}</td>" + | ||
"<td>{{architecture}}</td><td>{{payload.PKGTOOLS}}</td><td>{{payload.CMSDIST}}</td>" + | ||
"<td>{{#url}}<a href='{{url}}'>{{/url}}{{#machine}}{{machine}} (pid:{{pid}}){{/machine}}{{#url}}</a>{{/url}}</td>"; | ||
for (var i = 0; i < d.length; ++i) | ||
table += Mustache.render(tableRow, d[i]); | ||
$("#buildrequests tbody").html(table); | ||
$("#stateTabs li.active").removeClass("active"); | ||
$("#li_" + currentState).addClass("active"); | ||
}).error(function(d,a,b){ | ||
$("#buildrequests tbody").html(""); | ||
$("#stateTabs li.active").removeClass("active"); | ||
$("#li_" + currentState).addClass("active"); | ||
$("#myAlert").html('<div class="alert alert-error"><strong>Unable to find build requests.</strong></div></div>'); | ||
}); | ||
} | ||
|
||
$(document).ready(function() { | ||
|
||
$(window).bind('hashchange', mainLoop); | ||
var userInfoPromise = $.post("api/auth").done(function(d,a,b) { | ||
$("#formbox").attr("action", "https://github.com/" + d["repository"] + "/search"); | ||
$("#userInfo").html("Welcome " + d["firstname"] + "<b class='caret'></b>"); | ||
$("#userCern").html("<a href='#'>CERN: " + d["user"] + "</a>"); | ||
$("#userGithub").html("<a href='#'>github: " + d["githubUser"] + "</a>"); | ||
var userCategories = d["categories"]; | ||
var userCanSign = {} | ||
var mapEgroups = { | ||
"cms-git-core": "Core", | ||
"cms-git-analysis": "Analysis", | ||
"cms-git-alca": "AlCa", | ||
"cms-git-daq": "DAQ", | ||
"cms-git-dqm": "DQM", | ||
"cms-git-db": "DB", | ||
"cms-git-docs": "Docs", | ||
"cms-git-fastsim": "Fast simulation", | ||
"cms-git-simulation": "Simulation", | ||
"cms-git-generators": "Generators", | ||
"cms-git-geometry": "Geometry", | ||
"cms-git-hlt": "HLT", | ||
"cms-git-l1": "L1", | ||
"cms-git-operations": "Operations", | ||
"cms-git-reconstruction": "Reconstruction", | ||
"cms-git-visualization": "Visualization" | ||
} | ||
userInfo = d; | ||
var realCategories = []; | ||
for (var i = 0; i < userCategories.length; ++i) { | ||
if (userCategories[i] == "cms-git-admins") | ||
userInfo["isAdmin"] = true; | ||
var realName = mapEgroups[userCategories[i]]; | ||
if (!realName) | ||
continue; | ||
userCanSign[realName] = true; | ||
realCategories[realCategories.length] = realName; | ||
} | ||
userInfo["canSign"] = userCanSign; | ||
var categoriesSummaryTmpl = "<a>Signs for: <ul>{{#categories}}<li>{{.}}</li>{{/categories}}</ul></a>"; | ||
$("#userCategories").html(Mustache.render(categoriesSummaryTmpl, {"categories": realCategories})); | ||
|
||
}); | ||
|
||
var currentState = "Running"; | ||
|
||
var d = ["Pending", "Running", "Failed", "Cancelled", "Completed"]; | ||
// Create the tabs | ||
var tabs = '<div class="navbar"><div class="navbar-inner"><ul class="nav">'; | ||
|
||
var currentState = "Running"; | ||
if (window.location.hash) | ||
currentState = window.location.hash.slice(1, window.location.hash.length); | ||
|
||
var stateTemplate = "<li id='li_{{state}}' {{#active}}class='active'{{/active}}><a href='buildrequests#{{state}}'>{{state}}</a></li>"; | ||
for (var i = 0; i != d.length; ++i) | ||
{ | ||
var r = d[i]; | ||
var view = { | ||
active: currentState == r, | ||
state: r | ||
} | ||
tabs += Mustache.render(stateTemplate, view); | ||
} | ||
tabs += "</ul></div></div>"; | ||
$("#stateTabs").html(tabs); | ||
window.location.hash = "#" + currentState; | ||
mainLoop(); | ||
}); | ||
|
||
</script> | ||
</body> |
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