Differential D15677 Diff 37783 src/applications/config/controller/PhabricatorConfigClusterDatabasesController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/controller/PhabricatorConfigClusterDatabasesController.php
Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | foreach ($databases as $database) { | ||||
} | } | ||||
$replication = array( | $replication = array( | ||||
id(new PHUIIconView())->setIcon("{$replica_icon} {$replica_color}"), | id(new PHUIIconView())->setIcon("{$replica_icon} {$replica_color}"), | ||||
' ', | ' ', | ||||
$replica_label, | $replica_label, | ||||
); | ); | ||||
$health = $database->getHealthRecord(); | |||||
$health_up = $health->getUpEventCount(); | |||||
$health_down = $health->getDownEventCount(); | |||||
if ($health->getIsHealthy()) { | |||||
$health_icon = id(new PHUIIconView()) | |||||
->setIcon('fa-plus green'); | |||||
} else { | |||||
$health_icon = id(new PHUIIconView()) | |||||
->setIcon('fa-times red'); | |||||
} | |||||
$health_count = pht( | |||||
'%s / %s', | |||||
new PhutilNumber($health_up), | |||||
new PhutilNumber($health_up + $health_down)); | |||||
$health_status = array( | |||||
$health_icon, | |||||
' ', | |||||
$health_count, | |||||
); | |||||
$messages = array(); | $messages = array(); | ||||
$conn_message = $database->getConnectionMessage(); | $conn_message = $database->getConnectionMessage(); | ||||
if ($conn_message) { | if ($conn_message) { | ||||
$messages[] = $conn_message; | $messages[] = $conn_message; | ||||
} | } | ||||
$replica_message = $database->getReplicaMessage(); | $replica_message = $database->getReplicaMessage(); | ||||
if ($replica_message) { | if ($replica_message) { | ||||
$messages[] = $replica_message; | $messages[] = $replica_message; | ||||
} | } | ||||
$messages = phutil_implode_html(phutil_tag('br'), $messages); | $messages = phutil_implode_html(phutil_tag('br'), $messages); | ||||
$rows[] = array( | $rows[] = array( | ||||
$role_icon, | $role_icon, | ||||
$database->getHost(), | $database->getHost(), | ||||
$database->getPort(), | $database->getPort(), | ||||
$database->getUser(), | $database->getUser(), | ||||
$connection, | $connection, | ||||
$replication, | $replication, | ||||
$health_status, | |||||
$messages, | $messages, | ||||
); | ); | ||||
} | } | ||||
$table = id(new AphrontTableView($rows)) | $table = id(new AphrontTableView($rows)) | ||||
->setNoDataString( | ->setNoDataString( | ||||
pht('Phabricator is not configured in cluster mode.')) | pht('Phabricator is not configured in cluster mode.')) | ||||
->setHeaders( | ->setHeaders( | ||||
array( | array( | ||||
null, | null, | ||||
pht('Host'), | pht('Host'), | ||||
pht('Port'), | pht('Port'), | ||||
pht('User'), | pht('User'), | ||||
pht('Connection'), | pht('Connection'), | ||||
pht('Replication'), | pht('Replication'), | ||||
pht('Health'), | |||||
pht('Messages'), | pht('Messages'), | ||||
)) | )) | ||||
->setColumnClasses( | ->setColumnClasses( | ||||
array( | array( | ||||
null, | null, | ||||
null, | null, | ||||
null, | null, | ||||
null, | null, | ||||
null, | null, | ||||
null, | null, | ||||
null, | |||||
'wide', | 'wide', | ||||
)); | )); | ||||
$doc_href = PhabricatorEnv::getDoclink('Cluster: Databases'); | $doc_href = PhabricatorEnv::getDoclink('Cluster: Databases'); | ||||
$header = id(new PHUIHeaderView()) | $header = id(new PHUIHeaderView()) | ||||
->setHeader(pht('Cluster Database Status')) | ->setHeader(pht('Cluster Database Status')) | ||||
->addActionLink( | ->addActionLink( | ||||
Show All 12 Lines |