Redesigned build summary for the dashboard to include recent builds.
Closes #783 Closes #708
This commit is contained in:
parent
ffe01df5b5
commit
6233dfa714
|
@ -3,17 +3,32 @@ use PHPCI\Helper\Lang;
|
|||
|
||||
foreach($projects as $project):
|
||||
$statuses = array();
|
||||
$successes = 0;
|
||||
$failures = 0;
|
||||
$subcls = '';
|
||||
$subcls = 'yellow';
|
||||
$cls = '';
|
||||
|
||||
$success = null;
|
||||
$failure = null;
|
||||
|
||||
if (count($builds[$project->getId()])) {
|
||||
// Get the most recent build status to determine the main block colour.
|
||||
$last_build = $builds[$project->getId()][0];
|
||||
$status = $last_build->getStatus();
|
||||
switch($status) {
|
||||
case 0:
|
||||
$subcls = 'blue';
|
||||
break;
|
||||
case 1:
|
||||
$subcls = 'yellow';
|
||||
break;
|
||||
case 2:
|
||||
$subcls = 'green';
|
||||
break;
|
||||
case 3:
|
||||
$subcls = 'red';
|
||||
break;
|
||||
}
|
||||
// Use the last 5 builds to determine project health:
|
||||
$successes = 0;
|
||||
$failures = 0;
|
||||
|
||||
foreach ($builds[$project->getId()] as $build) {
|
||||
|
@ -25,7 +40,6 @@ foreach($projects as $project):
|
|||
$statuses[] = 'running';
|
||||
break;
|
||||
case 2:
|
||||
$successes++;
|
||||
$statuses[] = 'ok';
|
||||
$success = is_null($success) && !is_null($build->getFinished()) ? Lang::formatDateTime($build->getFinished()) : $success;
|
||||
break;
|
||||
|
@ -38,15 +52,6 @@ foreach($projects as $project):
|
|||
}
|
||||
}
|
||||
|
||||
if ($failures == 0) {
|
||||
$subcls = 'green';
|
||||
} elseif ($successes == 0) {
|
||||
$subcls = 'red';
|
||||
} else {
|
||||
$subcls = 'yellow';
|
||||
}
|
||||
|
||||
|
||||
$buildCount = count($builds[$project->getId()]);
|
||||
$lastSuccess = $successful[$project->getId()];
|
||||
$lastFailure = $failed[$project->getId()];
|
||||
|
@ -77,24 +82,31 @@ foreach($projects as $project):
|
|||
|
||||
?>
|
||||
|
||||
<?php
|
||||
if (count($projects) > 10) {
|
||||
$containerClass = 'small-box-minimal';
|
||||
} else {
|
||||
$containerClass = 'small-box-full';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="small-box <?php print $containerClass; ?> bg-<?php print $subcls; ?>">
|
||||
|
||||
<?php if (count($projects) > 10): ?>
|
||||
|
||||
<div class="small-box bg-<?php print $subcls; ?>">
|
||||
<div class="inner">
|
||||
<h4>
|
||||
<strong>
|
||||
<a href="<?php print PHPCI_URL; ?>project/view/<?php print $project->getId(); ?>">
|
||||
<?php print $project->getTitle(); ?>
|
||||
</a>
|
||||
</strong> -
|
||||
<?php print $shortMessage; ?>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="inner">
|
||||
<h4>
|
||||
<strong>
|
||||
<a href="<?php print PHPCI_URL; ?>project/view/<?php print $project->getId(); ?>">
|
||||
<?php print $project->getTitle(); ?>
|
||||
</a>
|
||||
</strong> -
|
||||
<?php print $shortMessage; ?>
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<div class="small-box bg-<?php print $subcls; ?>">
|
||||
<div class="inner">
|
||||
<h3>
|
||||
<a href="<?php print PHPCI_URL; ?>project/view/<?php print $project->getId(); ?>">
|
||||
|
@ -110,10 +122,40 @@ foreach($projects as $project):
|
|||
<div class="icon">
|
||||
<i class="fa fa-<?php print $project->getIcon(); ?>"></i>
|
||||
</div>
|
||||
<a href="<?php print PHPCI_URL; ?>project/view/<?php print $project->getId(); ?>" class="small-box-footer">
|
||||
<a href="<?php print PHPCI_URL; ?>project/view/<?php print $project->getId(); ?>" class="small-box-footer small-box-footer-project">
|
||||
<?php Lang::out('view_project'); ?> <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php for ($idx=0; $idx < 5; $idx++) {
|
||||
if (empty($builds[$project->getId()][$idx])) {
|
||||
echo '<span class="small-box-footer-build small-box-footer bg-blue"><i class="fa fa-minus"></i></span>';
|
||||
} else {
|
||||
$build = $builds[$project->getId()][$idx];
|
||||
$link = PHPCI_URL . 'build/view/' . $build->id;
|
||||
switch ($build->getStatus()) {
|
||||
case 0:
|
||||
$class = 'bg-blue';
|
||||
$icon = 'fa-minus';
|
||||
break;
|
||||
case 1:
|
||||
$class = 'bg-yellow';
|
||||
$icon = 'fa-clock-o';
|
||||
break;
|
||||
case 2:
|
||||
$class = 'bg-green';
|
||||
$icon = 'fa-check';
|
||||
break;
|
||||
case 3:
|
||||
$class = 'bg-red';
|
||||
$icon = 'fa-times';
|
||||
break;
|
||||
}
|
||||
echo '<a href="' . $link .'" class="small-box-footer-build small-box-footer ' . $class . '"><i class="fa ' . $icon . '"></i></a>';
|
||||
}
|
||||
} ?>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
|
|
@ -51,3 +51,27 @@
|
|||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.small-box > .inner {
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.small-box > .small-box-footer-project {
|
||||
width: 60%;
|
||||
float: left;
|
||||
}
|
||||
.small-box > .small-box-footer-build {
|
||||
width: 8%;
|
||||
float: left;
|
||||
}
|
||||
.small-box-minimal > .inner {
|
||||
width: 71%;
|
||||
float: left;
|
||||
}
|
||||
.small-box-minimal > .small-box-footer-build {
|
||||
width: 5%;
|
||||
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||
margin-left: 1px;
|
||||
margin-top: 19px;
|
||||
font-size: 11px;
|
||||
}
|
Loading…
Reference in a new issue