View Issue Details

IDProjectCategoryView StatusLast Update
2035RackTablesdefaultpublic2021-07-13 17:32
Reporternetniv Assigned To 
PrioritynormalSeveritytrivialReproducibilityalways
Status newResolutionopen 
Summary2035: Common Name vs Visible Label
DescriptionThe display name ('dname') applied to $cell is usually taken from $cell['name'] unless it is blank (then the object type is used). However, as common name ($cell['name']) can be quite long, this can be problematic in racks with lots of long FQDN's. There should be an option within the system configuration to allow visible label to be used over common name. I've included the one line change I did to make things much better for my client but this may not be to everyone's taste so a configuration option to control this makes sense.

Additionally, it may be worth having some form of hook to allow plugins to adjust the displayname when needed.
Additional Informationdiff --git a/wwwroot/inc/functions.php b/wwwroot/inc/functions.php
index 521a98d9..f523cb84 100644
--- a/wwwroot/inc/functions.php
+++ b/wwwroot/inc/functions.php
@@ -601,7 +601,7 @@ function setDisplayedName (&$cell)
 {
        if ($cell['realm'] == 'object')
        {
- $cell['dname'] = formatObjectDisplayedName ($cell['name'], $cell['objtype_id']);
+ $cell['dname'] = formatObjectDisplayedName ($cell['label'], $cell['objtype_id']);
                // If the object has a container, set its dname as well
                if ($cell['container_id'])
                        $cell['container_dname'] = formatObjectDisplayedName ($cell['container_name'], $cell['container_objtype_id']);
TagsNo tags attached.

Activities

netniv

netniv

2021-07-13 17:32

reporter   ~0004319

Further testing showed that for some object types, a label may not be set leading to just "Network Switch" for example, so I updated the code to be:

diff --git a/wwwroot/inc/functions.php b/wwwroot/inc/functions.php
index 521a98d9..ca7a4e5e 100644
--- a/wwwroot/inc/functions.php
+++ b/wwwroot/inc/functions.php
@@ -601,7 +601,8 @@ function setDisplayedName (&$cell)
 {
        if ($cell['realm'] == 'object')
        {
- $cell['dname'] = formatObjectDisplayedName ($cell['name'], $cell['objtype_id']);
+ $label = empty($cell['label'])?$cell['name']:$cell['label'];
+ $cell['dname'] = formatObjectDisplayedName ($label, $cell['objtype_id']);
                // If the object has a container, set its dname as well
                if ($cell['container_id'])
                        $cell['container_dname'] = formatObjectDisplayedName ($cell['container_name'], $cell['container_objtype_id']);

Issue History

Date Modified Username Field Change
2021-07-13 17:09 netniv New Issue
2021-07-13 17:32 netniv Note Added: 0004319