From 6233dfa714378635beb9779f0c0930b61ec4c75e Mon Sep 17 00:00:00 2001 From: Lee Willis Date: Sun, 8 Feb 2015 10:24:27 +0000 Subject: [PATCH] Redesigned build summary for the dashboard to include recent builds. Closes #783 Closes #708 --- PHPCI/View/SummaryTable.phtml | 96 +++++++++++++++++++-------- public/assets/css/AdminLTE-custom.css | 24 +++++++ 2 files changed, 93 insertions(+), 27 deletions(-) diff --git a/PHPCI/View/SummaryTable.phtml b/PHPCI/View/SummaryTable.phtml index 10782a5b..56df6e38 100644 --- a/PHPCI/View/SummaryTable.phtml +++ b/PHPCI/View/SummaryTable.phtml @@ -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): ?> + 10) { + $containerClass = 'small-box-minimal'; + } else { + $containerClass = 'small-box-full'; + } +?> + +
+ 10): ?> -
-
-

- - - getTitle(); ?> - - - - -

-
+
+

+ + + getTitle(); ?> + + - + +

-
+ + getId()][$idx])) { + echo ''; + } 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 ''; + } + } ?> +
+
+ diff --git a/public/assets/css/AdminLTE-custom.css b/public/assets/css/AdminLTE-custom.css index 009a360b..a0fb3dd7 100644 --- a/public/assets/css/AdminLTE-custom.css +++ b/public/assets/css/AdminLTE-custom.css @@ -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; +} \ No newline at end of file