From 9574b63470f4cf1f34d8d94353562b3d37cac96b Mon Sep 17 00:00:00 2001 From: Gabriel Baker Date: Tue, 4 Jun 2013 19:14:47 +0100 Subject: [PATCH 1/4] css and html tweaks for plugin statueses in builds --- PHPCI/View/BuildsTable.phtml | 15 ++++++++++++++- assets/css/phpci.css | 23 ++++++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/PHPCI/View/BuildsTable.phtml b/PHPCI/View/BuildsTable.phtml index 8ced123f..6b0c5b16 100644 --- a/PHPCI/View/BuildsTable.phtml +++ b/PHPCI/View/BuildsTable.phtml @@ -35,7 +35,20 @@ switch($build->getStatus()) getProject()->getTitle(); ?> getCommitId(); ?> getBranch(); ?> - + + getPlugins(), true); + if ( !is_array($plugins) ) { + $plugins = array(); + } + ?> + $pluginstatus): ?> +
'> + +
+ +
+
View diff --git a/assets/css/phpci.css b/assets/css/phpci.css index 931c4b0a..8d540519 100644 --- a/assets/css/phpci.css +++ b/assets/css/phpci.css @@ -14,6 +14,27 @@ body padding: 10px; } +.build-plugin-status { + text-align: center; + min-width: 80px; + float: left; + padding: 5px; + margin-right: 5px; + border: 1px solid black; +} + +.success-message { + background-color: #4F8A10; +} + +.error-message { + background-color: #FF4747; +} + +#latest-builds td { + vertical-align: middle; +} + .widget-title, .modal-header, .table th, div.dataTables_wrapper .ui-widget-header, .ui-dialog .ui-dialog-titlebar { background-color: #efefef; background-image: -webkit-gradient(linear, 0 0%, 0 100%, from(#fdfdfd), to(#eaeaea)); @@ -61,7 +82,7 @@ body background: url('/assets/img/icon-build-running.png') no-repeat top left; } -h3 +h3 { border-bottom: 1px solid #f0f0f0; margin-top: 0; From 4eadb1aef3d8a5eba2f65addfddf30d488ca2dd3 Mon Sep 17 00:00:00 2001 From: Gabriel Baker Date: Tue, 4 Jun 2013 19:49:26 +0100 Subject: [PATCH 2/4] Fix user entity not bein in registry --- PHPCI/Application.php | 8 ++++++-- PHPCI/Controller/BuildController.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/PHPCI/Application.php b/PHPCI/Application.php index c0048adf..3378a050 100644 --- a/PHPCI/Application.php +++ b/PHPCI/Application.php @@ -10,6 +10,7 @@ namespace PHPCI; use b8; +use b8\Registry; use b8\Http\Response\RedirectResponse; use b8\View; @@ -33,8 +34,11 @@ class Application extends b8\Application $sessionAction = ($this->controllerName == 'Session' && in_array($this->action, array('login', 'logout'))); $externalAction = in_array($this->controllerName, array('Bitbucket', 'Github', 'BuildStatus')); $skipValidation = ($externalAction || $sessionAction); - + if($skipValidation || $this->validateSession()) { + if ( !empty($_SESSION['user']) ) { + Registry::getInstance()->set('user', $_SESSION['user']); + } parent::handleRequest(); } @@ -43,7 +47,7 @@ class Application extends b8\Application $view->content = $this->response->getContent(); $this->response->setContent($view->render()); } - + return $this->response; } diff --git a/PHPCI/Controller/BuildController.php b/PHPCI/Controller/BuildController.php index 21de59c9..d4cf64b6 100644 --- a/PHPCI/Controller/BuildController.php +++ b/PHPCI/Controller/BuildController.php @@ -89,7 +89,7 @@ class BuildController extends \PHPCI\Controller if (!Registry::getInstance()->get('user')->getIsAdmin()) { throw new \Exception('You do not have permission to do that.'); } - + $build = $this->_buildStore->getById($buildId); $this->_buildStore->delete($build); From 396428cc828ab526cef3df5f989ef52df63cb3b9 Mon Sep 17 00:00:00 2001 From: Gabriel Baker Date: Wed, 5 Jun 2013 17:13:00 +0100 Subject: [PATCH 3/4] ui tweaks --- PHPCI/View/BuildsTable.phtml | 2 +- assets/css/phpci.css | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/PHPCI/View/BuildsTable.phtml b/PHPCI/View/BuildsTable.phtml index 6b0c5b16..df34d97a 100644 --- a/PHPCI/View/BuildsTable.phtml +++ b/PHPCI/View/BuildsTable.phtml @@ -43,7 +43,7 @@ switch($build->getStatus()) } ?> $pluginstatus): ?> -
'> +
'>
diff --git a/assets/css/phpci.css b/assets/css/phpci.css index 8d540519..1d1a16f9 100644 --- a/assets/css/phpci.css +++ b/assets/css/phpci.css @@ -15,9 +15,7 @@ body } .build-plugin-status { - text-align: center; - min-width: 80px; - float: left; + float: left!important; padding: 5px; margin-right: 5px; border: 1px solid black; From 9323797900702a26b61a14fcff854084e0c0b88b Mon Sep 17 00:00:00 2001 From: Gabriel Baker Date: Wed, 5 Jun 2013 20:59:05 +0100 Subject: [PATCH 4/4] ui --- PHPCI/View/BuildsTable.phtml | 22 +++++++++++++++++++--- assets/css/phpci.css | 7 +------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/PHPCI/View/BuildsTable.phtml b/PHPCI/View/BuildsTable.phtml index df34d97a..34a5ca72 100644 --- a/PHPCI/View/BuildsTable.phtml +++ b/PHPCI/View/BuildsTable.phtml @@ -11,21 +11,26 @@ switch($build->getStatus()) { case 0: $cls = 'info'; + $subcls = 'info'; $status = 'Pending'; + break; case 1: $cls = 'warning'; + $subcls = 'warning'; $status = 'Running'; break; case 2: $cls = 'success'; + $subcls = 'success'; $status = 'Success'; break; case 3: $cls = 'error'; + $subcls = 'important'; $status = 'Failed'; break; } @@ -38,14 +43,25 @@ switch($build->getStatus()) getPlugins(), true); + if ( !is_array($plugins) ) { $plugins = array(); } + if ( 0 === count($plugins) ) { + ?> + + + + - $pluginstatus): ?> -
'> + $pluginstatus): + $subcls = $pluginstatus?'label label-success':'label label-important'; + ?> + -
+
diff --git a/assets/css/phpci.css b/assets/css/phpci.css index 1d1a16f9..cfb886d4 100644 --- a/assets/css/phpci.css +++ b/assets/css/phpci.css @@ -14,12 +14,7 @@ body padding: 10px; } -.build-plugin-status { - float: left!important; - padding: 5px; - margin-right: 5px; - border: 1px solid black; -} +td .label { margin-right: 5px; } .success-message { background-color: #4F8A10;