Fixed inconsistent details facet validation.

The details facet validation has been moved out of update() such
that all subclasses perform consistent validation.

Ticket #1455
This commit is contained in:
Endi S. Dewata 2011-10-26 18:21:11 -05:00
parent a486f49a37
commit 916d08719b
4 changed files with 25 additions and 15 deletions

View File

@ -374,7 +374,7 @@ IPA.details_facet = function(spec) {
icon: 'reset-icon',
'class': 'details-reset action-button-disabled',
click: function() {
if(!that.update_button.hasClass('action-button-disabled')) {
if (!that.update_button.hasClass('action-button-disabled')) {
that.reset();
}
return false;
@ -387,9 +387,19 @@ IPA.details_facet = function(spec) {
icon: 'update-icon',
'class': 'details-update action-button-disabled',
click: function() {
if(!that.update_button.hasClass('action-button-disabled')) {
that.update();
if (that.update_button.hasClass('action-button-disabled')) return false;
if (!that.validate()) {
var dialog = IPA.message_dialog({
title: IPA.messages.dialogs.validation_title,
message: IPA.messages.dialogs.validation_message
});
dialog.open();
return false;
}
that.update();
return false;
}
}).appendTo(that.controls);
@ -628,15 +638,6 @@ IPA.details_facet = function(spec) {
on_error: on_error
});
if (!that.validate()) {
var dialog = IPA.message_dialog({
title: IPA.messages.dialogs.validation_title,
message: IPA.messages.dialogs.validation_message
});
dialog.open();
return;
}
var record = {};
that.save(record);

View File

@ -168,6 +168,9 @@ IPA.dnszone_details_facet = function(spec) {
})
};
var record = {};
that.save(record);
var sections = that.sections.values;
for (var i=0; i<sections.length; i++) {
var section = sections[i];
@ -177,7 +180,7 @@ IPA.dnszone_details_facet = function(spec) {
var field = section_fields[j];
if (!field.is_dirty()) continue;
var values = field.save();
var values = record[field.name];
if (!values) continue;
var metadata = field.metadata;

View File

@ -440,6 +440,9 @@ IPA.hbacrule_details_facet = function(spec) {
})
};
var record = {};
that.save(record);
var sections = that.sections.values;
for (var i=0; i<sections.length; i++) {
var section = sections[i];
@ -451,7 +454,7 @@ IPA.hbacrule_details_facet = function(spec) {
// association tables are never dirty, so call
// is_dirty() after checking table values
var values = field.save();
var values = record[field.name];
if (!values) continue;
var metadata = field.metadata;

View File

@ -389,6 +389,9 @@ IPA.sudorule_details_facet = function(spec) {
})
};
var record = {};
that.save(record);
var sections = that.sections.values;
for (var i=0; i<sections.length; i++) {
var section = sections[i];
@ -400,7 +403,7 @@ IPA.sudorule_details_facet = function(spec) {
// association tables are never dirty, so call
// is_dirty() after checking table values
var values = field.save();
var values = record[field.name];
if (!values) continue;
var metadata = field.metadata;