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

Support "select" types in bulk editor (status, priority)

Summary: Depends on D18864. Ref T13025. Adds bulk edit support back for "status" and "priority" using `<select />` controls.

Test Plan:
Used bulk editor to change status and priority for tasks.

{F5374436}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13025

Differential Revision: https://secure.phabricator.com/D18866
This commit is contained in:
epriestley 2018-01-11 09:27:58 -08:00
parent a251db4618
commit bf1ac701c3
6 changed files with 43 additions and 1 deletions

View file

@ -223,6 +223,7 @@ phutil_register_library_map(array(
'AuditQueryConduitAPIMethod' => 'applications/audit/conduit/AuditQueryConduitAPIMethod.php',
'AuthManageProvidersCapability' => 'applications/auth/capability/AuthManageProvidersCapability.php',
'BulkParameterType' => 'applications/transactions/bulk/type/BulkParameterType.php',
'BulkSelectParameterType' => 'applications/transactions/bulk/type/BulkSelectParameterType.php',
'BulkStringParameterType' => 'applications/transactions/bulk/type/BulkStringParameterType.php',
'CalendarTimeUtil' => 'applications/calendar/util/CalendarTimeUtil.php',
'CalendarTimeUtilTestCase' => 'applications/calendar/__tests__/CalendarTimeUtilTestCase.php',
@ -5244,6 +5245,7 @@ phutil_register_library_map(array(
'AuditQueryConduitAPIMethod' => 'AuditConduitAPIMethod',
'AuthManageProvidersCapability' => 'PhabricatorPolicyCapability',
'BulkParameterType' => 'Phobject',
'BulkSelectParameterType' => 'BulkParameterType',
'BulkStringParameterType' => 'BulkParameterType',
'CalendarTimeUtil' => 'Phobject',
'CalendarTimeUtilTestCase' => 'PhabricatorTestCase',

View file

@ -201,6 +201,7 @@ EODOCS
id(new PhabricatorSelectEditField())
->setKey('status')
->setLabel(pht('Status'))
->setBulkEditLabel(pht('Set status to'))
->setDescription(pht('Status of the task.'))
->setConduitDescription(pht('Change the task status.'))
->setConduitTypeDescription(pht('New task status constant.'))
@ -213,6 +214,7 @@ EODOCS
id(new PhabricatorSelectEditField())
->setKey('priority')
->setLabel(pht('Priority'))
->setBulkEditLabel(pht('Set priority to'))
->setDescription(pht('Priority of the task.'))
->setConduitDescription(pht('Change the priority of the task.'))
->setConduitTypeDescription(pht('New task priority constant.'))

View file

@ -3,6 +3,7 @@
abstract class BulkParameterType extends Phobject {
private $viewer;
private $field;
final public function setViewer(PhabricatorUser $viewer) {
$this->viewer = $viewer;
@ -13,6 +14,15 @@ abstract class BulkParameterType extends Phobject {
return $this->viewer;
}
final public function setField(PhabricatorEditField $field) {
$this->field = $field;
return $this;
}
final public function getField() {
return $this->field;
}
abstract public function getPHUIXControlType();
public function getPHUIXControlSpecification() {

View file

@ -0,0 +1,22 @@
<?php
final class BulkSelectParameterType
extends BulkParameterType {
public function getOptions() {
return $this->getField()->getOptions();
}
public function getPHUIXControlType() {
return 'select';
}
public function getPHUIXControlSpecification() {
return array(
'options' => $this->getOptions(),
'order' => array_keys($this->getOptions()),
'value' => null,
);
}
}

View file

@ -643,7 +643,9 @@ abstract class PhabricatorEditField extends Phobject {
return null;
}
$type->setViewer($this->getViewer());
$type
->setField($this)
->setViewer($this->getViewer());
return $type;
}

View file

@ -54,6 +54,10 @@ final class PhabricatorSelectEditField
return new ConduitStringParameterType();
}
protected function newBulkParameterType() {
return new BulkSelectParameterType();
}
private function getCanonicalValue($value) {
$options = $this->getOptions();
if (!isset($options[$value])) {