From ed1928eee267270874f8046f21c9d009c0788b2d Mon Sep 17 00:00:00 2001 From: Natthu Bharambe Date: Fri, 24 Feb 2012 14:26:49 -0800 Subject: [PATCH] Show lint/unit failure explanation in Phabricator Summary: Tweaked lint/unit field specifications to introduce the failure explanation read from arc:[lint|unit]-excuse. Task ID: # Blame Rev: Test Plan: Create dumb diffs with errors - run modified 'arc' and change conduit_url to http://phabricator.dev1020.facebook.com/api/ - verified that explanation shows up with proper formatting. Revert Plan: Tags: Reviewers: epriestley, nh Reviewed By: epriestley CC: Girish, akramer, blair, aran, epriestley, andreygoder Differential Revision: https://secure.phabricator.com/D1689 --- .../DifferentialLintFieldSpecification.php | 17 ++++++++++++++++- .../DifferentialUnitFieldSpecification.php | 18 +++++++++++++++++- .../differential/revision-detail.css | 7 +++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/applications/differential/field/specification/lint/DifferentialLintFieldSpecification.php b/src/applications/differential/field/specification/lint/DifferentialLintFieldSpecification.php index 13b31b6989..872fa645ee 100644 --- a/src/applications/differential/field/specification/lint/DifferentialLintFieldSpecification.php +++ b/src/applications/differential/field/specification/lint/DifferentialLintFieldSpecification.php @@ -28,7 +28,20 @@ final class DifferentialLintFieldSpecification } public function getRequiredDiffProperties() { - return array('arc:lint'); + return array('arc:lint', 'arc:lint-excuse'); + } + + private function getLintExcuse() { + $excuse = $this->getDiffProperty('arc:lint-excuse'); + $excuse = phutil_escape_html($excuse); + $excuse = nl2br($excuse); + + $excuse_markup = ''; + if (strlen($excuse)) { + $excuse_markup = '

Explanation for failure(s):

'. + ''.$excuse.''; + } + return $excuse_markup; } public function renderValueForRevisionView() { @@ -83,8 +96,10 @@ final class DifferentialLintFieldSpecification ''. ''; } + $lexcuse = $this->getLintExcuse(); $ltail = '
'. + $lexcuse. ''. diff --git a/src/applications/differential/field/specification/unit/DifferentialUnitFieldSpecification.php b/src/applications/differential/field/specification/unit/DifferentialUnitFieldSpecification.php index 8e3fda1e77..6a8e365e68 100644 --- a/src/applications/differential/field/specification/unit/DifferentialUnitFieldSpecification.php +++ b/src/applications/differential/field/specification/unit/DifferentialUnitFieldSpecification.php @@ -28,7 +28,20 @@ final class DifferentialUnitFieldSpecification } public function getRequiredDiffProperties() { - return array('arc:unit'); + return array('arc:unit', 'arc:unit-excuse'); + } + + private function getUnitExcuse() { + $excuse = $this->getDiffProperty('arc:unit-excuse'); + $excuse = phutil_escape_html($excuse); + $excuse = nl2br($excuse); + + $excuse_markup = ''; + if (strlen($excuse)) { + $excuse_markup = '

Explanation for failure(s):

'. + ''.$excuse.''; + } + return $excuse_markup; } public function renderValueForRevisionView() { @@ -67,9 +80,12 @@ final class DifferentialUnitFieldSpecification $postponed_count++; } } + + $uexcuse = $this->getUnitExcuse(); if ($unit_messages) { $utail = '
'. + $uexcuse. '
    '. implode("\n", $unit_messages). '
'. diff --git a/webroot/rsrc/css/application/differential/revision-detail.css b/webroot/rsrc/css/application/differential/revision-detail.css index efc53d3bf6..d7d694f91b 100644 --- a/webroot/rsrc/css/application/differential/revision-detail.css +++ b/webroot/rsrc/css/application/differential/revision-detail.css @@ -86,6 +86,13 @@ font-weight: bold; } +.differential-lint-block .lint-excuse, +.differential-unit-block .unit-excuse { + background: #808080; + color: #ffff66; + font-size: 12px; +} + .differential-keyboard-shortcuts { float: right; }