Differential D19443 Diff 46541 src/applications/diffusion/controller/DiffusionIdentityViewController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionIdentityViewController.php
Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | if ($effective_phid) { | ||||
$tag = id(new PHUITagView()) | $tag = id(new PHUITagView()) | ||||
->setType(PHUITagView::TYPE_SHADE) | ->setType(PHUITagView::TYPE_SHADE) | ||||
->setColor('indigo') | ->setColor('indigo') | ||||
->setIcon('fa-bomb') | ->setIcon('fa-bomb') | ||||
->setName('Unassigned'); | ->setName('Unassigned'); | ||||
} | } | ||||
$properties->addProperty( | $properties->addProperty( | ||||
pht('Effective User'), | pht('Effective User'), | ||||
$viewer->renderHandle($effective_phid)); | $this->buildPropertyValue($effective_phid)); | ||||
$properties->addProperty( | $properties->addProperty( | ||||
pht('Automatically Detected User'), | pht('Automatically Detected User'), | ||||
$viewer->renderHandle($automatic_phid)); | $this->buildPropertyValue($automatic_phid)); | ||||
$properties->addProperty( | $properties->addProperty( | ||||
pht('Manually Set User'), | pht('Manually Set User'), | ||||
$viewer->renderHandle($manual_phid)); | $this->buildPropertyValue($manual_phid)); | ||||
$header = id(new PHUIHeaderView()) | $header = id(new PHUIHeaderView()) | ||||
->setHeader(array(pht('Identity Assignments'), $tag)); | ->setHeader(array(pht('Identity Assignments'), $tag)); | ||||
return id(new PHUIObjectBoxView()) | return id(new PHUIObjectBoxView()) | ||||
->setHeader($header) | ->setHeader($header) | ||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) | ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) | ||||
->addPropertyList($properties); | ->addPropertyList($properties); | ||||
} | } | ||||
private function buildPropertyValue($value) { | |||||
$viewer = $this->getViewer(); | |||||
if ($value == DiffusionIdentityUnassignedDatasource::FUNCTION_TOKEN) { | |||||
epriestley: I think there is, but it's super tricky. Something like you instantiate a copy of the… | |||||
return phutil_tag('em', array(), pht('Explicitly Unassigned')); | |||||
} else if (!$value) { | |||||
Done Inline ActionsJust for UI consistency, do something like: phutil_tag('em', array(), pht('Explicitly Unassigned')); epriestley: Just for UI consistency, do something like:
```
phutil_tag('em', array(), pht('Explicitly… | |||||
return null; | |||||
} else { | |||||
return $viewer->renderHandle($value); | |||||
} | |||||
} | |||||
} | } |
I think there is, but it's super tricky. Something like you instantiate a copy of the Datasource, then set the value, render wire tokens from it, rebuild handles out of those wire tokens, then render tags out of the handles? There's a comment somewhere like "make this easier". The approach you've taken here is quite reasonable.