Summary:
Ref T10054. This does a big chunk of the legwork to let users reconfigure profile menus (currently, just project menus).
This includes:
- Editing builtin items (e.g., you can rename the default items).
- Creating new items (for now, only links are available).
This does not yet include:
- Hiding items.
- Reordering items.
- Lots of fancy types of items (dashboards, etc).
- Any UI changes.
- Documentation (does feature: TODO link for documentation).
Test Plan:
{F1060695}
{F1060696}
{F1060697}
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T10054
Differential Revision: https://secure.phabricator.com/D15010
88 lines
2.0 KiB
PHP
88 lines
2.0 KiB
PHP
<?php
|
|
|
|
final class PhabricatorEditEngineSearchEngine
|
|
extends PhabricatorApplicationSearchEngine {
|
|
|
|
public function getResultTypeDescription() {
|
|
return pht('Edit Engines');
|
|
}
|
|
|
|
public function getApplicationClassName() {
|
|
return 'PhabricatorTransactionsApplication';
|
|
}
|
|
|
|
public function newQuery() {
|
|
return id(new PhabricatorEditEngineQuery());
|
|
}
|
|
|
|
protected function buildQueryFromParameters(array $map) {
|
|
$query = $this->newQuery();
|
|
return $query;
|
|
}
|
|
|
|
protected function buildCustomSearchFields() {
|
|
return array();
|
|
}
|
|
|
|
protected function getDefaultFieldOrder() {
|
|
return array();
|
|
}
|
|
|
|
protected function getURI($path) {
|
|
return '/transactions/editengine/'.$path;
|
|
}
|
|
|
|
protected function getBuiltinQueryNames() {
|
|
$names = array(
|
|
'all' => pht('All Edit Engines'),
|
|
);
|
|
|
|
return $names;
|
|
}
|
|
|
|
public function buildSavedQueryFromBuiltin($query_key) {
|
|
$query = $this->newSavedQuery();
|
|
$query->setQueryKey($query_key);
|
|
|
|
switch ($query_key) {
|
|
case 'all':
|
|
return $query;
|
|
}
|
|
|
|
return parent::buildSavedQueryFromBuiltin($query_key);
|
|
}
|
|
|
|
protected function renderResultList(
|
|
array $engines,
|
|
PhabricatorSavedQuery $query,
|
|
array $handles) {
|
|
assert_instances_of($engines, 'PhabricatorEditEngine');
|
|
$viewer = $this->requireViewer();
|
|
|
|
$list = id(new PHUIObjectItemListView())
|
|
->setUser($viewer);
|
|
foreach ($engines as $engine) {
|
|
if (!$engine->isEngineConfigurable()) {
|
|
continue;
|
|
}
|
|
|
|
$engine_key = $engine->getEngineKey();
|
|
$query_uri = "/transactions/editengine/{$engine_key}/";
|
|
|
|
$application = $engine->getApplication();
|
|
$app_icon = $application->getFontIcon();
|
|
|
|
$item = id(new PHUIObjectItemView())
|
|
->setHeader($engine->getSummaryHeader())
|
|
->setHref($query_uri)
|
|
->setStatusIcon($app_icon)
|
|
->addAttribute($engine->getSummaryText());
|
|
|
|
$list->addItem($item);
|
|
}
|
|
|
|
return id(new PhabricatorApplicationSearchResultView())
|
|
->setObjectList($list);
|
|
}
|
|
}
|