Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15388745
D12528.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Referenced Files
None
Subscribers
None
D12528.diff
View Options
diff --git a/src/applications/maniphest/constants/ManiphestTaskPriority.php b/src/applications/maniphest/constants/ManiphestTaskPriority.php
--- a/src/applications/maniphest/constants/ManiphestTaskPriority.php
+++ b/src/applications/maniphest/constants/ManiphestTaskPriority.php
@@ -101,6 +101,9 @@
return idx(self::getColorMap(), $priority, 'black');
}
+ public static function getTaskPriorityIcon($priority) {
+ return 'fa-arrow-right';
+ }
private static function getConfig() {
$config = PhabricatorEnv::getEnvConfig('maniphest.priorities');
diff --git a/src/applications/maniphest/constants/ManiphestTaskStatus.php b/src/applications/maniphest/constants/ManiphestTaskStatus.php
--- a/src/applications/maniphest/constants/ManiphestTaskStatus.php
+++ b/src/applications/maniphest/constants/ManiphestTaskStatus.php
@@ -85,14 +85,16 @@
public static function renderFullDescription($status) {
if (self::isOpenStatus($status)) {
$color = 'status';
- $icon = 'fa-square-o bluegrey';
+ $icon_color = 'bluegrey';
} else {
$color = 'status-dark';
- $icon = 'fa-check-square-o';
+ $icon_color = '';
}
+ $icon = self::getStatusIcon($status);
+
$img = id(new PHUIIconView())
- ->setIconFont($icon);
+ ->setIconFont($icon.' '.$icon_color);
$tag = phutil_tag(
'span',
@@ -166,7 +168,16 @@
}
public static function getStatusIcon($status) {
- return self::getStatusAttribute($status, 'transaction.icon');
+ $icon = self::getStatusAttribute($status, 'transaction.icon');
+ if ($icon) {
+ return $icon;
+ }
+
+ if (self::isOpenStatus($status)) {
+ return 'fa-square-o';
+ } else {
+ return 'fa-check-square-o';
+ }
}
public static function getStatusPrefixMap() {
diff --git a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php
--- a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php
+++ b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php
@@ -219,28 +219,7 @@
$subscriber_phids = $saved->getParameter('subscriberPHIDs', array());
$statuses = $saved->getParameter('statuses', array());
- $statuses = array_fuse($statuses);
- $status_control = id(new AphrontFormCheckboxControl())
- ->setLabel(pht('Status'));
- foreach (ManiphestTaskStatus::getTaskStatusMap() as $status => $name) {
- $status_control->addCheckbox(
- 'statuses[]',
- $status,
- $name,
- isset($statuses[$status]));
- }
-
$priorities = $saved->getParameter('priorities', array());
- $priorities = array_fuse($priorities);
- $priority_control = id(new AphrontFormCheckboxControl())
- ->setLabel(pht('Priority'));
- foreach (ManiphestTaskPriority::getTaskPriorityMap() as $pri => $name) {
- $priority_control->addCheckbox(
- 'priorities[]',
- $pri,
- $name,
- isset($priorities[$pri]));
- }
$blocking_control = id(new AphrontFormSelectControl())
->setLabel(pht('Blocking'))
@@ -293,13 +272,23 @@
->setName('subscribers')
->setLabel(pht('Subscribers'))
->setValue($subscriber_phids))
+ ->appendControl(
+ id(new AphrontFormTokenizerControl())
+ ->setDatasource(new ManiphestTaskStatusDatasource())
+ ->setLabel(pht('Statuses'))
+ ->setName('statuses')
+ ->setValue($statuses))
+ ->appendControl(
+ id(new AphrontFormTokenizerControl())
+ ->setDatasource(new ManiphestTaskPriorityDatasource())
+ ->setLabel(pht('Priorities'))
+ ->setName('priorities')
+ ->setValue($priorities))
->appendChild(
id(new AphrontFormTextControl())
->setName('fulltext')
->setLabel(pht('Contains Words'))
->setValue($saved->getParameter('fulltext')))
- ->appendChild($status_control)
- ->appendChild($priority_control)
->appendChild($blocking_control)
->appendChild($blocked_control);
diff --git a/src/applications/maniphest/typeahead/ManiphestTaskPriorityDatasource.php b/src/applications/maniphest/typeahead/ManiphestTaskPriorityDatasource.php
--- a/src/applications/maniphest/typeahead/ManiphestTaskPriorityDatasource.php
+++ b/src/applications/maniphest/typeahead/ManiphestTaskPriorityDatasource.php
@@ -16,20 +16,26 @@
}
public function loadResults() {
- $viewer = $this->getViewer();
- $raw_query = $this->getRawQuery();
+ $results = $this->buildResults();
+ return $this->filterResultsAgainstTokens($results);
+ }
+ public function renderTokens(array $values) {
+ return $this->renderTokensFromResults($this->buildResults(), $values);
+ }
+
+ private function buildResults() {
$results = array();
$priority_map = ManiphestTaskPriority::getTaskPriorityMap();
foreach ($priority_map as $value => $name) {
- // NOTE: $value is not a PHID but is unique. This'll work.
- $results[] = id(new PhabricatorTypeaheadResult())
+ $results[$value] = id(new PhabricatorTypeaheadResult())
+ ->setIcon(ManiphestTaskPriority::getTaskPriorityIcon($value))
->setPHID($value)
->setName($name);
}
- return $this->filterResultsAgainstTokens($results);
+ return $results;
}
}
diff --git a/src/applications/maniphest/typeahead/ManiphestTaskStatusDatasource.php b/src/applications/maniphest/typeahead/ManiphestTaskStatusDatasource.php
--- a/src/applications/maniphest/typeahead/ManiphestTaskStatusDatasource.php
+++ b/src/applications/maniphest/typeahead/ManiphestTaskStatusDatasource.php
@@ -16,19 +16,26 @@
}
public function loadResults() {
- $viewer = $this->getViewer();
- $raw_query = $this->getRawQuery();
+ $results = $this->buildResults();
+ return $this->filterResultsAgainstTokens($results);
+ }
+
+ public function renderTokens(array $values) {
+ return $this->renderTokensFromResults($this->buildResults(), $values);
+ }
+ private function buildResults() {
$results = array();
$status_map = ManiphestTaskStatus::getTaskStatusMap();
foreach ($status_map as $value => $name) {
- // NOTE: $value is not a PHID but is unique. This'll work.
- $results[] = id(new PhabricatorTypeaheadResult())
+ $results[$value] = id(new PhabricatorTypeaheadResult())
+ ->setIcon(ManiphestTaskStatus::getStatusIcon($value))
->setPHID($value)
->setName($name);
}
- return $this->filterResultsAgainstTokens($results);
+ return $results;
}
+
}
diff --git a/src/applications/search/typeahead/PhabricatorSearchDocumentTypeDatasource.php b/src/applications/search/typeahead/PhabricatorSearchDocumentTypeDatasource.php
--- a/src/applications/search/typeahead/PhabricatorSearchDocumentTypeDatasource.php
+++ b/src/applications/search/typeahead/PhabricatorSearchDocumentTypeDatasource.php
@@ -21,16 +21,7 @@
}
public function renderTokens(array $values) {
- $results = $this->buildResults();
- $results = array_select_keys($results, $values);
-
- $tokens = array();
- foreach ($results as $result) {
- $tokens[] = PhabricatorTypeaheadTokenView::newFromTypeaheadResult(
- $result);
- }
-
- return $tokens;
+ return $this->renderTokensFromResults($this->buildResults(), $values);
}
private function buildResults() {
diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php
--- a/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php
+++ b/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php
@@ -73,7 +73,7 @@
// If this is a request for a specific token after the user clicks
// "Select", return the token in wire format so it can be added to
// the tokenizer.
- if ($select_phid) {
+ if ($select_phid !== null) {
$map = mpull($results, null, 'getPHID');
$token = idx($map, $select_phid);
if (!$token) {
diff --git a/src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php b/src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php
--- a/src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php
+++ b/src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php
@@ -423,4 +423,16 @@
return nonempty(last($this->functionStack), null);
}
+ protected function renderTokensFromResults(array $results, array $values) {
+ $results = array_select_keys($results, $values);
+
+ $tokens = array();
+ foreach ($results as $result) {
+ $tokens[] = PhabricatorTypeaheadTokenView::newFromTypeaheadResult(
+ $result);
+ }
+
+ return $tokens;
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 4:20 AM (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7389721
Default Alt Text
D12528.diff (8 KB)
Attached To
Mode
D12528: Use typeaheads instead of checkbox lists for task status / priority
Attached
Detach File
Event Timeline
Log In to Comment