Differential D25070 Diff 328 src/applications/config/controller/services/PhabricatorConfigClusterSearchController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/controller/services/PhabricatorConfigClusterSearchController.php
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | private function renderStatusView($service) { | ||||
$rows = array(); | $rows = array(); | ||||
$status_map = PhabricatorSearchService::getConnectionStatusMap(); | $status_map = PhabricatorSearchService::getConnectionStatusMap(); | ||||
$stats = false; | $stats = false; | ||||
$stats_view = false; | $stats_view = false; | ||||
foreach ($service->getHosts() as $host) { | foreach ($service->getHosts() as $host) { | ||||
try { | try { | ||||
// Default status icon | |||||
// | |||||
// At the moment the default status is shown also when | |||||
// you just use MySQL as search server. So, on MySQL it | |||||
// shows "Unknown" even if probably it should says "Active". | |||||
// If you have time, please improve the MySQL getConnectionStatus() | |||||
// to return something more useful than this default. | |||||
$default_status = array( | |||||
'icon' => 'fa-question-circle', | |||||
'color' => 'blue', | |||||
'label' => pht('Unknown'), | |||||
); | |||||
$status = $host->getConnectionStatus(); | $status = $host->getConnectionStatus(); | ||||
$status = idx($status_map, $status, array()); | $status = idx($status_map, $status, $default_status); | ||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
$status['icon'] = 'fa-times'; | $status['icon'] = 'fa-times'; | ||||
valerio.bozzolan: NOTE: I'm not very happy about the fact that here we are, in a single line, creating the array… | |||||
$status['label'] = pht('Connection Error'); | $status['label'] = pht('Connection Error'); | ||||
$status['color'] = 'red'; | $status['color'] = 'red'; | ||||
$host->didHealthCheck(false); | $host->didHealthCheck(false); | ||||
} | } | ||||
if (!$stats_view) { | if (!$stats_view) { | ||||
try { | try { | ||||
$stats = $host->getEngine()->getIndexStats($host); | $stats = $host->getEngine()->getIndexStats($host); | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
But I think it's out of the scope of this patch to improve that part.