Display custom types as in the config file (with ucwords) (#11367)

* Display custom types as in the config file (with ucwords)

* filter same line
This commit is contained in:
Tony Murray 2020-04-02 16:38:38 -05:00 committed by GitHub
parent 69280b3501
commit 7d2a1ae799
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 9 deletions

View File

@ -83,11 +83,7 @@ class MenuComposer
$vars['port_counts']['pseudowire'] = Config::get('enable_pseudowires') ? ObjectCache::portCounts(['pseudowire'])['pseudowire'] : 0;
$vars['port_counts']['alerted'] = 0; // not actually supported on old...
$vars['custom_port_descr'] = collect(Config::get('custom_descr', []))
->filter()
->map(function ($descr) {
return strtolower($descr);
});
$vars['custom_port_descr'] = collect(Config::get('custom_descr', []))->filter();
$vars['port_groups_exist'] = Config::get('int_customers') ||
Config::get('int_transit') ||
Config::get('int_peering') ||

View File

@ -17,10 +17,13 @@ foreach ($ports as $port) {
unset($seperator);
for ($i = 0; $i < count($types_array);
$i++) {
$types_array[$i] = ucfirst($types_array[$i]);
}
// show title from config file (but ucwords it)
$ctypes = collect(\LibreNMS\Config::get('custom_descr', []))->keyBy(function ($descr) {
return strtolower($descr);
});
array_walk($types_array, function (&$type) use ($ctypes) {
$type = ucwords($ctypes->get(strtolower($type), $type));
});
$types = implode(' + ', $types_array);