1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Make the dashboard panel datasource work properly with hundreds of panels

Summary:
Ref T13151. See PHI727. Update the dashboard widget/panel datasource to actually query results using what the user typed.

The current approach is blind to what the user typed when pulling results from the database, and gets limited to an artificially small number of results somewhere in the pipeline.

Test Plan:
  - Queried for panels with text queries.
  - Queried for panels with `W123` queries.
  - This is substantially similar to the Owners datasource, which received a similar update in D17142 and has worked well since then.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13151

Differential Revision: https://secure.phabricator.com/D19511
This commit is contained in:
epriestley 2018-06-27 10:52:42 -07:00
parent ca1349ab45
commit 4214b56a4f

View file

@ -20,13 +20,22 @@ final class PhabricatorDashboardPanelDatasource
return $this->filterResultsAgainstTokens($results);
}
protected function renderSpecialTokens(array $values) {
return $this->renderTokensFromResults($this->buildResults(), $values);
}
public function buildResults() {
$query = id(new PhabricatorDashboardPanelQuery());
$query = new PhabricatorDashboardPanelQuery();
$raw_query = $this->getRawQuery();
if (preg_match('/^[wW]\d+\z/', $raw_query)) {
$id = trim($raw_query, 'wW');
$id = (int)$id;
$query->withIDs(array($id));
} else {
$query->withNameNgrams($raw_query);
}
$panels = $this->executeQuery($query);
$results = array();