php-censor/src/PHPCensor/View/Project/ajax-builds.phtml

105 lines
3.2 KiB
PHTML
Raw Normal View History

2016-07-19 20:28:11 +02:00
<?php use PHPCensor\Helper\Lang; ?>
2013-05-10 13:28:43 +02:00
<?php if(empty($builds) || !count($builds)): ?>
2017-01-06 12:39:04 +01:00
<tr class="">
<td colspan="6"><?php Lang::out('no_builds_yet'); ?></td>
</tr>
2013-05-10 13:28:43 +02:00
<?php endif; ?>
<?php foreach($builds as $build): ?>
2013-05-10 13:28:43 +02:00
<?php
switch($build->getStatus())
{
2017-01-06 12:39:04 +01:00
case 0:
$cls = 'active';
$subcls = 'info';
$status = Lang::get('pending');
break;
case 1:
$cls = 'warning';
$subcls = 'warning';
$status = Lang::get('running');
break;
case 2:
$cls = 'success';
$subcls = 'success';
$status = Lang::get('success');
break;
case 3:
$cls = 'danger';
$subcls = 'danger';
$status = Lang::get('failed');
break;
2013-05-10 13:28:43 +02:00
}
2017-03-23 13:53:24 +01:00
$branches = $build->getExtra('branches');
2013-05-10 13:28:43 +02:00
?>
2017-01-06 12:39:04 +01:00
<tr>
<td><a href="<?php echo APP_URL ?>build/view/<?php print $build->getId(); ?>">#<?php print str_pad($build->getId(), 6, '0', STR_PAD_LEFT); ?></a></td>
2017-04-09 17:51:03 +02:00
<td><span class='label label-<?php echo $subcls ?>'><?php echo $status ?></span></td>
<td><?php print $build->getCreated()->format('Y-m-d H:i:s'); ?></td>
<td class="hidden-md hidden-sm hidden-xs">
2014-03-12 16:22:57 +01:00
<?php
if ($build->getCommitId() !== 'Manual') {
print sprintf(
'<a href="%s" target="_blank">%s (%s)</a>',
$build->getCommitLink(),
substr($build->getCommitId(), 0, 7),
$build->getCommitterEmail()
);
} else {
2014-12-04 13:19:06 +01:00
print Lang::get('manual_build');
2014-03-12 16:22:57 +01:00
}
?>
</td>
2017-03-23 13:53:24 +01:00
<td>
2017-04-22 16:06:53 +02:00
<a href="<?= $build->getBranchLink(); ?>" target="_blank">
<i class="fa fa-code-fork"></i> <?= $build->getBranch(); ?>
2017-04-22 16:06:53 +02:00
</a>
2017-04-22 15:02:24 +02:00
<?= $branches ? ' + '.implode(', ', $branches) : ''; ?>
<?php if ($tag = $build->getTag()): ?>
(<a href="<?= $build->getTagLink(); ?>" target="_blank">
<i class="fa fa-tag"></i> <?= $tag; ?>
</a>)
2017-04-22 15:02:24 +02:00
<?php endif; ?>
2017-03-23 13:53:24 +01:00
</td>
2017-01-06 12:39:04 +01:00
<td>
2017-04-09 17:51:03 +02:00
<?php
$environment = $build->getEnvironment();
echo !empty($environment) ? $environment : '—' ;
?>
2017-01-06 12:39:04 +01:00
</td>
<td>
<?php print $build->getDuration(); ?> <?= Lang::get('seconds'); ?>
</td>
2017-01-06 12:39:04 +01:00
<td>
<div class="btn-group btn-group-right">
2017-01-06 12:39:04 +01:00
<a class="btn btn-default btn-sm" href="<?php echo APP_URL ?>build/view/<?php print $build->getId(); ?>"><?php Lang::out('view'); ?></a>
<?php if($this->User()->getIsAdmin()): ?>
<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="<?php echo APP_URL ?>build/delete/<?php print $build->getId(); ?>" class="delete-build"><?php Lang::out('delete_build'); ?></a></li>
2017-01-06 12:39:04 +01:00
</ul>
<?php endif; ?>
</div>
</td>
2013-05-10 13:28:43 +02:00
</tr>
<?php endforeach; ?>
<script>
$(document).ready(function() {
$('.delete-build').on('click', function (e) {
e.preventDefault();
confirmDelete(e.target.href)
.onCloseConfirmed = function () {window.location = window.location.href};
});
});
</script>