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();
$application = $this->getApplication();
$active_engine = PhabricatorFulltextStorageEngine::loadEngine();
$engines = PhabricatorFulltextStorageEngine::loadAllEngines();
$services = PhabricatorSearchService::getAllServices();
$rows = array();
$rowc = array();
foreach ($engines as $key => $engine) {
foreach ($services as $key => $service) {
try {
$index_exists = $engine->indexExists() ? pht('Yes') : pht('No');
$name = $service->getDisplayName();
} catch (Exception $ex) {
$index_exists = pht('N/A');
$name = phutil_tag('em', array(), pht('Error'));
}
try {
$index_is_sane = $engine->indexIsSane() ? pht('Yes') : pht('No');
$can_read = $service->isReadable() ? pht('Yes') : pht('No');
} catch (Exception $ex) {
$index_is_sane = pht('N/A');
$can_read = pht('N/A');
}
if ($engine == $active_engine) {
$rowc[] = 'highlighted';
} else {
$rowc[] = null;
try {
$can_write = $service->isWritable() ? pht('Yes') : pht('No');
} catch (Exception $ex) {
$can_write = pht('N/A');
}
$rows[] = array(
$key,
get_class($engine),
$index_exists,
$index_is_sane,
$name,
$can_read,
$can_write,
);
}
$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))
->setNoDataString(pht('No search engines available.'))
->setNotice(new PHUIRemarkupView($viewer, $instructions))
->setHeaders(
array(
pht('Key'),
pht('Class'),
pht('Index Exists'),
pht('Index Is Sane'),
pht('Engine Name'),
pht('Writable'),
pht('Readable'),
))
->setRowClasses($rowc)
->setColumnClasses(
array(
'',
'wide',
'',
'',
));
$box = id(new PHUIObjectBoxView())