diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 64d5095731..21ebc6f894 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -963,7 +963,7 @@ celerity_register_resource_map(array( ), 'config-options-css' => array( - 'uri' => '/res/cbef6aae/rsrc/css/application/config/config-options.css', + 'uri' => '/res/4b5b6779/rsrc/css/application/config/config-options.css', 'type' => 'css', 'requires' => array( diff --git a/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php b/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php index 3bc9141e4a..11f70d1619 100644 --- a/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php +++ b/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php @@ -12,6 +12,40 @@ final class PhabricatorManiphestConfigOptions } public function getOptions() { + + $priority_defaults = array( + 100 => array( + 'name' => pht('Unbreak Now!'), + 'short' => pht('Unbreak!'), + 'color' => 'indigo', + ), + 90 => array( + 'name' => pht('Needs Triage'), + 'short' => pht('Triage'), + 'color' => 'violet', + ), + 80 => array( + 'name' => pht('High'), + 'short' => pht('High'), + 'color' => 'red', + ), + 50 => array( + 'name' => pht('Normal'), + 'short' => pht('Normal'), + 'color' => 'orange', + ), + 25 => array( + 'name' => pht('Low'), + 'short' => pht('Low'), + 'color' => 'yellow', + ), + 0 => array( + 'name' => pht('Wishlist'), + 'short' => pht('Wish'), + 'color' => 'sky', + ), + ); + return array( $this->newOption('maniphest.custom-fields', 'wild', array()) ->setSummary(pht("Custom Maniphest fields.")) @@ -36,6 +70,24 @@ final class PhabricatorManiphestConfigOptions "Class which drives custom field construction. See 'Maniphest ". "User Guide: Adding Custom Fields' in the documentation for more ". "information.")), + $this->newOption('maniphest.priorities', 'wild', $priority_defaults) + ->setSummary(pht("Configure Maniphest priority names.")) + ->setDescription( + pht( + 'Allows you to edit or override the default priorities available '. + 'in Maniphest, like "High", "Normal" and "Low". The configuration '. + 'should contain a map of priority constants to priority '. + 'specifications (see defaults below for examples).'. + "\n\n". + 'The keys you can define for a priority are:'. + "\n\n". + ' - `name` Name of the priority.'."\n". + ' - `short` Alternate shorter name, used in UIs where there is '. + ' not much space available.'."\n". + ' - `color` A color for this priority, like "red" or "blue".'. + "\n\n". + 'You can choose which priority is the default for newly created '. + 'tasks with `maniphest.default-priority`.')), $this->newOption('maniphest.default-priority', 'int', 90) ->setSummary(pht("Default task priority for create flows.")) ->setDescription( diff --git a/src/applications/maniphest/constants/ManiphestTaskPriority.php b/src/applications/maniphest/constants/ManiphestTaskPriority.php index aa397a247f..603acd2231 100644 --- a/src/applications/maniphest/constants/ManiphestTaskPriority.php +++ b/src/applications/maniphest/constants/ManiphestTaskPriority.php @@ -1,49 +1,49 @@ 'Unbreak Now!', - self::PRIORITY_TRIAGE => 'Needs Triage', - self::PRIORITY_HIGH => 'High', - self::PRIORITY_NORMAL => 'Normal', - self::PRIORITY_LOW => 'Low', - self::PRIORITY_WISH => 'Wishlist', - ); + $map = self::getConfig(); + foreach ($map as $key => $spec) { + $map[$key] = idx($spec, 'name', $key); + } + return $map; } + /** * Get the priorities and their related short (one-word) descriptions. * - * @return map Priorities to brief descriptions. + * @return map Priorities to short descriptions. */ - public static function getTaskBriefPriorityMap() { - return array( - self::PRIORITY_UNBREAK_NOW => 'Unbreak!', - self::PRIORITY_TRIAGE => 'Triage', - self::PRIORITY_HIGH => 'High', - self::PRIORITY_NORMAL => 'Normal', - self::PRIORITY_LOW => 'Low', - self::PRIORITY_WISH => 'Wish', - ); + public static function getShortNameMap() { + $map = self::getConfig(); + foreach ($map as $key => $spec) { + $map[$key] = idx($spec, 'short', idx($spec, 'name', $key)); + } + return $map; } + + /** + * Get a map from priority constants to their colors. + * + * @return map Priorities to colors. + */ + public static function getColorMap() { + $map = self::getConfig(); + foreach ($map as $key => $spec) { + $map[$key] = idx($spec, 'color', 'grey'); + } + return $map; + } + + /** * Return the default priority for this instance of Phabricator. * @@ -53,15 +53,22 @@ final class ManiphestTaskPriority extends ManiphestConstants { return PhabricatorEnv::getEnvConfig('maniphest.default-priority'); } + /** * Retrieve the full name of the priority level provided. * * @param int A priority level. - * @return string The priority name if the level is a valid one, - * or `???` if it is not. + * @return string The priority name if the level is a valid one. */ public static function getTaskPriorityName($priority) { - return idx(self::getTaskPriorityMap(), $priority, '???'); + return idx(self::getTaskPriorityMap(), $priority, $priority); + } + + + private static function getConfig() { + $config = PhabricatorEnv::getEnvConfig('maniphest.priorities'); + krsort($config); + return $config; } } diff --git a/src/applications/maniphest/controller/ManiphestReportController.php b/src/applications/maniphest/controller/ManiphestReportController.php index 8f0cc46e3f..c76653f288 100644 --- a/src/applications/maniphest/controller/ManiphestReportController.php +++ b/src/applications/maniphest/controller/ManiphestReportController.php @@ -520,7 +520,9 @@ final class ManiphestReportController extends ManiphestController { $normal_or_better = array(); foreach ($taskv as $id => $task) { - if ($task->getPriority() < ManiphestTaskPriority::PRIORITY_NORMAL) { + // TODO: This is sort of a hard-code for the default "normal" status. + // When reports are more powerful, this should be made more general. + if ($task->getPriority() < 50) { continue; } $normal_or_better[$id] = $task; @@ -574,7 +576,7 @@ final class ManiphestReportController extends ManiphestController { $cname = array($col_header); $cclass = array('pri right wide'); - $pri_map = ManiphestTaskPriority::getTaskBriefPriorityMap(); + $pri_map = ManiphestTaskPriority::getShortNameMap(); foreach ($pri_map as $pri => $label) { $cname[] = $label; $cclass[] = 'n'; diff --git a/src/applications/maniphest/view/ManiphestTaskListView.php b/src/applications/maniphest/view/ManiphestTaskListView.php index 14c5d5dba2..2954ac509c 100644 --- a/src/applications/maniphest/view/ManiphestTaskListView.php +++ b/src/applications/maniphest/view/ManiphestTaskListView.php @@ -40,14 +40,7 @@ final class ManiphestTaskListView extends ManiphestView { $list->setFlush(true); $status_map = ManiphestTaskStatus::getTaskStatusMap(); - $color_map = array( - ManiphestTaskPriority::PRIORITY_UNBREAK_NOW => 'indigo', - ManiphestTaskPriority::PRIORITY_TRIAGE => 'violet', - ManiphestTaskPriority::PRIORITY_HIGH => 'red', - ManiphestTaskPriority::PRIORITY_NORMAL => 'orange', - ManiphestTaskPriority::PRIORITY_LOW => 'yellow', - ManiphestTaskPriority::PRIORITY_WISH => 'sky', - ); + $color_map = ManiphestTaskPriority::getColorMap(); if ($this->showBatchControls) { Javelin::initBehavior('maniphest-list-editor'); diff --git a/webroot/rsrc/css/application/config/config-options.css b/webroot/rsrc/css/application/config/config-options.css index 7d8f757933..c7b6d55512 100644 --- a/webroot/rsrc/css/application/config/config-options.css +++ b/webroot/rsrc/css/application/config/config-options.css @@ -31,6 +31,7 @@ .config-option-table td { color: {$darkgreytext}; width: 100%; + white-space: pre-wrap; } .config-option-table .column-labels th {