From d1f144b214dfe48470af4a07e39f07591cc0d7f1 Mon Sep 17 00:00:00 2001 From: Aviv Eyal Date: Tue, 18 Jul 2017 17:44:56 +0000 Subject: [PATCH] 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 --- ...torSearchApplicationStorageEnginePanel.php | 47 +++++++++++-------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/src/applications/search/applicationpanel/PhabricatorSearchApplicationStorageEnginePanel.php b/src/applications/search/applicationpanel/PhabricatorSearchApplicationStorageEnginePanel.php index 15ecc3f391..6dd0786c0c 100644 --- a/src/applications/search/applicationpanel/PhabricatorSearchApplicationStorageEnginePanel.php +++ b/src/applications/search/applicationpanel/PhabricatorSearchApplicationStorageEnginePanel.php @@ -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())