mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-11 17:32:41 +01:00
b2bf634795
Summary: Nothing fancy here, just add a detail page. Test Plan: Looked at detail page. {F24808} Reviewers: btrahan Reviewed By: btrahan CC: aran, vrana Maniphest Tasks: T2015 Differential Revision: https://secure.phabricator.com/D3995
89 lines
2.2 KiB
PHP
89 lines
2.2 KiB
PHP
<?php
|
|
|
|
abstract class DrydockController extends PhabricatorController {
|
|
|
|
public function buildStandardPageResponse($view, array $data) {
|
|
|
|
$page = $this->buildStandardPageView();
|
|
|
|
$page->setApplicationName('Drydock');
|
|
$page->setBaseURI('/drydock/');
|
|
$page->setTitle(idx($data, 'title'));
|
|
$page->setGlyph("\xE2\x98\x82");
|
|
|
|
$page->appendChild($view);
|
|
|
|
$response = new AphrontWebpageResponse();
|
|
return $response->setContent($page->render());
|
|
}
|
|
|
|
final protected function buildSideNav($selected) {
|
|
$nav = new AphrontSideNavFilterView();
|
|
$nav->setBaseURI(new PhutilURI('/drydock/'));
|
|
$nav->addFilter('resource', 'Resources');
|
|
$nav->addFilter('lease', 'Leases');
|
|
$nav->addSpacer();
|
|
$nav->addFilter('log', 'Logs');
|
|
|
|
$nav->selectFilter($selected, 'resource');
|
|
|
|
return $nav;
|
|
}
|
|
|
|
protected function buildLogTableView(array $logs) {
|
|
assert_instances_of($logs, 'DrydockLog');
|
|
|
|
$user = $this->getRequest()->getUser();
|
|
|
|
// TODO: It's probably a stretch to claim this works on mobile.
|
|
|
|
$rows = array();
|
|
foreach ($logs as $log) {
|
|
$resource_uri = '/resource/'.$log->getResourceID().'/';
|
|
$resource_uri = $this->getApplicationURI($resource_uri);
|
|
|
|
$lease_uri = '/lease/'.$log->getLeaseID().'/';
|
|
$lease_uri = $this->getApplicationURI($lease_uri);
|
|
|
|
$rows[] = array(
|
|
phutil_render_tag(
|
|
'a',
|
|
array(
|
|
'href' => $resource_uri,
|
|
),
|
|
phutil_escape_html($log->getResourceID())),
|
|
phutil_render_tag(
|
|
'a',
|
|
array(
|
|
'href' => $lease_uri,
|
|
),
|
|
phutil_escape_html($log->getLeaseID())),
|
|
phutil_escape_html($log->getMessage()),
|
|
phabricator_datetime($log->getEpoch(), $user),
|
|
);
|
|
}
|
|
|
|
$table = new AphrontTableView($rows);
|
|
$table->setHeaders(
|
|
array(
|
|
'Resource',
|
|
'Lease',
|
|
'Message',
|
|
'Date',
|
|
));
|
|
$table->setColumnClasses(
|
|
array(
|
|
'',
|
|
'',
|
|
'wide',
|
|
'',
|
|
));
|
|
|
|
$panel = new AphrontPanelView();
|
|
$panel->setHeader('Logs');
|
|
$panel->appendChild($table);
|
|
|
|
return $panel;
|
|
}
|
|
|
|
}
|