Changeset View
Changeset View
Standalone View
Standalone View
src/ref/ArcanistBuildRef.php
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | private function getStatusMap() { | ||||
return $map; | return $map; | ||||
} | } | ||||
public function getID() { | public function getID() { | ||||
return $this->parameters['id']; | return $this->parameters['id']; | ||||
} | } | ||||
public function getPHID() { | |||||
return $this->parameters['phid']; | |||||
} | |||||
public function getName() { | public function getName() { | ||||
if (isset($this->parameters['fields']['name'])) { | if (isset($this->parameters['fields']['name'])) { | ||||
return $this->parameters['fields']['name']; | return $this->parameters['fields']['name']; | ||||
} | } | ||||
return $this->parameters['name']; | return $this->parameters['name']; | ||||
} | } | ||||
Show All 11 Lines | public function getStatusANSIColor() { | ||||
$map = $this->getStatusMap(); | $map = $this->getStatusMap(); | ||||
return $map['color.ansi']; | return $map['color.ansi']; | ||||
} | } | ||||
public function getObjectName() { | public function getObjectName() { | ||||
return pht('Build %d', $this->getID()); | return pht('Build %d', $this->getID()); | ||||
} | } | ||||
public function getBuildPlanPHID() { | |||||
return idxv($this->parameters, array('fields', 'buildPlanPHID')); | |||||
} | |||||
public function isComplete() { | |||||
switch ($this->getStatus()) { | |||||
case 'passed': | |||||
case 'failed': | |||||
case 'aborted': | |||||
case 'error': | |||||
case 'deadlocked': | |||||
return true; | |||||
default: | |||||
return false; | |||||
} | |||||
} | |||||
public function isPassed() { | |||||
return ($this->getStatus() === 'passed'); | |||||
} | |||||
public function getStatusSortVector() { | public function getStatusSortVector() { | ||||
$status = $this->getStatus(); | $status = $this->getStatus(); | ||||
// For now, just sort passed builds first. | // For now, just sort passed builds first. | ||||
if ($this->getStatus() == 'passed') { | if ($this->isPassed()) { | ||||
$status_class = 1; | $status_class = 1; | ||||
} else { | } else { | ||||
$status_class = 2; | $status_class = 2; | ||||
} | } | ||||
return id(new PhutilSortVector()) | return id(new PhutilSortVector()) | ||||
->addInt($status_class) | ->addInt($status_class) | ||||
->addString($status); | ->addString($status); | ||||
} | } | ||||
} | } |