mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-03 04:02:43 +01:00
d9dd4d427d
Summary: Ref T10756. This: - Fixes T7307. This UI is now admin-only. - Makes the main "running daemons" table more useful for multi-host setups (show where daemons are running). - Removes logs from the web UI: these are sometimes vaguely sensitive and shouldn't be visible. The UI tells you how to get them with `bin/phd log`. - Minor modernization. Test Plan: - As a non-admin, viewed daemons (access error) and bulk jobs (worked great). - Browsed bulk job pages. - Ran a bulk job. - Viewed daemon console. - Viewed task detail / daemon detail / daemon list pages. {F1220516} Reviewers: chad Reviewed By: chad Maniphest Tasks: T7307, T10756 Differential Revision: https://secure.phabricator.com/D15724
89 lines
2.2 KiB
PHP
89 lines
2.2 KiB
PHP
<?php
|
|
|
|
final class PhabricatorDaemonBulkJobViewController
|
|
extends PhabricatorDaemonBulkJobController {
|
|
|
|
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);
|
|
$crumbs->setBorder(true);
|
|
|
|
$properties = $this->renderProperties($job);
|
|
$curtain = $this->buildCurtainView($job);
|
|
|
|
$box = id(new PHUIObjectBoxView())
|
|
->setHeaderText(pht('Details'))
|
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
|
->addPropertyList($properties);
|
|
|
|
$timeline = $this->buildTransactionTimeline(
|
|
$job,
|
|
new PhabricatorWorkerBulkJobTransactionQuery());
|
|
$timeline->setShouldTerminate(true);
|
|
|
|
$header = id(new PHUIHeaderView())
|
|
->setHeader($title)
|
|
->setHeaderIcon('fa-hourglass');
|
|
|
|
$view = id(new PHUITwoColumnView())
|
|
->setHeader($header)
|
|
->setCurtain($curtain)
|
|
->setMainColumn(array(
|
|
$box,
|
|
$timeline,
|
|
));
|
|
|
|
return $this->newPage()
|
|
->setTitle($title)
|
|
->setCrumbs($crumbs)
|
|
->appendChild($view);
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
private function buildCurtainView(PhabricatorWorkerBulkJob $job) {
|
|
$viewer = $this->getViewer();
|
|
$curtain = $this->newCurtainView($job);
|
|
|
|
if ($job->isConfirming()) {
|
|
$continue_uri = $job->getMonitorURI();
|
|
} else {
|
|
$continue_uri = $job->getDoneURI();
|
|
}
|
|
|
|
$curtain->addAction(
|
|
id(new PhabricatorActionView())
|
|
->setHref($continue_uri)
|
|
->setIcon('fa-arrow-circle-o-right')
|
|
->setName(pht('Continue')));
|
|
|
|
return $curtain;
|
|
}
|
|
|
|
}
|