From 1e0c5e087353de7089887ec82d786e45a9a1939c Mon Sep 17 00:00:00 2001 From: Simon MacMullen Date: Mon, 21 Jan 2013 12:30:55 +0000 Subject: [PATCH] Certain client authors send very long fields here (particularly for platform, which can include all sorts of details of the OS, compiler, etc). So truncate long fields rather than display an enormous table. --- deps/rabbitmq_management/priv/www/css/main.css | 2 +- deps/rabbitmq_management/priv/www/js/formatters.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/deps/rabbitmq_management/priv/www/css/main.css b/deps/rabbitmq_management/priv/www/css/main.css index 76709369a6..6fb80b8e29 100644 --- a/deps/rabbitmq_management/priv/www/css/main.css +++ b/deps/rabbitmq_management/priv/www/css/main.css @@ -195,7 +195,7 @@ acronym { background: #add; color: #222; padding: 2px 4px; border-radius: 2px; - acronym.warning { background: #daa; } -.status-red acronym, .status-yellow acronym, .status-green acronym, small acronym { background: none; color: inherit; padding: 0; border-bottom: 1px dotted; cursor: default; } +.status-red acronym, .status-yellow acronym, .status-green acronym, small acronym, acronym.normal { background: none; color: inherit; padding: 0; border-bottom: 1px dotted; cursor: default; } acronym.type { background: none; color: inherit; padding: 0; border-bottom: 1px dotted #ddd; cursor: default; } diff --git a/deps/rabbitmq_management/priv/www/js/formatters.js b/deps/rabbitmq_management/priv/www/js/formatters.js index bcda8d020a..3b46661d8c 100644 --- a/deps/rabbitmq_management/priv/www/js/formatters.js +++ b/deps/rabbitmq_management/priv/www/js/formatters.js @@ -486,19 +486,25 @@ function fmt_shortened_uri(uri0) { function fmt_client_name(properties) { var res = []; if (properties.product != undefined) { - res.push(properties.product); + res.push(fmt_trunc(properties.product, 10)); } if (properties.platform != undefined) { - res.push(properties.platform); + res.push(fmt_trunc(properties.platform, 10)); } res = res.join(" / "); if (properties.version != undefined) { - res += '' + properties.version + ''; + res += '' + fmt_trunc(properties.version) + ''; } return res; } +function fmt_trunc(str, max_length) { + return str.length > max_length ? + ('' + + str.substring(0, max_length) + '...') : str; +} + function alt_rows(i) { return (i % 2 == 0) ? ' class="alt1"' : ' class="alt2"'; }