@cryptotaxi247 / netdata-1 / commits / 24b02b9f7

fix for the interface names

Costa Tsaousis (ktsaou) committed Feb 8, 2016 at 22:38 UTC 24b02b9f786266a8d296f433d596436e0db526f8
1 file changed +37 -12
web/index.html
+37 -12
@@ -1150,19 +1150,44 @@ function chartHeight(id, def) {
1150 // enrich the data structure returned by netdata
1151 // to reflect our menu system and content
1152 function enrichChartData(chart) {
1153 - // net_* and disk_* have special grouping
1154 - if(chart.type.match(/^net_/))
1155 - chart.menu = 'net';
1156 - else if(chart.type.match(/^ap_/))
1157 - chart.menu = 'ap';
1158 - else if(chart.type.match(/^disk_/))
1159 - chart.menu = 'disk';
1160 - else
1161 - chart.menu = chart.type;
1153 + var tmp = chart.type.split('_')[0];
1154 +
1155 + switch(tmp) {
1156 + case 'disk':
1157 + chart.menu = tmp;
1158 + break;
1159 +
1160 + case 'ap':
1161 + case 'net':
1162 + chart.menu = tmp;
1163 +
1164 + // set the family using the name
1165 + if(typeof options.interfaces_registry[chart.family] !== 'undefined' && options.interfaces_registry[chart.family] !== chart.family)
1166 + chart.family += ' (' + options.interfaces_registry[chart.family] + ')';
1167 +
1168 + break;
1169 +
1170 + case 'tc':
1171 + chart.menu = tmp;
1172
1163 - // increase the priority of IFB devices
1164 - if(chart.type === 'tc' && chart.id.match(/.*-ifb$/))
1165 - chart.priority--;
1173 + // find the interface name from the name
1174 + if(typeof options.interfaces_registry[chart.family] === 'undefined' || options.interfaces_registry[chart.family] === chart.family)
1175 + options.interfaces_registry[chart.family] = chart.name.split('.')[1].split('_')[0];
1176 +
1177 + // set the family using the name
1178 + if(typeof options.interfaces_registry[chart.family] !== 'undefined' && options.interfaces_registry[chart.family] !== chart.family)
1179 + chart.family += ' (' + options.interfaces_registry[chart.family] + ')';
1180 +
1181 + // increase the priority of IFB devices
1182 + if(chart.id.match(/.*-ifb$/))
1183 + chart.priority--;
1184 +
1185 + break;
1186 +
1187 + default:
1188 + chart.menu = chart.type;
1189 + break;
1190 + }
1191
1192 chart.submenu = chart.family;
1193 }