From 9c1c4bb5ae710270ecb701343f99d17addbfcc79 Mon Sep 17 00:00:00 2001 From: James Rhodes Date: Wed, 6 Aug 2014 10:34:39 +1000 Subject: [PATCH] Move artifacts and build target messages into tabs Summary: This moves artifacts and build target messages into tabs. Test Plan: Viewed build plan, saw the tabs appear when the steps had appropriate artifacts and / or messages. Reviewers: #blessed_reviewers, epriestley, chad Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D10161 --- resources/celerity/map.php | 6 +-- .../HarbormasterBuildViewController.php | 46 +++++++++---------- src/view/phui/PHUIPropertyListView.php | 22 +++++++++ .../rsrc/css/phui/phui-property-list-view.css | 6 +++ 4 files changed, 54 insertions(+), 26 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 39a710a0f5..57e6443b30 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -7,7 +7,7 @@ */ return array( 'names' => array( - 'core.pkg.css' => '66ada2ec', + 'core.pkg.css' => '519e8478', 'core.pkg.js' => '4c28870b', 'darkconsole.pkg.js' => 'df001cab', 'differential.pkg.css' => '4a93db37', @@ -137,7 +137,7 @@ return array( 'rsrc/css/phui/phui-object-box.css' => 'e9f7e938', 'rsrc/css/phui/phui-object-item-list-view.css' => '7ac40b5a', 'rsrc/css/phui/phui-pinboard-view.css' => '3dd4a269', - 'rsrc/css/phui/phui-property-list-view.css' => '2f7199e8', + 'rsrc/css/phui/phui-property-list-view.css' => '86f9df88', 'rsrc/css/phui/phui-remarkup-preview.css' => '19ad512b', 'rsrc/css/phui/phui-spacing.css' => '042804d6', 'rsrc/css/phui/phui-status.css' => '2f562399', @@ -787,7 +787,7 @@ return array( 'phui-object-box-css' => 'e9f7e938', 'phui-object-item-list-view-css' => '7ac40b5a', 'phui-pinboard-view-css' => '3dd4a269', - 'phui-property-list-view-css' => '2f7199e8', + 'phui-property-list-view-css' => '86f9df88', 'phui-remarkup-preview-css' => '19ad512b', 'phui-spacing-css' => '042804d6', 'phui-status-list-view-css' => '2f562399', diff --git a/src/applications/harbormaster/controller/HarbormasterBuildViewController.php b/src/applications/harbormaster/controller/HarbormasterBuildViewController.php index 437621e3e2..681526b35e 100644 --- a/src/applications/harbormaster/controller/HarbormasterBuildViewController.php +++ b/src/applications/harbormaster/controller/HarbormasterBuildViewController.php @@ -23,6 +23,8 @@ final class HarbormasterBuildViewController return new Aphront404Response(); } + require_celerity_resource('harbormaster-css'); + $title = pht('Build %d', $id); $header = id(new PHUIHeaderView()) @@ -127,18 +129,26 @@ final class HarbormasterBuildViewController $target_box->addPropertyList($properties, pht('Variables')); } + $artifacts = $this->buildArtifacts($build_target); + if ($artifacts) { + $properties = new PHUIPropertyListView(); + $properties->addRawContent($artifacts); + $target_box->addPropertyList($properties, pht('Artifacts')); + } + + $build_messages = idx($messages, $build_target->getPHID(), array()); + if ($build_messages) { + $properties = new PHUIPropertyListView(); + $properties->addRawContent($this->buildMessages($build_messages)); + $target_box->addPropertyList($properties, pht('Messages')); + } + $properties = new PHUIPropertyListView(); $properties->addProperty('Build Target ID', $build_target->getID()); $target_box->addPropertyList($properties, pht('Metadata')); $targets[] = $target_box; - $build_messages = idx($messages, $build_target->getPHID(), array()); - if ($build_messages) { - $targets[] = $this->buildMessages($build_messages); - } - - $targets[] = $this->buildArtifacts($build_target); $targets[] = $this->buildLog($build, $build_target); } @@ -163,7 +173,9 @@ final class HarbormasterBuildViewController )); } - private function buildArtifacts(HarbormasterBuildTarget $build_target) { + private function buildArtifacts( + HarbormasterBuildTarget $build_target) { + $request = $this->getRequest(); $viewer = $request->getUser(); @@ -176,20 +188,14 @@ final class HarbormasterBuildViewController return null; } - $list = new PHUIObjectItemListView(); + $list = id(new PHUIObjectItemListView()) + ->setFlush(true); foreach ($artifacts as $artifact) { $list->addItem($artifact->getObjectItemView($viewer)); } - $header = id(new PHUIHeaderView()) - ->setHeader(pht('Build Artifacts')) - ->setUser($viewer); - - $box = id(new PHUIObjectBoxView()) - ->setHeader($header); - - return array($box, $list); + return $list; } private function buildLog( @@ -247,8 +253,6 @@ final class HarbormasterBuildViewController ->setForm($log_view); if ($is_empty) { - require_celerity_resource('harbormaster-css'); - $log_box = phutil_tag( 'div', array( @@ -475,11 +479,7 @@ final class HarbormasterBuildViewController 'date', )); - $box = id(new PHUIObjectBoxView()) - ->setHeaderText(pht('Build Target Messages')) - ->appendChild($table); - - return $box; + return $table; } diff --git a/src/view/phui/PHUIPropertyListView.php b/src/view/phui/PHUIPropertyListView.php index 466f83a33b..4569d3209d 100644 --- a/src/view/phui/PHUIPropertyListView.php +++ b/src/view/phui/PHUIPropertyListView.php @@ -81,6 +81,14 @@ final class PHUIPropertyListView extends AphrontView { return $this; } + public function addRawContent($content) { + $this->parts[] = array( + 'type' => 'raw', + 'content' => $content, + ); + return $this; + } + public function addImageContent($content) { $this->parts[] = array( 'type' => 'image', @@ -143,6 +151,9 @@ final class PHUIPropertyListView extends AphrontView { case 'image': $items[] = $this->renderTextPart($part); break; + case 'raw': + $items[] = $this->renderRawPart($part); + break; default: throw new Exception(pht("Unknown part type '%s'!", $type)); } @@ -263,4 +274,15 @@ final class PHUIPropertyListView extends AphrontView { $part['content']); } + private function renderRawPart(array $part) { + $classes = array(); + $classes[] = 'phui-property-list-raw-content'; + return phutil_tag( + 'div', + array( + 'class' => implode($classes, ' '), + ), + $part['content']); + } + } diff --git a/webroot/rsrc/css/phui/phui-property-list-view.css b/webroot/rsrc/css/phui/phui-property-list-view.css index 03b2ed89f9..a3dd186d81 100644 --- a/webroot/rsrc/css/phui/phui-property-list-view.css +++ b/webroot/rsrc/css/phui/phui-property-list-view.css @@ -118,6 +118,12 @@ padding: 8px; } +.phui-property-list-raw-content { + padding: 0px; + background: #fff; + overflow: hidden; +} + /* In the common case where we immediately follow a header, move back up 30px so we snuggle next to the header. */ .device-desktop .phui-header-view