diff --git a/ui/js/src/wok.message.js b/ui/js/src/wok.message.js index e4c2ebd41..159dc36b4 100644 --- a/ui/js/src/wok.message.js +++ b/ui/js/src/wok.message.js @@ -18,53 +18,56 @@ * limitations under the License. */ -wok.message = function(msg, level, node, closeable, onclick) { +wok.message = function(msg, level, node, closeable, onclick, alertId) { "use strict"; + var close = closeable || true; var container = node || $('#alert-fields'); - if ($(container).size() < 1) { - container = $('
').appendTo($('#alert-container')); - } - var message = ''; - var $message = $(message); - $(container).show(); - $(container).append($message); - $message.alert(); - $message.fadeIn(100); + if($("#" + alertId).length === 0) { + if ($(container).size() < 1) { + container = $('
').appendTo($('#alert-container')); + } + var message = ''; + var $message = $(message); + $(container).show(); + $(container).append($message); + $message.alert(); + $message.fadeIn(100); - if(!closeable){ - var timeout = setTimeout(function() { - $message.delay(4000).fadeOut(100, function() { - $message.alert('close'); - $(this).remove(); - if ($(container).children().length < 1) { - $(container).hide(); - } - }); - }, 10000); + if(!close){ + var timeout = setTimeout(function() { + $message.delay(4000).fadeOut(100, function() { + $message.alert('close'); + $(this).remove(); + if ($(container).children().length < 1) { + $(container).hide(); + } + }); + }, 10000); + } } }; -wok.message.warn = function(msg, node, closeable) { +wok.message.warn = function(msg, node, closeable, alertId) { "use strict"; - wok.message(msg, 'alert-warning', node, closeable); + wok.message(msg, 'alert-warning', node, closeable, null, alertId); }; -wok.message.error = function(msg, node, closeable) { +wok.message.error = function(msg, node, closeable, alertId) { "use strict"; - wok.message(msg, 'alert-danger', node, closeable); + wok.message(msg, 'alert-danger', node, closeable, null, alertId); }; -wok.message.error.code = function(code, node, closeable) { +wok.message.error.code = function(code, node, closeable, alertId) { "use strict"; var msg = code + ": " + i18n[code]; - wok.message(msg, 'alert-danger', node, closeable); + wok.message(msg, 'alert-danger', node, closeable, null, alertId); }; -wok.message.success = function(msg, node, closeable) { +wok.message.success = function(msg, node, closeable, alertId) { "use strict"; - wok.message(msg, 'alert-success', node, closeable); + wok.message(msg, 'alert-success', node, closeable, null, alertId); }; wok.message.notify = function(notification, node) { "use strict"; diff --git a/ui/js/src/wok.window.js b/ui/js/src/wok.window.js index 1386e0959..b021605e0 100644 --- a/ui/js/src/wok.window.js +++ b/ui/js/src/wok.window.js @@ -49,7 +49,7 @@ wok.window = (function() { $('#' + windowID).remove(); }); - $(windowNode).appendTo('#' + target).on('click', '.window .close', function() { + $(windowNode).appendTo('#' + target).on('click', '.modal-header > .close', function() { wok.window.close(); });