Add "Spaces", an application for managing policy namespaces
Summary: Ref T3820. This doesn't actually do anything yet, but dumps in all the plumbing.
Test Plan:
{F156989}
{F156990}
{F156991}
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: eadler, wienczny, jdloft, devurandom, thz, hwinkel, 20after4, sascha-egerer, seporaitis, joshuaspence, chad, epriestley
Maniphest Tasks: T3820
Differential Revision: https://secure.phabricator.com/D9204
2015-06-01 20:28:38 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorSpacesNamespaceSearchEngine
|
|
|
|
extends PhabricatorApplicationSearchEngine {
|
|
|
|
|
|
|
|
public function getApplicationClassName() {
|
|
|
|
return 'PhabricatorSpacesApplication';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getResultTypeDescription() {
|
|
|
|
return pht('Spaces');
|
|
|
|
}
|
|
|
|
|
2015-06-11 19:13:47 +02:00
|
|
|
public function newQuery() {
|
|
|
|
return new PhabricatorSpacesNamespaceQuery();
|
|
|
|
}
|
Add "Spaces", an application for managing policy namespaces
Summary: Ref T3820. This doesn't actually do anything yet, but dumps in all the plumbing.
Test Plan:
{F156989}
{F156990}
{F156991}
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: eadler, wienczny, jdloft, devurandom, thz, hwinkel, 20after4, sascha-egerer, seporaitis, joshuaspence, chad, epriestley
Maniphest Tasks: T3820
Differential Revision: https://secure.phabricator.com/D9204
2015-06-01 20:28:38 +02:00
|
|
|
|
2015-06-14 23:34:14 +02:00
|
|
|
protected function buildCustomSearchFields() {
|
2015-06-11 19:13:47 +02:00
|
|
|
return array(
|
|
|
|
id(new PhabricatorSearchThreeStateField())
|
|
|
|
->setLabel(pht('Active'))
|
|
|
|
->setKey('active')
|
|
|
|
->setOptions(
|
|
|
|
pht('(Show All)'),
|
|
|
|
pht('Show Only Active Spaces'),
|
|
|
|
pht('Hide Active Spaces')),
|
|
|
|
);
|
Add "Spaces", an application for managing policy namespaces
Summary: Ref T3820. This doesn't actually do anything yet, but dumps in all the plumbing.
Test Plan:
{F156989}
{F156990}
{F156991}
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: eadler, wienczny, jdloft, devurandom, thz, hwinkel, 20after4, sascha-egerer, seporaitis, joshuaspence, chad, epriestley
Maniphest Tasks: T3820
Differential Revision: https://secure.phabricator.com/D9204
2015-06-01 20:28:38 +02:00
|
|
|
}
|
|
|
|
|
2015-06-14 23:34:14 +02:00
|
|
|
protected function buildQueryFromParameters(array $map) {
|
2015-06-11 19:13:47 +02:00
|
|
|
$query = $this->newQuery();
|
|
|
|
|
|
|
|
if ($map['active']) {
|
|
|
|
$query->withIsArchived(!$map['active']);
|
|
|
|
}
|
Add "Spaces", an application for managing policy namespaces
Summary: Ref T3820. This doesn't actually do anything yet, but dumps in all the plumbing.
Test Plan:
{F156989}
{F156990}
{F156991}
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: eadler, wienczny, jdloft, devurandom, thz, hwinkel, 20after4, sascha-egerer, seporaitis, joshuaspence, chad, epriestley
Maniphest Tasks: T3820
Differential Revision: https://secure.phabricator.com/D9204
2015-06-01 20:28:38 +02:00
|
|
|
|
|
|
|
return $query;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getURI($path) {
|
|
|
|
return '/spaces/'.$path;
|
|
|
|
}
|
|
|
|
|
2015-06-03 00:27:49 +02:00
|
|
|
protected function getBuiltinQueryNames() {
|
Add "Spaces", an application for managing policy namespaces
Summary: Ref T3820. This doesn't actually do anything yet, but dumps in all the plumbing.
Test Plan:
{F156989}
{F156990}
{F156991}
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: eadler, wienczny, jdloft, devurandom, thz, hwinkel, 20after4, sascha-egerer, seporaitis, joshuaspence, chad, epriestley
Maniphest Tasks: T3820
Differential Revision: https://secure.phabricator.com/D9204
2015-06-01 20:28:38 +02:00
|
|
|
$names = array(
|
2015-06-11 19:13:47 +02:00
|
|
|
'active' => pht('Active Spaces'),
|
Add "Spaces", an application for managing policy namespaces
Summary: Ref T3820. This doesn't actually do anything yet, but dumps in all the plumbing.
Test Plan:
{F156989}
{F156990}
{F156991}
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: eadler, wienczny, jdloft, devurandom, thz, hwinkel, 20after4, sascha-egerer, seporaitis, joshuaspence, chad, epriestley
Maniphest Tasks: T3820
Differential Revision: https://secure.phabricator.com/D9204
2015-06-01 20:28:38 +02:00
|
|
|
'all' => pht('All Spaces'),
|
|
|
|
);
|
|
|
|
|
|
|
|
return $names;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function buildSavedQueryFromBuiltin($query_key) {
|
|
|
|
$query = $this->newSavedQuery();
|
|
|
|
$query->setQueryKey($query_key);
|
|
|
|
|
|
|
|
switch ($query_key) {
|
2015-06-11 19:13:47 +02:00
|
|
|
case 'active':
|
|
|
|
return $query->setParameter('active', true);
|
Add "Spaces", an application for managing policy namespaces
Summary: Ref T3820. This doesn't actually do anything yet, but dumps in all the plumbing.
Test Plan:
{F156989}
{F156990}
{F156991}
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: eadler, wienczny, jdloft, devurandom, thz, hwinkel, 20after4, sascha-egerer, seporaitis, joshuaspence, chad, epriestley
Maniphest Tasks: T3820
Differential Revision: https://secure.phabricator.com/D9204
2015-06-01 20:28:38 +02:00
|
|
|
case 'all':
|
|
|
|
return $query;
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::buildSavedQueryFromBuiltin($query_key);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function renderResultList(
|
|
|
|
array $spaces,
|
|
|
|
PhabricatorSavedQuery $query,
|
|
|
|
array $handles) {
|
|
|
|
assert_instances_of($spaces, 'PhabricatorSpacesNamespace');
|
|
|
|
|
|
|
|
$viewer = $this->requireViewer();
|
|
|
|
|
|
|
|
$list = new PHUIObjectItemListView();
|
|
|
|
$list->setUser($viewer);
|
|
|
|
foreach ($spaces as $space) {
|
|
|
|
$item = id(new PHUIObjectItemView())
|
|
|
|
->setObjectName($space->getMonogram())
|
|
|
|
->setHeader($space->getNamespaceName())
|
|
|
|
->setHref('/'.$space->getMonogram());
|
|
|
|
|
|
|
|
if ($space->getIsDefaultNamespace()) {
|
|
|
|
$item->addIcon('fa-certificate', pht('Default Space'));
|
|
|
|
}
|
|
|
|
|
2015-06-11 19:13:47 +02:00
|
|
|
if ($space->getIsArchived()) {
|
|
|
|
$item->setDisabled(true);
|
|
|
|
}
|
|
|
|
|
Add "Spaces", an application for managing policy namespaces
Summary: Ref T3820. This doesn't actually do anything yet, but dumps in all the plumbing.
Test Plan:
{F156989}
{F156990}
{F156991}
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: eadler, wienczny, jdloft, devurandom, thz, hwinkel, 20after4, sascha-egerer, seporaitis, joshuaspence, chad, epriestley
Maniphest Tasks: T3820
Differential Revision: https://secure.phabricator.com/D9204
2015-06-01 20:28:38 +02:00
|
|
|
$list->addItem($item);
|
|
|
|
}
|
|
|
|
|
2015-06-19 12:46:20 +02:00
|
|
|
$result = new PhabricatorApplicationSearchResultView();
|
|
|
|
$result->setObjectList($list);
|
|
|
|
$result->setNoDataString(pht('No spaces found.'));
|
|
|
|
|
|
|
|
return $result;
|
Add "Spaces", an application for managing policy namespaces
Summary: Ref T3820. This doesn't actually do anything yet, but dumps in all the plumbing.
Test Plan:
{F156989}
{F156990}
{F156991}
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: eadler, wienczny, jdloft, devurandom, thz, hwinkel, 20after4, sascha-egerer, seporaitis, joshuaspence, chad, epriestley
Maniphest Tasks: T3820
Differential Revision: https://secure.phabricator.com/D9204
2015-06-01 20:28:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|