diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/SystemhealthController.php b/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/SystemhealthController.php index a3d10ccc4..402373dc6 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/SystemhealthController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/SystemhealthController.php @@ -32,6 +32,7 @@ namespace OPNsense\Diagnostics\Api; use \OPNsense\Base\ApiControllerBase; use \OPNsense\Core\Backend; +use \OPNsense\Core\Config; /** * Class ServiceController @@ -585,4 +586,22 @@ class SystemhealthController extends ApiControllerBase return ["sets" => [], "d3" => [], "title" => "error", "y-axis_label" => ""]; } } + + /** + * Retrieve network interfaces by key (lan, wan, opt1,..) + * @return array + */ + public function getInterfacesAction() + { + // collect interface names + $intfmap = array(); + $config = Config::getInstance()->object() ; + if ($config->interfaces != null) { + foreach ($config->interfaces->children() as $key => $node) { + $intfmap[(string)$key] = array("descr" => !empty((string)$node->descr) ? (string)$node->descr : $key) ; + } + } + return $intfmap; + } + } diff --git a/src/opnsense/mvc/app/views/OPNsense/Diagnostics/systemhealth.volt b/src/opnsense/mvc/app/views/OPNsense/Diagnostics/systemhealth.volt index 1da70d6cb..3352e68f2 100644 --- a/src/opnsense/mvc/app/views/OPNsense/Diagnostics/systemhealth.volt +++ b/src/opnsense/mvc/app/views/OPNsense/Diagnostics/systemhealth.volt @@ -210,11 +210,11 @@ rrd_name = subitem + '-' + category; if (subitem==active_subitem) { - tabs += '
  • ' + subitem[0].toUpperCase() + subitem.slice(1) + '
  • '; + tabs += '
  • ' + subitem[0].toUpperCase() + subitem.slice(1) + '
  • '; rrd=rrd_name; getdata(rrd_name,0,0,120,false,0); // load initial data } else { - tabs += '
  • ' + subitem[0].toUpperCase() + subitem.slice(1) + '
  • '; + tabs += '
  • ' + subitem[0].toUpperCase() + subitem.slice(1) + '
  • '; } } tabs+=''; @@ -222,6 +222,19 @@ } $('#maintabs').html(tabs); $('#tab_1').toggleClass('active'); + // map interface descriptions + ajaxGet(url = "/api/diagnostics/systemhealth/getInterfaces" , sendData = {}, callback = function (data, status) { + $(".rrd-item").each(function(){ + var rrd_item = $(this); + var rrd_item_name = $(this).attr('id').split('-')[0].toLowerCase(); + $.map(data, function(value, key){ + if (key.toLowerCase() == rrd_item_name) { + rrd_item.html(' ' + value['descr']); + } + + }); + }); + }); } else { alert("Error while fetching RRD list : "+status); }