IcingaHost: add name to assign properties...

...and remove internal ones
This commit is contained in:
Thomas Gelf 2016-02-27 09:45:38 +01:00
parent 4f65a44494
commit 8c3f38c11b
1 changed files with 12 additions and 2 deletions

View File

@ -74,7 +74,10 @@ class IcingaHost extends IcingaObject
public static function enumProperties(DbConnection $connection = null) public static function enumProperties(DbConnection $connection = null)
{ {
$properties = static::create()->listProperties(); $properties = array_merge(
array('name'),
static::create()->listProperties()
);
$props = mt('director', 'Properties'); $props = mt('director', 'Properties');
$vars = mt('director', 'Custom variables'); $vars = mt('director', 'Custom variables');
$properties = array( $properties = array(
@ -82,10 +85,17 @@ class IcingaHost extends IcingaObject
$vars => array() $vars => array()
); );
unset($properties[$props]['object_name']);
unset($properties[$props]['object_type']);
if ($connection !== null) { if ($connection !== null) {
foreach ($connection->fetchDistinctHostVars() as $var) { foreach ($connection->fetchDistinctHostVars() as $var) {
if ($var->datatype) { if ($var->datatype) {
$properties[$vars]['vars.' . $var->varname] = sprintf('%s (%s)', $var->varname, $var->caption); $properties[$vars]['vars.' . $var->varname] = sprintf(
'%s (%s)',
$var->varname,
$var->caption
);
} else { } else {
$properties[$vars]['vars.' . $var->varname] = $var->varname; $properties[$vars]['vars.' . $var->varname] = $var->varname;
} }