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:
parent
3ac99006bf
commit
9a270efe8a
5 changed files with 60 additions and 9 deletions
|
@ -61,6 +61,10 @@ final class DrydockBlueprintViewController extends DrydockBlueprintController {
|
||||||
$viewer,
|
$viewer,
|
||||||
$properties);
|
$properties);
|
||||||
|
|
||||||
|
$resource_box = id(new PHUIObjectBoxView())
|
||||||
|
->setHeaderText(pht('Resources'))
|
||||||
|
->setObjectList($resource_list);
|
||||||
|
|
||||||
$timeline = $this->buildTransactionTimeline(
|
$timeline = $this->buildTransactionTimeline(
|
||||||
$blueprint,
|
$blueprint,
|
||||||
new DrydockBlueprintTransactionQuery());
|
new DrydockBlueprintTransactionQuery());
|
||||||
|
@ -70,7 +74,7 @@ final class DrydockBlueprintViewController extends DrydockBlueprintController {
|
||||||
array(
|
array(
|
||||||
$crumbs,
|
$crumbs,
|
||||||
$object_box,
|
$object_box,
|
||||||
$resource_list,
|
$resource_box,
|
||||||
$timeline,
|
$timeline,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -8,4 +8,32 @@ abstract class DrydockController extends PhabricatorController {
|
||||||
return $this->buildSideNavView()->getMenu();
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,18 +42,25 @@ final class DrydockLeaseViewController extends DrydockLeaseController {
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
$crumbs->addTextCrumb($title, $lease_uri);
|
$crumbs->addTextCrumb($title, $lease_uri);
|
||||||
|
|
||||||
|
$locks = $this->buildLocksTab($lease->getPHID());
|
||||||
|
|
||||||
$object_box = id(new PHUIObjectBoxView())
|
$object_box = id(new PHUIObjectBoxView())
|
||||||
->setHeader($header)
|
->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(
|
return $this->buildApplicationPage(
|
||||||
array(
|
array(
|
||||||
$crumbs,
|
$crumbs,
|
||||||
$object_box,
|
$object_box,
|
||||||
$log_table,
|
$log_box,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,16 +54,27 @@ final class DrydockResourceViewController extends DrydockResourceController {
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
$crumbs->addTextCrumb(pht('Resource %d', $resource->getID()));
|
$crumbs->addTextCrumb(pht('Resource %d', $resource->getID()));
|
||||||
|
|
||||||
|
$locks = $this->buildLocksTab($resource->getPHID());
|
||||||
|
|
||||||
$object_box = id(new PHUIObjectBoxView())
|
$object_box = id(new PHUIObjectBoxView())
|
||||||
->setHeader($header)
|
->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(
|
return $this->buildApplicationPage(
|
||||||
array(
|
array(
|
||||||
$crumbs,
|
$crumbs,
|
||||||
$object_box,
|
$object_box,
|
||||||
$lease_list,
|
$lease_box,
|
||||||
$log_table,
|
$log_box,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
@ -95,6 +106,7 @@ final class DrydockResourceViewController extends DrydockResourceController {
|
||||||
private function buildPropertyListView(
|
private function buildPropertyListView(
|
||||||
DrydockResource $resource,
|
DrydockResource $resource,
|
||||||
PhabricatorActionListView $actions) {
|
PhabricatorActionListView $actions) {
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
$view = new PHUIPropertyListView();
|
$view = new PHUIPropertyListView();
|
||||||
$view->setActionList($actions);
|
$view->setActionList($actions);
|
||||||
|
@ -110,10 +122,9 @@ final class DrydockResourceViewController extends DrydockResourceController {
|
||||||
pht('Resource Type'),
|
pht('Resource Type'),
|
||||||
$resource->getType());
|
$resource->getType());
|
||||||
|
|
||||||
// TODO: Load handle.
|
|
||||||
$view->addProperty(
|
$view->addProperty(
|
||||||
pht('Blueprint'),
|
pht('Blueprint'),
|
||||||
$resource->getBlueprintPHID());
|
$viewer->renderHandle($resource->getBlueprintPHID()));
|
||||||
|
|
||||||
$attributes = $resource->getAttributes();
|
$attributes = $resource->getAttributes();
|
||||||
if ($attributes) {
|
if ($attributes) {
|
||||||
|
|
|
@ -29,6 +29,7 @@ final class DrydockBlueprintPHIDType extends PhabricatorPHIDType {
|
||||||
$blueprint = $objects[$phid];
|
$blueprint = $objects[$phid];
|
||||||
$id = $blueprint->getID();
|
$id = $blueprint->getID();
|
||||||
|
|
||||||
|
$handle->setName($blueprint->getBlueprintName());
|
||||||
$handle->setURI("/drydock/blueprint/{$id}/");
|
$handle->setURI("/drydock/blueprint/{$id}/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue