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

Daemons - add status of environment to daemon console, etc

Summary: Shows the UI everywhere. Also asort() the keys before calculating the environment hash as that is probably an issue for someone at some point we just don't need to have. Ref T5968.

Test Plan: Viewed the setup check and saw a link to the daemon console. Viewed the daemon console and saw the various stale config daemons. Clicked a daemon and saw a "stale config" header icon where expected. Restarted daemons and all of this went away.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5968

Differential Revision: https://secure.phabricator.com/D10367
This commit is contained in:
Bob Trahan 2014-08-27 11:35:21 -07:00
parent 0988ddbf2f
commit c2874945c8
4 changed files with 28 additions and 3 deletions

View file

@ -62,8 +62,15 @@ final class PhabricatorSetupCheckDaemons extends PhabricatorSetupCheck {
'configuration. If you are making multiple configuration changes, '.
'you only need to restart the daemons once after the last change.'.
"\n\n".
'Use %s to restart daemons. See %s for more information.',
'Use %s to restart daemons. See the %s or %s for more information.',
phutil_tag('tt', array(), 'bin/phd restart'),
phutil_tag(
'a',
array(
'href' => '/daemon/',
'target' => '_blank'
),
pht('Daemon Console')),
phutil_tag(
'a',
array(

View file

@ -64,6 +64,14 @@ final class PhabricatorDaemonLogViewController
}
$header->addTag($tag);
$env_hash = PhabricatorEnv::calculateEnvironmentHash();
if ($log->getEnvHash() != $env_hash) {
$tag = id(new PHUITagView())
->setType(PHUITagView::TYPE_STATE)
->setBackgroundColor(PHUITagView::COLOR_YELLOW)
->setName(pht('Stale Config'));
$header->addTag($tag);
}
$properties = $this->buildPropertyListView($log);

View file

@ -17,6 +17,7 @@ final class PhabricatorDaemonLogListView extends AphrontView {
throw new Exception('Call setUser() before rendering!');
}
$env_hash = PhabricatorEnv::calculateEnvironmentHash();
$list = new PHUIObjectItemListView();
foreach ($this->daemonLogs as $log) {
$id = $log->getID();
@ -31,8 +32,15 @@ final class PhabricatorDaemonLogListView extends AphrontView {
$status = $log->getStatus();
switch ($status) {
case PhabricatorDaemonLog::STATUS_RUNNING:
if ($env_hash != $log->getEnvHash()) {
$item->setBarColor('yellow');
$item->addAttribute(pht(
'This daemon is running with an out of date configuration and '.
'should be restarted.'));
} else {
$item->setBarColor('green');
$item->addAttribute(pht('This daemon is running.'));
}
break;
case PhabricatorDaemonLog::STATUS_DEAD:
$item->setBarColor('red');

View file

@ -223,6 +223,8 @@ final class PhabricatorEnv {
public static function calculateEnvironmentHash() {
$keys = array_keys(self::getAllConfigKeys());
asort($keys);
$values = array();
foreach ($keys as $key) {
$values[$key] = self::getEnvConfigIfExists($key);