diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-01-28 09:36:25 -0600 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-01-28 14:15:43 -0500 |
commit | b96138ba56d33fb3b84d992a731d797c2c8492be (patch) | |
tree | 42883d4e5b80c86a99ec016bdb9f340b9f915253 /install/ui/widget.js | |
parent | 4486341c83a746cb9960cdf8e5da7811a5a5ef7b (diff) | |
download | freeipa-b96138ba56d33fb3b84d992a731d797c2c8492be.tar.gz freeipa-b96138ba56d33fb3b84d992a731d797c2c8492be.tar.xz freeipa-b96138ba56d33fb3b84d992a731d797c2c8492be.zip |
Fixed delegation UI issues
This patch fixes several issues in delegation UI:
When adding a new delegation, only the first attribute selected
was saved. Now all attributes will be saved properly.
When loading the details page, the custom widgets did not store
the original values properly so is_dirty() did not work correctly.
Now this has been fixed except for the memberof attribute because
of these issues:
- https://fedorahosted.org/freeipa/ticket/869
- https://fedorahosted.org/freeipa/ticket/870
When saving the details page, the attrs were saved as an array
which was rejected by the server. Now it is stored as comma-
separated list.
Diffstat (limited to 'install/ui/widget.js')
-rw-r--r-- | install/ui/widget.js | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/install/ui/widget.js b/install/ui/widget.js index 9f7c8cae8..3bb5c0f5a 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -38,6 +38,7 @@ IPA.widget = function(spec) { that.height = spec.height; that.undo = typeof spec.undo == 'undefined' ? true : spec.undo; + that.join = spec.join; that.init = spec.init || init; that.create = spec.create || create; @@ -110,6 +111,7 @@ IPA.widget = function(spec) { function load(record) { that.record = record; + that.values = record[that.name]; that.reset(); } @@ -126,36 +128,39 @@ IPA.widget = function(spec) { } that.is_dirty = function() { + if (that.read_only) { return false; } + var values = that.save(); - if (!that.values){ + if (!that.values) { + if (!values) { return false; } - if ( values === "" ){ - return false; - } - if ((values instanceof Array) && - (values.length ===1) && - (values[0] === "")){ - return false; - } - if ((values instanceof Array) && - (values.length === 0)){ + if (values === '') { return false; } - if (values) { - return true; + if (values instanceof Array) { + + if ((values.length === 0) || + (values.length === 1) && + (values[0] === '')) { + return false; + } } + + return true; } + if (values.length != that.values.length) { return true; } + for (var i=0; i<values.length; i++) { if (values[i] != that.values[i]) { return true; @@ -1017,14 +1022,12 @@ IPA.dialog = function(spec) { that.container.dialog('option', name, value); }; - that.get_record = function() { - var record = {}; + that.save = function(record) { for (var i=0; i<that.fields.length; i++) { var field = that.fields[i]; var values = field.save(); - record[field.name] = values[0]; + record[field.name] = values.join(','); } - return record; }; that.close = function() { |