mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 04:20:55 +01:00
Move a bunch more rendering into SearchEngine
Summary: Ref T4986. These are mostly mechanical now, I skipped a couple of slightly tricky ones. Still a bunch to go. Test Plan: For each engine: - Viewed the application; - created a panel to issue the query. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T4986 Differential Revision: https://secure.phabricator.com/D9017
This commit is contained in:
parent
c6a68aadc0
commit
78b89711cb
25 changed files with 561 additions and 556 deletions
|
@ -3061,11 +3061,7 @@ phutil_register_library_map(array(
|
||||||
'DifferentialRevisionEditController' => 'DifferentialController',
|
'DifferentialRevisionEditController' => 'DifferentialController',
|
||||||
'DifferentialRevisionIDField' => 'DifferentialCustomField',
|
'DifferentialRevisionIDField' => 'DifferentialCustomField',
|
||||||
'DifferentialRevisionLandController' => 'DifferentialController',
|
'DifferentialRevisionLandController' => 'DifferentialController',
|
||||||
'DifferentialRevisionListController' =>
|
'DifferentialRevisionListController' => 'DifferentialController',
|
||||||
array(
|
|
||||||
0 => 'DifferentialController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'DifferentialRevisionListView' => 'AphrontView',
|
'DifferentialRevisionListView' => 'AphrontView',
|
||||||
'DifferentialRevisionMailReceiver' => 'PhabricatorObjectMailReceiver',
|
'DifferentialRevisionMailReceiver' => 'PhabricatorObjectMailReceiver',
|
||||||
'DifferentialRevisionQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'DifferentialRevisionQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
|
@ -3150,11 +3146,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionPathValidateController' => 'DiffusionController',
|
'DiffusionPathValidateController' => 'DiffusionController',
|
||||||
'DiffusionPushEventViewController' => 'DiffusionPushLogController',
|
'DiffusionPushEventViewController' => 'DiffusionPushLogController',
|
||||||
'DiffusionPushLogController' => 'DiffusionController',
|
'DiffusionPushLogController' => 'DiffusionController',
|
||||||
'DiffusionPushLogListController' =>
|
'DiffusionPushLogListController' => 'DiffusionPushLogController',
|
||||||
array(
|
|
||||||
0 => 'DiffusionPushLogController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'DiffusionQuery' => 'PhabricatorQuery',
|
'DiffusionQuery' => 'PhabricatorQuery',
|
||||||
'DiffusionRawDiffQuery' => 'DiffusionQuery',
|
'DiffusionRawDiffQuery' => 'DiffusionQuery',
|
||||||
'DiffusionRepositoryController' => 'DiffusionController',
|
'DiffusionRepositoryController' => 'DiffusionController',
|
||||||
|
@ -3172,11 +3164,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionRepositoryEditLocalController' => 'DiffusionRepositoryEditController',
|
'DiffusionRepositoryEditLocalController' => 'DiffusionRepositoryEditController',
|
||||||
'DiffusionRepositoryEditMainController' => 'DiffusionRepositoryEditController',
|
'DiffusionRepositoryEditMainController' => 'DiffusionRepositoryEditController',
|
||||||
'DiffusionRepositoryEditSubversionController' => 'DiffusionRepositoryEditController',
|
'DiffusionRepositoryEditSubversionController' => 'DiffusionRepositoryEditController',
|
||||||
'DiffusionRepositoryListController' =>
|
'DiffusionRepositoryListController' => 'DiffusionController',
|
||||||
array(
|
|
||||||
0 => 'DiffusionController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'DiffusionRepositoryNewController' => 'DiffusionController',
|
'DiffusionRepositoryNewController' => 'DiffusionController',
|
||||||
'DiffusionRepositoryRef' => 'Phobject',
|
'DiffusionRepositoryRef' => 'Phobject',
|
||||||
'DiffusionRepositoryRemarkupRule' => 'PhabricatorRemarkupRuleObject',
|
'DiffusionRepositoryRemarkupRule' => 'PhabricatorRemarkupRuleObject',
|
||||||
|
@ -3208,11 +3196,7 @@ phutil_register_library_map(array(
|
||||||
'DivinerArticleAtomizer' => 'DivinerAtomizer',
|
'DivinerArticleAtomizer' => 'DivinerAtomizer',
|
||||||
'DivinerAtomCache' => 'DivinerDiskCache',
|
'DivinerAtomCache' => 'DivinerDiskCache',
|
||||||
'DivinerAtomController' => 'DivinerController',
|
'DivinerAtomController' => 'DivinerController',
|
||||||
'DivinerAtomListController' =>
|
'DivinerAtomListController' => 'DivinerController',
|
||||||
array(
|
|
||||||
0 => 'DivinerController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'DivinerAtomQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'DivinerAtomQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'DivinerAtomSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'DivinerAtomSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'DivinerAtomizeWorkflow' => 'DivinerWorkflow',
|
'DivinerAtomizeWorkflow' => 'DivinerWorkflow',
|
||||||
|
@ -3281,11 +3265,7 @@ phutil_register_library_map(array(
|
||||||
'DrydockBlueprintCreateController' => 'DrydockBlueprintController',
|
'DrydockBlueprintCreateController' => 'DrydockBlueprintController',
|
||||||
'DrydockBlueprintEditController' => 'DrydockBlueprintController',
|
'DrydockBlueprintEditController' => 'DrydockBlueprintController',
|
||||||
'DrydockBlueprintEditor' => 'PhabricatorApplicationTransactionEditor',
|
'DrydockBlueprintEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||||
'DrydockBlueprintListController' =>
|
'DrydockBlueprintListController' => 'DrydockBlueprintController',
|
||||||
array(
|
|
||||||
0 => 'DrydockBlueprintController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'DrydockBlueprintQuery' => 'DrydockQuery',
|
'DrydockBlueprintQuery' => 'DrydockQuery',
|
||||||
'DrydockBlueprintSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'DrydockBlueprintSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'DrydockBlueprintTransaction' => 'PhabricatorApplicationTransaction',
|
'DrydockBlueprintTransaction' => 'PhabricatorApplicationTransaction',
|
||||||
|
@ -3438,11 +3418,7 @@ phutil_register_library_map(array(
|
||||||
2 => 'HarbormasterBuildableInterface',
|
2 => 'HarbormasterBuildableInterface',
|
||||||
),
|
),
|
||||||
'HarbormasterBuildableActionController' => 'HarbormasterController',
|
'HarbormasterBuildableActionController' => 'HarbormasterController',
|
||||||
'HarbormasterBuildableListController' =>
|
'HarbormasterBuildableListController' => 'HarbormasterController',
|
||||||
array(
|
|
||||||
0 => 'HarbormasterController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'HarbormasterBuildableQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'HarbormasterBuildableQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'HarbormasterBuildableSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'HarbormasterBuildableSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'HarbormasterBuildableViewController' => 'HarbormasterController',
|
'HarbormasterBuildableViewController' => 'HarbormasterController',
|
||||||
|
@ -3466,11 +3442,7 @@ phutil_register_library_map(array(
|
||||||
'HarbormasterPlanController' => 'HarbormasterController',
|
'HarbormasterPlanController' => 'HarbormasterController',
|
||||||
'HarbormasterPlanDisableController' => 'HarbormasterPlanController',
|
'HarbormasterPlanDisableController' => 'HarbormasterPlanController',
|
||||||
'HarbormasterPlanEditController' => 'HarbormasterPlanController',
|
'HarbormasterPlanEditController' => 'HarbormasterPlanController',
|
||||||
'HarbormasterPlanListController' =>
|
'HarbormasterPlanListController' => 'HarbormasterPlanController',
|
||||||
array(
|
|
||||||
0 => 'HarbormasterPlanController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'HarbormasterPlanOrderController' => 'HarbormasterController',
|
'HarbormasterPlanOrderController' => 'HarbormasterController',
|
||||||
'HarbormasterPlanRunController' => 'HarbormasterController',
|
'HarbormasterPlanRunController' => 'HarbormasterController',
|
||||||
'HarbormasterPlanViewController' => 'HarbormasterPlanController',
|
'HarbormasterPlanViewController' => 'HarbormasterPlanController',
|
||||||
|
@ -3520,11 +3492,7 @@ phutil_register_library_map(array(
|
||||||
'HeraldRuleEditHistoryController' => 'HeraldController',
|
'HeraldRuleEditHistoryController' => 'HeraldController',
|
||||||
'HeraldRuleEditHistoryView' => 'AphrontView',
|
'HeraldRuleEditHistoryView' => 'AphrontView',
|
||||||
'HeraldRuleEditor' => 'PhabricatorApplicationTransactionEditor',
|
'HeraldRuleEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||||
'HeraldRuleListController' =>
|
'HeraldRuleListController' => 'HeraldController',
|
||||||
array(
|
|
||||||
0 => 'HeraldController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'HeraldRuleQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'HeraldRuleQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'HeraldRuleSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'HeraldRuleSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'HeraldRuleTransaction' => 'PhabricatorApplicationTransaction',
|
'HeraldRuleTransaction' => 'PhabricatorApplicationTransaction',
|
||||||
|
@ -4133,11 +4101,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorConduitConsoleController' => 'PhabricatorConduitController',
|
'PhabricatorConduitConsoleController' => 'PhabricatorConduitController',
|
||||||
'PhabricatorConduitController' => 'PhabricatorController',
|
'PhabricatorConduitController' => 'PhabricatorController',
|
||||||
'PhabricatorConduitDAO' => 'PhabricatorLiskDAO',
|
'PhabricatorConduitDAO' => 'PhabricatorLiskDAO',
|
||||||
'PhabricatorConduitListController' =>
|
'PhabricatorConduitListController' => 'PhabricatorConduitController',
|
||||||
array(
|
|
||||||
0 => 'PhabricatorConduitController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'PhabricatorConduitLogController' => 'PhabricatorConduitController',
|
'PhabricatorConduitLogController' => 'PhabricatorConduitController',
|
||||||
'PhabricatorConduitLogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhabricatorConduitLogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'PhabricatorConduitMethodCallLog' =>
|
'PhabricatorConduitMethodCallLog' =>
|
||||||
|
@ -4202,11 +4166,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorCountdownDAO' => 'PhabricatorLiskDAO',
|
'PhabricatorCountdownDAO' => 'PhabricatorLiskDAO',
|
||||||
'PhabricatorCountdownDeleteController' => 'PhabricatorCountdownController',
|
'PhabricatorCountdownDeleteController' => 'PhabricatorCountdownController',
|
||||||
'PhabricatorCountdownEditController' => 'PhabricatorCountdownController',
|
'PhabricatorCountdownEditController' => 'PhabricatorCountdownController',
|
||||||
'PhabricatorCountdownListController' =>
|
'PhabricatorCountdownListController' => 'PhabricatorCountdownController',
|
||||||
array(
|
|
||||||
0 => 'PhabricatorCountdownController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'PhabricatorCountdownPHIDTypeCountdown' => 'PhabricatorPHIDType',
|
'PhabricatorCountdownPHIDTypeCountdown' => 'PhabricatorPHIDType',
|
||||||
'PhabricatorCountdownQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhabricatorCountdownQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'PhabricatorCountdownRemarkupRule' => 'PhabricatorRemarkupRuleObject',
|
'PhabricatorCountdownRemarkupRule' => 'PhabricatorRemarkupRuleObject',
|
||||||
|
@ -4265,11 +4225,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorDashboardController' => 'PhabricatorController',
|
'PhabricatorDashboardController' => 'PhabricatorController',
|
||||||
'PhabricatorDashboardDAO' => 'PhabricatorLiskDAO',
|
'PhabricatorDashboardDAO' => 'PhabricatorLiskDAO',
|
||||||
'PhabricatorDashboardEditController' => 'PhabricatorDashboardController',
|
'PhabricatorDashboardEditController' => 'PhabricatorDashboardController',
|
||||||
'PhabricatorDashboardListController' =>
|
'PhabricatorDashboardListController' => 'PhabricatorDashboardController',
|
||||||
array(
|
|
||||||
0 => 'PhabricatorDashboardController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'PhabricatorDashboardPHIDTypeDashboard' => 'PhabricatorPHIDType',
|
'PhabricatorDashboardPHIDTypeDashboard' => 'PhabricatorPHIDType',
|
||||||
'PhabricatorDashboardPHIDTypePanel' => 'PhabricatorPHIDType',
|
'PhabricatorDashboardPHIDTypePanel' => 'PhabricatorPHIDType',
|
||||||
'PhabricatorDashboardPanel' =>
|
'PhabricatorDashboardPanel' =>
|
||||||
|
@ -4286,11 +4242,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorDashboardPanelCreateController' => 'PhabricatorDashboardController',
|
'PhabricatorDashboardPanelCreateController' => 'PhabricatorDashboardController',
|
||||||
'PhabricatorDashboardPanelCustomField' => 'PhabricatorCustomField',
|
'PhabricatorDashboardPanelCustomField' => 'PhabricatorCustomField',
|
||||||
'PhabricatorDashboardPanelEditController' => 'PhabricatorDashboardController',
|
'PhabricatorDashboardPanelEditController' => 'PhabricatorDashboardController',
|
||||||
'PhabricatorDashboardPanelListController' =>
|
'PhabricatorDashboardPanelListController' => 'PhabricatorDashboardController',
|
||||||
array(
|
|
||||||
0 => 'PhabricatorDashboardController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'PhabricatorDashboardPanelQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhabricatorDashboardPanelQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'PhabricatorDashboardPanelRenderController' => 'PhabricatorDashboardController',
|
'PhabricatorDashboardPanelRenderController' => 'PhabricatorDashboardController',
|
||||||
'PhabricatorDashboardPanelRenderingEngine' => 'Phobject',
|
'PhabricatorDashboardPanelRenderingEngine' => 'Phobject',
|
||||||
|
@ -4415,11 +4367,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorFileInfoController' => 'PhabricatorFileController',
|
'PhabricatorFileInfoController' => 'PhabricatorFileController',
|
||||||
'PhabricatorFileLinkListView' => 'AphrontView',
|
'PhabricatorFileLinkListView' => 'AphrontView',
|
||||||
'PhabricatorFileLinkView' => 'AphrontView',
|
'PhabricatorFileLinkView' => 'AphrontView',
|
||||||
'PhabricatorFileListController' =>
|
'PhabricatorFileListController' => 'PhabricatorFileController',
|
||||||
array(
|
|
||||||
0 => 'PhabricatorFileController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'PhabricatorFilePHIDTypeFile' => 'PhabricatorPHIDType',
|
'PhabricatorFilePHIDTypeFile' => 'PhabricatorPHIDType',
|
||||||
'PhabricatorFileQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhabricatorFileQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'PhabricatorFileSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'PhabricatorFileSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
|
@ -4452,11 +4400,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorFlagDAO' => 'PhabricatorLiskDAO',
|
'PhabricatorFlagDAO' => 'PhabricatorLiskDAO',
|
||||||
'PhabricatorFlagDeleteController' => 'PhabricatorFlagController',
|
'PhabricatorFlagDeleteController' => 'PhabricatorFlagController',
|
||||||
'PhabricatorFlagEditController' => 'PhabricatorFlagController',
|
'PhabricatorFlagEditController' => 'PhabricatorFlagController',
|
||||||
'PhabricatorFlagListController' =>
|
'PhabricatorFlagListController' => 'PhabricatorFlagController',
|
||||||
array(
|
|
||||||
0 => 'PhabricatorFlagController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'PhabricatorFlagQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhabricatorFlagQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'PhabricatorFlagSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'PhabricatorFlagSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'PhabricatorFlagSelectControl' => 'AphrontFormControl',
|
'PhabricatorFlagSelectControl' => 'AphrontFormControl',
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PhabricatorDashboardPanelListController
|
final class PhabricatorDashboardPanelListController
|
||||||
extends PhabricatorDashboardController
|
extends PhabricatorDashboardController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
public function willProcessRequest(array $data) {
|
||||||
$this->queryKey = idx($data, 'queryKey');
|
$this->queryKey = idx($data, 'queryKey');
|
||||||
}
|
}
|
||||||
|
@ -47,25 +47,4 @@ final class PhabricatorDashboardPanelListController
|
||||||
return $crumbs;
|
return $crumbs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderResultsList(
|
|
||||||
array $panels,
|
|
||||||
PhabricatorSavedQuery $query) {
|
|
||||||
|
|
||||||
$viewer = $this->getRequest()->getUser();
|
|
||||||
|
|
||||||
$list = new PHUIObjectItemListView();
|
|
||||||
$list->setUser($viewer);
|
|
||||||
foreach ($panels as $panel) {
|
|
||||||
$item = id(new PHUIObjectItemView())
|
|
||||||
->setObjectName($panel->getMonogram())
|
|
||||||
->setHeader($panel->getName())
|
|
||||||
->setHref('/'.$panel->getMonogram())
|
|
||||||
->setObject($panel);
|
|
||||||
|
|
||||||
$list->addItem($item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $list;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class PhabricatorDashboardPanelSearchEngine
|
final class PhabricatorDashboardPanelSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationDashboard';
|
||||||
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||||
$saved = new PhabricatorSavedQuery();
|
$saved = new PhabricatorSavedQuery();
|
||||||
|
|
||||||
|
@ -46,4 +50,26 @@ final class PhabricatorDashboardPanelSearchEngine
|
||||||
return parent::buildSavedQueryFromBuiltin($query_key);
|
return parent::buildSavedQueryFromBuiltin($query_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function renderResultList(
|
||||||
|
array $panels,
|
||||||
|
PhabricatorSavedQuery $query,
|
||||||
|
array $handles) {
|
||||||
|
|
||||||
|
$viewer = $this->requireViewer();
|
||||||
|
|
||||||
|
$list = new PHUIObjectItemListView();
|
||||||
|
$list->setUser($viewer);
|
||||||
|
foreach ($panels as $panel) {
|
||||||
|
$item = id(new PHUIObjectItemView())
|
||||||
|
->setObjectName($panel->getMonogram())
|
||||||
|
->setHeader($panel->getName())
|
||||||
|
->setHref('/'.$panel->getMonogram())
|
||||||
|
->setObject($panel);
|
||||||
|
|
||||||
|
$list->addItem($item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class DifferentialRevisionListController extends DifferentialController
|
final class DifferentialRevisionListController extends DifferentialController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
@ -23,64 +22,4 @@ final class DifferentialRevisionListController extends DifferentialController
|
||||||
return $this->delegateToController($controller);
|
return $this->delegateToController($controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderResultsList(
|
|
||||||
array $revisions,
|
|
||||||
PhabricatorSavedQuery $query) {
|
|
||||||
assert_instances_of($revisions, 'DifferentialRevision');
|
|
||||||
|
|
||||||
$user = $this->getRequest()->getUser();
|
|
||||||
$template = id(new DifferentialRevisionListView())
|
|
||||||
->setUser($user);
|
|
||||||
|
|
||||||
$views = array();
|
|
||||||
if ($query->getQueryKey() == 'active') {
|
|
||||||
$split = DifferentialRevisionQuery::splitResponsible(
|
|
||||||
$revisions,
|
|
||||||
$query->getParameter('responsiblePHIDs'));
|
|
||||||
list($blocking, $active, $waiting) = $split;
|
|
||||||
|
|
||||||
$views[] = id(clone $template)
|
|
||||||
->setHeader(pht('Blocking Others'))
|
|
||||||
->setNoDataString(
|
|
||||||
pht('No revisions are blocked on your action.'))
|
|
||||||
->setHighlightAge(true)
|
|
||||||
->setRevisions($blocking)
|
|
||||||
->setHandles(array());
|
|
||||||
|
|
||||||
$views[] = id(clone $template)
|
|
||||||
->setHeader(pht('Action Required'))
|
|
||||||
->setNoDataString(
|
|
||||||
pht('No revisions require your action.'))
|
|
||||||
->setHighlightAge(true)
|
|
||||||
->setRevisions($active)
|
|
||||||
->setHandles(array());
|
|
||||||
|
|
||||||
$views[] = id(clone $template)
|
|
||||||
->setHeader(pht('Waiting on Others'))
|
|
||||||
->setNoDataString(
|
|
||||||
pht('You have no revisions waiting on others.'))
|
|
||||||
->setRevisions($waiting)
|
|
||||||
->setHandles(array());
|
|
||||||
} else {
|
|
||||||
$views[] = id(clone $template)
|
|
||||||
->setRevisions($revisions)
|
|
||||||
->setHandles(array());
|
|
||||||
}
|
|
||||||
|
|
||||||
$phids = array_mergev(mpull($views, 'getRequiredHandlePHIDs'));
|
|
||||||
$handles = $this->loadViewerHandles($phids);
|
|
||||||
|
|
||||||
foreach ($views as $view) {
|
|
||||||
$view->setHandles($handles);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($views) == 1) {
|
|
||||||
// Reduce this to a PHUIObjectItemListView so we can get the free
|
|
||||||
// support from ApplicationSearch.
|
|
||||||
return head($views)->render();
|
|
||||||
} else {
|
|
||||||
return $views;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class DifferentialRevisionSearchEngine
|
final class DifferentialRevisionSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationDifferential';
|
||||||
|
}
|
||||||
|
|
||||||
public function getPageSize(PhabricatorSavedQuery $saved) {
|
public function getPageSize(PhabricatorSavedQuery $saved) {
|
||||||
if ($saved->getQueryKey() == 'active') {
|
if ($saved->getQueryKey() == 'active') {
|
||||||
return 0xFFFF;
|
return 0xFFFF;
|
||||||
|
@ -243,4 +247,72 @@ final class DifferentialRevisionSearchEngine
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function renderResultList(
|
||||||
|
array $revisions,
|
||||||
|
PhabricatorSavedQuery $query,
|
||||||
|
array $handles) {
|
||||||
|
assert_instances_of($revisions, 'DifferentialRevision');
|
||||||
|
|
||||||
|
$viewer = $this->requireViewer();
|
||||||
|
$template = id(new DifferentialRevisionListView())
|
||||||
|
->setUser($viewer);
|
||||||
|
|
||||||
|
$views = array();
|
||||||
|
if ($query->getQueryKey() == 'active') {
|
||||||
|
$split = DifferentialRevisionQuery::splitResponsible(
|
||||||
|
$revisions,
|
||||||
|
$query->getParameter('responsiblePHIDs'));
|
||||||
|
list($blocking, $active, $waiting) = $split;
|
||||||
|
|
||||||
|
$views[] = id(clone $template)
|
||||||
|
->setHeader(pht('Blocking Others'))
|
||||||
|
->setNoDataString(
|
||||||
|
pht('No revisions are blocked on your action.'))
|
||||||
|
->setHighlightAge(true)
|
||||||
|
->setRevisions($blocking)
|
||||||
|
->setHandles(array());
|
||||||
|
|
||||||
|
$views[] = id(clone $template)
|
||||||
|
->setHeader(pht('Action Required'))
|
||||||
|
->setNoDataString(
|
||||||
|
pht('No revisions require your action.'))
|
||||||
|
->setHighlightAge(true)
|
||||||
|
->setRevisions($active)
|
||||||
|
->setHandles(array());
|
||||||
|
|
||||||
|
$views[] = id(clone $template)
|
||||||
|
->setHeader(pht('Waiting on Others'))
|
||||||
|
->setNoDataString(
|
||||||
|
pht('You have no revisions waiting on others.'))
|
||||||
|
->setRevisions($waiting)
|
||||||
|
->setHandles(array());
|
||||||
|
} else {
|
||||||
|
$views[] = id(clone $template)
|
||||||
|
->setRevisions($revisions)
|
||||||
|
->setHandles(array());
|
||||||
|
}
|
||||||
|
|
||||||
|
$phids = array_mergev(mpull($views, 'getRequiredHandlePHIDs'));
|
||||||
|
if ($phids) {
|
||||||
|
$handles = id(new PhabricatorHandleQuery())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->withPHIDs($phids)
|
||||||
|
->execute();
|
||||||
|
} else {
|
||||||
|
$handles = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($views as $view) {
|
||||||
|
$view->setHandles($handles);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($views) == 1) {
|
||||||
|
// Reduce this to a PHUIObjectItemListView so we can get the free
|
||||||
|
// support from ApplicationSearch.
|
||||||
|
return head($views)->render();
|
||||||
|
} else {
|
||||||
|
return $views;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class DiffusionPushLogListController extends DiffusionPushLogController
|
final class DiffusionPushLogListController extends DiffusionPushLogController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class DiffusionRepositoryListController extends DiffusionController
|
final class DiffusionRepositoryListController extends DiffusionController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
@ -23,83 +22,6 @@ final class DiffusionRepositoryListController extends DiffusionController
|
||||||
return $this->delegateToController($controller);
|
return $this->delegateToController($controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderResultsList(
|
|
||||||
array $repositories,
|
|
||||||
PhabricatorSavedQuery $query) {
|
|
||||||
assert_instances_of($repositories, 'PhabricatorRepository');
|
|
||||||
|
|
||||||
$viewer = $this->getRequest()->getUser();
|
|
||||||
|
|
||||||
$project_phids = array_fuse(
|
|
||||||
array_mergev(
|
|
||||||
mpull($repositories, 'getProjectPHIDs')));
|
|
||||||
$project_handles = $this->loadViewerHandles($project_phids);
|
|
||||||
|
|
||||||
$list = new PHUIObjectItemListView();
|
|
||||||
$list->setCards(true);
|
|
||||||
foreach ($repositories as $repository) {
|
|
||||||
$id = $repository->getID();
|
|
||||||
|
|
||||||
$item = id(new PHUIObjectItemView())
|
|
||||||
->setUser($viewer)
|
|
||||||
->setHeader($repository->getName())
|
|
||||||
->setObjectName('r'.$repository->getCallsign())
|
|
||||||
->setHref($this->getApplicationURI($repository->getCallsign().'/'));
|
|
||||||
|
|
||||||
$commit = $repository->getMostRecentCommit();
|
|
||||||
if ($commit) {
|
|
||||||
$commit_link = DiffusionView::linkCommit(
|
|
||||||
$repository,
|
|
||||||
$commit->getCommitIdentifier(),
|
|
||||||
$commit->getSummary());
|
|
||||||
$item->setSubhead($commit_link);
|
|
||||||
$item->setEpoch($commit->getEpoch());
|
|
||||||
}
|
|
||||||
|
|
||||||
$item->addIcon(
|
|
||||||
'none',
|
|
||||||
PhabricatorRepositoryType::getNameForRepositoryType(
|
|
||||||
$repository->getVersionControlSystem()));
|
|
||||||
|
|
||||||
$size = $repository->getCommitCount();
|
|
||||||
if ($size) {
|
|
||||||
$history_uri = DiffusionRequest::generateDiffusionURI(
|
|
||||||
array(
|
|
||||||
'callsign' => $repository->getCallsign(),
|
|
||||||
'action' => 'history',
|
|
||||||
));
|
|
||||||
|
|
||||||
$item->addAttribute(
|
|
||||||
phutil_tag(
|
|
||||||
'a',
|
|
||||||
array(
|
|
||||||
'href' => $history_uri,
|
|
||||||
),
|
|
||||||
pht('%s Commit(s)', new PhutilNumber($size))));
|
|
||||||
} else {
|
|
||||||
$item->addAttribute(pht('No Commits'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$handles = array_select_keys(
|
|
||||||
$project_handles,
|
|
||||||
$repository->getProjectPHIDs());
|
|
||||||
if ($handles) {
|
|
||||||
$item->addAttribute(
|
|
||||||
id(new ManiphestTaskProjectsView())
|
|
||||||
->setHandles($handles));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$repository->isTracked()) {
|
|
||||||
$item->setDisabled(true);
|
|
||||||
$item->addIcon('disable-grey', pht('Inactive'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$list->addItem($item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildSideNavView($for_app = false) {
|
public function buildSideNavView($for_app = false) {
|
||||||
$viewer = $this->getRequest()->getUser();
|
$viewer = $this->getRequest()->getUser();
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class DivinerAtomListController extends DivinerController
|
final class DivinerAtomListController extends DivinerController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $key;
|
private $key;
|
||||||
|
|
||||||
|
@ -23,32 +22,4 @@ final class DivinerAtomListController extends DivinerController
|
||||||
return $this->delegateToController($controller);
|
return $this->delegateToController($controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderResultsList(
|
|
||||||
array $symbols,
|
|
||||||
PhabricatorSavedQuery $query) {
|
|
||||||
|
|
||||||
assert_instances_of($symbols, 'DivinerLiveSymbol');
|
|
||||||
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$list = id(new PHUIObjectItemListView())
|
|
||||||
->setUser($viewer);
|
|
||||||
|
|
||||||
foreach ($symbols as $symbol) {
|
|
||||||
$type = $symbol->getType();
|
|
||||||
$type_name = DivinerAtom::getAtomTypeNameString($type);
|
|
||||||
|
|
||||||
$item = id(new PHUIObjectItemView())
|
|
||||||
->setHeader($symbol->getTitle())
|
|
||||||
->setHref($symbol->getURI())
|
|
||||||
->addAttribute($symbol->getSummary())
|
|
||||||
->addIcon('none', $type_name);
|
|
||||||
|
|
||||||
$list->addItem($item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $list;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class DivinerAtomSearchEngine
|
final class DivinerAtomSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationDiviner';
|
||||||
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||||
$saved = new PhabricatorSavedQuery();
|
$saved = new PhabricatorSavedQuery();
|
||||||
|
|
||||||
|
@ -88,4 +92,32 @@ final class DivinerAtomSearchEngine
|
||||||
return parent::buildSavedQueryFromBuiltin($query_key);
|
return parent::buildSavedQueryFromBuiltin($query_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function renderResultList(
|
||||||
|
array $symbols,
|
||||||
|
PhabricatorSavedQuery $query,
|
||||||
|
array $handles) {
|
||||||
|
|
||||||
|
assert_instances_of($symbols, 'DivinerLiveSymbol');
|
||||||
|
|
||||||
|
$viewer = $this->requireViewer();
|
||||||
|
|
||||||
|
$list = id(new PHUIObjectItemListView())
|
||||||
|
->setUser($viewer);
|
||||||
|
|
||||||
|
foreach ($symbols as $symbol) {
|
||||||
|
$type = $symbol->getType();
|
||||||
|
$type_name = DivinerAtom::getAtomTypeNameString($type);
|
||||||
|
|
||||||
|
$item = id(new PHUIObjectItemView())
|
||||||
|
->setHeader($symbol->getTitle())
|
||||||
|
->setHref($symbol->getURI())
|
||||||
|
->addAttribute($symbol->getSummary())
|
||||||
|
->addIcon('none', $type_name);
|
||||||
|
|
||||||
|
$list->addItem($item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class DrydockBlueprintListController extends DrydockBlueprintController
|
final class DrydockBlueprintListController extends DrydockBlueprintController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
@ -23,32 +22,6 @@ final class DrydockBlueprintListController extends DrydockBlueprintController
|
||||||
return $this->delegateToController($controller);
|
return $this->delegateToController($controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderResultsList(
|
|
||||||
array $blueprints,
|
|
||||||
PhabricatorSavedQuery $query) {
|
|
||||||
assert_instances_of($blueprints, 'DrydockBlueprint');
|
|
||||||
|
|
||||||
$viewer = $this->getRequest()->getUser();
|
|
||||||
$view = new PHUIObjectItemListView();
|
|
||||||
|
|
||||||
foreach ($blueprints as $blueprint) {
|
|
||||||
$item = id(new PHUIObjectItemView())
|
|
||||||
->setHeader($blueprint->getBlueprintName())
|
|
||||||
->setHref($this->getApplicationURI('/blueprint/'.$blueprint->getID()))
|
|
||||||
->setObjectName(pht('Blueprint %d', $blueprint->getID()));
|
|
||||||
|
|
||||||
if (!$blueprint->getImplementation()->isEnabled()) {
|
|
||||||
$item->setDisabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$item->addAttribute($blueprint->getImplementation()->getBlueprintName());
|
|
||||||
|
|
||||||
$view->addItem($item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $view;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildApplicationCrumbs() {
|
public function buildApplicationCrumbs() {
|
||||||
$can_create = $this->hasApplicationCapability(
|
$can_create = $this->hasApplicationCapability(
|
||||||
DrydockCapabilityCreateBlueprints::CAPABILITY);
|
DrydockCapabilityCreateBlueprints::CAPABILITY);
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class DrydockBlueprintSearchEngine
|
final class DrydockBlueprintSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationDrydock';
|
||||||
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||||
$saved = new PhabricatorSavedQuery();
|
$saved = new PhabricatorSavedQuery();
|
||||||
|
|
||||||
|
@ -45,4 +49,31 @@ final class DrydockBlueprintSearchEngine
|
||||||
return parent::buildSavedQueryFromBuiltin($query_key);
|
return parent::buildSavedQueryFromBuiltin($query_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function renderResultList(
|
||||||
|
array $blueprints,
|
||||||
|
PhabricatorSavedQuery $query,
|
||||||
|
array $handles) {
|
||||||
|
assert_instances_of($blueprints, 'DrydockBlueprint');
|
||||||
|
|
||||||
|
$viewer = $this->requireViewer();
|
||||||
|
$view = new PHUIObjectItemListView();
|
||||||
|
|
||||||
|
foreach ($blueprints as $blueprint) {
|
||||||
|
$item = id(new PHUIObjectItemView())
|
||||||
|
->setHeader($blueprint->getBlueprintName())
|
||||||
|
->setHref($this->getApplicationURI('/blueprint/'.$blueprint->getID()))
|
||||||
|
->setObjectName(pht('Blueprint %d', $blueprint->getID()));
|
||||||
|
|
||||||
|
if (!$blueprint->getImplementation()->isEnabled()) {
|
||||||
|
$item->setDisabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$item->addAttribute($blueprint->getImplementation()->getBlueprintName());
|
||||||
|
|
||||||
|
$view->addItem($item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $view;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* @group file
|
|
||||||
*/
|
|
||||||
final class PhabricatorApplicationFiles extends PhabricatorApplication {
|
final class PhabricatorApplicationFiles extends PhabricatorApplication {
|
||||||
|
|
||||||
public function getBaseURI() {
|
public function getBaseURI() {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PhabricatorFileListController extends PhabricatorFileController
|
final class PhabricatorFileListController extends PhabricatorFileController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $key;
|
private $key;
|
||||||
|
|
||||||
|
@ -23,65 +22,4 @@ final class PhabricatorFileListController extends PhabricatorFileController
|
||||||
return $this->delegateToController($controller);
|
return $this->delegateToController($controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderResultsList(
|
|
||||||
array $files,
|
|
||||||
PhabricatorSavedQuery $query) {
|
|
||||||
|
|
||||||
assert_instances_of($files, 'PhabricatorFile');
|
|
||||||
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$user = $request->getUser();
|
|
||||||
|
|
||||||
$highlighted_ids = $request->getStrList('h');
|
|
||||||
$this->loadHandles(mpull($files, 'getAuthorPHID'));
|
|
||||||
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$user = $request->getUser();
|
|
||||||
|
|
||||||
$highlighted_ids = array_fill_keys($highlighted_ids, true);
|
|
||||||
|
|
||||||
$list_view = id(new PHUIObjectItemListView())
|
|
||||||
->setUser($user);
|
|
||||||
|
|
||||||
foreach ($files as $file) {
|
|
||||||
$id = $file->getID();
|
|
||||||
$phid = $file->getPHID();
|
|
||||||
$name = $file->getName();
|
|
||||||
$file_uri = $this->getApplicationURI("/info/{$phid}/");
|
|
||||||
|
|
||||||
$date_created = phabricator_date($file->getDateCreated(), $user);
|
|
||||||
$author_phid = $file->getAuthorPHID();
|
|
||||||
if ($author_phid) {
|
|
||||||
$author_link = $this->getHandle($author_phid)->renderLink();
|
|
||||||
$uploaded = pht('Uploaded by %s on %s', $author_link, $date_created);
|
|
||||||
} else {
|
|
||||||
$uploaded = pht('Uploaded on %s', $date_created);
|
|
||||||
}
|
|
||||||
|
|
||||||
$item = id(new PHUIObjectItemView())
|
|
||||||
->setObject($file)
|
|
||||||
->setObjectName("F{$id}")
|
|
||||||
->setHeader($name)
|
|
||||||
->setHref($file_uri)
|
|
||||||
->addAttribute($uploaded)
|
|
||||||
->addIcon('none', phabricator_format_bytes($file->getByteSize()));
|
|
||||||
|
|
||||||
$ttl = $file->getTTL();
|
|
||||||
if ($ttl !== null) {
|
|
||||||
$item->addIcon('blame', pht('Temporary'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($highlighted_ids[$id])) {
|
|
||||||
$item->setEffect('highlighted');
|
|
||||||
}
|
|
||||||
|
|
||||||
$list_view->addItem($item);
|
|
||||||
}
|
|
||||||
|
|
||||||
$list_view->appendChild(id(new PhabricatorGlobalUploadTargetView())
|
|
||||||
->setUser($user));
|
|
||||||
|
|
||||||
return $list_view;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* @group file
|
|
||||||
*/
|
|
||||||
final class PhabricatorFileSearchEngine
|
final class PhabricatorFileSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationFiles';
|
||||||
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||||
$saved = new PhabricatorSavedQuery();
|
$saved = new PhabricatorSavedQuery();
|
||||||
$saved->setParameter(
|
$saved->setParameter(
|
||||||
|
@ -113,4 +114,72 @@ final class PhabricatorFileSearchEngine
|
||||||
return parent::buildSavedQueryFromBuiltin($query_key);
|
return parent::buildSavedQueryFromBuiltin($query_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getRequiredHandlePHIDsForResultList(
|
||||||
|
array $files,
|
||||||
|
PhabricatorSavedQuery $query) {
|
||||||
|
return mpull($files, 'getAuthorPHID');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function renderResultList(
|
||||||
|
array $files,
|
||||||
|
PhabricatorSavedQuery $query,
|
||||||
|
array $handles) {
|
||||||
|
|
||||||
|
assert_instances_of($files, 'PhabricatorFile');
|
||||||
|
|
||||||
|
$request = $this->getRequest();
|
||||||
|
if ($request) {
|
||||||
|
$highlighted_ids = $request->getStrList('h');
|
||||||
|
} else {
|
||||||
|
$highlighted_ids = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$viewer = $this->requireViewer();
|
||||||
|
|
||||||
|
$highlighted_ids = array_fill_keys($highlighted_ids, true);
|
||||||
|
|
||||||
|
$list_view = id(new PHUIObjectItemListView())
|
||||||
|
->setUser($viewer);
|
||||||
|
|
||||||
|
foreach ($files as $file) {
|
||||||
|
$id = $file->getID();
|
||||||
|
$phid = $file->getPHID();
|
||||||
|
$name = $file->getName();
|
||||||
|
$file_uri = $this->getApplicationURI("/info/{$phid}/");
|
||||||
|
|
||||||
|
$date_created = phabricator_date($file->getDateCreated(), $viewer);
|
||||||
|
$author_phid = $file->getAuthorPHID();
|
||||||
|
if ($author_phid) {
|
||||||
|
$author_link = $handles[$author_phid]->renderLink();
|
||||||
|
$uploaded = pht('Uploaded by %s on %s', $author_link, $date_created);
|
||||||
|
} else {
|
||||||
|
$uploaded = pht('Uploaded on %s', $date_created);
|
||||||
|
}
|
||||||
|
|
||||||
|
$item = id(new PHUIObjectItemView())
|
||||||
|
->setObject($file)
|
||||||
|
->setObjectName("F{$id}")
|
||||||
|
->setHeader($name)
|
||||||
|
->setHref($file_uri)
|
||||||
|
->addAttribute($uploaded)
|
||||||
|
->addIcon('none', phabricator_format_bytes($file->getByteSize()));
|
||||||
|
|
||||||
|
$ttl = $file->getTTL();
|
||||||
|
if ($ttl !== null) {
|
||||||
|
$item->addIcon('blame', pht('Temporary'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($highlighted_ids[$id])) {
|
||||||
|
$item->setEffect('highlighted');
|
||||||
|
}
|
||||||
|
|
||||||
|
$list_view->addItem($item);
|
||||||
|
}
|
||||||
|
|
||||||
|
$list_view->appendChild(id(new PhabricatorGlobalUploadTargetView())
|
||||||
|
->setUser($viewer));
|
||||||
|
|
||||||
|
return $list_view;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PhabricatorFlagListController extends PhabricatorFlagController
|
final class PhabricatorFlagListController extends PhabricatorFlagController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
@ -23,56 +22,4 @@ final class PhabricatorFlagListController extends PhabricatorFlagController
|
||||||
return $this->delegateToController($controller);
|
return $this->delegateToController($controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderResultsList(
|
|
||||||
array $flags,
|
|
||||||
PhabricatorSavedQuery $query) {
|
|
||||||
assert_instances_of($flags, 'PhabricatorFlag');
|
|
||||||
|
|
||||||
$viewer = $this->getRequest()->getUser();
|
|
||||||
|
|
||||||
$list = id(new PHUIObjectItemListView())
|
|
||||||
->setUser($viewer);
|
|
||||||
foreach ($flags as $flag) {
|
|
||||||
$id = $flag->getID();
|
|
||||||
$phid = $flag->getObjectPHID();
|
|
||||||
|
|
||||||
$class = PhabricatorFlagColor::getCSSClass($flag->getColor());
|
|
||||||
|
|
||||||
$flag_icon = phutil_tag(
|
|
||||||
'div',
|
|
||||||
array(
|
|
||||||
'class' => 'phabricator-flag-icon '.$class,
|
|
||||||
),
|
|
||||||
'');
|
|
||||||
|
|
||||||
$item = id(new PHUIObjectItemView())
|
|
||||||
->addHeadIcon($flag_icon)
|
|
||||||
->setHeader($flag->getHandle()->renderLink());
|
|
||||||
|
|
||||||
$item->addAction(
|
|
||||||
id(new PHUIListItemView())
|
|
||||||
->setIcon('edit')
|
|
||||||
->setHref($this->getApplicationURI("edit/{$phid}/"))
|
|
||||||
->setWorkflow(true));
|
|
||||||
|
|
||||||
$item->addAction(
|
|
||||||
id(new PHUIListItemView())
|
|
||||||
->setIcon('delete')
|
|
||||||
->setHref($this->getApplicationURI("delete/{$id}/"))
|
|
||||||
->setWorkflow(true));
|
|
||||||
|
|
||||||
if ($flag->getNote()) {
|
|
||||||
$item->addAttribute($flag->getNote());
|
|
||||||
}
|
|
||||||
|
|
||||||
$item->addIcon(
|
|
||||||
'none',
|
|
||||||
phabricator_datetime($flag->getDateCreated(), $viewer));
|
|
||||||
|
|
||||||
$list->addItem($item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $list;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class PhabricatorFlagSearchEngine
|
final class PhabricatorFlagSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationFlags';
|
||||||
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||||
$saved = new PhabricatorSavedQuery();
|
$saved = new PhabricatorSavedQuery();
|
||||||
$saved->setParameter('colors', $request->getArr('colors'));
|
$saved->setParameter('colors', $request->getArr('colors'));
|
||||||
|
@ -115,4 +119,58 @@ final class PhabricatorFlagSearchEngine
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function renderResultList(
|
||||||
|
array $flags,
|
||||||
|
PhabricatorSavedQuery $query,
|
||||||
|
array $handles) {
|
||||||
|
assert_instances_of($flags, 'PhabricatorFlag');
|
||||||
|
|
||||||
|
$viewer = $this->requireViewer();
|
||||||
|
|
||||||
|
$list = id(new PHUIObjectItemListView())
|
||||||
|
->setUser($viewer);
|
||||||
|
foreach ($flags as $flag) {
|
||||||
|
$id = $flag->getID();
|
||||||
|
$phid = $flag->getObjectPHID();
|
||||||
|
|
||||||
|
$class = PhabricatorFlagColor::getCSSClass($flag->getColor());
|
||||||
|
|
||||||
|
$flag_icon = phutil_tag(
|
||||||
|
'div',
|
||||||
|
array(
|
||||||
|
'class' => 'phabricator-flag-icon '.$class,
|
||||||
|
),
|
||||||
|
'');
|
||||||
|
|
||||||
|
$item = id(new PHUIObjectItemView())
|
||||||
|
->addHeadIcon($flag_icon)
|
||||||
|
->setHeader($flag->getHandle()->renderLink());
|
||||||
|
|
||||||
|
$item->addAction(
|
||||||
|
id(new PHUIListItemView())
|
||||||
|
->setIcon('edit')
|
||||||
|
->setHref($this->getApplicationURI("edit/{$phid}/"))
|
||||||
|
->setWorkflow(true));
|
||||||
|
|
||||||
|
$item->addAction(
|
||||||
|
id(new PHUIListItemView())
|
||||||
|
->setIcon('delete')
|
||||||
|
->setHref($this->getApplicationURI("delete/{$id}/"))
|
||||||
|
->setWorkflow(true));
|
||||||
|
|
||||||
|
if ($flag->getNote()) {
|
||||||
|
$item->addAttribute($flag->getNote());
|
||||||
|
}
|
||||||
|
|
||||||
|
$item->addIcon(
|
||||||
|
'none',
|
||||||
|
phabricator_datetime($flag->getDateCreated(), $viewer));
|
||||||
|
|
||||||
|
$list->addItem($item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class HarbormasterBuildableListController
|
final class HarbormasterBuildableListController extends HarbormasterController {
|
||||||
extends HarbormasterController
|
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
@ -24,58 +22,6 @@ final class HarbormasterBuildableListController
|
||||||
return $this->delegateToController($controller);
|
return $this->delegateToController($controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderResultsList(
|
|
||||||
array $buildables,
|
|
||||||
PhabricatorSavedQuery $query) {
|
|
||||||
assert_instances_of($buildables, 'HarbormasterBuildable');
|
|
||||||
|
|
||||||
$viewer = $this->getRequest()->getUser();
|
|
||||||
|
|
||||||
$list = new PHUIObjectItemListView();
|
|
||||||
$list->setCards(true);
|
|
||||||
foreach ($buildables as $buildable) {
|
|
||||||
$id = $buildable->getID();
|
|
||||||
|
|
||||||
$item = id(new PHUIObjectItemView())
|
|
||||||
->setHeader(pht('Buildable %d', $buildable->getID()));
|
|
||||||
if ($buildable->getContainerHandle() !== null) {
|
|
||||||
$item->addAttribute($buildable->getContainerHandle()->getName());
|
|
||||||
}
|
|
||||||
if ($buildable->getBuildableHandle() !== null) {
|
|
||||||
$item->addAttribute($buildable->getBuildableHandle()->getFullName());
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($id) {
|
|
||||||
$item->setHref("/B{$id}");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($buildable->getIsManualBuildable()) {
|
|
||||||
$item->addIcon('wrench-grey', pht('Manual'));
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($buildable->getBuildableStatus()) {
|
|
||||||
case HarbormasterBuildable::STATUS_PASSED:
|
|
||||||
$item->setBarColor('green');
|
|
||||||
$item->addByline(pht('Build Passed'));
|
|
||||||
break;
|
|
||||||
case HarbormasterBuildable::STATUS_FAILED:
|
|
||||||
$item->setBarColor('red');
|
|
||||||
$item->addByline(pht('Build Failed'));
|
|
||||||
break;
|
|
||||||
case HarbormasterBuildable::STATUS_BUILDING:
|
|
||||||
$item->setBarColor('red');
|
|
||||||
$item->addByline(pht('Building'));
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$list->addItem($item);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return $list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildSideNavView($for_app = false) {
|
public function buildSideNavView($for_app = false) {
|
||||||
$user = $this->getRequest()->getUser();
|
$user = $this->getRequest()->getUser();
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class HarbormasterPlanListController
|
final class HarbormasterPlanListController extends HarbormasterPlanController {
|
||||||
extends HarbormasterPlanController
|
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
@ -24,33 +22,6 @@ final class HarbormasterPlanListController
|
||||||
return $this->delegateToController($controller);
|
return $this->delegateToController($controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderResultsList(
|
|
||||||
array $plans,
|
|
||||||
PhabricatorSavedQuery $query) {
|
|
||||||
assert_instances_of($plans, 'HarbormasterBuildPlan');
|
|
||||||
|
|
||||||
$viewer = $this->getRequest()->getUser();
|
|
||||||
|
|
||||||
$list = new PHUIObjectItemListView();
|
|
||||||
foreach ($plans as $plan) {
|
|
||||||
$id = $plan->getID();
|
|
||||||
|
|
||||||
$item = id(new PHUIObjectItemView())
|
|
||||||
->setObjectName(pht('Plan %d', $plan->getID()))
|
|
||||||
->setHeader($plan->getName());
|
|
||||||
|
|
||||||
if ($plan->isDisabled()) {
|
|
||||||
$item->setDisabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$item->setHref($this->getApplicationURI("plan/{$id}/"));
|
|
||||||
|
|
||||||
$list->addItem($item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildSideNavView($for_app = false) {
|
public function buildSideNavView($for_app = false) {
|
||||||
$user = $this->getRequest()->getUser();
|
$user = $this->getRequest()->getUser();
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class HarbormasterBuildPlanSearchEngine
|
final class HarbormasterBuildPlanSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationHarbormaster';
|
||||||
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||||
$saved = new PhabricatorSavedQuery();
|
$saved = new PhabricatorSavedQuery();
|
||||||
|
|
||||||
|
@ -79,4 +83,32 @@ final class HarbormasterBuildPlanSearchEngine
|
||||||
return parent::buildSavedQueryFromBuiltin($query_key);
|
return parent::buildSavedQueryFromBuiltin($query_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function renderResultList(
|
||||||
|
array $plans,
|
||||||
|
PhabricatorSavedQuery $query,
|
||||||
|
array $handles) {
|
||||||
|
assert_instances_of($plans, 'HarbormasterBuildPlan');
|
||||||
|
|
||||||
|
$viewer = $this->requireViewer();
|
||||||
|
|
||||||
|
$list = new PHUIObjectItemListView();
|
||||||
|
foreach ($plans as $plan) {
|
||||||
|
$id = $plan->getID();
|
||||||
|
|
||||||
|
$item = id(new PHUIObjectItemView())
|
||||||
|
->setObjectName(pht('Plan %d', $plan->getID()))
|
||||||
|
->setHeader($plan->getName());
|
||||||
|
|
||||||
|
if ($plan->isDisabled()) {
|
||||||
|
$item->setDisabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$item->setHref($this->getApplicationURI("plan/{$id}/"));
|
||||||
|
|
||||||
|
$list->addItem($item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class HarbormasterBuildableSearchEngine
|
final class HarbormasterBuildableSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationHarbormaster';
|
||||||
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||||
$saved = new PhabricatorSavedQuery();
|
$saved = new PhabricatorSavedQuery();
|
||||||
|
|
||||||
|
@ -172,4 +176,56 @@ final class HarbormasterBuildableSearchEngine
|
||||||
return parent::buildSavedQueryFromBuiltin($query_key);
|
return parent::buildSavedQueryFromBuiltin($query_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function renderResultList(
|
||||||
|
array $buildables,
|
||||||
|
PhabricatorSavedQuery $query,
|
||||||
|
array $handles) {
|
||||||
|
assert_instances_of($buildables, 'HarbormasterBuildable');
|
||||||
|
|
||||||
|
$viewer = $this->requireViewer();
|
||||||
|
|
||||||
|
$list = new PHUIObjectItemListView();
|
||||||
|
$list->setCards(true);
|
||||||
|
foreach ($buildables as $buildable) {
|
||||||
|
$id = $buildable->getID();
|
||||||
|
|
||||||
|
$item = id(new PHUIObjectItemView())
|
||||||
|
->setHeader(pht('Buildable %d', $buildable->getID()));
|
||||||
|
if ($buildable->getContainerHandle() !== null) {
|
||||||
|
$item->addAttribute($buildable->getContainerHandle()->getName());
|
||||||
|
}
|
||||||
|
if ($buildable->getBuildableHandle() !== null) {
|
||||||
|
$item->addAttribute($buildable->getBuildableHandle()->getFullName());
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id) {
|
||||||
|
$item->setHref("/B{$id}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($buildable->getIsManualBuildable()) {
|
||||||
|
$item->addIcon('wrench-grey', pht('Manual'));
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($buildable->getBuildableStatus()) {
|
||||||
|
case HarbormasterBuildable::STATUS_PASSED:
|
||||||
|
$item->setBarColor('green');
|
||||||
|
$item->addByline(pht('Build Passed'));
|
||||||
|
break;
|
||||||
|
case HarbormasterBuildable::STATUS_FAILED:
|
||||||
|
$item->setBarColor('red');
|
||||||
|
$item->addByline(pht('Build Failed'));
|
||||||
|
break;
|
||||||
|
case HarbormasterBuildable::STATUS_BUILDING:
|
||||||
|
$item->setBarColor('red');
|
||||||
|
$item->addByline(pht('Building'));
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$list->addItem($item);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class HeraldRuleListController extends HeraldController
|
final class HeraldRuleListController extends HeraldController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
@ -23,57 +22,5 @@ final class HeraldRuleListController extends HeraldController
|
||||||
return $this->delegateToController($controller);
|
return $this->delegateToController($controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderResultsList(
|
|
||||||
array $rules,
|
|
||||||
PhabricatorSavedQuery $query) {
|
|
||||||
assert_instances_of($rules, 'HeraldRule');
|
|
||||||
|
|
||||||
$viewer = $this->getRequest()->getUser();
|
|
||||||
|
|
||||||
$phids = mpull($rules, 'getAuthorPHID');
|
|
||||||
$this->loadHandles($phids);
|
|
||||||
|
|
||||||
$content_type_map = HeraldAdapter::getEnabledAdapterMap($viewer);
|
|
||||||
|
|
||||||
$list = id(new PHUIObjectItemListView())
|
|
||||||
->setUser($viewer)
|
|
||||||
->setCards(true);
|
|
||||||
foreach ($rules as $rule) {
|
|
||||||
$id = $rule->getID();
|
|
||||||
|
|
||||||
$item = id(new PHUIObjectItemView())
|
|
||||||
->setObjectName("H{$id}")
|
|
||||||
->setHeader($rule->getName())
|
|
||||||
->setHref($this->getApplicationURI("rule/{$id}/"));
|
|
||||||
|
|
||||||
if ($rule->isPersonalRule()) {
|
|
||||||
$item->addIcon('user', pht('Personal Rule'));
|
|
||||||
$item->addByline(
|
|
||||||
pht(
|
|
||||||
'Authored by %s',
|
|
||||||
$this->getHandle($rule->getAuthorPHID())->renderLink()));
|
|
||||||
} else {
|
|
||||||
$item->addIcon('world', pht('Global Rule'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($rule->getIsDisabled()) {
|
|
||||||
$item->setDisabled(true);
|
|
||||||
$item->addIcon('disable-grey', pht('Disabled'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$item->addAction(
|
|
||||||
id(new PHUIListItemView())
|
|
||||||
->setHref($this->getApplicationURI("history/{$id}/"))
|
|
||||||
->setIcon('transcript')
|
|
||||||
->setName(pht('Edit Log')));
|
|
||||||
|
|
||||||
$content_type_name = idx($content_type_map, $rule->getContentType());
|
|
||||||
$item->addAttribute(pht('Affects: %s', $content_type_name));
|
|
||||||
|
|
||||||
$list->addItem($item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $list;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class HeraldRuleSearchEngine
|
final class HeraldRuleSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationHerald';
|
||||||
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||||
$saved = new PhabricatorSavedQuery();
|
$saved = new PhabricatorSavedQuery();
|
||||||
|
|
||||||
|
@ -152,4 +156,61 @@ final class HeraldRuleSearchEngine
|
||||||
return array_fuse(array_keys(HeraldRuleTypeConfig::getRuleTypeMap()));
|
return array_fuse(array_keys(HeraldRuleTypeConfig::getRuleTypeMap()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getRequiredHandlePHIDsForResultList(
|
||||||
|
array $rules,
|
||||||
|
PhabricatorSavedQuery $query) {
|
||||||
|
return mpull($rules, 'getAuthorPHID');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function renderResultList(
|
||||||
|
array $rules,
|
||||||
|
PhabricatorSavedQuery $query,
|
||||||
|
array $handles) {
|
||||||
|
assert_instances_of($rules, 'HeraldRule');
|
||||||
|
|
||||||
|
$viewer = $this->requireViewer();
|
||||||
|
|
||||||
|
$content_type_map = HeraldAdapter::getEnabledAdapterMap($viewer);
|
||||||
|
|
||||||
|
$list = id(new PHUIObjectItemListView())
|
||||||
|
->setUser($viewer)
|
||||||
|
->setCards(true);
|
||||||
|
foreach ($rules as $rule) {
|
||||||
|
$id = $rule->getID();
|
||||||
|
|
||||||
|
$item = id(new PHUIObjectItemView())
|
||||||
|
->setObjectName("H{$id}")
|
||||||
|
->setHeader($rule->getName())
|
||||||
|
->setHref($this->getApplicationURI("rule/{$id}/"));
|
||||||
|
|
||||||
|
if ($rule->isPersonalRule()) {
|
||||||
|
$item->addIcon('user', pht('Personal Rule'));
|
||||||
|
$item->addByline(
|
||||||
|
pht(
|
||||||
|
'Authored by %s',
|
||||||
|
$handles[$rule->getAuthorPHID()]->renderLink()));
|
||||||
|
} else {
|
||||||
|
$item->addIcon('world', pht('Global Rule'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rule->getIsDisabled()) {
|
||||||
|
$item->setDisabled(true);
|
||||||
|
$item->addIcon('disable-grey', pht('Disabled'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$item->addAction(
|
||||||
|
id(new PHUIListItemView())
|
||||||
|
->setHref($this->getApplicationURI("history/{$id}/"))
|
||||||
|
->setIcon('transcript')
|
||||||
|
->setName(pht('Edit Log')));
|
||||||
|
|
||||||
|
$content_type_name = idx($content_type_map, $rule->getContentType());
|
||||||
|
$item->addAttribute(pht('Affects: %s', $content_type_name));
|
||||||
|
|
||||||
|
$list->addItem($item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class PhabricatorRepositorySearchEngine
|
final class PhabricatorRepositorySearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationDiffusion';
|
||||||
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||||
$saved = new PhabricatorSavedQuery();
|
$saved = new PhabricatorSavedQuery();
|
||||||
|
|
||||||
|
@ -215,4 +219,83 @@ final class PhabricatorRepositorySearchEngine
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getRequiredHandlePHIDsForResultList(
|
||||||
|
array $repositories,
|
||||||
|
PhabricatorSavedQuery $query) {
|
||||||
|
return array_mergev(mpull($repositories, 'getProjectPHIDs'));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function renderResultList(
|
||||||
|
array $repositories,
|
||||||
|
PhabricatorSavedQuery $query,
|
||||||
|
array $handles) {
|
||||||
|
assert_instances_of($repositories, 'PhabricatorRepository');
|
||||||
|
|
||||||
|
$viewer = $this->requireViewer();;
|
||||||
|
|
||||||
|
$list = new PHUIObjectItemListView();
|
||||||
|
$list->setCards(true);
|
||||||
|
foreach ($repositories as $repository) {
|
||||||
|
$id = $repository->getID();
|
||||||
|
|
||||||
|
$item = id(new PHUIObjectItemView())
|
||||||
|
->setUser($viewer)
|
||||||
|
->setHeader($repository->getName())
|
||||||
|
->setObjectName('r'.$repository->getCallsign())
|
||||||
|
->setHref($this->getApplicationURI($repository->getCallsign().'/'));
|
||||||
|
|
||||||
|
$commit = $repository->getMostRecentCommit();
|
||||||
|
if ($commit) {
|
||||||
|
$commit_link = DiffusionView::linkCommit(
|
||||||
|
$repository,
|
||||||
|
$commit->getCommitIdentifier(),
|
||||||
|
$commit->getSummary());
|
||||||
|
$item->setSubhead($commit_link);
|
||||||
|
$item->setEpoch($commit->getEpoch());
|
||||||
|
}
|
||||||
|
|
||||||
|
$item->addIcon(
|
||||||
|
'none',
|
||||||
|
PhabricatorRepositoryType::getNameForRepositoryType(
|
||||||
|
$repository->getVersionControlSystem()));
|
||||||
|
|
||||||
|
$size = $repository->getCommitCount();
|
||||||
|
if ($size) {
|
||||||
|
$history_uri = DiffusionRequest::generateDiffusionURI(
|
||||||
|
array(
|
||||||
|
'callsign' => $repository->getCallsign(),
|
||||||
|
'action' => 'history',
|
||||||
|
));
|
||||||
|
|
||||||
|
$item->addAttribute(
|
||||||
|
phutil_tag(
|
||||||
|
'a',
|
||||||
|
array(
|
||||||
|
'href' => $history_uri,
|
||||||
|
),
|
||||||
|
pht('%s Commit(s)', new PhutilNumber($size))));
|
||||||
|
} else {
|
||||||
|
$item->addAttribute(pht('No Commits'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$project_handles = array_select_keys(
|
||||||
|
$handles,
|
||||||
|
$repository->getProjectPHIDs());
|
||||||
|
if ($project_handles) {
|
||||||
|
$item->addAttribute(
|
||||||
|
id(new ManiphestTaskProjectsView())
|
||||||
|
->setHandles($project_handles));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$repository->isTracked()) {
|
||||||
|
$item->setDisabled(true);
|
||||||
|
$item->addIcon('disable-grey', pht('Inactive'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$list->addItem($item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,6 +220,8 @@ final class PhabricatorApplicationSearchController
|
||||||
if ($parent instanceof $interface) {
|
if ($parent instanceof $interface) {
|
||||||
$list = $parent->renderResultsList($objects, $saved_query);
|
$list = $parent->renderResultsList($objects, $saved_query);
|
||||||
} else {
|
} else {
|
||||||
|
$engine->setRequest($request);
|
||||||
|
|
||||||
$list = $engine->renderResults(
|
$list = $engine->renderResults(
|
||||||
$objects,
|
$objects,
|
||||||
$saved_query);
|
$saved_query);
|
||||||
|
|
|
@ -21,6 +21,7 @@ abstract class PhabricatorApplicationSearchEngine {
|
||||||
private $viewer;
|
private $viewer;
|
||||||
private $errors = array();
|
private $errors = array();
|
||||||
private $customFields = false;
|
private $customFields = false;
|
||||||
|
private $request;
|
||||||
|
|
||||||
public function setViewer(PhabricatorUser $viewer) {
|
public function setViewer(PhabricatorUser $viewer) {
|
||||||
$this->viewer = $viewer;
|
$this->viewer = $viewer;
|
||||||
|
@ -593,6 +594,15 @@ abstract class PhabricatorApplicationSearchEngine {
|
||||||
/* -( Rendering )---------------------------------------------------------- */
|
/* -( Rendering )---------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
public function setRequest(AphrontRequest $request) {
|
||||||
|
$this->request = $request;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRequest() {
|
||||||
|
return $this->request;
|
||||||
|
}
|
||||||
|
|
||||||
public function renderResults(
|
public function renderResults(
|
||||||
array $objects,
|
array $objects,
|
||||||
PhabricatorSavedQuery $query) {
|
PhabricatorSavedQuery $query) {
|
||||||
|
|
Loading…
Reference in a new issue