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

Convert Nuance sources and queues to two-column + curtain

Summary: Ref T10537. Update the detail views.

Test Plan:
{F1162212}

{F1162213}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10537

Differential Revision: https://secure.phabricator.com/D15430
This commit is contained in:
epriestley 2016-03-07 16:14:01 -08:00
parent 01ed526527
commit 6872b96808
2 changed files with 46 additions and 87 deletions

View file

@ -19,29 +19,25 @@ final class NuanceQueueViewController
$crumbs = $this->buildApplicationCrumbs(); $crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Queues'), $this->getApplicationURI('queue/')); $crumbs->addTextCrumb(pht('Queues'), $this->getApplicationURI('queue/'));
$crumbs->addTextCrumb($queue->getName()); $crumbs->addTextCrumb($queue->getName());
$crumbs->setBorder(true);
$header = $this->buildHeaderView($queue); $header = $this->buildHeaderView($queue);
$actions = $this->buildActionView($queue); $curtain = $this->buildCurtain($queue);
$properties = $this->buildPropertyView($queue, $actions);
$box = id(new PHUIObjectBoxView())
->setHeader($header)
->addPropertyList($properties);
$timeline = $this->buildTransactionTimeline( $timeline = $this->buildTransactionTimeline(
$queue, $queue,
new NuanceQueueTransactionQuery()); new NuanceQueueTransactionQuery());
$timeline->setShouldTerminate(true); $timeline->setShouldTerminate(true);
return $this->buildApplicationPage( $view = id(new PHUITwoColumnView())
array( ->setHeader($header)
$crumbs, ->setCurtain($curtain)
$box, ->setMainColumn($timeline);
$timeline,
), return $this->newPage()
array( ->setTitle($title)
'title' => $title, ->setCrumbs($crumbs)
)); ->appendChild($view);
} }
private function buildHeaderView(NuanceQueue $queue) { private function buildHeaderView(NuanceQueue $queue) {
@ -55,19 +51,18 @@ final class NuanceQueueViewController
return $header; return $header;
} }
private function buildActionView(NuanceQueue $queue) { private function buildCurtain(NuanceQueue $queue) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$id = $queue->getID(); $id = $queue->getID();
$actions = id(new PhabricatorActionListView())
->setUser($viewer);
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
$queue, $queue,
PhabricatorPolicyCapability::CAN_EDIT); PhabricatorPolicyCapability::CAN_EDIT);
$actions->addAction( $curtain = $this->newCurtainView($queue);
$curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Edit Queue')) ->setName(pht('Edit Queue'))
->setIcon('fa-pencil') ->setIcon('fa-pencil')
@ -75,19 +70,7 @@ final class NuanceQueueViewController
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(!$can_edit)); ->setWorkflow(!$can_edit));
return $actions; return $curtain;
} }
private function buildPropertyView(
NuanceQueue $queue,
PhabricatorActionListView $actions) {
$viewer = $this->getViewer();
$properties = id(new PHUIPropertyListView())
->setUser($viewer)
->setObject($queue)
->setActionList($actions);
return $properties;
}
} }

View file

@ -16,53 +16,38 @@ final class NuanceSourceViewController
$source_id = $source->getID(); $source_id = $source->getID();
$timeline = $this->buildTransactionTimeline(
$source,
new NuanceSourceTransactionQuery());
$timeline->setShouldTerminate(true);
$header = $this->buildHeaderView($source); $header = $this->buildHeaderView($source);
$actions = $this->buildActionView($source); $curtain = $this->buildCurtain($source);
$properties = $this->buildPropertyView($source, $actions); $properties = $this->buildPropertyView($source);
$box = id(new PHUIObjectBoxView())
->setHeader($header)
->addPropertyList($properties);
$title = $source->getName(); $title = $source->getName();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Sources'), $this->getApplicationURI('source/'));
$crumbs->addTextCrumb($title);
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,
$source,
PhabricatorPolicyCapability::CAN_EDIT);
$routing_list = id(new PHUIPropertyListView()) $routing_list = id(new PHUIPropertyListView())
->addProperty( ->addProperty(
pht('Default Queue'), pht('Default Queue'),
$viewer->renderHandle($source->getDefaultQueuePHID())); $viewer->renderHandle($source->getDefaultQueuePHID()));
$routing_header = id(new PHUIHeaderView()) $crumbs = $this->buildApplicationCrumbs();
->setHeader(pht('Routing Rules')); $crumbs->addTextCrumb(pht('Sources'), $this->getApplicationURI('source/'));
$crumbs->addTextCrumb($title);
$crumbs->setBorder(true);
$routing = id(new PHUIObjectBoxView()) $timeline = $this->buildTransactionTimeline(
->setHeader($routing_header) $source,
->addPropertyList($routing_list); new NuanceSourceTransactionQuery());
$timeline->setShouldTerminate(true);
return $this->buildApplicationPage( $view = id(new PHUITwoColumnView())
array( ->setHeader($header)
$crumbs, ->setCurtain($curtain)
$box, ->addPropertySection(pht('DETAILS'), $properties)
$routing, ->addPropertySection(pht('ROUTING'), $routing_list)
$timeline, ->setMainColumn($timeline);
),
array( return $this->newPage()
'title' => $title, ->setTitle($title)
)); ->setCrumbs($crumbs)
->appendChild($view);
} }
private function buildHeaderView(NuanceSource $source) { private function buildHeaderView(NuanceSource $source) {
@ -76,7 +61,7 @@ final class NuanceSourceViewController
return $header; return $header;
} }
private function buildActionView(NuanceSource $source) { private function buildCurtain(NuanceSource $source) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$id = $source->getID(); $id = $source->getID();
@ -88,7 +73,9 @@ final class NuanceSourceViewController
$source, $source,
PhabricatorPolicyCapability::CAN_EDIT); PhabricatorPolicyCapability::CAN_EDIT);
$actions->addAction( $curtain = $this->newCurtainView($source);
$curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Edit Source')) ->setName(pht('Edit Source'))
->setIcon('fa-pencil') ->setIcon('fa-pencil')
@ -100,35 +87,24 @@ final class NuanceSourceViewController
$definition = $source->requireDefinition(); $definition = $source->requireDefinition();
$source_actions = $definition->getSourceViewActions($request); $source_actions = $definition->getSourceViewActions($request);
foreach ($source_actions as $source_action) { foreach ($source_actions as $source_action) {
$actions->addAction($source_action); $curtain->addAction($source_action);
} }
return $actions; return $curtain;
} }
private function buildPropertyView( private function buildPropertyView(
NuanceSource $source, NuanceSource $source) {
PhabricatorActionListView $actions) { $viewer = $this->getViewer();
$viewer = $this->getRequest()->getUser();
$properties = id(new PHUIPropertyListView()) $properties = id(new PHUIPropertyListView())
->setUser($viewer) ->setViewer($viewer);
->setObject($source)
->setActionList($actions);
$definition = $source->requireDefinition(); $definition = $source->requireDefinition();
$properties->addProperty( $properties->addProperty(
pht('Source Type'), pht('Source Type'),
$definition->getName()); $definition->getName());
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
$viewer,
$source);
$properties->addProperty(
pht('Editable By'),
$descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
return $properties; return $properties;
} }
} }