1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +01:00

Fix Search Application Config

Summary: Fix T12924. Looks like this melted in D17384, and nobody noticed yet.

Test Plan: Visit page, see fancy table.

Reviewers: epriestley, 20after4, #blessed_reviewers

Reviewed By: epriestley, 20after4, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T12924

Differential Revision: https://secure.phabricator.com/D18230
This commit is contained in:
Aviv Eyal 2017-07-18 17:44:56 +00:00 committed by avivey
parent 887ac740c6
commit d1f144b214

View file

@ -16,54 +16,61 @@ final class PhabricatorSearchApplicationStorageEnginePanel
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$application = $this->getApplication(); $application = $this->getApplication();
$active_engine = PhabricatorFulltextStorageEngine::loadEngine(); $services = PhabricatorSearchService::getAllServices();
$engines = PhabricatorFulltextStorageEngine::loadAllEngines();
$rows = array(); $rows = array();
$rowc = array(); $rowc = array();
foreach ($engines as $key => $engine) { foreach ($services as $key => $service) {
try { try {
$index_exists = $engine->indexExists() ? pht('Yes') : pht('No'); $name = $service->getDisplayName();
} catch (Exception $ex) { } catch (Exception $ex) {
$index_exists = pht('N/A'); $name = phutil_tag('em', array(), pht('Error'));
} }
try { try {
$index_is_sane = $engine->indexIsSane() ? pht('Yes') : pht('No'); $can_read = $service->isReadable() ? pht('Yes') : pht('No');
} catch (Exception $ex) { } catch (Exception $ex) {
$index_is_sane = pht('N/A'); $can_read = pht('N/A');
} }
if ($engine == $active_engine) { try {
$rowc[] = 'highlighted'; $can_write = $service->isWritable() ? pht('Yes') : pht('No');
} else { } catch (Exception $ex) {
$rowc[] = null; $can_write = pht('N/A');
} }
$rows[] = array( $rows[] = array(
$key, $name,
get_class($engine), $can_read,
$index_exists, $can_write,
$index_is_sane,
); );
} }
$instructions = pht(
'To configure the search engines, edit [[ %s | `%s` ]] configuration. '.
'See **[[ %s | %s ]]** for documentation.',
'/config/edit/cluster.search/',
'cluster.search',
PhabricatorEnv::getDoclink('Cluster: Search'),
pht('Cluster: Search'));
$table = id(new AphrontTableView($rows)) $table = id(new AphrontTableView($rows))
->setNoDataString(pht('No search engines available.')) ->setNoDataString(pht('No search engines available.'))
->setNotice(new PHUIRemarkupView($viewer, $instructions))
->setHeaders( ->setHeaders(
array( array(
pht('Key'), pht('Engine Name'),
pht('Class'), pht('Writable'),
pht('Index Exists'), pht('Readable'),
pht('Index Is Sane'),
)) ))
->setRowClasses($rowc) ->setRowClasses($rowc)
->setColumnClasses( ->setColumnClasses(
array( array(
'',
'wide', 'wide',
'', '',
'',
)); ));
$box = id(new PHUIObjectBoxView()) $box = id(new PHUIObjectBoxView())