Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15546818
D7927.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D7927.diff
View Options
Index: src/applications/repository/query/PhabricatorRepositoryQuery.php
===================================================================
--- src/applications/repository/query/PhabricatorRepositoryQuery.php
+++ src/applications/repository/query/PhabricatorRepositoryQuery.php
@@ -21,6 +21,11 @@
const ORDER_NAME = 'order-name';
private $order = self::ORDER_CREATED;
+ const HOSTED_PHABRICATOR = 'hosted-phab';
+ const HOSTED_REMOTE = 'hosted-remote';
+ const HOSTED_ALL = 'hosted-all';
+ private $hosted = self::HOSTED_ALL;
+
private $needMostRecentCommits;
private $needCommitCounts;
private $needProjectPHIDs;
@@ -45,6 +50,11 @@
return $this;
}
+ public function withHosted($hosted) {
+ $this->hosted = $hosted;
+ return $this;
+ }
+
public function withTypes(array $types) {
$this->types = $types;
return $this;
@@ -148,6 +158,24 @@
default:
throw new Exception("Unknown status '{$status}'!");
}
+
+ $hosted = $this->hosted;
+ switch ($hosted) {
+ case self::HOSTED_PHABRICATOR:
+ if (!$repo->isHosted()) {
+ unset($repositories[$key]);
+ }
+ break;
+ case self::HOSTED_REMOTE:
+ if ($repo->isHosted()) {
+ unset($repositories[$key]);
+ }
+ break;
+ case self::HOSTED_ALL:
+ break;
+ default:
+ throw new Exception("Uknown hosted failed '${hosted}'!");
+ }
}
return $repositories;
Index: src/applications/repository/query/PhabricatorRepositorySearchEngine.php
===================================================================
--- src/applications/repository/query/PhabricatorRepositorySearchEngine.php
+++ src/applications/repository/query/PhabricatorRepositorySearchEngine.php
@@ -9,6 +9,7 @@
$saved->setParameter('callsigns', $request->getStrList('callsigns'));
$saved->setParameter('status', $request->getStr('status'));
$saved->setParameter('order', $request->getStr('order'));
+ $saved->setParameter('hosted', $request->getStr('hosted'));
$saved->setParameter('types', $request->getArr('types'));
$saved->setParameter('name', $request->getStr('name'));
@@ -40,6 +41,12 @@
$query->setOrder(head($this->getOrderValues()));
}
+ $hosted = $saved->getParameter('hosted');
+ $hosted = idx($this->getHostedValues(), $hosted);
+ if ($hosted) {
+ $query->withHosted($hosted);
+ }
+
$types = $saved->getParameter('types');
if ($types) {
$query->withTypes($types);
@@ -78,7 +85,13 @@
->setName('status')
->setLabel(pht('Status'))
->setValue($saved_query->getParameter('status'))
- ->setOptions($this->getStatusOptions()));
+ ->setOptions($this->getStatusOptions()))
+ ->appendChild(
+ id(new AphrontFormSelectControl())
+ ->setName('hosted')
+ ->setLabel(pht('Hosted'))
+ ->setValue($saved_query->getParameter('hosted'))
+ ->setOptions($this->getHostedOptions()));
$type_control = id(new AphrontFormCheckboxControl())
->setLabel(pht('Types'));
@@ -164,5 +177,20 @@
);
}
+ private function getHostedOptions() {
+ return array(
+ '' => pht('Hosted and Remote Repositories'),
+ 'phabricator' => pht('Hosted Repositories'),
+ 'remote' => pht('Remote Repositories'),
+ );
+ }
+
+ private function getHostedValues() {
+ return array(
+ '' => PhabricatorRepositoryQuery::HOSTED_ALL,
+ 'phabricator' => PhabricatorRepositoryQuery::HOSTED_PHABRICATOR,
+ 'remote' => PhabricatorRepositoryQuery::HOSTED_REMOTE,
+ );
+ }
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 27, 5:08 PM (5 h, 5 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7705475
Default Alt Text
D7927.diff (3 KB)
Attached To
Mode
D7927: Add Hosted/Remote filtering to Diffusion
Attached
Detach File
Event Timeline
Log In to Comment