summaryrefslogtreecommitdiffstats
path: root/install/ui/details.js
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2011-08-24 15:36:48 +0200
committerEndi S. Dewata <edewata@redhat.com>2011-08-25 00:51:28 +0000
commita6cf44bd6538788a20fd6021b802443d4b0c63d9 (patch)
tree8d27f73864b7a572024f0762e95110d082d80e67 /install/ui/details.js
parent5ba0be24e850fa924f8e36f579cfca3768607e4b (diff)
downloadfreeipa-a6cf44bd6538788a20fd6021b802443d4b0c63d9.tar.gz
freeipa-a6cf44bd6538788a20fd6021b802443d4b0c63d9.tar.xz
freeipa-a6cf44bd6538788a20fd6021b802443d4b0c63d9.zip
Validation of details facet before update https://fedorahosted.org/freeipa/ticket/1676 The ticket is a duplicate of server error, but it revealed few UI errors.test-patches-2-1
Newly performs validation of details facet before update. If validation fails, notification dialog is shown and command isn't executed. Fixed integer minimum and maximum value checking. Read-only and non-writable fields are no longer considered required.
Diffstat (limited to 'install/ui/details.js')
-rw-r--r--install/ui/details.js31
1 files changed, 29 insertions, 2 deletions
diff --git a/install/ui/details.js b/install/ui/details.js
index 564d848d4..4550c1abf 100644
--- a/install/ui/details.js
+++ b/install/ui/details.js
@@ -128,6 +128,18 @@ IPA.details_section = function(spec) {
return false;
};
+ that.is_valid = function() {
+ var fields = that.fields.values;
+ var valid = true;
+ for (var i=0; i<fields.length; i++) {
+ var field = fields[i];
+ if (!field.valid || !field.check_required()) {
+ valid = false;
+ }
+ }
+ return valid;
+ };
+
// methods that should be invoked by subclasses
that.section_create = that.create;
that.section_setup = that.setup;
@@ -458,12 +470,12 @@ IPA.details_facet = function(spec) {
on_win(data, text_status, xhr);
if (data.error)
return;
-
+
if (that.post_update_hook) {
that.post_update_hook(data, text_status);
return;
}
-
+
var result = data.result.result;
that.load(result);
}
@@ -488,11 +500,17 @@ IPA.details_facet = function(spec) {
});
var values;
+ var valid = true;
var sections = that.sections.values;
for (var i=0; i<sections.length; i++) {
var section = sections[i];
+ if(!section.is_valid() || !valid) {
+ valid = false;
+ continue;
+ }
+
if (section.save) {
section.save(command.options);
continue;
@@ -528,6 +546,15 @@ IPA.details_facet = function(spec) {
}
}
+ if(!valid) {
+ var dialog = IPA.message_dialog({
+ title: IPA.messages.dialogs.validation_title,
+ message: IPA.messages.dialogs.validation_message
+ });
+ dialog.open();
+ return;
+ }
+
//alert(JSON.stringify(command.to_json()));
if (that.pre_execute_hook){