Make project overview table update when build list does on dashboard, fixes #336
This commit is contained in:
parent
15b880b2f0
commit
81eff5e41c
2 changed files with 28 additions and 13 deletions
|
|
@ -41,20 +41,11 @@ class HomeController extends \PHPCI\Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
$projects = $this->projectStore->getWhere(array(), 50, 0, array(), array('title' => 'ASC'));
|
||||
|
||||
$summaryBuilds = array();
|
||||
foreach ($projects['items'] as $project) {
|
||||
$summaryBuilds[$project->getId()] = $this->buildStore->getLatestBuilds($project->getId());
|
||||
}
|
||||
|
||||
$summaryView = new b8\View('SummaryTable');
|
||||
$summaryView->projects = $projects['items'];
|
||||
$summaryView->builds = $summaryBuilds;
|
||||
$projects = $this->projectStore->getWhere(array(), 50, 0, array(), array('title' => 'ASC'));
|
||||
|
||||
$this->view->builds = $this->getLatestBuildsHtml();
|
||||
$this->view->projects = $projects['items'];
|
||||
$this->view->summary = $summaryView->render();
|
||||
$this->view->summary = $this->getSummaryHtml($projects);
|
||||
|
||||
$this->config->set('page_title', 'Dashboard');
|
||||
|
||||
|
|
@ -69,6 +60,26 @@ class HomeController extends \PHPCI\Controller
|
|||
die($this->getLatestBuildsHtml());
|
||||
}
|
||||
|
||||
public function summary()
|
||||
{
|
||||
$projects = $this->projectStore->getWhere(array(), 50, 0, array(), array('title' => 'ASC'));
|
||||
die($this->getSummaryHtml($projects));
|
||||
}
|
||||
|
||||
protected function getSummaryHtml($projects)
|
||||
{
|
||||
$summaryBuilds = array();
|
||||
foreach ($projects['items'] as $project) {
|
||||
$summaryBuilds[$project->getId()] = $this->buildStore->getLatestBuilds($project->getId());
|
||||
}
|
||||
|
||||
$summaryView = new b8\View('SummaryTable');
|
||||
$summaryView->projects = $projects['items'];
|
||||
$summaryView->builds = $summaryBuilds;
|
||||
|
||||
return $summaryView->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get latest builds and render as a table.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue