1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +01:00

Tidy up some Drydock UI

Summary: Ref T9253. We had some un-modern use of UI elements, clean that up. Add a tab for showing slot locks so you don't have to fish around in the database.

Test Plan: Looked at blueprints, resources and leases. Looked at slot locks.

Reviewers: chad, hach-que

Reviewed By: chad, hach-que

Maniphest Tasks: T9253

Differential Revision: https://secure.phabricator.com/D14119
This commit is contained in:
epriestley 2015-09-21 04:45:43 -07:00
parent 3ac99006bf
commit 9a270efe8a
5 changed files with 60 additions and 9 deletions

View file

@ -61,6 +61,10 @@ final class DrydockBlueprintViewController extends DrydockBlueprintController {
$viewer,
$properties);
$resource_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Resources'))
->setObjectList($resource_list);
$timeline = $this->buildTransactionTimeline(
$blueprint,
new DrydockBlueprintTransactionQuery());
@ -70,7 +74,7 @@ final class DrydockBlueprintViewController extends DrydockBlueprintController {
array(
$crumbs,
$object_box,
$resource_list,
$resource_box,
$timeline,
),
array(

View file

@ -8,4 +8,32 @@ abstract class DrydockController extends PhabricatorController {
return $this->buildSideNavView()->getMenu();
}
protected function buildLocksTab($owner_phid) {
$locks = DrydockSlotLock::loadLocks($owner_phid);
$rows = array();
foreach ($locks as $lock) {
$rows[] = array(
$lock->getID(),
$lock->getLockKey(),
);
}
$table = id(new AphrontTableView($rows))
->setNoDataString(pht('No slot locks held.'))
->setHeaders(
array(
pht('ID'),
pht('Lock Key'),
))
->setColumnClasses(
array(
null,
'wide',
));
return id(new PHUIPropertyListView())
->addRawContent($table);
}
}

View file

@ -42,18 +42,25 @@ final class DrydockLeaseViewController extends DrydockLeaseController {
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($title, $lease_uri);
$locks = $this->buildLocksTab($lease->getPHID());
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addPropertyList($properties);
->addPropertyList($properties, pht('Properties'))
->addPropertyList($locks, pht('Slot Locks'));
$log_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Lease Logs'))
->setTable($log_table);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
$log_table,
$log_box,
),
array(
'title' => $title,
'title' => $title,
));
}

View file

@ -54,16 +54,27 @@ final class DrydockResourceViewController extends DrydockResourceController {
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Resource %d', $resource->getID()));
$locks = $this->buildLocksTab($resource->getPHID());
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addPropertyList($properties);
->addPropertyList($properties, pht('Properties'))
->addPropertyList($locks, pht('Slot Locks'));
$lease_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Leases'))
->setObjectList($lease_list);
$log_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Resource Logs'))
->setTable($log_table);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
$lease_list,
$log_table,
$lease_box,
$log_box,
),
array(
'title' => $title,
@ -95,6 +106,7 @@ final class DrydockResourceViewController extends DrydockResourceController {
private function buildPropertyListView(
DrydockResource $resource,
PhabricatorActionListView $actions) {
$viewer = $this->getViewer();
$view = new PHUIPropertyListView();
$view->setActionList($actions);
@ -110,10 +122,9 @@ final class DrydockResourceViewController extends DrydockResourceController {
pht('Resource Type'),
$resource->getType());
// TODO: Load handle.
$view->addProperty(
pht('Blueprint'),
$resource->getBlueprintPHID());
$viewer->renderHandle($resource->getBlueprintPHID()));
$attributes = $resource->getAttributes();
if ($attributes) {

View file

@ -29,6 +29,7 @@ final class DrydockBlueprintPHIDType extends PhabricatorPHIDType {
$blueprint = $objects[$phid];
$id = $blueprint->getID();
$handle->setName($blueprint->getBlueprintName());
$handle->setURI("/drydock/blueprint/{$id}/");
}
}