mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-20 05:42:40 +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:
parent
dd3ed6fdd8
commit
c462713584
4 changed files with 25 additions and 17 deletions
|
@ -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'),
|
||||
|
|
|
@ -41,7 +41,7 @@ final class PhabricatorMetaMTAWorker
|
|||
return $this->message;
|
||||
}
|
||||
|
||||
public function renderForDisplay() {
|
||||
public function renderForDisplay(PhabricatorUser $viewer) {
|
||||
return phutil_tag(
|
||||
'pre',
|
||||
array(
|
||||
|
|
|
@ -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.
|
||||
$link = DiffusionView::linkCommit(
|
||||
$commit->getRepository(),
|
||||
$commit->getCommitIdentifier());
|
||||
|
||||
$repository = id(new PhabricatorRepository())
|
||||
->load($commit->getRepositoryID());
|
||||
$link = DiffusionView::linkCommit($repository,
|
||||
$commit->getCommitIdentifier());
|
||||
return hsprintf('%s%s', $link, $suffix);
|
||||
return array($link, $suffix);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue