Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/customfield/DifferentialUnitField.php
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | public function getWarningsForDetailView() { | ||||
} else { | } else { | ||||
$warnings[] = pht('These changes have unit test problems.'); | $warnings[] = pht('These changes have unit test problems.'); | ||||
} | } | ||||
return $warnings; | return $warnings; | ||||
} | } | ||||
public function renderDiffPropertyViewValue(DifferentialDiff $diff) { | public function renderDiffPropertyViewValue(DifferentialDiff $diff) { | ||||
$status_value = $diff->getUnitStatus(); | |||||
$status = DifferentialUnitStatus::newStatusFromValue($status_value); | |||||
$colors = array( | $status_icon = $status->getIconIcon(); | ||||
DifferentialUnitStatus::UNIT_NONE => 'grey', | $status_color = $status->getIconColor(); | ||||
DifferentialUnitStatus::UNIT_OKAY => 'green', | $status_name = $status->getName(); | ||||
DifferentialUnitStatus::UNIT_WARN => 'yellow', | |||||
DifferentialUnitStatus::UNIT_FAIL => 'red', | |||||
DifferentialUnitStatus::UNIT_SKIP => 'blue', | |||||
DifferentialUnitStatus::UNIT_AUTO_SKIP => 'blue', | |||||
); | |||||
$icon_color = idx($colors, $diff->getUnitStatus(), 'grey'); | |||||
$message = DifferentialRevisionUpdateHistoryView::getDiffUnitMessage( | |||||
$diff->getUnitStatus()); | |||||
$status = id(new PHUIStatusListView()) | $status = id(new PHUIStatusListView()) | ||||
->addItem( | ->addItem( | ||||
id(new PHUIStatusItemView()) | id(new PHUIStatusItemView()) | ||||
->setIcon(PHUIStatusItemView::ICON_STAR, $icon_color) | ->setIcon($status_icon, $status_color) | ||||
->setTarget($message)); | ->setTarget($status_name)); | ||||
return $status; | return $status; | ||||
} | } | ||||
} | } |