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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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