1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Restore "Change Status" and "Change Priority" comment actions to Maniphest

Summary: Ref T9132. Supports selects in stacked actions and adds "Change Status" + "Change Priority".

Test Plan: Changed status and priority from stacked actions.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9132

Differential Revision: https://secure.phabricator.com/D14667
This commit is contained in:
epriestley 2015-12-04 07:56:03 -08:00
parent b3cf00333c
commit 92ea07e787
8 changed files with 111 additions and 32 deletions

View file

@ -427,7 +427,7 @@ return array(
'rsrc/js/application/repository/repository-crossreference.js' => 'e5339c43',
'rsrc/js/application/search/behavior-reorder-queries.js' => 'e9581f08',
'rsrc/js/application/slowvote/behavior-slowvote-embed.js' => '887ad43f',
'rsrc/js/application/transactions/behavior-comment-actions.js' => 'dd5cae21',
'rsrc/js/application/transactions/behavior-comment-actions.js' => '2ada1547',
'rsrc/js/application/transactions/behavior-reorder-fields.js' => 'b59e1e96',
'rsrc/js/application/transactions/behavior-show-older-transactions.js' => 'dbbf48b6',
'rsrc/js/application/transactions/behavior-transaction-comment-form.js' => 'b23b49e6',
@ -506,7 +506,7 @@ return array(
'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8',
'rsrc/js/phuix/PHUIXActionView.js' => '8cf6d262',
'rsrc/js/phuix/PHUIXDropdownMenu.js' => 'bd4c8dca',
'rsrc/js/phuix/PHUIXFormControl.js' => 'f9fba5ee',
'rsrc/js/phuix/PHUIXFormControl.js' => '7e1dc09e',
'rsrc/js/phuix/PHUIXIconView.js' => 'bff6884b',
),
'symbols' => array(
@ -571,7 +571,7 @@ return array(
'javelin-behavior-audit-preview' => 'd835b03a',
'javelin-behavior-bulk-job-reload' => 'edf8a145',
'javelin-behavior-choose-control' => '6153c708',
'javelin-behavior-comment-actions' => 'dd5cae21',
'javelin-behavior-comment-actions' => '2ada1547',
'javelin-behavior-config-reorder-fields' => 'b6993408',
'javelin-behavior-conpherence-drag-and-drop-photo' => 'cf86d16a',
'javelin-behavior-conpherence-menu' => '1d45c74d',
@ -831,7 +831,7 @@ return array(
'phuix-action-list-view' => 'b5c256b8',
'phuix-action-view' => '8cf6d262',
'phuix-dropdown-menu' => 'bd4c8dca',
'phuix-form-control-view' => 'f9fba5ee',
'phuix-form-control-view' => '7e1dc09e',
'phuix-icon-view' => 'bff6884b',
'policy-css' => '957ea14c',
'policy-edit-css' => '815c66f7',
@ -1027,6 +1027,14 @@ return array(
'javelin-install',
'javelin-util',
),
'2ada1547' => array(
'javelin-behavior',
'javelin-stratcom',
'javelin-workflow',
'javelin-dom',
'phuix-form-control-view',
'phuix-icon-view',
),
'2b8de964' => array(
'javelin-install',
'javelin-util',
@ -1422,6 +1430,10 @@ return array(
'phuix-action-view',
'javelin-workflow',
),
'7e1dc09e' => array(
'javelin-install',
'javelin-dom',
),
'7e41274a' => array(
'javelin-install',
),
@ -1867,14 +1879,6 @@ return array(
'javelin-dom',
'phabricator-busy',
),
'dd5cae21' => array(
'javelin-behavior',
'javelin-stratcom',
'javelin-workflow',
'javelin-dom',
'phuix-form-control-view',
'phuix-icon-view',
),
'de2e896f' => array(
'javelin-behavior',
'javelin-dom',
@ -2032,10 +2036,6 @@ return array(
'javelin-util',
'phabricator-busy',
),
'f9fba5ee' => array(
'javelin-install',
'javelin-dom',
),
'fa0f4fc2' => array(
'javelin-behavior',
'javelin-dom',

View file

@ -62,12 +62,18 @@ final class ManiphestEditEngine
// TODO: Restore these or toss them:
// - Default owner to viewer.
// - Don't show "change status" for closed tasks.
// - Don't show "change owner" for closed tasks.
// - Don't let users change a task status to "Duplicate".
// - When closing an unassigned task, assign the closing user.
// - Make sure implicit CCs on actions are working reasonably.
if ($object->isClosed()) {
$priority_label = null;
$default_status = ManiphestTaskStatus::getDefaultStatus();
} else {
$priority_label = pht('Change Priority');
$default_status = ManiphestTaskStatus::getDefaultClosedStatus();
}
return array(
id(new PhabricatorTextEditField())
->setKey('title')
@ -82,7 +88,9 @@ final class ManiphestEditEngine
->setDescription(pht('Status of the task.'))
->setTransactionType(ManiphestTransaction::TYPE_STATUS)
->setValue($object->getStatus())
->setOptions($status_map),
->setOptions($status_map)
->setCommentActionLabel(pht('Change Status'))
->setCommentActionDefaultValue($default_status),
id(new PhabricatorUsersEditField())
->setKey('owner')
->setAliases(array('ownerPHID', 'assign', 'assigned'))
@ -96,7 +104,8 @@ final class ManiphestEditEngine
->setDescription(pht('Priority of the task.'))
->setTransactionType(ManiphestTransaction::TYPE_PRIORITY)
->setValue($object->getPriority())
->setOptions($priority_map),
->setOptions($priority_map)
->setCommentActionLabel($priority_label),
id(new PhabricatorRemarkupEditField())
->setKey('description')
->setLabel(pht('Description'))

View file

@ -15,6 +15,7 @@ abstract class PhabricatorEditField extends Phobject {
private $description;
private $editTypeKey;
private $isRequired;
private $commentActionLabel;
private $isLocked;
private $isHidden;
@ -172,6 +173,16 @@ abstract class PhabricatorEditField extends Phobject {
return $this->controlError;
}
public function setCommentActionLabel($label) {
$this->commentActionLabel = $label;
return $this;
}
public function getCommentActionLabel() {
return $this->commentActionLabel;
}
protected function newControl() {
throw new PhutilMethodNotImplementedException();
}

View file

@ -4,6 +4,7 @@ final class PhabricatorSelectEditField
extends PhabricatorEditField {
private $options;
private $commentActionDefaultValue;
public function setOptions(array $options) {
$this->options = $options;
@ -17,6 +18,15 @@ final class PhabricatorSelectEditField
return $this->options;
}
public function setCommentActionDefaultValue($default) {
$this->commentActionDefaultValue = $default;
return $this;
}
public function getCommentActionDefaultValue() {
return $this->commentActionDefaultValue;
}
protected function newControl() {
return id(new AphrontFormSelectControl())
->setOptions($this->getOptions());
@ -26,4 +36,27 @@ final class PhabricatorSelectEditField
return new AphrontSelectHTTPParameterType();
}
public function getCommentEditTypes() {
$label = $this->getCommentActionLabel();
if ($label === null) {
return array();
}
$default_value = $this->getCommentActionDefaultValue();
if ($default_value === null) {
$default_value = $this->getValue();
}
$edit = $this->getEditType()
->setLabel($label)
->setPHUIXControlType('select')
->setPHUIXControlSpecification(
array(
'options' => $this->getOptions(),
'value' => $default_value,
));
return array($edit);
}
}

View file

@ -3,19 +3,8 @@
abstract class PhabricatorTokenizerEditField
extends PhabricatorPHIDListEditField {
private $commentActionLabel;
abstract protected function newDatasource();
public function setCommentActionLabel($label) {
$this->commentActionLabel = $label;
return $this;
}
public function getCommentActionLabel() {
return $this->commentActionLabel;
}
protected function newControl() {
$control = id(new AphrontFormTokenizerControl())
->setDatasource($this->newDatasource());

View file

@ -4,6 +4,8 @@ final class PhabricatorSimpleEditType extends PhabricatorEditType {
private $valueType;
private $valueDescription;
private $phuixControlType;
private $phuixControlSpecification = array();
public function setValueType($value_type) {
$this->valueType = $value_type;
@ -33,4 +35,22 @@ final class PhabricatorSimpleEditType extends PhabricatorEditType {
return $this->valueDescription;
}
public function setPHUIXControlType($type) {
$this->phuixControlType = $type;
return $this;
}
public function getPHUIXControlType() {
return $this->phuixControlType;
}
public function setPHUIXControlSpecification(array $spec) {
$this->phuixControlSpecification = $spec;
return $this;
}
public function getPHUIXControlSpecification() {
return $this->phuixControlSpecification;
}
}

View file

@ -62,7 +62,7 @@ JX.behavior('comment-actions', function(config) {
var control = new JX.PHUIXFormControl()
.setLabel(action.label)
.setError(remove)
.setControl('tokenizer', action.spec);
.setControl(action.type, action.spec);
var node = control.getNode();
rows[action.key] = control;

View file

@ -32,6 +32,9 @@ JX.install('PHUIXFormControl', {
case 'tokenizer':
input = this._newTokenizer(spec);
break;
case 'select':
input = this._newSelect(spec);
break;
default:
// TODO: Default or better error?
JX.$E('Bad Input Type');
@ -126,6 +129,20 @@ JX.install('PHUIXFormControl', {
}
}
};
},
_newSelect: function(spec) {
var node = JX.Prefab.renderSelect(spec.options, spec.value);
return {
node: node,
get: function() {
return node.value;
},
set: function(value) {
node.value = value;
}
};
}
}