diff --git a/horizon/exceptions.py b/horizon/exceptions.py index 069424cca3..c2cf0046ba 100644 --- a/horizon/exceptions.py +++ b/horizon/exceptions.py @@ -31,6 +31,8 @@ from horizon import messages LOG = logging.getLogger(__name__) +SEPERATOR = '\u2026' + class HorizonReporterFilter(SafeExceptionReporterFilter): """Error report filter that's always active, even in DEBUG mode.""" @@ -261,7 +263,7 @@ HANDLE_EXC_METHODS = [ def _append_detail(message, details): - return encoding.force_text(message) + '\u2026' + \ + return encoding.force_text(message) + SEPERATOR + \ encoding.force_text(details) diff --git a/horizon/static/horizon/js/horizon.messages.js b/horizon/static/horizon/js/horizon.messages.js index 444d0ccecb..33cb8f4cad 100644 --- a/horizon/static/horizon/js/horizon.messages.js +++ b/horizon/static/horizon/js/horizon.messages.js @@ -49,6 +49,12 @@ horizon.alert = function (type, message, extra_tags, details) { }; var this_alert = $(template.render(params)).hide().prependTo("#main_content .messages").fadeIn(100); horizon.autoDismissAlert(this_alert); + + // NOTE: messages template engine doesn't support conditional rendering yet + // So it's a temporary work-around to hide details link when details is empty. + if (details === undefined || details === "") { + this_alert.find("#details_link").remove(); + } return this_alert; }; diff --git a/horizon/templates/horizon/client_side/_alert_message.html b/horizon/templates/horizon/client_side/_alert_message.html index 5f008ed5db..cc28637186 100644 --- a/horizon/templates/horizon/client_side/_alert_message.html +++ b/horizon/templates/horizon/client_side/_alert_message.html @@ -15,7 +15,8 @@ [[/safe]] [[^safe]] [[message]] - Details + Details