mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +01:00
Modernize Nuance queries and search engines
Summary: Ref T10537. Minor updates to simplify and modernize these codepaths. Test Plan: Searched for queues and sources. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10537 Differential Revision: https://secure.phabricator.com/D15429
This commit is contained in:
parent
98542637a1
commit
01ed526527
5 changed files with 24 additions and 48 deletions
|
@ -15,10 +15,6 @@ final class AlmanacServiceSearchEngine
|
||||||
return new AlmanacServiceQuery();
|
return new AlmanacServiceQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function newResultObject() {
|
|
||||||
return new AlmanacService();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function buildQueryFromParameters(array $map) {
|
protected function buildQueryFromParameters(array $map) {
|
||||||
$query = $this->newQuery();
|
$query = $this->newQuery();
|
||||||
|
|
||||||
|
|
|
@ -16,20 +16,12 @@ final class NuanceQueueQuery
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function newResultObject() {
|
||||||
|
return new NuanceQueue();
|
||||||
|
}
|
||||||
|
|
||||||
protected function loadPage() {
|
protected function loadPage() {
|
||||||
$table = new NuanceQueue();
|
return $this->loadStandardPage($this->newResultObject());
|
||||||
$conn = $table->establishConnection('r');
|
|
||||||
|
|
||||||
$data = queryfx_all(
|
|
||||||
$conn,
|
|
||||||
'%Q FROM %T %Q %Q %Q',
|
|
||||||
$this->buildSelectClause($conn),
|
|
||||||
$table->getTableName(),
|
|
||||||
$this->buildWhereClause($conn),
|
|
||||||
$this->buildOrderClause($conn),
|
|
||||||
$this->buildLimitClause($conn));
|
|
||||||
|
|
||||||
return $table->loadAllFromArray($data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
|
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
|
||||||
|
|
|
@ -11,21 +11,19 @@ final class NuanceQueueSearchEngine
|
||||||
return pht('Nuance Queues');
|
return pht('Nuance Queues');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function newQuery() {
|
||||||
$saved = new PhabricatorSavedQuery();
|
return new NuanceQueueQuery();
|
||||||
|
|
||||||
return $saved;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
|
protected function buildQueryFromParameters(array $map) {
|
||||||
$query = id(new NuanceQueueQuery());
|
$query = $this->newQuery();
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildSearchForm(
|
protected function buildCustomSearchFields() {
|
||||||
AphrontFormView $form,
|
return array();
|
||||||
PhabricatorSavedQuery $saved_query) {}
|
}
|
||||||
|
|
||||||
protected function getURI($path) {
|
protected function getURI($path) {
|
||||||
return '/nuance/queue/'.$path;
|
return '/nuance/queue/'.$path;
|
||||||
|
|
|
@ -22,20 +22,12 @@ final class NuanceSourceQuery
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function newResultObject() {
|
||||||
|
return new NuanceSource();
|
||||||
|
}
|
||||||
|
|
||||||
protected function loadPage() {
|
protected function loadPage() {
|
||||||
$table = new NuanceSource();
|
return $this->loadStandardPage($this->newResultObject());
|
||||||
$conn = $table->establishConnection('r');
|
|
||||||
|
|
||||||
$data = queryfx_all(
|
|
||||||
$conn,
|
|
||||||
'%Q FROM %T %Q %Q %Q',
|
|
||||||
$this->buildSelectClause($conn),
|
|
||||||
$table->getTableName(),
|
|
||||||
$this->buildWhereClause($conn),
|
|
||||||
$this->buildOrderClause($conn),
|
|
||||||
$this->buildLimitClause($conn));
|
|
||||||
|
|
||||||
return $table->loadAllFromArray($data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
|
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
|
||||||
|
|
|
@ -11,21 +11,19 @@ final class NuanceSourceSearchEngine
|
||||||
return pht('Nuance Sources');
|
return pht('Nuance Sources');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function newQuery() {
|
||||||
$saved = new PhabricatorSavedQuery();
|
return new NuanceSourceQuery();
|
||||||
|
|
||||||
return $saved;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
|
protected function buildQueryFromParameters(array $map) {
|
||||||
$query = id(new NuanceSourceQuery());
|
$query = $this->newQuery();
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildSearchForm(
|
protected function buildCustomSearchFields() {
|
||||||
AphrontFormView $form,
|
return array();
|
||||||
PhabricatorSavedQuery $saved_query) {}
|
}
|
||||||
|
|
||||||
protected function getURI($path) {
|
protected function getURI($path) {
|
||||||
return '/nuance/source/'.$path;
|
return '/nuance/source/'.$path;
|
||||||
|
|
Loading…
Reference in a new issue