UI plugins, including quality trend chart, logs and lines of code. Some UI tweaks.

This commit is contained in:
Dan Cryer 2013-10-08 07:21:46 +01:00
commit b33189e08e
28 changed files with 2778 additions and 217 deletions

View file

@ -31,10 +31,28 @@ class BuildController extends \PHPCI\Controller
public function view($buildId)
{
$build = $this->_buildStore->getById($buildId);
$this->view->plugins = $this->getUiPlugins();
$this->view->build = $build;
$this->view->data = $this->getBuildData($buildId);
}
protected function getUiPlugins()
{
$rtn = array();
$path = APPLICATION_PATH . 'public/assets/js/build-plugins/';
$dir = opendir($path);
while ($item = readdir($dir)) {
if (substr($item, 0, 1) == '.' || substr($item, -3) != '.js') {
continue;
}
$rtn[] = $item;
}
return $rtn;
}
/**
* AJAX call to get build data:
*/
@ -43,6 +61,23 @@ class BuildController extends \PHPCI\Controller
die($this->getBuildData($buildId));
}
/**
* AJAX call to get build meta:
*/
public function meta($buildId)
{
$build = $this->_buildStore->getById($buildId);
$key = $this->getParam('key', null);
$numBuilds = $this->getParam('num_builds', 1);
$data = null;
if ($key && $build) {
$data = $this->_buildStore->getMeta($key, $build->getProjectId(), $buildId, $numBuilds);
}
die(json_encode($data));
}
/**
* Get build data from database and json encode it:
*/