2017-04-13 06:39:02 +02:00
|
|
|
<?php
|
2017-04-03 16:19:51 +02:00
|
|
|
|
2017-04-13 06:39:02 +02:00
|
|
|
use PHPCensor\Helper\Lang;
|
2017-04-03 16:19:51 +02:00
|
|
|
use PHPCensor\Model\Build;
|
|
|
|
|
2017-10-15 16:58:36 +02:00
|
|
|
/**
|
|
|
|
* @var Build[] $builds
|
|
|
|
*/
|
|
|
|
|
2017-04-03 16:19:51 +02:00
|
|
|
?>
|
2017-01-14 19:11:32 +01:00
|
|
|
<ul class="timeline">
|
|
|
|
<?php $last = new \DateTime('-1 Year'); ?>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
foreach ($builds as $build):
|
2017-03-23 13:53:24 +01:00
|
|
|
$environment = $build->getEnvironment();
|
|
|
|
$branches = $build->getExtra('branches');
|
|
|
|
|
2017-01-14 19:11:32 +01:00
|
|
|
switch ($build->getStatus()) {
|
2017-04-03 16:19:51 +02:00
|
|
|
case Build::STATUS_PENDING:
|
2017-10-15 16:58:36 +02:00
|
|
|
$updated = $build->getCreateDate();
|
2017-01-14 19:11:32 +01:00
|
|
|
$label = Lang::get('pending');
|
|
|
|
$color = 'blue';
|
|
|
|
break;
|
|
|
|
|
2017-04-03 16:19:51 +02:00
|
|
|
case Build::STATUS_RUNNING:
|
2017-10-15 16:58:36 +02:00
|
|
|
$updated = $build->getStartDate();
|
2017-01-14 19:11:32 +01:00
|
|
|
$label = Lang::get('running');
|
|
|
|
$color = 'yellow';
|
|
|
|
break;
|
|
|
|
|
2017-04-03 16:19:51 +02:00
|
|
|
case Build::STATUS_SUCCESS:
|
2017-10-15 16:58:36 +02:00
|
|
|
$updated = $build->getFinishDate();
|
2017-01-14 19:11:32 +01:00
|
|
|
$label = Lang::get('success');
|
|
|
|
$color = 'green';
|
|
|
|
break;
|
|
|
|
|
2017-04-03 16:19:51 +02:00
|
|
|
case Build::STATUS_FAILED:
|
2017-10-15 16:58:36 +02:00
|
|
|
$updated = $build->getFinishDate();
|
2017-01-14 19:11:32 +01:00
|
|
|
$label = Lang::get('failed');
|
|
|
|
$color = 'red';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$updated) {
|
2017-10-15 16:58:36 +02:00
|
|
|
$updated = $build->getCreateDate();
|
2017-01-14 19:11:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($updated->format('Y-m-d') != $last->format('Y-m-d')): $last = $updated;
|
|
|
|
?>
|
|
|
|
<li class="time-label">
|
|
|
|
<span class="bg-gray">
|
2017-01-15 11:28:15 +01:00
|
|
|
<?= $last->format('Y-m-d'); ?>
|
2017-01-14 19:11:32 +01:00
|
|
|
</span>
|
|
|
|
</li>
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<!-- /.timeline-label -->
|
|
|
|
<!-- timeline item -->
|
|
|
|
<li>
|
2018-03-09 12:15:38 +01:00
|
|
|
<i class="fa fa-<?= $build->getProject()->getIcon(); ?> bg-<?= $color; ?>"></i>
|
2017-01-14 19:11:32 +01:00
|
|
|
<div class="timeline-item">
|
2017-03-16 13:36:48 +01:00
|
|
|
<span class="time"><i class="fa fa-clock-o"></i>
|
2017-12-13 16:40:51 +01:00
|
|
|
<?php
|
2017-04-22 17:02:27 +02:00
|
|
|
echo $updated->format('H:i:s');
|
|
|
|
if ($build->getStatus() != Build::STATUS_PENDING) {
|
|
|
|
echo ' — ' . $build->getDuration(); ?> <?= Lang::get('seconds');
|
|
|
|
}
|
2017-03-16 13:36:48 +01:00
|
|
|
?>
|
|
|
|
</span>
|
2017-01-14 19:11:32 +01:00
|
|
|
<h3 class="timeline-header">
|
2017-05-08 09:51:32 +02:00
|
|
|
<a href="<?= APP_URL; ?>project/view/<?= $build->getProjectId(); ?>">
|
|
|
|
<?= $build->getProject()->getTitle(); ?>
|
2017-02-28 15:04:14 +01:00
|
|
|
</a>
|
2017-05-08 09:51:32 +02:00
|
|
|
<span><?= $environment; ?></span>
|
2017-12-13 16:40:51 +01:00
|
|
|
—
|
2017-05-08 09:51:32 +02:00
|
|
|
<a href="<?= APP_URL; ?>build/view/<?= $build->getId(); ?>">
|
2017-12-13 16:40:51 +01:00
|
|
|
<?php Lang::out('build'); ?> #<?= $build->getId(); ?>
|
2017-01-14 19:11:32 +01:00
|
|
|
</a>
|
2017-12-13 16:40:51 +01:00
|
|
|
—
|
2017-04-13 17:00:29 +02:00
|
|
|
<?php Lang::out($build->getSourceHumanize()); ?>
|
2017-12-13 16:40:51 +01:00
|
|
|
<?php if ($newErrorsCount = $build->getNewErrorsCount()): ?>
|
|
|
|
—
|
|
|
|
<?php Lang::out('new_errors'); ?>:
|
|
|
|
<?= $newErrorsCount; ?>
|
|
|
|
<?php endif; ?>
|
2017-01-14 19:11:32 +01:00
|
|
|
</h3>
|
|
|
|
|
|
|
|
<div class="timeline-body">
|
2018-02-28 04:19:02 +01:00
|
|
|
<p>
|
2018-02-23 13:31:06 +01:00
|
|
|
<?php if (Build::SOURCE_WEBHOOK_PULL_REQUEST === $build->getSource()): ?>
|
|
|
|
<a href="<?= $build->getRemoteBranchLink(); ?>">
|
|
|
|
<i class="fa fa-code-fork"></i>
|
|
|
|
<?= $build->getRemoteBranch(); ?> :
|
|
|
|
</a>
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<a href="<?= $build->getBranchLink(); ?>">
|
|
|
|
<i class="fa fa-code-fork"></i>
|
|
|
|
<?= $build->getBranch(); ?>
|
|
|
|
</a>
|
2017-04-22 16:48:54 +02:00
|
|
|
<?= $branches ? ' + '.implode(', ', $branches) : ''; ?>
|
2017-12-13 16:40:51 +01:00
|
|
|
<?php if ($tag = $build->getTag()): ?> /
|
2018-02-23 13:31:06 +01:00
|
|
|
<a href="<?= $build->getTagLink(); ?>">
|
|
|
|
<i class="fa fa-tag"></i>
|
|
|
|
<?= $tag; ?>
|
2017-04-22 16:56:51 +02:00
|
|
|
</a>
|
2017-04-22 16:48:54 +02:00
|
|
|
<?php endif; ?>
|
2017-01-14 19:11:32 +01:00
|
|
|
<?php
|
2017-04-13 17:00:29 +02:00
|
|
|
if (!empty($build->getCommitId())) {
|
|
|
|
echo ' — ';
|
|
|
|
echo sprintf(
|
2018-02-23 13:31:06 +01:00
|
|
|
'<a href="%s">%s %s</a>',
|
2017-04-13 17:00:29 +02:00
|
|
|
$build->getCommitLink(),
|
|
|
|
substr($build->getCommitId(), 0, 7),
|
|
|
|
$build->getCommitterEmail() ? ('(' . $build->getCommitterEmail() . ')') : ''
|
|
|
|
);
|
2018-03-09 19:00:53 +01:00
|
|
|
$buildCommitMessage = htmlspecialchars($build->getCommitMessage());
|
|
|
|
if ($buildCommitMessage) {
|
2018-02-28 04:19:02 +01:00
|
|
|
echo '</p><p>';
|
2018-03-09 19:00:53 +01:00
|
|
|
echo $buildCommitMessage;
|
2017-04-13 17:00:29 +02:00
|
|
|
}
|
|
|
|
}
|
2017-01-14 19:11:32 +01:00
|
|
|
?>
|
2018-02-28 04:19:02 +01:00
|
|
|
</p>
|
2017-01-14 19:11:32 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<!-- END timeline item -->
|
|
|
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
|
|
<li>
|
|
|
|
<i class="fa fa-clock-o"></i>
|
|
|
|
</li>
|
|
|
|
</ul>
|