Merge branch 'ent-8122-bug-visual-widget-show-top-agents-modules' into 'develop'

Fixed visual issue

Closes pandora_enterprise#8122

See merge request artica/pandorafms!4619
This commit is contained in:
Daniel Rodriguez 2022-01-11 14:59:38 +00:00
commit db4d9928b4
2 changed files with 11 additions and 11 deletions

View File

@ -437,25 +437,23 @@ function pandoraFlotHBars(
var format = new Array(); var format = new Array();
for (var i = 0; i < labels_total.length; i++) { for (var i = 0; i < labels_total.length; i++) {
var label = labels_total[i][1]; var label = labels_total[i][1];
// var shortLabel = reduceText(label, 25);
var title = label;
if (label.length > 30) {
label = reduceText(label, 30);
}
var div_attributes = var div_attributes =
'style="font-size:' + 'style="font-size:' +
font_size + font_size +
"pt !important;" + "pt !important;" +
" margin: 0; max-width: 150px;" + "margin: 0; max-width: 200px;" +
"margin-right:5px"; "margin-right:5px;" +
+"margin-left: -1.5em"; "margin-left: -1.5em" +
+"text-align: right"; "text-align: right" +
"text-overflow: ellipsis;" +
"overflow: hidden;" +
"white-space: pre;";
if (label.indexOf("<br>") != -1) { if (label.indexOf("<br>") != -1) {
div_attributes += "min-height: 2.5em;"; div_attributes += "min-height: 2.5em;";
} }
div_attributes += '" title="' + title + '" style="overflow: hidden;"'; div_attributes += '" title="' + label + '" style="overflow: hidden;"';
format.push([i, "<div " + div_attributes + ">" + label + "</div>"]); format.push([i, "<div " + div_attributes + ">" + label + "</div>"]);
} }
@ -3270,5 +3268,6 @@ function reduceText(text, maxLength) {
if (text.length <= maxLength) return text; if (text.length <= maxLength) return text;
var firstSlideEnd = parseInt((maxLength - 3) / 1.6); var firstSlideEnd = parseInt((maxLength - 3) / 1.6);
var str_cut = text.substr(0, firstSlideEnd); var str_cut = text.substr(0, firstSlideEnd);
return str_cut + "...<br>" + text.substr(-firstSlideEnd - 3); //return str_cut + "...<br>" + text.substr(-firstSlideEnd - 3);
return str_cut + "..." + text.substr(-firstSlideEnd - 3);
} }

View File

@ -455,6 +455,7 @@ class TopNWidget extends Widget
$data_hbar = []; $data_hbar = [];
foreach ($modules as $module) { foreach ($modules as $module) {
$module['aliasAgent'] = ui_print_truncate_text($module['aliasAgent'], 20);
$item_name = ''; $item_name = '';
$item_name = $module['aliasAgent'].' - '.$module['nameModule']; $item_name = $module['aliasAgent'].' - '.$module['nameModule'];
$data_hbar[$item_name]['g'] = $module[$display]; $data_hbar[$item_name]['g'] = $module[$display];