mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 03:50:54 +01:00
Permit users to touch maniphest.points
Summary: Ref T4427. Seems fine / not egregiously broken. Test Plan: Edited points configuration. Tried to set a bad value. Set a good value. Persued examples and help text. Reviewers: chad Reviewed By: chad Maniphest Tasks: T4427 Differential Revision: https://secure.phabricator.com/D15256
This commit is contained in:
parent
8d1e7c0d5f
commit
7e94d2f808
4 changed files with 70 additions and 3 deletions
|
@ -1300,6 +1300,7 @@ phutil_register_library_map(array(
|
||||||
'ManiphestHovercardEngineExtension' => 'applications/maniphest/engineextension/ManiphestHovercardEngineExtension.php',
|
'ManiphestHovercardEngineExtension' => 'applications/maniphest/engineextension/ManiphestHovercardEngineExtension.php',
|
||||||
'ManiphestInfoConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestInfoConduitAPIMethod.php',
|
'ManiphestInfoConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestInfoConduitAPIMethod.php',
|
||||||
'ManiphestNameIndex' => 'applications/maniphest/storage/ManiphestNameIndex.php',
|
'ManiphestNameIndex' => 'applications/maniphest/storage/ManiphestNameIndex.php',
|
||||||
|
'ManiphestPointsConfigOptionType' => 'applications/maniphest/config/ManiphestPointsConfigOptionType.php',
|
||||||
'ManiphestPriorityConfigOptionType' => 'applications/maniphest/config/ManiphestPriorityConfigOptionType.php',
|
'ManiphestPriorityConfigOptionType' => 'applications/maniphest/config/ManiphestPriorityConfigOptionType.php',
|
||||||
'ManiphestPriorityEmailCommand' => 'applications/maniphest/command/ManiphestPriorityEmailCommand.php',
|
'ManiphestPriorityEmailCommand' => 'applications/maniphest/command/ManiphestPriorityEmailCommand.php',
|
||||||
'ManiphestProjectNameFulltextEngineExtension' => 'applications/maniphest/engineextension/ManiphestProjectNameFulltextEngineExtension.php',
|
'ManiphestProjectNameFulltextEngineExtension' => 'applications/maniphest/engineextension/ManiphestProjectNameFulltextEngineExtension.php',
|
||||||
|
@ -5460,6 +5461,7 @@ phutil_register_library_map(array(
|
||||||
'ManiphestHovercardEngineExtension' => 'PhabricatorHovercardEngineExtension',
|
'ManiphestHovercardEngineExtension' => 'PhabricatorHovercardEngineExtension',
|
||||||
'ManiphestInfoConduitAPIMethod' => 'ManiphestConduitAPIMethod',
|
'ManiphestInfoConduitAPIMethod' => 'ManiphestConduitAPIMethod',
|
||||||
'ManiphestNameIndex' => 'ManiphestDAO',
|
'ManiphestNameIndex' => 'ManiphestDAO',
|
||||||
|
'ManiphestPointsConfigOptionType' => 'PhabricatorConfigJSONOptionType',
|
||||||
'ManiphestPriorityConfigOptionType' => 'PhabricatorConfigJSONOptionType',
|
'ManiphestPriorityConfigOptionType' => 'PhabricatorConfigJSONOptionType',
|
||||||
'ManiphestPriorityEmailCommand' => 'ManiphestEmailCommand',
|
'ManiphestPriorityEmailCommand' => 'ManiphestEmailCommand',
|
||||||
'ManiphestProjectNameFulltextEngineExtension' => 'PhabricatorFulltextEngineExtension',
|
'ManiphestProjectNameFulltextEngineExtension' => 'PhabricatorFulltextEngineExtension',
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class ManiphestPointsConfigOptionType
|
||||||
|
extends PhabricatorConfigJSONOptionType {
|
||||||
|
|
||||||
|
public function validateOption(PhabricatorConfigOption $option, $value) {
|
||||||
|
ManiphestTaskPoints::validateConfiguration($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -255,6 +255,42 @@ EOTEXT
|
||||||
);
|
);
|
||||||
$fields_json = id(new PhutilJSON())->encodeFormatted($fields_example);
|
$fields_json = id(new PhutilJSON())->encodeFormatted($fields_example);
|
||||||
|
|
||||||
|
$points_type = 'custom:ManiphestPointsConfigOptionType';
|
||||||
|
|
||||||
|
$points_example_1 = array(
|
||||||
|
'enabled' => true,
|
||||||
|
'label' => pht('Story Points'),
|
||||||
|
'action' => pht('Change Story Points'),
|
||||||
|
);
|
||||||
|
$points_json_1 = id(new PhutilJSON())->encodeFormatted($points_example_1);
|
||||||
|
|
||||||
|
$points_example_2 = array(
|
||||||
|
'enabled' => true,
|
||||||
|
'label' => pht('Estimated Hours'),
|
||||||
|
'action' => pht('Change Estimate'),
|
||||||
|
);
|
||||||
|
$points_json_2 = id(new PhutilJSON())->encodeFormatted($points_example_2);
|
||||||
|
|
||||||
|
$points_description = $this->deformat(pht(<<<EOTEXT
|
||||||
|
Activates a points field on tasks. You can use points for estimation or
|
||||||
|
planning. If configured, points will appear on workboards.
|
||||||
|
|
||||||
|
To activate points, set this value to a map with these keys:
|
||||||
|
|
||||||
|
- `enabled` //Optional bool.// Use `true` to enable points, or
|
||||||
|
`false` to disable them.
|
||||||
|
- `label` //Optional string.// Label for points, like "Story Points" or
|
||||||
|
"Estimated Hours". If omitted, points will be called "Points".
|
||||||
|
- `action` //Optional string.// Label for the action which changes points
|
||||||
|
in Maniphest, like "Change Estimate". If omitted, the action will
|
||||||
|
be called "Change Points".
|
||||||
|
|
||||||
|
See the example below for a starting point.
|
||||||
|
EOTEXT
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
$this->newOption('maniphest.custom-field-definitions', 'wild', array())
|
$this->newOption('maniphest.custom-field-definitions', 'wild', array())
|
||||||
->setSummary(pht('Custom Maniphest fields.'))
|
->setSummary(pht('Custom Maniphest fields.'))
|
||||||
|
@ -336,9 +372,11 @@ EOTEXT
|
||||||
'"Needs Triage" panel on the home page. You should adjust this if '.
|
'"Needs Triage" panel on the home page. You should adjust this if '.
|
||||||
'you adjust priorities using `%s`.',
|
'you adjust priorities using `%s`.',
|
||||||
'maniphest.priorities')),
|
'maniphest.priorities')),
|
||||||
$this->newOption('maniphest.points', 'map<string, wild>', array())
|
$this->newOption('maniphest.points', $points_type, array())
|
||||||
->setDescription(
|
->setSummary(pht('Configure point values for tasks.'))
|
||||||
pht('PROTOTYPE! Very hot. Burns user. Do not touch!')),
|
->setDescription($points_description)
|
||||||
|
->addExample($points_json_1, pht('Points Config'))
|
||||||
|
->addExample($points_json_2, pht('Hours Config')),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,4 +21,21 @@ final class ManiphestTaskPoints extends Phobject {
|
||||||
return PhabricatorEnv::getEnvConfig('maniphest.points');
|
return PhabricatorEnv::getEnvConfig('maniphest.points');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function validateConfiguration($config) {
|
||||||
|
if (!is_array($config)) {
|
||||||
|
throw new Exception(
|
||||||
|
pht(
|
||||||
|
'Configuration is not valid. Maniphest points configuration must '.
|
||||||
|
'be a dictionary.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
PhutilTypeSpec::checkMap(
|
||||||
|
$config,
|
||||||
|
array(
|
||||||
|
'enabled' => 'optional bool',
|
||||||
|
'label' => 'optional string',
|
||||||
|
'action' => 'optional string',
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue