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

View file

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

View file

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

View file

@ -4,6 +4,7 @@ final class PhabricatorSelectEditField
extends PhabricatorEditField { extends PhabricatorEditField {
private $options; private $options;
private $commentActionDefaultValue;
public function setOptions(array $options) { public function setOptions(array $options) {
$this->options = $options; $this->options = $options;
@ -17,6 +18,15 @@ final class PhabricatorSelectEditField
return $this->options; return $this->options;
} }
public function setCommentActionDefaultValue($default) {
$this->commentActionDefaultValue = $default;
return $this;
}
public function getCommentActionDefaultValue() {
return $this->commentActionDefaultValue;
}
protected function newControl() { protected function newControl() {
return id(new AphrontFormSelectControl()) return id(new AphrontFormSelectControl())
->setOptions($this->getOptions()); ->setOptions($this->getOptions());
@ -26,4 +36,27 @@ final class PhabricatorSelectEditField
return new AphrontSelectHTTPParameterType(); 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 abstract class PhabricatorTokenizerEditField
extends PhabricatorPHIDListEditField { extends PhabricatorPHIDListEditField {
private $commentActionLabel;
abstract protected function newDatasource(); abstract protected function newDatasource();
public function setCommentActionLabel($label) {
$this->commentActionLabel = $label;
return $this;
}
public function getCommentActionLabel() {
return $this->commentActionLabel;
}
protected function newControl() { protected function newControl() {
$control = id(new AphrontFormTokenizerControl()) $control = id(new AphrontFormTokenizerControl())
->setDatasource($this->newDatasource()); ->setDatasource($this->newDatasource());

View file

@ -4,6 +4,8 @@ final class PhabricatorSimpleEditType extends PhabricatorEditType {
private $valueType; private $valueType;
private $valueDescription; private $valueDescription;
private $phuixControlType;
private $phuixControlSpecification = array();
public function setValueType($value_type) { public function setValueType($value_type) {
$this->valueType = $value_type; $this->valueType = $value_type;
@ -33,4 +35,22 @@ final class PhabricatorSimpleEditType extends PhabricatorEditType {
return $this->valueDescription; 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() var control = new JX.PHUIXFormControl()
.setLabel(action.label) .setLabel(action.label)
.setError(remove) .setError(remove)
.setControl('tokenizer', action.spec); .setControl(action.type, action.spec);
var node = control.getNode(); var node = control.getNode();
rows[action.key] = control; rows[action.key] = control;

View file

@ -32,6 +32,9 @@ JX.install('PHUIXFormControl', {
case 'tokenizer': case 'tokenizer':
input = this._newTokenizer(spec); input = this._newTokenizer(spec);
break; break;
case 'select':
input = this._newSelect(spec);
break;
default: default:
// TODO: Default or better error? // TODO: Default or better error?
JX.$E('Bad Input Type'); 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;
}
};
} }
} }