1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 08:42:41 +01:00

Make bulk edit <select /> fields a little more natrual and set options for subtype transactions

Summary:
Ref T13025. This is some minor technical stuff: make the "select" bulk edit type a little more consistent with other types by passing data down instead of having it reach up the stack. This simplifies the implementation of a custom field "select" in a future change.

Also, provide an option list to the "select" edit field for object subtypes. This is only accessible via Conduit so it currently never actually renders anything in the UI, but with the bulk edit stuff we get some initialization order issues if we don't set anything. This will also make any future changes which expose subtypes more broadly more straightforward.

Test Plan:
  - Bulk edited "select" fields, like "Status" and "Priority".
  - No more fatal when trying to `getOptions()` internally on the subtype field.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13025

Differential Revision: https://secure.phabricator.com/D18878
This commit is contained in:
epriestley 2018-01-19 06:52:59 -08:00
parent b6737554e1
commit f8113aecdc
3 changed files with 15 additions and 3 deletions

View file

@ -3,8 +3,15 @@
final class BulkSelectParameterType
extends BulkParameterType {
private $options;
public function setOptions(array $options) {
$this->options = $options;
return $this;
}
public function getOptions() {
return $this->getField()->getOptions();
return $this->options;
}
public function getPHUIXControlType() {

View file

@ -55,7 +55,8 @@ final class PhabricatorSelectEditField
}
protected function newBulkParameterType() {
return new BulkSelectParameterType();
return id(new BulkSelectParameterType())
->setOptions($this->getOptions());
}
private function getCanonicalValue($value) {

View file

@ -30,6 +30,9 @@ final class PhabricatorSubtypeEditEngineExtension
$subtype_type = PhabricatorTransactions::TYPE_SUBTYPE;
$map = $object->newEditEngineSubtypeMap();
$options = mpull($map, 'getName');
$subtype_field = id(new PhabricatorSelectEditField())
->setKey(self::EDITKEY)
->setLabel(pht('Subtype'))
@ -41,7 +44,8 @@ final class PhabricatorSubtypeEditEngineExtension
->setTransactionType($subtype_type)
->setConduitDescription(pht('Change the object subtype.'))
->setConduitTypeDescription(pht('New object subtype key.'))
->setValue($object->getEditEngineSubtype());
->setValue($object->getEditEngineSubtype())
->setOptions($options);
return array(
$subtype_field,