1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 20:40:56 +01:00

Minor cleanup for task rendering in Daemons

Summary:
Fixes two issues:

  - When rendering a task's details, we currently issue a policy-oblivious query. Instead, issue a policy-aware query.
  - The formatting is a little bit weird, with the top half in a box and the bottom half with an older style. Make them consistent.

Test Plan: Looked at the detail pages for several tasks in queue.

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D7812
This commit is contained in:
epriestley 2013-12-20 18:02:32 -08:00
parent dd3ed6fdd8
commit c462713584
4 changed files with 25 additions and 17 deletions

View file

@ -41,19 +41,23 @@ final class PhabricatorWorkerTaskDetailController
$actions = $this->buildActionListView($task); $actions = $this->buildActionListView($task);
$properties = $this->buildPropertyListView($task, $actions); $properties = $this->buildPropertyListView($task, $actions);
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addPropertyList($properties);
$retry_head = id(new PHUIHeaderView()) $retry_head = id(new PHUIHeaderView())
->setHeader(pht('Retries')); ->setHeader(pht('Retries'));
$retry_info = $this->buildRetryListView($task); $retry_info = $this->buildRetryListView($task);
$object_box = id(new PHUIObjectBoxView()) $retry_box = id(new PHUIObjectBoxView())
->setHeader($header) ->setHeader($retry_head)
->addPropertyList($properties); ->addPropertyList($retry_info);
$content = array( $content = array(
$object_box, $object_box,
$retry_head, $retry_box,
$retry_info,
); );
} }
@ -118,6 +122,8 @@ final class PhabricatorWorkerTaskDetailController
PhabricatorWorkerTask $task, PhabricatorWorkerTask $task,
PhabricatorActionListView $actions) { PhabricatorActionListView $actions) {
$viewer = $this->getRequest()->getUser();
$view = new PHUIPropertyListView(); $view = new PHUIPropertyListView();
$view->setActionList($actions); $view->setActionList($actions);
@ -191,7 +197,7 @@ final class PhabricatorWorkerTaskDetailController
$data = id(new PhabricatorWorkerTaskData())->load($task->getDataID()); $data = id(new PhabricatorWorkerTaskData())->load($task->getDataID());
$task->setData($data->getData()); $task->setData($data->getData());
$worker = $task->getWorkerInstance(); $worker = $task->getWorkerInstance();
$data = $worker->renderForDisplay(); $data = $worker->renderForDisplay($viewer);
$view->addProperty( $view->addProperty(
pht('Data'), pht('Data'),

View file

@ -41,7 +41,7 @@ final class PhabricatorMetaMTAWorker
return $this->message; return $this->message;
} }
public function renderForDisplay() { public function renderForDisplay(PhabricatorUser $viewer) {
return phutil_tag( return phutil_tag(
'pre', 'pre',
array( array(

View file

@ -64,19 +64,21 @@ abstract class PhabricatorRepositoryCommitParserWorker
return (bool)$bad_commit; return (bool)$bad_commit;
} }
public function renderForDisplay() { public function renderForDisplay(PhabricatorUser $viewer) {
$suffix = parent::renderForDisplay(); $suffix = parent::renderForDisplay($viewer);
$commit = $this->loadCommit();
$commit = id(new DiffusionCommitQuery())
->setViewer($viewer)
->withIDs(array(idx($this->getTaskData(), 'commitID')))
->executeOne();
if (!$commit) { if (!$commit) {
return $suffix; return $suffix;
} }
// TODO: (T603) This method should probably take a viewer. $link = DiffusionView::linkCommit(
$commit->getRepository(),
$commit->getCommitIdentifier());
$repository = id(new PhabricatorRepository()) return array($link, $suffix);
->load($commit->getRepositoryID());
$link = DiffusionView::linkCommit($repository,
$commit->getCommitIdentifier());
return hsprintf('%s%s', $link, $suffix);
} }
} }

View file

@ -154,7 +154,7 @@ abstract class PhabricatorWorker {
} }
} }
public function renderForDisplay() { public function renderForDisplay(PhabricatorUser $viewer) {
$data = PhutilReadableSerializer::printableValue($this->data); $data = PhutilReadableSerializer::printableValue($this->data);
return phutil_tag('pre', array(), $data); return phutil_tag('pre', array(), $data);
} }