1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Show current value in configuration list; show default vs non-default values

Summary:
  - When viewing a config list, show the current effective value.
  - Add an icon showing default vs nondefault values.

Test Plan: {F28475}

Reviewers: btrahan, codeblock

Reviewed By: codeblock

CC: aran

Maniphest Tasks: T2255

Differential Revision: https://secure.phabricator.com/D4313
This commit is contained in:
epriestley 2013-01-01 14:11:39 -08:00
parent 21efc7cb64
commit 25ca17da46
2 changed files with 40 additions and 1 deletions

View file

@ -53,12 +53,44 @@ final class PhabricatorConfigGroupController
private function buildOptionList(array $options) {
assert_instances_of($options, 'PhabricatorConfigOption');
require_celerity_resource('config-options-css');
$db_values = array();
if ($options) {
$db_values = id(new PhabricatorConfigEntry())->loadAllWhere(
'configKey IN (%Ls) AND namespace = %s',
mpull($options, 'getKey'),
'default');
$db_values = mpull($db_values, null, 'getConfigKey');
}
$list = new PhabricatorObjectItemListView();
foreach ($options as $option) {
$current_value = PhabricatorEnv::getEnvConfig($option->getKey());
$current_value = $this->prettyPrintJSON($current_value);
$current_value = phutil_render_tag(
'div',
array(
'class' => 'config-options-current-value',
),
'<span>'.pht('Current Value:').'</span> '.
phutil_escape_html($current_value));
$item = id(new PhabricatorObjectItemView())
->setHeader($option->getKey())
->setHref('/config/edit/'.$option->getKey().'/')
->addAttribute(phutil_escape_html($option->getSummary()));
->addAttribute(phutil_escape_html($option->getSummary()))
->appendChild($current_value);
$db_value = idx($db_values, $option->getKey());
if ($db_value && !$db_value->getIsDeleted()) {
$item->addIcon('edit', pht('Customized'));
} else {
$item->addIcon('edit-grey', pht('Default'));
}
$list->addItem($item);
}

View file

@ -37,4 +37,11 @@
background: #e0e0e0;
}
.config-options-current-value {
padding: 0 6px 2px;
white-space: pre-wrap;
}
.config-options-current-value span {
color: #666666;
}