From db42aae361474cb4b8189008638ec4c2bf042667 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 29 Apr 2014 11:10:16 -0700 Subject: [PATCH] Add PHUIObjectItemView Status Display to Harbormaster Summary: Took a short pass here with the new UI, holler if something is TOO EXTREME. Test Plan: Tested with manual sleep builds. {F148693} Reviewers: btrahan, epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D8901 --- .../HarbormasterBuildableListController.php | 22 ++++++++++++++----- src/view/phui/PHUIObjectItemView.php | 4 ++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/applications/harbormaster/controller/HarbormasterBuildableListController.php b/src/applications/harbormaster/controller/HarbormasterBuildableListController.php index 0faef87424..4f76bf567d 100644 --- a/src/applications/harbormaster/controller/HarbormasterBuildableListController.php +++ b/src/applications/harbormaster/controller/HarbormasterBuildableListController.php @@ -32,6 +32,7 @@ final class HarbormasterBuildableListController $viewer = $this->getRequest()->getUser(); $list = new PHUIObjectItemListView(); + $list->setStates(true); foreach ($buildables as $buildable) { $id = $buildable->getID(); @@ -52,19 +53,30 @@ final class HarbormasterBuildableListController $item->addIcon('wrench-grey', pht('Manual')); } - $list->addItem($item); - switch ($buildable->getBuildableStatus()) { case HarbormasterBuildable::STATUS_PASSED: - $item->setBarColor('green'); + $item->setState(PHUIObjectItemView::STATE_SUCCESS); break; case HarbormasterBuildable::STATUS_FAILED: - $item->setBarColor('red'); + $item->setState(PHUIObjectItemView::STATE_FAIL); + break; + case HarbormasterBuildable::STATUS_BUILDING: + $item->setState(PHUIObjectItemView::STATE_BUILD); + break; + default: + $item->setState(PHUIObjectItemView::STATE_WARN); break; } + + $list->addItem($item); + } - return $list; + $box = id(new PHUIObjectBoxView()) + ->setHeaderText(pht('Buildables')) + ->appendChild($list); + + return $box; } public function buildSideNavView($for_app = false) { diff --git a/src/view/phui/PHUIObjectItemView.php b/src/view/phui/PHUIObjectItemView.php index cbba7a64b2..00bedd86c6 100644 --- a/src/view/phui/PHUIObjectItemView.php +++ b/src/view/phui/PHUIObjectItemView.php @@ -30,6 +30,7 @@ final class PHUIObjectItemView extends AphrontTagView { const STATE_FAIL = 'red'; const STATE_WARN = 'yellow'; const STATE_NOTE = 'blue'; + const STATE_BUILD = 'sky'; public function setDisabled($disabled) { $this->disabled = $disabled; @@ -129,6 +130,9 @@ final class PHUIObjectItemView extends AphrontTagView { case self::STATE_NOTE: $fi = 'fa-info-circle blue'; break; + case self::STATE_BUILD: + $fi = 'fa-refresh ph-spin sky'; + break; } $this->fontIcon = id(new PHUIIconView()) ->setIconFont($fi.' fa-2x');