Front-End Upgrade: New UI Based on Admin LTE.

Closes #673
This commit is contained in:
Dan Cryer 2014-12-02 16:26:55 +00:00
commit 9eeaabc6fe
364 changed files with 51722 additions and 987 deletions

View file

@ -11,6 +11,7 @@ namespace PHPCI\Controller;
use b8;
use PHPCI\BuildFactory;
use PHPCI\Model\Build;
/**
* Home Controller - Displays the PHPCI Dashboard.
@ -41,14 +42,20 @@ class HomeController extends \PHPCI\Controller
*/
public function index()
{
$this->layout->title = 'Dashboard';
$projects = $this->projectStore->getWhere(array(), 50, 0, array(), array('title' => 'ASC'));
$this->view->builds = $this->getLatestBuildsHtml();
$builds = $this->buildStore->getLatestBuilds(null, 10);
foreach ($builds as &$build) {
$build = BuildFactory::getBuild($build);
}
$this->view->builds = $builds;
$this->view->projects = $projects['items'];
$this->view->summary = $this->getSummaryHtml($projects);
$this->config->set('page_title', 'Dashboard');
return $this->view->render();
}
@ -69,13 +76,24 @@ class HomeController extends \PHPCI\Controller
protected function getSummaryHtml($projects)
{
$summaryBuilds = array();
$successes = array();
$failures = array();
foreach ($projects['items'] as $project) {
$summaryBuilds[$project->getId()] = $this->buildStore->getLatestBuilds($project->getId());
$success = $this->buildStore->getLastBuildByStatus($project->getId(), Build::STATUS_SUCCESS);
$failure = $this->buildStore->getLastBuildByStatus($project->getId(), Build::STATUS_FAILED);
$successes[$project->getId()] = $success;
$failures[$project->getId()] = $failure;
}
$summaryView = new b8\View('SummaryTable');
$summaryView->projects = $projects['items'];
$summaryView->builds = $summaryBuilds;
$summaryView->successful = $successes;
$summaryView->failed = $failures;
return $summaryView->render();
}