diff --git a/public/assets/js/app.js b/public/assets/js/app.js
index 644d7974..c37723cd 100644
--- a/public/assets/js/app.js
+++ b/public/assets/js/app.js
@@ -498,3 +498,17 @@ var Lang = {
return string;
}
};
+
+jquery(document).ready(function() {
+ jquery('#delete-build').on('click', function (e) {
+ e.preventDefault();
+
+ var buildId = this.data('buildId');
+ var projectId = this.data('projectId');
+
+ confirmDelete(APP_URL + 'build/delete/' + buildId)
+ .onCloseConfirmed = function () {
+ window.location = APP_URL + 'project/view/' + projectId;
+ };
+ });
+});
diff --git a/src/Controller/BuildController.php b/src/Controller/BuildController.php
index 3db8143b..7430449a 100644
--- a/src/Controller/BuildController.php
+++ b/src/Controller/BuildController.php
@@ -10,6 +10,7 @@ use PHPCensor\Helper\AnsiConverter;
use PHPCensor\Helper\Lang;
use PHPCensor\Http\Response\RedirectResponse;
use PHPCensor\Model\Build;
+use PHPCensor\Model\Project;
use PHPCensor\Model\User;
use PHPCensor\Service\BuildService;
use PHPCensor\WebController;
@@ -47,8 +48,6 @@ class BuildController extends WebController
}
/**
- * View a specific build.
- *
* @param integer $buildId
*
* @throws NotFoundException
@@ -143,6 +142,77 @@ class BuildController extends WebController
$this->layout->actions = $actions;
}
+ /**
+ * @param integer $buildId
+ *
+ * @throws NotFoundException
+ */
+ public function viewLog($buildId)
+ {
+ $build = BuildFactory::getBuildById($buildId);
+
+ if (!$build) {
+ throw new NotFoundException(Lang::get('build_x_not_found', $buildId));
+ }
+
+ /** @var Project $project */
+ $project = Factory::getStore('Project')->getByPrimaryKey($build->getProjectId());
+
+ /** @var \PHPCensor\Store\BuildErrorStore $errorStore */
+ $errorStore = Factory::getStore('BuildError');
+
+ $this->view->build = $build;
+ $this->view->totalErrors = $errorStore->getErrorTotalForBuild($build->getId());
+
+ $this->layout->title = Lang::get('build_n', $buildId);
+ $this->layout->subtitle = $build->getProjectTitle();
+
+ 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;
+ }
+
+ $rebuildLabel = Lang::get('rebuild_now');
+ $rebuildLink = APP_URL . 'build/rebuild/' . $build->getId();
+
+ $deleteLabel = Lang::get('delete_build');
+ $deleteLink = APP_URL . 'build/delete/' . $build->getId();
+
+ $actions = '';
+ if (!$project->getArchived()) {
+ $actions .= sprintf(
+ '%s',
+ $rebuildLink,
+ $rebuildLabel
+ );
+ }
+
+ if ($this->currentUserIsAdmin()) {
+ $actions .= sprintf(
+ '%s',
+ $build->getId(),
+ $build->getProjectId(),
+ $deleteLink,
+ $deleteLabel
+ );
+ }
+
+ $this->layout->actions = $actions;
+ }
+
/**
* Returns an array of the JS plugins to include.
* @return array
diff --git a/src/View/Build/errors.phtml b/src/View/Build/errors.phtml
index c7b87be6..979f502d 100644
--- a/src/View/Build/errors.phtml
+++ b/src/View/Build/errors.phtml
@@ -21,7 +21,9 @@ foreach ($errors as $error):
getIsNew()): ?>
- = Lang::get('new'); ?>
+
+ = Lang::get('new'); ?>
+
|
@@ -29,19 +31,25 @@ foreach ($errors as $error):
= Lang::get($error->getSeverityString()); ?>
|
- = Lang::get($error->getPlugin()); ?> |
- = $error->getFile(); ?> |
+
+ = Lang::get($error->getPlugin()); ?>
+ |
- getLineStart() == $error->getLineEnd() || !$error->getLineEnd()) {
- echo $error->getLineStart();
- } else {
- echo ($error->getLineStart() . ' - ' . $error->getLineEnd());
- }
- ?>
+ = $error->getFile(); ?>
|
- = htmlspecialchars(trim($error->getMessage())); ?> |
+
+
+ getLineStart() == $error->getLineEnd() || !$error->getLineEnd()): ?>
+ = $error->getLineStart(); ?>
+
+ = ($error->getLineStart() . ' - ' . $error->getLineEnd()); ?>
+
+
+ |
+
+ = htmlspecialchars(trim($error->getMessage())); ?>
+ |
diff --git a/src/View/Build/viewLog.phtml b/src/View/Build/viewLog.phtml
new file mode 100644
index 00000000..a09bc27d
--- /dev/null
+++ b/src/View/Build/viewLog.phtml
@@ -0,0 +1,205 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ = Lang::get('build_source'); ?> |
+
+ = Lang::get($build->getSourceHumanize()); ?>
+ |
+
+
+ = Lang::get('commit'); ?> |
+
+
+ = substr($build->getCommitId(), 0, 7); ?>
+
+ |
+
+
+
+ = Lang::get('committer'); ?> |
+
+ = $build->getCommitterEmail(); ?>
+ |
+
+
+
+ = Lang::get('commit_message'); ?> |
+
+ = htmlspecialchars($build->getCommitMessage()); ?>
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+ = Lang::get('created'); ?> |
+
+ = ($build->getCreateDate() ? $build->getCreateDate()->format('Y-m-d H:i:s') : ''); ?>
+ |
+
+
+
+ = Lang::get('started'); ?> |
+
+ = ($build->getStartDate() ? $build->getStartDate()->format('Y-m-d H:i:s') : ''); ?>
+ |
+
+
+
+ = Lang::get('finished'); ?> |
+
+ = ($build->getFinishDate() ? $build->getFinishDate()->format('Y-m-d H:i:s') : ''); ?>
+ |
+
+
+
+ = Lang::get('duration'); ?> |
+
+ = $build->getDuration(); ?> = Lang::get('seconds'); ?>
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
= AnsiConverter::convert($build->getLog()); ?>
+
+
+
diff --git a/src/View/WidgetBuildErrors/index.phtml b/src/View/WidgetBuildErrors/index.phtml
index 363ae597..2d42181d 100644
--- a/src/View/WidgetBuildErrors/index.phtml
+++ b/src/View/WidgetBuildErrors/index.phtml
@@ -2,6 +2,10 @@
use PHPCensor\Helper\Lang;
+/**
+ * @var string $projects
+ */
+
?>