webui: proper alerts in dialogs

Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
This commit is contained in:
Petr Vobornik 2014-05-28 17:51:08 +02:00
parent 0fadb14ec7
commit bedd128de0
3 changed files with 11 additions and 6 deletions

View File

@ -85,7 +85,7 @@ IPA.entity_adder_dialog = function(spec) {
that.add(
function(data, text_status, xhr) {
that.added.notify([data], that);
that.show_message(that.get_success_message(data));
that.show_message(that.get_success_message(data), 'success');
that.reset();
that.focus_first_element();
},

View File

@ -30,7 +30,7 @@ define([
'./text',
'./field',
'./widget'],
function(keys, builder, IPA, $, phases, reg, text) {
function(keys, builder, IPA, $, phases, reg, text, field_mod, widget_mod) {
/**
* Opened dialogs
@ -331,7 +331,7 @@ IPA.dialog = function(spec) {
that.message_container = $('<div/>', {
style: 'display: none',
'class': 'dialog-message alert'
'class': 'dialog-message col-sm-12'
}).appendTo(that.body_node);
var widgets = that.widgets.get_widgets();
@ -433,14 +433,19 @@ IPA.dialog = function(spec) {
* Show message in dialog's message container
* @param {string} message
*/
that.show_message = function(message) {
that.message_container.text(message);
that.show_message = function(message, type) {
var ah = widget_mod.alert_helper;
var alert = ah.create_alert('msg', message, type);
var el = ah.render_alert(alert);
that.message_container.append(el);
that.message_container.css('display', '');
};
/** Hide dialog message */
that.hide_message = function() {
that.message_container.css('display', 'none');
that.message_container.empty();
};
/**

View File

@ -1884,7 +1884,7 @@ IPA.dns.record_type_table_widget = function(spec) {
dialog.add(
function(data, text_status, xhr) {
dialog.show_message(dialog.get_add_message());
dialog.show_message(dialog.get_add_message(), 'success');
if (data.result.result.dnsrecords) {
that.reload_facet(data);