Support PhabricatorSpacesInterface in ApplicationSearch UI
Summary: Ref T8441. Does what it says, provided other conditions (like using the new SearchField stuff) are fulfilled.
Test Plan:
{F473836}
{F473837}
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T8441
Differential Revision: https://secure.phabricator.com/D13171
This commit is contained in:
@@ -9,6 +9,10 @@ final class PhabricatorSpacesNamespacePHIDType
|
||||
return pht('Space');
|
||||
}
|
||||
|
||||
public function getPHIDTypeApplicationClass() {
|
||||
return 'PhabricatorSpacesApplication';
|
||||
}
|
||||
|
||||
public function newObject() {
|
||||
return new PhabricatorSpacesNamespace();
|
||||
}
|
||||
|
||||
@@ -86,6 +86,10 @@ final class PhabricatorSpacesNamespaceQuery
|
||||
));
|
||||
}
|
||||
|
||||
public static function getSpacesExist() {
|
||||
return (bool)self::getAllSpaces();
|
||||
}
|
||||
|
||||
public static function getAllSpaces() {
|
||||
$cache = PhabricatorCaches::getRequestCache();
|
||||
$cache_key = self::KEY_ALL;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
final class PhabricatorSpacesNamespaceDatasource
|
||||
extends PhabricatorTypeaheadDatasource {
|
||||
|
||||
public function getBrowseTitle() {
|
||||
return pht('Browse Spaces');
|
||||
}
|
||||
|
||||
public function getPlaceholderText() {
|
||||
return pht('Type a space name...');
|
||||
}
|
||||
|
||||
public function getDatasourceApplicationClass() {
|
||||
return 'PhabricatorSpacesApplication';
|
||||
}
|
||||
|
||||
public function loadResults() {
|
||||
$query = id(new PhabricatorSpacesNamespaceQuery());
|
||||
|
||||
$spaces = $this->executeQuery($query);
|
||||
$results = array();
|
||||
foreach ($spaces as $space) {
|
||||
$results[] = id(new PhabricatorTypeaheadResult())
|
||||
->setName($space->getNamespaceName())
|
||||
->setPHID($space->getPHID());
|
||||
}
|
||||
|
||||
return $this->filterResultsAgainstTokens($results);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user