View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
2035 | RackTables | default | public | 2021-07-13 17:09 | 2021-07-13 17:32 |
Reporter | netniv | Assigned To | |||
Priority | normal | Severity | trivial | Reproducibility | always |
Status | new | Resolution | open | ||
Summary | 2035: Common Name vs Visible Label | ||||
Description | The 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 Information | diff --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']); | ||||
Tags | No tags attached. | ||||
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']); |
|