Skip to content

Commit

Permalink
view full log on alerts
Browse files Browse the repository at this point in the history
minor refactoring to pr
  • Loading branch information
nimrodshn committed Nov 29, 2017
1 parent 28c6f65 commit a05086c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/assets/javascripts/miq_flash.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@ function add_flash(msg, level, options) {
var textStrong = $('<strong></strong>');
textStrong.text(msg);

var alertDiv = $('<div class="' + cls.alert + '"><button class="close" data-dismiss="alert"><span class="pficon pficon-close"></span></button></div>');
var alertDiv = $('<div class="' + cls.alert + '" style="height:70px; text-overflow:ellipsis; overflow: hidden; white-space: nowrap;"><button class="close" data-dismiss="alert"><span class="pficon pficon-close"></span></button></div>');
alertDiv.append(iconSpan, textStrong);

var textDiv = $('<div class="flash_text_div"></div>');

textDiv.append(alertDiv);
// In case msg is too large we add a button to the alert to allow user to expand the alert and see the full error.
if (msg.length > 200) {
var detailsButton = $('<div style="padding-top: 4px"><button class="btn btn-default pull-right" onclick="expandAlert()" type="submit">Details</button></div>');
alertDiv.append(detailsButton);
}

// if options.id is provided, only one flash message with that id may exist
if (options.id) {
Expand All @@ -48,6 +53,10 @@ function add_flash(msg, level, options) {
$('#flash_msg_div').append(textDiv).show();
}

function expandAlert() {
$(".alert").css({height: "auto", 'text-overflow': "initial", "white-space": "normal"});
}

function _miqFlashLoad() {
return JSON.parse(sessionStorage.getItem('flash_msgs') || '[]');
}
Expand Down

0 comments on commit a05086c

Please sign in to comment.