1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00

Convert Drydock to two column layout

Summary: Updates Drydock to use two column + curtain layouts.

Test Plan: Tested what I could get to, need @epriestley to run this locally for edge cases.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D15467
This commit is contained in:
Chad Little 2016-03-13 08:08:45 -07:00
parent 148a50e48b
commit 301ecdef18
7 changed files with 123 additions and 112 deletions

View file

@ -26,16 +26,14 @@ final class DrydockAuthorizationViewController
->setUser($viewer)
->setPolicyObject($authorization);
$state = $authorization->getBlueprintAuthorizationState();
$icon = DrydockAuthorization::getBlueprintStateIcon($state);
$name = DrydockAuthorization::getBlueprintStateName($state);
$header->setStatus($icon, null, $name);
$actions = $this->buildActionListView($authorization);
$curtain = $this->buildCurtain($authorization);
$properties = $this->buildPropertyListView($authorization);
$properties->setActionList($actions);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(
@ -45,29 +43,32 @@ final class DrydockAuthorizationViewController
$blueprint->getBlueprintName(),
$this->getApplicationURI("blueprint/{$blueprint_id}/"));
$crumbs->addTextCrumb($title);
$crumbs->setBorder(true);
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addPropertyList($properties);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
),
array(
'title' => $title,
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setCurtain($curtain)
->addPropertySection(pht('Properties'), $properties);
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild(
array(
$view,
));
}
private function buildActionListView(DrydockAuthorization $authorization) {
private function buildCurtain(DrydockAuthorization $authorization) {
$viewer = $this->getViewer();
$id = $authorization->getID();
$view = id(new PhabricatorActionListView())
->setUser($viewer)
->setObject($authorization);
$curtain = $this->newCurtainView($authorization);
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,
@ -84,7 +85,7 @@ final class DrydockAuthorizationViewController
$can_authorize = $can_edit && ($state != $state_authorized);
$can_decline = $can_edit && ($state != $state_declined);
$view->addAction(
$curtain->addAction(
id(new PhabricatorActionView())
->setHref($authorize_uri)
->setName(pht('Approve Authorization'))
@ -92,7 +93,7 @@ final class DrydockAuthorizationViewController
->setWorkflow(true)
->setDisabled(!$can_authorize));
$view->addAction(
$curtain->addAction(
id(new PhabricatorActionView())
->setHref($decline_uri)
->setName(pht('Decline Authorization'))
@ -100,7 +101,7 @@ final class DrydockAuthorizationViewController
->setWorkflow(true)
->setDisabled(!$can_decline));
return $view;
return $curtain;
}
private function buildPropertyListView(DrydockAuthorization $authorization) {

View file

@ -19,7 +19,8 @@ final class DrydockBlueprintViewController extends DrydockBlueprintController {
$header = id(new PHUIHeaderView())
->setHeader($title)
->setUser($viewer)
->setPolicyObject($blueprint);
->setPolicyObject($blueprint)
->setHeaderIcon('fa-map-o');
if ($blueprint->getIsDisabled()) {
$header->setStatus('fa-ban', 'red', pht('Disabled'));
@ -27,15 +28,12 @@ final class DrydockBlueprintViewController extends DrydockBlueprintController {
$header->setStatus('fa-check', 'bluegrey', pht('Active'));
}
$actions = $this->buildActionListView($blueprint);
$properties = $this->buildPropertyListView($blueprint, $actions);
$curtain = $this->buildCurtain($blueprint);
$properties = $this->buildPropertyListView($blueprint);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Blueprint %d', $blueprint->getID()));
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addPropertyList($properties);
$crumbs->setBorder(true);
$field_list = PhabricatorCustomField::getObjectFields(
$blueprint,
@ -49,9 +47,8 @@ final class DrydockBlueprintViewController extends DrydockBlueprintController {
$viewer,
$properties);
$resource_box = $this->buildResourceBox($blueprint);
$authorizations_box = $this->buildAuthorizationsBox($blueprint);
$resources = $this->buildResourceBox($blueprint);
$authorizations = $this->buildAuthorizationsBox($blueprint);
$timeline = $this->buildTransactionTimeline(
$blueprint,
@ -61,33 +58,36 @@ final class DrydockBlueprintViewController extends DrydockBlueprintController {
$log_query = id(new DrydockLogQuery())
->withBlueprintPHIDs(array($blueprint->getPHID()));
$log_box = $this->buildLogBox(
$logs = $this->buildLogBox(
$log_query,
$this->getApplicationURI("blueprint/{$id}/logs/query/all/"));
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
$resource_box,
$authorizations_box,
$log_box,
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setCurtain($curtain)
->addPropertySection(pht('Properties'), $properties)
->setMainColumn(array(
$resources,
$authorizations,
$logs,
$timeline,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild(
array(
$view,
));
}
private function buildActionListView(DrydockBlueprint $blueprint) {
private function buildCurtain(DrydockBlueprint $blueprint) {
$viewer = $this->getViewer();
$id = $blueprint->getID();
$view = id(new PhabricatorActionListView())
->setUser($viewer)
->setObject($blueprint);
$curtain = $this->newCurtainView($blueprint);
$edit_uri = $this->getApplicationURI("blueprint/edit/{$id}/");
$can_edit = PhabricatorPolicyFilter::hasCapability(
@ -95,7 +95,7 @@ final class DrydockBlueprintViewController extends DrydockBlueprintController {
$blueprint,
PhabricatorPolicyCapability::CAN_EDIT);
$view->addAction(
$curtain->addAction(
id(new PhabricatorActionView())
->setHref($edit_uri)
->setName(pht('Edit Blueprint'))
@ -113,7 +113,7 @@ final class DrydockBlueprintViewController extends DrydockBlueprintController {
$disable_uri = $this->getApplicationURI("blueprint/{$id}/enable/");
}
$view->addAction(
$curtain->addAction(
id(new PhabricatorActionView())
->setHref($disable_uri)
->setName($disable_name)
@ -121,19 +121,15 @@ final class DrydockBlueprintViewController extends DrydockBlueprintController {
->setWorkflow(true)
->setDisabled(!$can_edit));
return $view;
return $curtain;
}
private function buildPropertyListView(
DrydockBlueprint $blueprint,
PhabricatorActionListView $actions) {
DrydockBlueprint $blueprint) {
$viewer = $this->getViewer();
$view = id(new PHUIPropertyListView())
->setUser($viewer)
->setObject($blueprint);
$view->setActionList($actions);
->setUser($viewer);
$view->addProperty(
pht('Type'),
@ -177,6 +173,7 @@ final class DrydockBlueprintViewController extends DrydockBlueprintController {
return id(new PHUIObjectBoxView())
->setHeader($resource_header)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setObjectList($resource_list);
}
@ -242,6 +239,7 @@ final class DrydockBlueprintViewController extends DrydockBlueprintController {
return id(new PHUIObjectBoxView())
->setHeader($authorizations_header)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setObjectList($authorization_list);
}

View file

@ -102,6 +102,7 @@ abstract class DrydockController extends PhabricatorController {
->setText(pht('View All')));
return id(new PHUIObjectBoxView())
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setHeader($log_header)
->setTable($log_table);
}

View file

@ -21,53 +21,59 @@ final class DrydockLeaseViewController extends DrydockLeaseController {
$title = pht('Lease %d', $lease->getID());
$header = id(new PHUIHeaderView())
->setHeader($title);
->setHeader($title)
->setHeaderIcon('fa-link');
if ($lease->isReleasing()) {
$header->setStatus('fa-exclamation-triangle', 'red', pht('Releasing'));
}
$actions = $this->buildActionListView($lease);
$properties = $this->buildPropertyListView($lease, $actions);
$curtain = $this->buildCurtain($lease);
$properties = $this->buildPropertyListView($lease);
$log_query = id(new DrydockLogQuery())
->withLeasePHIDs(array($lease->getPHID()));
$log_box = $this->buildLogBox(
$logs = $this->buildLogBox(
$log_query,
$this->getApplicationURI("lease/{$id}/logs/query/all/"));
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($title, $lease_uri);
$crumbs->setBorder(true);
$locks = $this->buildLocksTab($lease->getPHID());
$commands = $this->buildCommandsTab($lease->getPHID());
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->setHeaderText(pht('Properties'))
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->addPropertyList($properties, pht('Properties'))
->addPropertyList($locks, pht('Slot Locks'))
->addPropertyList($commands, pht('Commands'));
return $this->buildApplicationPage(
array(
$crumbs,
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setCurtain($curtain)
->setMainColumn(array(
$object_box,
$log_box,
),
array(
'title' => $title,
$logs,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild(
array(
$view,
));
}
private function buildActionListView(DrydockLease $lease) {
private function buildCurtain(DrydockLease $lease) {
$viewer = $this->getViewer();
$view = id(new PhabricatorActionListView())
->setUser($viewer)
->setObject($lease);
$curtain = $this->newCurtainView($lease);
$id = $lease->getID();
$can_release = $lease->canRelease();
@ -80,7 +86,7 @@ final class DrydockLeaseViewController extends DrydockLeaseController {
$lease,
PhabricatorPolicyCapability::CAN_EDIT);
$view->addAction(
$curtain->addAction(
id(new PhabricatorActionView())
->setName(pht('Release Lease'))
->setIcon('fa-times')
@ -88,16 +94,14 @@ final class DrydockLeaseViewController extends DrydockLeaseController {
->setWorkflow(true)
->setDisabled(!$can_release || !$can_edit));
return $view;
return $curtain;
}
private function buildPropertyListView(
DrydockLease $lease,
PhabricatorActionListView $actions) {
DrydockLease $lease) {
$viewer = $this->getViewer();
$view = new PHUIPropertyListView();
$view->setActionList($actions);
$view->addProperty(
pht('Status'),

View file

@ -25,50 +25,52 @@ final class DrydockRepositoryOperationViewController
$header = id(new PHUIHeaderView())
->setHeader($title)
->setUser($viewer)
->setPolicyObject($operation);
->setPolicyObject($operation)
->setHeaderIcon('fa-fighter-jet');
$state = $operation->getOperationState();
$icon = DrydockRepositoryOperation::getOperationStateIcon($state);
$name = DrydockRepositoryOperation::getOperationStateName($state);
$header->setStatus($icon, null, $name);
$actions = $this->buildActionListView($operation);
$curtain = $this->buildCurtain($operation);
$properties = $this->buildPropertyListView($operation);
$properties->setActionList($actions);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(
pht('Operations'),
$this->getApplicationURI('operation/'));
$crumbs->addTextCrumb($title);
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addPropertyList($properties);
$crumbs->setBorder(true);
$status_view = id(new DrydockRepositoryOperationStatusView())
->setUser($viewer)
->setOperation($operation);
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setCurtain($curtain)
->addPropertySection(pht('Properties'), $properties)
->setMainColumn(array(
$status_view,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild(
array(
$object_box,
$status_view,
));
$view,
));
}
private function buildActionListView(DrydockRepositoryOperation $operation) {
private function buildCurtain(DrydockRepositoryOperation $operation) {
$viewer = $this->getViewer();
$id = $operation->getID();
$view = id(new PhabricatorActionListView())
->setUser($viewer)
->setObject($operation);
$curtain = $this->newCurtainView($operation);
return $view;
return $curtain;
}
private function buildPropertyListView(

View file

@ -23,14 +23,15 @@ final class DrydockResourceViewController extends DrydockResourceController {
$header = id(new PHUIHeaderView())
->setUser($viewer)
->setPolicyObject($resource)
->setHeader($title);
->setHeader($title)
->setHeaderIcon('fa-map');
if ($resource->isReleasing()) {
$header->setStatus('fa-exclamation-triangle', 'red', pht('Releasing'));
}
$actions = $this->buildActionListView($resource);
$properties = $this->buildPropertyListView($resource, $actions);
$curtain = $this->buildCurtain($resource);
$properties = $this->buildPropertyListView($resource);
$id = $resource->getID();
$resource_uri = $this->getApplicationURI("resource/{$id}/");
@ -44,37 +45,42 @@ final class DrydockResourceViewController extends DrydockResourceController {
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Resource %d', $resource->getID()));
$crumbs->setBorder(true);
$locks = $this->buildLocksTab($resource->getPHID());
$commands = $this->buildCommandsTab($resource->getPHID());
$lease_box = $this->buildLeaseBox($resource);
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->setHeaderText(pht('Properties'))
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->addPropertyList($properties, pht('Properties'))
->addPropertyList($locks, pht('Slot Locks'))
->addPropertyList($commands, pht('Commands'));
$lease_box = $this->buildLeaseBox($resource);
return $this->buildApplicationPage(
array(
$crumbs,
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setCurtain($curtain)
->setMainColumn(array(
$object_box,
$lease_box,
$log_box,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild(
array(
$view,
));
}
private function buildActionListView(DrydockResource $resource) {
private function buildCurtain(DrydockResource $resource) {
$viewer = $this->getViewer();
$view = id(new PhabricatorActionListView())
->setUser($viewer)
->setObject($resource);
$curtain = $this->newCurtainView($resource);
$can_release = $resource->canRelease();
if ($resource->isReleasing()) {
@ -89,7 +95,7 @@ final class DrydockResourceViewController extends DrydockResourceController {
$uri = '/resource/'.$resource->getID().'/release/';
$uri = $this->getApplicationURI($uri);
$view->addAction(
$curtain->addAction(
id(new PhabricatorActionView())
->setHref($uri)
->setName(pht('Release Resource'))
@ -97,17 +103,14 @@ final class DrydockResourceViewController extends DrydockResourceController {
->setWorkflow(true)
->setDisabled(!$can_release || !$can_edit));
return $view;
return $curtain;
}
private function buildPropertyListView(
DrydockResource $resource,
PhabricatorActionListView $actions) {
DrydockResource $resource) {
$viewer = $this->getViewer();
$view = id(new PHUIPropertyListView())
->setActionList($actions);
$view = new PHUIPropertyListView();
$status = $resource->getStatus();
$status = DrydockResourceStatus::getNameForStatus($status);
@ -179,6 +182,7 @@ final class DrydockResourceViewController extends DrydockResourceController {
return id(new PHUIObjectBoxView())
->setHeader($lease_header)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setObjectList($lease_list);
}

View file

@ -48,6 +48,7 @@ final class DrydockRepositoryOperationStatusView
$box_view = $this->getBoxView();
if (!$box_view) {
$box_view = id(new PHUIObjectBoxView())
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setHeaderText(pht('Operation Status'));
}
$box_view->setObjectList($list);