diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2014-07-30 17:58:50 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2014-07-31 10:18:48 +0200 |
commit | 3f085123898468a9e64e49e5dd4e79ee540bc92c (patch) | |
tree | 74b9e6957d5c58b3342416155e1f30e7edaa7d3a | |
parent | f5bc59fe4516b16a7edce904ec771f3220f27633 (diff) | |
download | freeipa-3f085123898468a9e64e49e5dd4e79ee540bc92c.tar.gz freeipa-3f085123898468a9e64e49e5dd4e79ee540bc92c.tar.xz freeipa-3f085123898468a9e64e49e5dd4e79ee540bc92c.zip |
webui: improve value change reporting
-rwxr-xr-x | install/ui/src/freeipa/certificate.js | 2 | ||||
-rw-r--r-- | install/ui/src/freeipa/host.js | 4 | ||||
-rw-r--r-- | install/ui/src/freeipa/service.js | 2 | ||||
-rw-r--r-- | install/ui/src/freeipa/user.js | 2 | ||||
-rw-r--r-- | install/ui/src/freeipa/util.js | 2 | ||||
-rw-r--r-- | install/ui/src/freeipa/widget.js | 28 |
6 files changed, 21 insertions, 19 deletions
diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js index 6a11d9593..ccaa25807 100755 --- a/install/ui/src/freeipa/certificate.js +++ b/install/ui/src/freeipa/certificate.js @@ -880,7 +880,7 @@ IPA.cert.status_widget = function(spec) { status = IPA.cert.CERTIFICATE_STATUS_REVOKED; } that.set_status(status, certificate.revocation_reason); - that.on_value_changed(); + that.on_value_changed(certificate); }; that.clear = function() { diff --git a/install/ui/src/freeipa/host.js b/install/ui/src/freeipa/host.js index 4ccebe4c3..692441f6b 100644 --- a/install/ui/src/freeipa/host.js +++ b/install/ui/src/freeipa/host.js @@ -599,7 +599,7 @@ IPA.host_keytab_widget = function(spec) { that.update = function(values) { set_status(values[0] ? 'present' : 'missing'); - that.on_value_changed(); + that.on_value_changed(values); }; that.clear = function() { @@ -759,7 +759,7 @@ IPA.host_password_widget = function(spec) { that.update = function(values) { set_status(values[0] ? 'present' : 'missing'); - that.on_value_changed(); + that.on_value_changed(values); }; that.clear = function() { diff --git a/install/ui/src/freeipa/service.js b/install/ui/src/freeipa/service.js index 4b04878c0..ee71e7af3 100644 --- a/install/ui/src/freeipa/service.js +++ b/install/ui/src/freeipa/service.js @@ -330,7 +330,7 @@ IPA.service_provisioning_status_widget = function (spec) { that.update = function(values) { that.status = values && values.length ? values[0] : false; set_status(that.status ? 'valid' : 'missing'); - that.on_value_changed(); + that.on_value_changed(values); }; that.clear = function() { diff --git a/install/ui/src/freeipa/user.js b/install/ui/src/freeipa/user.js index 9872df26b..be01170b7 100644 --- a/install/ui/src/freeipa/user.js +++ b/install/ui/src/freeipa/user.js @@ -515,7 +515,7 @@ IPA.user_password_widget = function(spec) { } else { that.display_control.text(that.unset_value); } - that.on_value_changed(); + that.on_value_changed(values); }; that.clear = function() { diff --git a/install/ui/src/freeipa/util.js b/install/ui/src/freeipa/util.js index a33ebee0b..0032c8ace 100644 --- a/install/ui/src/freeipa/util.js +++ b/install/ui/src/freeipa/util.js @@ -111,7 +111,7 @@ define([ function is_empty(value) { var empty = false; - if (!value) empty = true; + if (value === null || value === undefined) empty = true; if (lang.isArray(value)) { empty = empty || value.length === 0 || diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 5f2428c7b..3d9296bdb 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -586,10 +586,12 @@ IPA.input_widget = function(spec) { * Raise value change event * @protected */ - that.on_value_changed = function() { - var value = that.save(); + that.on_value_changed = function(value) { + var old = that.value; + if (value === undefined) value = that.save(); + that.value = value; that.value_changed.notify([value], that); - that.emit('value-change', { source: that, value: value }); + that.emit('value-change', { source: that, value: value, old: old }); }; /** @@ -805,7 +807,7 @@ IPA.text_widget = function(spec) { var value = values && values.length ? values[0] : ''; that.display_control.text(value); that.input.val(value); - that.on_value_changed(); + that.on_value_changed(values); }; /** @@ -837,7 +839,7 @@ IPA.text_widget = function(spec) { that.clear = function() { that.input.val(''); that.display_control.text(''); - that.on_value_changed(); + that.on_value_changed([]); }; /** @@ -1741,7 +1743,7 @@ IPA.option_widget_base = function(spec, that) { } if (that.on_value_changed) { - that.on_value_changed(); + that.on_value_changed(values); } }; @@ -2044,7 +2046,7 @@ IPA.select_widget = function(spec) { // default was selected instead of supplied value, hence notify util.emit_delayed(that,'value-change', { source: that }); } - that.on_value_changed(); + that.on_value_changed(values); }; that.update_read_only = function() { @@ -2161,7 +2163,7 @@ IPA.textarea_widget = function (spec) { var value = values && values.length ? values[0] : ''; that.input.val(value); - that.on_value_changed(); + that.on_value_changed(values); }; that.update_read_only = function() { @@ -2946,7 +2948,7 @@ IPA.table_widget = function (spec) { that.values.push(record[that.value_attr_name]); that.add_record(record); } - that.on_value_changed(); + that.on_value_changed(records); }; that.save = function() { @@ -3838,7 +3840,7 @@ IPA.combobox_widget = function(spec) { that.select(value); } ); - that.on_value_changed(); + that.on_value_changed(values); }; that.update_read_only = function() { @@ -4058,7 +4060,7 @@ IPA.link_widget = function(spec) { that.nonlink.html(that.value); that.check_entity_link(); - that.on_value_changed(); + that.on_value_changed(values); }; that.update_link = function() { @@ -5298,7 +5300,7 @@ IPA.sshkey_widget = function(spec) { that.original_key = that.key.key; } that.update_link(); - that.on_value_changed(); + that.on_value_changed(value); }; that.set_deleted = function(deleted) { @@ -5609,7 +5611,7 @@ IPA.value_map_widget = function(spec) { } that.display_control.text(label); - that.on_value_changed(); + that.on_value_changed(values); }; that.save = function() { |