phpci/PHPCI/View/Home/index.phtml

94 lines
2.6 KiB
PHTML

<div id="title">
<h1><i class="glyphicon glyphicon-home"></i> Dashboard</h1>
</div>
<div class="row">
<div class="col-lg-3">
<?php if (count($projects)): ?>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">Projects</h4>
</div>
<div class="list-group">
<?php foreach($projects as $project): ?>
<a class="list-group-item" href="<?php echo PHPCI_URL ?>project/view/<?php print $project->getId(); ?>"><?php print htmlspecialchars($project->getTitle()); ?></a>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
</div>
<div class="col-lg-9">
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Project Overview</h3></div>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Health</th>
<th>Project</th>
<th>Last Success</th>
<th>Last Failure</th>
<th>Success/Failures</th>
<th style="width: 100px"></th>
</tr>
</thead>
<tbody id="project-overview">
<?php print $summary; ?>
</tbody>
</table>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Last 5 Builds</h3>
</div>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>ID</th>
<th>Project</th>
<th>Commit</th>
<th>Branch</th>
<th>Status</th>
<th style="width: 100px"></th>
</tr>
</thead>
<tbody id="latest-builds">
<?php print $builds; ?>
</tbody>
</table>
</div>
</div>
</div>
<script>
var refreshProjectData = function()
{
$.ajax({
url: '<?php echo PHPCI_URL ?>home/latest',
success: function (data) {
$('#latest-builds').html(data);
$('#latest-builds').trigger('latest-builds:reload');
},
error: handleFailedAjax
});
$.ajax({
url: '<?php echo PHPCI_URL ?>home/summary',
success: function (data) {
$('#project-overview').html(data);
$('#project-overview').trigger('project-overview:reload');
},
error: handleFailedAjax
});
};
setInterval(refreshProjectData, 10000);
</script>