From 31eebda584d556454104a8fbf26974b6b49d9589 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Wed, 29 Feb 2012 18:53:11 +0100 Subject: Removed CSV creation from UI Creating CSV values in UI is unnecessary and error-prone because server converts them back to list. Possible problems with values containing commas may occur. All occurrences of CSV joining were therefore removed. https://fedorahosted.org/freeipa/ticket/2227 --- install/ui/aci.js | 14 ++++---------- install/ui/add.js | 12 +++++------- install/ui/association.js | 24 ++++++------------------ install/ui/details.js | 2 -- install/ui/dns.js | 2 +- install/ui/field.js | 1 - install/ui/rule.js | 2 +- install/ui/widget.js | 2 +- 8 files changed, 18 insertions(+), 41 deletions(-) (limited to 'install') diff --git a/install/ui/aci.js b/install/ui/aci.js index ec3c8065b..ba4a22bf1 100644 --- a/install/ui/aci.js +++ b/install/ui/aci.js @@ -46,7 +46,6 @@ IPA.aci.permission_entity = function(spec) { { type: 'rights', name: 'permissions', - join: true, widget: 'rights.permissions' }, { @@ -142,7 +141,6 @@ IPA.aci.permission_entity = function(spec) { { type: 'rights', name: 'permissions', - join: true, widget: 'general.permissions' }, { @@ -407,14 +405,12 @@ IPA.aci.delegation_entity = function(spec) { type: 'entity_select', name: 'memberof', other_entity: that.group_entity, - other_field: 'cn', - join: true + other_field: 'cn' }, { type: 'attributes', name: 'attrs', - object_type: 'user', - join: true + object_type: 'user' } ] } @@ -434,14 +430,12 @@ IPA.aci.delegation_entity = function(spec) { type: 'entity_select', name: 'memberof', other_entity: that.group_entity, - other_field: 'cn', - join: true + other_field: 'cn' }, { type: 'attributes', name: 'attrs', - object_type: 'user', - join: true + object_type: 'user' } ] }); diff --git a/install/ui/add.js b/install/ui/add.js index 9b473ccc2..671d3f1fc 100644 --- a/install/ui/add.js +++ b/install/ui/add.js @@ -123,16 +123,14 @@ IPA.entity_adder_dialog = function(spec) { var field = fields[j]; var values = record[field.param]; - if (!values) continue; - - // TODO: Handle multi-valued attributes like in detail facet's update() - var value = values.join(','); - if (!value) continue; + if (!values || values.length === 0) continue; if (field.param === pkey_name) { - command.add_arg(value); + command.add_arg(values[0]); + } else if (values.length === 1) { + command.set_option(field.param, values[0]); } else { - command.set_option(field.param, value); + command.set_option(field.param, values); } } diff --git a/install/ui/association.js b/install/ui/association.js index 72e1f0c0e..b170b39d2 100644 --- a/install/ui/association.js +++ b/install/ui/association.js @@ -110,29 +110,17 @@ IPA.bulk_associator = function(spec) { return; } - var value = that.values.shift(); - if (!value) { - that.on_success(); - return; - } - - while (that.values.length > 0) { - value += ',' + that.values.shift(); - } - - var args = [that.pkey]; - var options = { 'all': true }; - options[that.other_entity.name] = value; - var command = IPA.command({ entity: that.entity.name, method: that.method, - args: args, - options: options, + args: [that.pkey], + options: { 'all': true }, on_success: that.on_success, on_error: that.on_error }); + command.set_option(that.other_entity.name, that.values); + //alert(JSON.stringify(command.to_json())); command.execute(); @@ -556,7 +544,7 @@ IPA.association_table_widget = function (spec) { on_success: on_success, on_error: on_error }); - command.set_option(that.other_entity.name, values.join(',')); + command.set_option(that.other_entity.name, values); command.execute(); }; @@ -619,7 +607,7 @@ IPA.association_table_widget = function (spec) { on_error: on_error }); - command.set_option(that.other_entity.name, values.join(',')); + command.set_option(that.other_entity.name, values); command.execute(); }; diff --git a/install/ui/details.js b/install/ui/details.js index d68ebd07c..8d5dcff68 100644 --- a/install/ui/details.js +++ b/install/ui/details.js @@ -844,8 +844,6 @@ IPA.command_builder = function() { if (field.metadata.primary_key) return; if (values.length === 1) { command.set_option(name, values[0]); - } else if (field.join) { - command.set_option(name, values.join(',')); } else { command.set_option(name, values); } diff --git a/install/ui/dns.js b/install/ui/dns.js index 4182074a8..4cc6d4c53 100644 --- a/install/ui/dns.js +++ b/install/ui/dns.js @@ -1613,7 +1613,7 @@ IPA.dns.record_type_table_widget = function(spec) { }); var record_name = that.dnstype.toLowerCase()+'record'; - command.set_option(record_name, values.join(',')); + command.set_option(record_name, values); command.set_option('structured', true); command.execute(); diff --git a/install/ui/field.js b/install/ui/field.js index a6553b1a8..5f073705d 100644 --- a/install/ui/field.js +++ b/install/ui/field.js @@ -52,7 +52,6 @@ IPA.field = function(spec) { that.enabled = spec.enabled === undefined ? true : spec.enabled; that.undo = spec.undo === undefined ? true : spec.undo; - that.join = spec.join; that.metadata = spec.metadata; that.validators = spec.validators || []; diff --git a/install/ui/rule.js b/install/ui/rule.js index 2a1648321..b7e6a74a2 100644 --- a/install/ui/rule.js +++ b/install/ui/rule.js @@ -213,7 +213,7 @@ IPA.rule_association_table_field = function(spec) { options: {all: true, rights: true} }); - command.set_option(that.widget.other_entity.name, values.join(',')); + command.set_option(that.widget.other_entity.name, values); update_info.append_command(command, that.priority); } } diff --git a/install/ui/widget.js b/install/ui/widget.js index d288a9bf4..f906d165c 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -1916,7 +1916,7 @@ IPA.attribute_table_widget = function(spec) { on_error: on_error }); - command.set_option(that.attribute_name, values.join(',')); + command.set_option(that.attribute_name, values); var additional_options = that.get_additional_options(); for (var i=0; i