170 lines
6 KiB
PHTML
170 lines
6 KiB
PHTML
<h1>
|
|
<i class="glyphicon glyphicon-th-list"></i> <?php print htmlspecialchars($project->getTitle()); ?>
|
|
<small><?php echo $branch ?></small>
|
|
<div class="btn-group pull-right branch-btn">
|
|
<button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
|
|
Branch <span class="caret"></span>
|
|
</button>
|
|
<ul class="dropdown-menu" role="menu">
|
|
<?php foreach ($branches as $curbranch) : ?>
|
|
<li <?php echo ($curbranch == $branch) ? 'class="active"' : ''?>>
|
|
<a href="<?php echo PHPCI_URL ?>project/view/<?php print $project->getId(); ?>/<?php echo urlencode($curbranch) ?>">
|
|
<?php echo $curbranch ?>
|
|
</a>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
<li class="divider"></li>
|
|
<li><a href="<?php echo PHPCI_URL ?>project/view/<?php print $project->getId(); ?>">All</a></li>
|
|
</ul>
|
|
</div>
|
|
</h1>
|
|
|
|
|
|
<div class="row">
|
|
<div class="col-lg-3">
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading">
|
|
<h3 class="panel-title">Options</h3>
|
|
</div>
|
|
|
|
<div class="list-group">
|
|
<a class="list-group-item"
|
|
href="<?php echo PHPCI_URL ?>project/build/<?php print $project->getId() . ((!empty($branch)) ? '/' . urlencode($branch) : ''); ?>">
|
|
<i class="glyphicon glyphicon-cog"></i> Build <?php print (!empty($branch)) ? 'Branch' : ''; ?> Now
|
|
</a>
|
|
|
|
<?php if($this->User()->getIsAdmin()): ?>
|
|
<a class="list-group-item" href="<?php echo PHPCI_URL ?>project/edit/<?php print $project->getId(); ?>"><i class="glyphicon glyphicon-edit"></i> Edit Project</a>
|
|
<a class="list-group-item" href="#" id="delete-project"><i class="glyphicon glyphicon-trash"></i> Delete Project</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if (in_array($project->getType(), array('github', 'gitlab', 'bitbucket'))): ?>
|
|
<div class="panel panel-info">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">Webhooks</h4>
|
|
</div>
|
|
|
|
<div class="panel-body">
|
|
To automatically build this project when new commits are pushed, add the URL below
|
|
|
|
<?php
|
|
switch($project->getType())
|
|
{
|
|
case 'github':
|
|
$url = PHPCI_URL . 'webhook/github/' . $project->getId();
|
|
print ' as a "WebHook URL" in the <a href="https://github.com/' . $project->getReference() . '/settings/hooks">Service Hooks</a> section of your Github repository.<br><br><strong style="word-wrap: break-word;">' . $url . '</strong>';
|
|
break;
|
|
|
|
case 'gitlab':
|
|
$url = PHPCI_URL. 'webhook/gitlab/' . $project->getId();
|
|
print ' as a "WebHook URL" in the Web Hooks section of your Gitlab repository.<br><br><strong style="word-wrap: break-word;">' . $url . '</strong>';
|
|
break;
|
|
|
|
case 'bitbucket':
|
|
$url = PHPCI_URL . 'webhook/bitbucket/' . $project->getId();
|
|
print ' as a "POST" service in the <a href="https://bitbucket.org/' . $project->getReference() . '/admin/services">Services</a> section of your Bitbucket repository.<br><br><strong style="word-wrap: break-word;">' . $url . '</strong>';
|
|
break;
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($project->getSshPublicKey()): ?>
|
|
<div class="panel panel-info">
|
|
<div class="panel-heading"><h3 class="panel-title"><a data-toggle="collapse" data-parent="#accordion" href="#publicCollapse">Public Key</a></h3></div>
|
|
<div id="publicCollapse" class="panel-collapse collapse out">
|
|
<div class="panel-body word-wrap"><?php print $project->getSshPublicKey(); ?></div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="col-lg-9">
|
|
|
|
|
|
|
|
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading">
|
|
|
|
<h3 class="panel-title">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>
|
|
|
|
<?php
|
|
|
|
print '<div><ul class="pagination">';
|
|
|
|
$project_url = PHPCI_URL . 'project/view/' . $project->getId() . ((!empty($branch)) ? '/' . urlencode($branch) : '');
|
|
|
|
if ($page > 1) {
|
|
print '<li><a href="' . $project_url . '?p='.($page == 1 ? '1' : $page - 1).'">« Prev</a></li>';
|
|
}
|
|
|
|
if ($pages > 1) {
|
|
for($i = 1; $i <= $pages; $i++)
|
|
{
|
|
if ($i == $page) {
|
|
print '<li><span>' . $i . '</span></li>';
|
|
} else {
|
|
print '<li><a href="' . $project_url . '?p=' . $i . '">' . $i . '</a></li>';
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($page < $pages) {
|
|
print '<li><a href="' . $project_url . '?p='.($page == $pages ? $pages : $page + 1).'">Next »</a></li>';
|
|
}
|
|
|
|
print '</ul></div>';
|
|
|
|
?>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<?php if($page == 1): ?>
|
|
<script>
|
|
setInterval(function()
|
|
{
|
|
$.ajax({
|
|
url: '<?php echo PHPCI_URL ?>project/builds/<?php print $project->getId() . ((!empty($branch)) ? '/' . urlencode($branch) : ''); ?>',
|
|
|
|
success: function (data) {
|
|
$('#latest-builds').html(data);
|
|
$('#latest-builds').trigger('latest-builds:reload');
|
|
},
|
|
|
|
error: handleFailedAjax
|
|
});
|
|
}, 10000);
|
|
|
|
$(function() {
|
|
$('#delete-project').on('click', function (e) {
|
|
e.preventDefault();
|
|
confirmDelete(
|
|
"<?php echo PHPCI_URL ?>project/delete/<?php print $project->getId(); ?>", "Project"
|
|
).onCloseConfirmed = function () {window.location = '/'};
|
|
});
|
|
})
|
|
</script>
|
|
<?php endif; ?>
|