2013-05-10 13:28:43 +02:00
|
|
|
<?php
|
2016-12-30 17:40:14 +01:00
|
|
|
|
2016-07-19 20:28:11 +02:00
|
|
|
namespace PHPCensor\Controller;
|
2013-05-16 16:25:39 +02:00
|
|
|
|
2018-03-04 11:14:09 +01:00
|
|
|
use PHPCensor\Exception\HttpException\NotFoundException;
|
2018-03-04 11:22:14 +01:00
|
|
|
use PHPCensor\Http\Response\JsonResponse;
|
2017-10-29 08:06:41 +01:00
|
|
|
use JasonGrimes\Paginator;
|
2016-07-19 20:28:11 +02:00
|
|
|
use PHPCensor\BuildFactory;
|
|
|
|
use PHPCensor\Helper\AnsiConverter;
|
|
|
|
use PHPCensor\Helper\Lang;
|
2018-03-04 11:22:14 +01:00
|
|
|
use PHPCensor\Http\Response\RedirectResponse;
|
2016-07-19 20:28:11 +02:00
|
|
|
use PHPCensor\Model\Build;
|
2017-10-29 08:06:41 +01:00
|
|
|
use PHPCensor\Model\User;
|
2016-07-19 20:28:11 +02:00
|
|
|
use PHPCensor\Service\BuildService;
|
|
|
|
use PHPCensor\Controller;
|
2018-02-16 14:18:04 +01:00
|
|
|
use PHPCensor\View;
|
2018-03-04 08:30:34 +01:00
|
|
|
use PHPCensor\Store\Factory;
|
2013-05-10 13:28:43 +02:00
|
|
|
|
2013-05-16 03:30:48 +02:00
|
|
|
/**
|
2017-03-04 16:39:56 +01:00
|
|
|
* Build Controller - Allows users to run and view builds.
|
2017-12-09 17:28:16 +01:00
|
|
|
*
|
2017-03-04 16:39:56 +01:00
|
|
|
* @author Dan Cryer <dan@block8.co.uk>
|
|
|
|
*/
|
2016-05-09 08:20:26 +02:00
|
|
|
class BuildController extends Controller
|
2013-05-10 13:28:43 +02:00
|
|
|
{
|
2013-10-08 19:24:20 +02:00
|
|
|
/**
|
2016-07-21 19:20:59 +02:00
|
|
|
* @var \PHPCensor\Store\BuildStore
|
2013-10-08 19:24:20 +02:00
|
|
|
*/
|
|
|
|
protected $buildStore;
|
2014-07-14 17:02:36 +02:00
|
|
|
|
|
|
|
/**
|
2016-07-21 19:20:59 +02:00
|
|
|
* @var \PHPCensor\Service\BuildService
|
2014-07-14 17:02:36 +02:00
|
|
|
*/
|
|
|
|
protected $buildService;
|
2014-12-08 12:25:33 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialise the controller, set up stores and services.
|
|
|
|
*/
|
2013-05-16 16:25:39 +02:00
|
|
|
public function init()
|
|
|
|
{
|
2018-03-04 08:30:34 +01:00
|
|
|
$this->buildStore = Factory::getStore('Build');
|
2014-07-14 17:02:36 +02:00
|
|
|
$this->buildService = new BuildService($this->buildStore);
|
2013-05-16 16:25:39 +02:00
|
|
|
}
|
|
|
|
|
2013-05-16 18:17:29 +02:00
|
|
|
/**
|
2017-10-29 08:06:41 +01:00
|
|
|
* View a specific build.
|
|
|
|
*
|
|
|
|
* @param integer $buildId
|
|
|
|
*
|
|
|
|
* @throws NotFoundException
|
|
|
|
*/
|
2013-05-16 16:25:39 +02:00
|
|
|
public function view($buildId)
|
|
|
|
{
|
2017-10-29 15:26:43 +01:00
|
|
|
$page = (integer)$this->getParam('page', 1);
|
|
|
|
$plugin = $this->getParam('plugin', '');
|
2017-12-09 17:28:16 +01:00
|
|
|
$isNew = $this->getParam('is_new', '');
|
2017-10-29 15:26:43 +01:00
|
|
|
|
|
|
|
$severity = $this->getParam('severity', null);
|
|
|
|
if (null !== $severity && '' !== $severity) {
|
|
|
|
$severity = (integer)$severity;
|
|
|
|
} else {
|
|
|
|
$severity = null;
|
|
|
|
}
|
2017-10-29 08:06:41 +01:00
|
|
|
|
2018-03-08 17:20:05 +01:00
|
|
|
$build = BuildFactory::getBuildById($buildId);
|
2014-05-09 13:15:11 +02:00
|
|
|
|
2018-03-08 17:20:05 +01:00
|
|
|
if (!$build) {
|
2014-12-04 14:08:48 +01:00
|
|
|
throw new NotFoundException(Lang::get('build_x_not_found', $buildId));
|
2014-05-09 13:15:11 +02:00
|
|
|
}
|
|
|
|
|
2017-10-29 08:06:41 +01:00
|
|
|
/** @var User $user */
|
2018-02-17 05:59:02 +01:00
|
|
|
$user = $this->getUser();
|
2017-10-29 08:06:41 +01:00
|
|
|
$perPage = $user->getFinalPerPage();
|
2017-12-09 17:28:16 +01:00
|
|
|
$data = $this->getBuildData($build, $plugin, $severity, $isNew, (($page - 1) * $perPage), $perPage);
|
2017-10-29 08:06:41 +01:00
|
|
|
$pages = ($data['errors'] === 0)
|
|
|
|
? 1
|
|
|
|
: (integer)ceil($data['errors'] / $perPage);
|
|
|
|
|
|
|
|
if ($page > $pages) {
|
|
|
|
$page = $pages;
|
|
|
|
}
|
|
|
|
|
2017-10-29 15:26:43 +01:00
|
|
|
/** @var \PHPCensor\Store\BuildErrorStore $errorStore */
|
2018-03-04 08:30:34 +01:00
|
|
|
$errorStore = Factory::getStore('BuildError');
|
2017-10-29 15:26:43 +01:00
|
|
|
|
|
|
|
$this->view->uiPlugins = $this->getUiPlugins();
|
2017-10-29 08:06:41 +01:00
|
|
|
$this->view->build = $build;
|
|
|
|
$this->view->data = $data;
|
2017-10-29 15:26:43 +01:00
|
|
|
|
|
|
|
$this->view->plugin = urldecode($plugin);
|
2017-12-09 17:28:16 +01:00
|
|
|
$this->view->plugins = $errorStore->getKnownPlugins($buildId, $severity, $isNew);
|
2017-10-29 15:26:43 +01:00
|
|
|
$this->view->severity = urldecode(null !== $severity ? $severity : '');
|
2017-12-09 17:28:16 +01:00
|
|
|
$this->view->severities = $errorStore->getKnownSeverities($buildId, $plugin, $isNew);
|
|
|
|
$this->view->isNew = urldecode($isNew);
|
|
|
|
$this->view->isNews = ['only_new', 'only_old'];
|
2017-10-29 15:26:43 +01:00
|
|
|
|
2017-10-29 08:06:41 +01:00
|
|
|
$this->view->page = $page;
|
|
|
|
$this->view->perPage = $perPage;
|
2017-12-09 17:28:16 +01:00
|
|
|
$this->view->paginator = $this->getPaginatorHtml($buildId, $plugin, $severity, $isNew, $data['errors'], $perPage, $page);
|
2014-04-24 17:25:24 +02:00
|
|
|
|
2014-12-04 14:08:48 +01:00
|
|
|
$this->layout->title = Lang::get('build_n', $buildId);
|
2014-12-02 17:26:55 +01:00
|
|
|
$this->layout->subtitle = $build->getProjectTitle();
|
|
|
|
|
2015-10-15 11:07:54 +02:00
|
|
|
switch ($build->getStatus()) {
|
|
|
|
case 0:
|
|
|
|
$this->layout->skin = 'blue';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
$this->layout->skin = 'yellow';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
$this->layout->skin = 'green';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
$this->layout->skin = 'red';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2018-03-05 13:32:49 +01:00
|
|
|
$rebuild = Lang::get('rebuild_now');
|
2016-07-21 17:20:34 +02:00
|
|
|
$rebuildLink = APP_URL . 'build/rebuild/' . $build->getId();
|
2015-10-15 11:07:54 +02:00
|
|
|
|
2018-03-05 13:32:49 +01:00
|
|
|
$delete = Lang::get('delete_build');
|
2016-07-21 17:20:34 +02:00
|
|
|
$deleteLink = APP_URL . 'build/delete/' . $build->getId();
|
2017-12-09 17:28:16 +01:00
|
|
|
|
2018-03-04 08:30:34 +01:00
|
|
|
$project = Factory::getStore('Project')->getByPrimaryKey($build->getProjectId());
|
2015-10-15 11:07:54 +02:00
|
|
|
|
2017-01-15 16:35:42 +01:00
|
|
|
$actions = '';
|
|
|
|
if (!$project->getArchived()) {
|
|
|
|
$actions .= "<a class=\"btn btn-default\" href=\"{$rebuildLink}\">{$rebuild}</a> ";
|
|
|
|
}
|
2014-12-02 17:26:55 +01:00
|
|
|
|
|
|
|
if ($this->currentUserIsAdmin()) {
|
2017-01-12 17:37:37 +01:00
|
|
|
$actions .= " <a class=\"btn btn-danger\" id=\"delete-build\" href=\"{$deleteLink}\">{$delete}</a>";
|
2014-12-02 17:26:55 +01:00
|
|
|
}
|
|
|
|
|
2015-10-15 11:07:54 +02:00
|
|
|
$this->layout->actions = $actions;
|
2013-05-16 16:25:39 +02:00
|
|
|
}
|
|
|
|
|
2014-12-08 12:25:33 +01:00
|
|
|
/**
|
|
|
|
* Returns an array of the JS plugins to include.
|
|
|
|
* @return array
|
|
|
|
*/
|
2013-10-08 08:21:46 +02:00
|
|
|
protected function getUiPlugins()
|
|
|
|
{
|
2016-04-21 19:05:32 +02:00
|
|
|
$rtn = [];
|
2016-07-21 17:20:34 +02:00
|
|
|
$path = PUBLIC_DIR . 'assets' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'build-plugins' . DIRECTORY_SEPARATOR;
|
2016-04-21 19:05:32 +02:00
|
|
|
$dir = opendir($path);
|
2013-10-08 08:21:46 +02:00
|
|
|
|
|
|
|
while ($item = readdir($dir)) {
|
|
|
|
if (substr($item, 0, 1) == '.' || substr($item, -3) != '.js') {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
$rtn[] = $item;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $rtn;
|
|
|
|
}
|
|
|
|
|
2013-05-16 18:17:29 +02:00
|
|
|
/**
|
2017-10-29 08:06:41 +01:00
|
|
|
* Get build data from database and json encode it.
|
|
|
|
*
|
|
|
|
* @param Build $build
|
2017-10-29 15:26:43 +01:00
|
|
|
* @param string $plugin
|
|
|
|
* @param integer $severity
|
2017-12-09 17:28:16 +01:00
|
|
|
* @param string $isNew
|
2017-10-29 08:06:41 +01:00
|
|
|
* @param integer $start
|
|
|
|
* @param integer $perPage
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
2017-12-09 17:28:16 +01:00
|
|
|
protected function getBuildData(Build $build, $plugin, $severity, $isNew, $start = 0, $perPage = 10)
|
2013-05-16 16:25:39 +02:00
|
|
|
{
|
2017-10-15 16:58:36 +02:00
|
|
|
$data = [];
|
|
|
|
$data['status'] = (int)$build->getStatus();
|
|
|
|
$data['log'] = $this->cleanLog($build->getLog());
|
|
|
|
$data['create_date'] = !is_null($build->getCreateDate()) ? $build->getCreateDate()->format('Y-m-d H:i:s') : null;
|
|
|
|
$data['start_date'] = !is_null($build->getStartDate()) ? $build->getStartDate()->format('Y-m-d H:i:s') : null;
|
|
|
|
$data['finish_date'] = !is_null($build->getFinishDate()) ? $build->getFinishDate()->format('Y-m-d H:i:s') : null;
|
|
|
|
$data['duration'] = $build->getDuration();
|
2015-10-15 11:07:54 +02:00
|
|
|
|
2016-07-21 19:20:59 +02:00
|
|
|
/** @var \PHPCensor\Store\BuildErrorStore $errorStore */
|
2018-03-04 08:30:34 +01:00
|
|
|
$errorStore = Factory::getStore('BuildError');
|
2017-12-09 17:28:16 +01:00
|
|
|
$errors = $errorStore->getByBuildId($build->getId(), $perPage, $start, $plugin, $severity, $isNew);
|
2015-10-15 11:07:54 +02:00
|
|
|
|
2018-02-16 14:18:04 +01:00
|
|
|
$errorView = new View('Build/errors');
|
2017-10-15 16:58:36 +02:00
|
|
|
$errorView->build = $build;
|
2017-10-29 08:06:41 +01:00
|
|
|
$errorView->errors = $errors['items'];
|
2015-10-15 11:07:54 +02:00
|
|
|
|
2017-12-09 17:28:16 +01:00
|
|
|
$data['errors'] = $errorStore->getErrorTotalForBuild($build->getId(), $plugin, $severity, $isNew);
|
2017-11-09 17:18:10 +01:00
|
|
|
$data['errors_total'] = $errorStore->getErrorTotalForBuild($build->getId());
|
2017-10-29 15:26:43 +01:00
|
|
|
$data['error_html'] = $errorView->render();
|
2013-05-16 16:25:39 +02:00
|
|
|
|
2015-02-12 13:37:56 +01:00
|
|
|
return $data;
|
2013-05-16 16:25:39 +02:00
|
|
|
}
|
|
|
|
|
2017-10-29 08:06:41 +01:00
|
|
|
/**
|
|
|
|
* @param integer $buildId
|
2017-10-29 15:26:43 +01:00
|
|
|
* @param string $plugin
|
|
|
|
* @param integer $severity
|
2017-12-09 17:28:16 +01:00
|
|
|
* @param string $isNew
|
2017-10-29 08:06:41 +01:00
|
|
|
* @param integer $total
|
|
|
|
* @param integer $perPage
|
|
|
|
* @param integer $page
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2017-12-09 17:28:16 +01:00
|
|
|
protected function getPaginatorHtml($buildId, $plugin, $severity, $isNew, $total, $perPage, $page)
|
2017-10-29 08:06:41 +01:00
|
|
|
{
|
2018-02-16 14:18:04 +01:00
|
|
|
$view = new View('pagination');
|
2017-10-29 08:06:41 +01:00
|
|
|
|
|
|
|
$urlPattern = APP_URL . 'build/view/' . $buildId;
|
2017-10-29 15:26:43 +01:00
|
|
|
$params = [];
|
|
|
|
if (!empty($plugin)) {
|
|
|
|
$params['plugin'] = $plugin;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (null !== $severity) {
|
|
|
|
$params['severity'] = $severity;
|
|
|
|
}
|
2017-10-29 08:06:41 +01:00
|
|
|
|
2017-12-09 17:28:16 +01:00
|
|
|
if (!empty($isNew)) {
|
|
|
|
$params['is_new'] = $isNew;
|
|
|
|
}
|
|
|
|
|
2017-10-29 15:26:43 +01:00
|
|
|
$urlPattern = $urlPattern . '?' . str_replace('%28%3Anum%29', '(:num)', http_build_query(array_merge($params, ['page' => '(:num)']))) . '#errors';
|
2017-10-29 08:06:41 +01:00
|
|
|
$paginator = new Paginator($total, $perPage, $page, $urlPattern);
|
|
|
|
|
|
|
|
$view->paginator = $paginator;
|
|
|
|
|
|
|
|
return $view->render();
|
|
|
|
}
|
|
|
|
|
2013-05-16 18:17:29 +02:00
|
|
|
/**
|
|
|
|
* Create a build using an existing build as a template:
|
|
|
|
*/
|
2013-05-16 16:25:39 +02:00
|
|
|
public function rebuild($buildId)
|
|
|
|
{
|
2017-01-15 16:35:42 +01:00
|
|
|
$copy = BuildFactory::getBuildById($buildId);
|
2018-03-04 08:30:34 +01:00
|
|
|
$project = Factory::getStore('Project')->getByPrimaryKey($copy->getProjectId());
|
2013-05-16 16:25:39 +02:00
|
|
|
|
2018-03-08 17:20:05 +01:00
|
|
|
if (!$copy || $project->getArchived()) {
|
2014-12-04 14:08:48 +01:00
|
|
|
throw new NotFoundException(Lang::get('build_x_not_found', $buildId));
|
2014-05-09 13:15:11 +02:00
|
|
|
}
|
|
|
|
|
2014-07-14 17:02:36 +02:00
|
|
|
$build = $this->buildService->createDuplicateBuild($copy);
|
2013-05-16 16:25:39 +02:00
|
|
|
|
2016-06-23 12:28:42 +02:00
|
|
|
if ($this->buildService->queueError) {
|
|
|
|
$_SESSION['global_error'] = Lang::get('add_to_queue_failed');
|
|
|
|
}
|
|
|
|
|
2018-03-04 11:22:14 +01:00
|
|
|
$response = new RedirectResponse();
|
2016-07-21 17:20:34 +02:00
|
|
|
$response->setHeader('Location', APP_URL.'build/view/' . $build->getId());
|
2017-01-14 19:11:32 +01:00
|
|
|
|
2015-02-12 13:37:56 +01:00
|
|
|
return $response;
|
2013-05-16 16:25:39 +02:00
|
|
|
}
|
|
|
|
|
2013-05-16 18:17:29 +02:00
|
|
|
/**
|
|
|
|
* Delete a build.
|
|
|
|
*/
|
2013-05-16 16:25:39 +02:00
|
|
|
public function delete($buildId)
|
|
|
|
{
|
2014-12-02 17:26:55 +01:00
|
|
|
$this->requireAdmin();
|
2013-06-04 21:17:17 +02:00
|
|
|
|
2014-05-09 13:15:11 +02:00
|
|
|
$build = BuildFactory::getBuildById($buildId);
|
2013-11-27 15:09:14 +01:00
|
|
|
|
2018-03-08 17:20:05 +01:00
|
|
|
if (!$build) {
|
2014-12-04 14:08:48 +01:00
|
|
|
throw new NotFoundException(Lang::get('build_x_not_found', $buildId));
|
2013-11-27 15:09:14 +01:00
|
|
|
}
|
|
|
|
|
2014-07-29 16:07:26 +02:00
|
|
|
$this->buildService->deleteBuild($build);
|
2013-05-16 16:25:39 +02:00
|
|
|
|
2018-03-04 11:22:14 +01:00
|
|
|
$response = new RedirectResponse();
|
2016-07-21 17:20:34 +02:00
|
|
|
$response->setHeader('Location', APP_URL.'project/view/' . $build->getProjectId());
|
2017-01-14 19:11:32 +01:00
|
|
|
|
2015-02-12 13:37:56 +01:00
|
|
|
return $response;
|
2013-05-16 16:25:39 +02:00
|
|
|
}
|
|
|
|
|
2013-05-16 18:17:29 +02:00
|
|
|
/**
|
|
|
|
* Parse log for unix colours and replace with HTML.
|
|
|
|
*/
|
2013-05-16 16:25:39 +02:00
|
|
|
protected function cleanLog($log)
|
|
|
|
{
|
2015-02-26 15:57:45 +01:00
|
|
|
return AnsiConverter::convert($log);
|
2013-05-16 16:25:39 +02:00
|
|
|
}
|
2014-12-02 17:26:55 +01:00
|
|
|
|
2014-12-08 12:25:33 +01:00
|
|
|
/**
|
2017-10-21 10:51:05 +02:00
|
|
|
* Formats a list of builds into rows suitable for the dropdowns in the header bar.
|
|
|
|
*
|
2014-12-08 12:25:33 +01:00
|
|
|
* @param $builds
|
2017-10-21 10:51:05 +02:00
|
|
|
*
|
2014-12-08 12:25:33 +01:00
|
|
|
* @return array
|
|
|
|
*/
|
2014-12-02 17:26:55 +01:00
|
|
|
protected function formatBuilds($builds)
|
|
|
|
{
|
2016-04-20 17:39:48 +02:00
|
|
|
$rtn = ['count' => $builds['count'], 'items' => []];
|
2014-12-02 17:26:55 +01:00
|
|
|
|
2018-02-23 19:49:59 +01:00
|
|
|
/** @var Build $build */
|
2014-12-02 17:26:55 +01:00
|
|
|
foreach ($builds['items'] as $build) {
|
2018-02-23 19:49:59 +01:00
|
|
|
$header = new View('Build/header-row');
|
2014-12-02 17:26:55 +01:00
|
|
|
$header->build = $build;
|
|
|
|
|
2018-02-23 19:49:59 +01:00
|
|
|
$rtn['items'][$build->getId()]['header_row'] = $header->render();
|
2014-12-02 17:26:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ksort($rtn['items']);
|
|
|
|
return $rtn;
|
|
|
|
}
|
2017-01-14 19:11:32 +01:00
|
|
|
|
|
|
|
public function ajaxData($buildId)
|
|
|
|
{
|
2017-10-29 08:06:41 +01:00
|
|
|
$page = (integer)$this->getParam('page', 1);
|
|
|
|
$perPage = (integer)$this->getParam('per_page', 10);
|
2017-10-29 15:26:43 +01:00
|
|
|
$plugin = $this->getParam('plugin', '');
|
2017-12-09 17:28:16 +01:00
|
|
|
$isNew = $this->getParam('is_new', '');
|
2017-10-29 15:26:43 +01:00
|
|
|
|
|
|
|
$severity = $this->getParam('severity', null);
|
|
|
|
if (null !== $severity && '' !== $severity) {
|
|
|
|
$severity = (integer)$severity;
|
|
|
|
} else {
|
|
|
|
$severity = null;
|
|
|
|
}
|
2017-10-29 08:06:41 +01:00
|
|
|
|
2017-01-14 19:11:32 +01:00
|
|
|
$response = new JsonResponse();
|
|
|
|
$build = BuildFactory::getBuildById($buildId);
|
|
|
|
|
|
|
|
if (!$build) {
|
|
|
|
$response->setResponseCode(404);
|
|
|
|
$response->setContent([]);
|
2017-12-09 17:28:16 +01:00
|
|
|
|
2017-01-14 19:11:32 +01:00
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
2017-12-09 17:28:16 +01:00
|
|
|
$data = $this->getBuildData($build, $plugin, $severity, $isNew, (($page - 1) * $perPage), $perPage);
|
|
|
|
$data['paginator'] = $this->getPaginatorHtml($buildId, $plugin, $severity, $isNew, $data['errors'], $perPage, $page);
|
2017-10-29 08:06:41 +01:00
|
|
|
|
|
|
|
$response->setContent($data);
|
2017-01-15 11:28:15 +01:00
|
|
|
|
2017-01-14 19:11:32 +01:00
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ajaxMeta($buildId)
|
|
|
|
{
|
2018-03-08 17:20:05 +01:00
|
|
|
$build = BuildFactory::getBuildById($buildId);
|
|
|
|
$key = $this->getParam('key', null);
|
2017-01-14 19:11:32 +01:00
|
|
|
$numBuilds = $this->getParam('num_builds', 1);
|
2018-03-08 17:20:05 +01:00
|
|
|
$data = null;
|
2017-01-14 19:11:32 +01:00
|
|
|
|
|
|
|
if ($key && $build) {
|
|
|
|
$data = $this->buildStore->getMeta($key, $build->getProjectId(), $buildId, $build->getBranch(), $numBuilds);
|
|
|
|
}
|
|
|
|
|
|
|
|
$response = new JsonResponse();
|
|
|
|
$response->setContent($data);
|
2017-01-15 11:28:15 +01:00
|
|
|
|
2017-01-14 19:11:32 +01:00
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ajaxQueue()
|
|
|
|
{
|
|
|
|
$rtn = [
|
2017-02-01 15:53:31 +01:00
|
|
|
'pending' => $this->formatBuilds($this->buildStore->getByStatus(Build::STATUS_PENDING)),
|
2017-01-14 19:11:32 +01:00
|
|
|
'running' => $this->formatBuilds($this->buildStore->getByStatus(Build::STATUS_RUNNING)),
|
|
|
|
];
|
|
|
|
|
|
|
|
$response = new JsonResponse();
|
|
|
|
$response->setContent($rtn);
|
|
|
|
|
|
|
|
return $response;
|
|
|
|
}
|
2013-05-16 16:25:39 +02:00
|
|
|
}
|