Added confirmation when adding multiple entries.

The adder dialog has been modified to show a confirmation message
after each successful addition.

Ticket #1786
This commit is contained in:
Endi S. Dewata
2011-09-27 09:28:14 -05:00
committed by Martin Kosek
parent f93d71409a
commit fe8aeef307
10 changed files with 57 additions and 19 deletions

View File

@@ -63,7 +63,7 @@ IPA.entity_factories.permission = function() {
facet_group: 'privilege' facet_group: 'privilege'
}). }).
adder_dialog({ adder_dialog({
height: 400, height: 450,
sections: [ sections: [
{ {
name: 'general', name: 'general',

View File

@@ -115,6 +115,7 @@ IPA.add_dialog = function (spec) {
name: 'add', name: 'add',
label: IPA.messages.buttons.add, label: IPA.messages.buttons.add,
click: function() { click: function() {
that.hide_message();
that.add( that.add(
function(data, text_status, xhr) { function(data, text_status, xhr) {
var facet = IPA.current_entity.get_facet(); var facet = IPA.current_entity.get_facet();
@@ -130,8 +131,14 @@ IPA.add_dialog = function (spec) {
name: 'add_and_add_another', name: 'add_and_add_another',
label: IPA.messages.buttons.add_and_add_another, label: IPA.messages.buttons.add_and_add_another,
click: function() { click: function() {
that.hide_message();
that.add( that.add(
function(data, text_status, xhr) { function(data, text_status, xhr) {
var label = that.entity.metadata.label_singular;
var message = IPA.messages.dialogs.add_confirmation;
message = message.replace('${entity}', label);
that.show_message(message);
var facet = IPA.current_entity.get_facet(); var facet = IPA.current_entity.get_facet();
var table = facet.table; var table = facet.table;
table.refresh(); table.refresh();
@@ -145,6 +152,7 @@ IPA.add_dialog = function (spec) {
name: 'add_and_edit', name: 'add_and_edit',
label: IPA.messages.buttons.add_and_edit, label: IPA.messages.buttons.add_and_edit,
click: function() { click: function() {
that.hide_message();
that.add( that.add(
function(data, text_status, xhr) { function(data, text_status, xhr) {
that.close(); that.close();
@@ -159,6 +167,7 @@ IPA.add_dialog = function (spec) {
name: 'cancel', name: 'cancel',
label: IPA.messages.buttons.cancel, label: IPA.messages.buttons.cancel,
click: function() { click: function() {
that.hide_message();
that.close(); that.close();
} }
}); });

View File

@@ -119,11 +119,8 @@ IPA.dialog = function(spec) {
}; };
that.add_field = function(field) { that.add_field = function(field) {
field.dialog = that;
var section = that.get_section(); var section = that.get_section();
section.add_field(field); section.add_field(field);
return field; return field;
}; };
@@ -184,6 +181,11 @@ IPA.dialog = function(spec) {
*/ */
that.create = function() { that.create = function() {
that.message_container = $('<div/>', {
style: 'display: none',
'class': 'dialog-message ui-state-highlight ui-corner-all'
}).appendTo(that.container);
var sections = that.sections.values; var sections = that.sections.values;
for (var i=0; i<sections.length; i++) { for (var i=0; i<sections.length; i++) {
var section = sections[i]; var section = sections[i];
@@ -198,6 +200,14 @@ IPA.dialog = function(spec) {
}; };
that.show_message = function(message) {
that.message_container.text(message);
that.message_container.css('display', '');
};
that.hide_message = function() {
that.message_container.css('display', 'none');
};
/** /**
* Open dialog * Open dialog

View File

@@ -231,6 +231,9 @@ IPA.dnszone_details_facet = function(spec) {
return that; return that;
}; };
// TODO: Remove the custom create() by moving the fields into sections.
// The idnsname and name_from_ip should be moved into a custom section.
// The idnssoamname, idnssoarname, and force into a standard section.
IPA.dnszone_adder_dialog = function(spec) { IPA.dnszone_adder_dialog = function(spec) {
spec = spec || {}; spec = spec || {};
@@ -241,6 +244,11 @@ IPA.dnszone_adder_dialog = function(spec) {
that.container.addClass('dnszone-adder-dialog'); that.container.addClass('dnszone-adder-dialog');
that.message_container = $('<div/>', {
style: 'display: none',
'class': 'dialog-message ui-state-highlight ui-corner-all'
}).appendTo(that.container);
var table = $('<table/>').appendTo(that.container); var table = $('<table/>').appendTo(that.container);
var field = that.get_field('idnsname'); var field = that.get_field('idnsname');

View File

@@ -120,7 +120,7 @@ IPA.entity_factories.host = function () {
standard_association_facets(). standard_association_facets().
adder_dialog({ adder_dialog({
factory: IPA.host_adder_dialog, factory: IPA.host_adder_dialog,
height: 250, height: 300,
sections: [ sections: [
{ {
factory: IPA.host_fqdn_section, factory: IPA.host_fqdn_section,

View File

@@ -279,7 +279,7 @@ div.tabs {
.tabs1 > .ui-tabs-nav li { .tabs1 > .ui-tabs-nav li {
-moz-border-radius: 0 !important; -moz-border-radius: 0 !important;
-webkit-border-radius: 0 !important; -webkit-border-radius: 0 !important;
background-image: url("Mainnav-offtab.png"); background-image: url("Mainnav-offtab.png");
margin: 0 0.4em 0 0; margin: 0 0.4em 0 0;
border-width: 0; border-width: 0;
@@ -296,7 +296,7 @@ div.tabs {
.tabs1 > .ui-tabs-nav > li > a { .tabs1 > .ui-tabs-nav > li > a {
-moz-border-radius: 0 !important; -moz-border-radius: 0 !important;
-webkit-border-radius: 0 !important; -webkit-border-radius: 0 !important;
font-family: "Overpass Bold","Liberation Sans", Arial, sans-serif; font-family: "Overpass Bold","Liberation Sans", Arial, sans-serif;
min-width: 5em; min-width: 5em;
height: 20px; height: 20px;
@@ -636,7 +636,7 @@ span.main-nav-off > a:visited {
float: right; float: right;
width: 215px; width: 215px;
-moz-border-radius: 15px !important; -moz-border-radius: 15px !important;
-webkit-border-radius: 15px !important; -webkit-border-radius: 15px !important;
border-radius: 15px !important; border-radius: 15px !important;
border: 1px solid #9f9e9e; border: 1px solid #9f9e9e;
background: url("search-bg.png"); background: url("search-bg.png");
@@ -660,10 +660,10 @@ span.main-nav-off > a:visited {
.search-controls { .search-controls {
-moz-border-radius: .7em .7em 0 0; -moz-border-radius: .7em .7em 0 0;
-webkit-border-radius: .7em .7em 0 0; -webkit-border-radius: .7em .7em 0 0;
height:2.5em; height:2.5em;
background: -moz-linear-gradient(top, #eeeeee, #dfdfdf); background: -moz-linear-gradient(top, #eeeeee, #dfdfdf);
background: -webkit-gradient(linear, left top, left bottom, from(#eeeeee), to(#dfdfdf)); background: -webkit-gradient(linear, left top, left bottom, from(#eeeeee), to(#dfdfdf));
position: relative; position: relative;
padding: 1em 1.5em; padding: 1em 1.5em;
margin-top: .8em; margin-top: .8em;
@@ -922,6 +922,15 @@ a, .ui-widget-content a {
} }
*/ */
.dialog-message {
margin: 5px 5px 10px;
padding: 10px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
text-align: center;
}
.ui-widget input, .ui-widget select, .ui-widget input, .ui-widget select,
.ui-widget textarea, .ui-widget button { .ui-widget textarea, .ui-widget button {
font-family: "Liberation Sans", Arial, sans-serif; font-family: "Liberation Sans", Arial, sans-serif;
@@ -931,13 +940,13 @@ a, .ui-widget-content a {
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default, #content .ui-state-default { .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default, #content .ui-state-default {
-moz-border-radius: .3em; -moz-border-radius: .3em;
-webkit-border-radius: .3em; -webkit-border-radius: .3em;
background: -moz-linear-gradient(top, #959595, #5e5e5e); background: -moz-linear-gradient(top, #959595, #5e5e5e);
background: -webkit-gradient(linear, left top, left bottom, from(#959595), to(#5e5e5e)); background: -webkit-gradient(linear, left top, left bottom, from(#959595), to(#5e5e5e));
border: 1px solid #777777; border: 1px solid #777777;
color: #fff; color: #fff;
font-weight: normal; font-weight: normal;
padding: 0.4em 1em; padding: 0.4em 1em;
} }
[title=">>"] { [title=">>"] {

View File

@@ -52,7 +52,7 @@ IPA.entity_factories.pwpolicy = function() {
other_field: 'cn' other_field: 'cn'
}, },
'cospriority'], 'cospriority'],
height: 250 height: 300
}). }).
build(); build();
}; };

View File

@@ -71,7 +71,7 @@ IPA.entity_factories.service = function() {
standard_association_facets(). standard_association_facets().
adder_dialog({ adder_dialog({
factory: IPA.service_add_dialog, factory: IPA.service_add_dialog,
height: 300 height: 350
}). }).
build(); build();
}; };

View File

@@ -16761,6 +16761,7 @@
"to_top": "Back to Top" "to_top": "Back to Top"
}, },
"dialogs": { "dialogs": {
"add_confirmation": "${entity} successfully added",
"add_title": "Add ${entity}", "add_title": "Add ${entity}",
"available": "Available", "available": "Available",
"batch_error_message": "Some operations failed.", "batch_error_message": "Some operations failed.",

View File

@@ -156,6 +156,7 @@ class i18n_messages(Command):
"to_top": _("Back to Top") "to_top": _("Back to Top")
}, },
"dialogs": { "dialogs": {
"add_confirmation": _("${entity} successfully added"),
"add_title": _("Add ${entity}"), "add_title": _("Add ${entity}"),
"available": _("Available"), "available": _("Available"),
"batch_error_message": _("Some operations failed."), "batch_error_message": _("Some operations failed."),