1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +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);
$properties = $this->buildPropertyListView($task, $actions);
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addPropertyList($properties);
$retry_head = id(new PHUIHeaderView())
->setHeader(pht('Retries'));
$retry_info = $this->buildRetryListView($task);
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addPropertyList($properties);
$retry_box = id(new PHUIObjectBoxView())
->setHeader($retry_head)
->addPropertyList($retry_info);
$content = array(
$object_box,
$retry_head,
$retry_info,
$retry_box,
);
}
@ -118,6 +122,8 @@ final class PhabricatorWorkerTaskDetailController
PhabricatorWorkerTask $task,
PhabricatorActionListView $actions) {
$viewer = $this->getRequest()->getUser();
$view = new PHUIPropertyListView();
$view->setActionList($actions);
@ -191,7 +197,7 @@ final class PhabricatorWorkerTaskDetailController
$data = id(new PhabricatorWorkerTaskData())->load($task->getDataID());
$task->setData($data->getData());
$worker = $task->getWorkerInstance();
$data = $worker->renderForDisplay();
$data = $worker->renderForDisplay($viewer);
$view->addProperty(
pht('Data'),

View file

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

View file

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

View file

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