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