2015-06-23 22:36:16 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorDaemonBulkJobViewController
|
2016-04-15 21:00:34 +02:00
|
|
|
extends PhabricatorDaemonBulkJobController {
|
2015-06-23 22:36:16 +02:00
|
|
|
|
|
|
|
public function handleRequest(AphrontRequest $request) {
|
|
|
|
$viewer = $this->getViewer();
|
|
|
|
|
|
|
|
$job = id(new PhabricatorWorkerBulkJobQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withIDs(array($request->getURIData('id')))
|
|
|
|
->executeOne();
|
|
|
|
if (!$job) {
|
|
|
|
return new Aphront404Response();
|
|
|
|
}
|
|
|
|
|
|
|
|
$title = pht('Bulk Job %d', $job->getID());
|
|
|
|
|
|
|
|
$crumbs = $this->buildApplicationCrumbs();
|
|
|
|
$crumbs->addTextCrumb($title);
|
2016-04-02 19:18:52 +02:00
|
|
|
$crumbs->setBorder(true);
|
2015-06-23 22:36:16 +02:00
|
|
|
|
|
|
|
$properties = $this->renderProperties($job);
|
2016-04-02 19:18:52 +02:00
|
|
|
$curtain = $this->buildCurtainView($job);
|
2015-06-23 22:36:16 +02:00
|
|
|
|
|
|
|
$box = id(new PHUIObjectBoxView())
|
2016-04-07 00:20:53 +02:00
|
|
|
->setHeaderText(pht('Details'))
|
2016-04-02 19:18:52 +02:00
|
|
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
2015-06-23 22:36:16 +02:00
|
|
|
->addPropertyList($properties);
|
|
|
|
|
|
|
|
$timeline = $this->buildTransactionTimeline(
|
|
|
|
$job,
|
|
|
|
new PhabricatorWorkerBulkJobTransactionQuery());
|
|
|
|
$timeline->setShouldTerminate(true);
|
|
|
|
|
2016-04-02 19:18:52 +02:00
|
|
|
$header = id(new PHUIHeaderView())
|
|
|
|
->setHeader($title)
|
|
|
|
->setHeaderIcon('fa-hourglass');
|
|
|
|
|
|
|
|
$view = id(new PHUITwoColumnView())
|
|
|
|
->setHeader($header)
|
|
|
|
->setCurtain($curtain)
|
|
|
|
->setMainColumn(array(
|
2015-06-23 22:36:16 +02:00
|
|
|
$box,
|
|
|
|
$timeline,
|
|
|
|
));
|
2016-04-02 19:18:52 +02:00
|
|
|
|
|
|
|
return $this->newPage()
|
|
|
|
->setTitle($title)
|
|
|
|
->setCrumbs($crumbs)
|
|
|
|
->appendChild($view);
|
2015-06-23 22:36:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private function renderProperties(PhabricatorWorkerBulkJob $job) {
|
|
|
|
$viewer = $this->getViewer();
|
|
|
|
|
|
|
|
$view = id(new PHUIPropertyListView())
|
|
|
|
->setUser($viewer)
|
|
|
|
->setObject($job);
|
|
|
|
|
|
|
|
$view->addProperty(
|
|
|
|
pht('Author'),
|
|
|
|
$viewer->renderHandle($job->getAuthorPHID()));
|
|
|
|
|
|
|
|
$view->addProperty(pht('Status'), $job->getStatusName());
|
|
|
|
|
|
|
|
return $view;
|
|
|
|
}
|
|
|
|
|
2016-04-02 19:18:52 +02:00
|
|
|
private function buildCurtainView(PhabricatorWorkerBulkJob $job) {
|
2015-06-23 22:36:16 +02:00
|
|
|
$viewer = $this->getViewer();
|
2016-04-02 19:18:52 +02:00
|
|
|
$curtain = $this->newCurtainView($job);
|
2015-06-23 22:36:16 +02:00
|
|
|
|
2016-01-10 19:05:59 +01:00
|
|
|
if ($job->isConfirming()) {
|
|
|
|
$continue_uri = $job->getMonitorURI();
|
|
|
|
} else {
|
|
|
|
$continue_uri = $job->getDoneURI();
|
|
|
|
}
|
|
|
|
|
2016-04-02 19:18:52 +02:00
|
|
|
$curtain->addAction(
|
2015-06-23 22:36:16 +02:00
|
|
|
id(new PhabricatorActionView())
|
2016-01-10 19:05:59 +01:00
|
|
|
->setHref($continue_uri)
|
2015-06-23 22:36:16 +02:00
|
|
|
->setIcon('fa-arrow-circle-o-right')
|
|
|
|
->setName(pht('Continue')));
|
|
|
|
|
2016-04-02 19:18:52 +02:00
|
|
|
return $curtain;
|
2015-06-23 22:36:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|