diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-05-27 12:04:20 -0500 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-05-27 21:38:26 -0400 |
commit | 6304d9173c16e082d6844b329987680b85086cb7 (patch) | |
tree | 957c54e65b73f9f75f3e789f7f4804df1ef89c14 /install/ui/hbac.js | |
parent | e91aa64d4ae6d85284c3b062f5ba03a8da27f547 (diff) | |
download | freeipa-6304d9173c16e082d6844b329987680b85086cb7.tar.gz freeipa-6304d9173c16e082d6844b329987680b85086cb7.tar.xz freeipa-6304d9173c16e082d6844b329987680b85086cb7.zip |
Fixed problem deleting value in text field.
Previously deleting a value in a text field did not work because
the field is not included in the modify operation when the value
is empty. The details facet's update() method has been modified
to update only dirty fields.
The section lists in details facet and dialog have been converted
into ordered maps.
Ticket #1256
Diffstat (limited to 'install/ui/hbac.js')
-rw-r--r-- | install/ui/hbac.js | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/install/ui/hbac.js b/install/ui/hbac.js index 4d46a18f5..64881a457 100644 --- a/install/ui/hbac.js +++ b/install/ui/hbac.js @@ -431,12 +431,14 @@ IPA.hbacrule_details_facet = function (spec) { }) }; - for (var i=0; i<that.sections.length; i++) { - var section = that.sections[i]; + var sections = that.sections.values; + for (var i=0; i<sections.length; i++) { + var section = sections[i]; var section_fields = section.fields.values; for (var j=0; j<section_fields.length; j++) { var field = section_fields[j]; + if (!field.is_dirty()) continue; var values = field.save(); if (!values) continue; @@ -486,23 +488,26 @@ IPA.hbacrule_details_facet = function (spec) { } } - // use setattr/addattr if param_info not available - if (!param_info) { - for (var l=0; l<values.length; l++) { - modify_operation.command.set_option( - l === 0 ? 'setattr' : 'addattr', - field.name+'='+values[l]); - modify_operation.execute = true; + if (param_info) { + if (values.length == 1) { + modify_operation.command.set_option(field.name, values[0]); + } else if (field.join) { + modify_operation.command.set_option(field.name, values.join(',')); + } else { + modify_operation.command.set_option(field.name, values); } - continue; - } - // set modify options - if (values.length == 1) { - modify_operation.command.set_option(field.name, values[0]); } else { - modify_operation.command.set_option(field.name, values); + if (values.length) { + modify_operation.command.set_option('setattr', field.name+'='+values[0]); + } else { + modify_operation.command.set_option('setattr', field.name+'='); + } + for (var l=1; l<values.length; l++) { + modify_operation.command.set_option('addattr', field.name+'='+values[l]); + } } + modify_operation.execute = true; } } @@ -538,13 +543,6 @@ IPA.hbacrule_details_facet = function (spec) { batch.execute(); }; - that.reset = function() { - for (var i=0; i<that.sections.length; i++) { - var section = that.sections[i]; - section.reset(); - } - }; - return that; }; |