Re: [Freeipa-devel] [PATCH] 655 webui: move RPC result extraction logic to Adapter

2014-06-16 Thread Petr Vobornik

On 12.6.2014 14:40, Endi Sukma Dewata wrote:

On 6/11/2014 8:05 AM, Petr Vobornik wrote:

It enables declarative extraction of values from partial
results of a batch commands and also further extensibility
in custom adapters.

The default adapter has detection logic for this extraction so
it can use bare record or extract data from normal or batch RPC
command.

Minor change of user plugin fixed:
https://fedorahosted.org/freeipa/ticket/4355


ACK.


Pushed to master: 5a428608beb3752b111b558ba2355ef112a057f1

--
Petr Vobornik

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 655 webui: move RPC result extraction logic to Adapter

2014-06-12 Thread Endi Sukma Dewata

On 6/11/2014 8:05 AM, Petr Vobornik wrote:

It enables declarative extraction of values from partial
results of a batch commands and also further extensibility
in custom adapters.

The default adapter has detection logic for this extraction so
it can use bare record or extract data from normal or batch RPC
command.

Minor change of user plugin fixed:
https://fedorahosted.org/freeipa/ticket/4355


ACK.

--
Endi S. Dewata

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


[Freeipa-devel] [PATCH] 655 webui: move RPC result extraction logic to Adapter

2014-06-11 Thread Petr Vobornik

It enables declarative extraction of values from partial
results of a batch commands and also further extensibility
in custom adapters.

The default adapter has detection logic for this extraction so
it can use bare record or extract data from normal or batch RPC
command.

Minor change of user plugin fixed:
https://fedorahosted.org/freeipa/ticket/4355
--
Petr Vobornik
From b90d2760c64992ef8303ad0bc674dcd695d4e8fe Mon Sep 17 00:00:00 2001
From: Petr Vobornik pvobo...@redhat.com
Date: Wed, 28 May 2014 14:45:57 +0200
Subject: [PATCH] webui: move RPC result extraction logic to Adapter

It enables declarative extraction of values from partial
results of a batch commands and also further extensibility
in custom adapters.

The default adapter has detection logic for this extraction so
it can use bare record or extract data from normal or batch RPC
command.

Minor change of user plugin fixed:
https://fedorahosted.org/freeipa/ticket/4355
---
 install/ui/src/freeipa/automember.js |  2 +-
 install/ui/src/freeipa/details.js| 39 ++-
 install/ui/src/freeipa/dns.js| 19 ++---
 install/ui/src/freeipa/field.js  | 74 +---
 install/ui/src/freeipa/rule.js   |  6 +--
 install/ui/src/freeipa/service.js|  6 ++-
 install/ui/src/freeipa/user.js   | 61 +
 install/ui/src/freeipa/util.js   |  3 --
 8 files changed, 120 insertions(+), 90 deletions(-)

diff --git a/install/ui/src/freeipa/automember.js b/install/ui/src/freeipa/automember.js
index 6faddae07a034c41c9baf216c495ea35791b9aad..621ed6d1f40affc6b6fa691e0ab9e01239d42ad9 100644
--- a/install/ui/src/freeipa/automember.js
+++ b/install/ui/src/freeipa/automember.js
@@ -455,7 +455,7 @@ IPA.automember.condition_field = function(spec) {
 
 IPA.automember.condition_adapter = declare([field_mod.Adapter], {
 
-load: function(record) {
+load: function(data) {
 var regexes = this.inherited(arguments);
 var values = [];
 if (regexes) {
diff --git a/install/ui/src/freeipa/details.js b/install/ui/src/freeipa/details.js
index a3aac27c7a32eb59338d9c093f16b397b6411e56..b7fa3646921dd8a3229d1bb397373d808877fa17 100644
--- a/install/ui/src/freeipa/details.js
+++ b/install/ui/src/freeipa/details.js
@@ -237,15 +237,15 @@ exp.section_builder = IPA.section_builder = function(spec) {
  */
 that.build_section = function(section_spec, index) {
 
-var spec = section_spec;
+var spec = {};
 var overrides = {};
 var spec_type = typeof that.section_spec;
 if (spec_type === 'object') {
 spec = lang.mixin({}, that.section_spec);
-spec = lang.mixin(spec, section_spec);
 } else if (spec_type === function) {
 overrides = that.section_spec;
 }
+spec = lang.mixin(spec, section_spec);
 
 if (!spec.label  spec.name  that.container.entity) {
 var section_label = '@i18n:objects.'+that.container.entity.name+
@@ -261,7 +261,9 @@ exp.section_builder = IPA.section_builder = function(spec) {
 }, overrides);
 
 that.container.widgets.add_widget(section);
+section.$field_adapter = spec.field_adapter;
 that.create_fields(section, spec.fields);
+delete section.$field_adapter;
 };
 
 /**
@@ -283,8 +285,18 @@ exp.section_builder = IPA.section_builder = function(spec) {
  */
 that.create_field = function(section, field_spec) {
 
+if (typeof field_spec === 'string') {
+field_spec = {
+name: field_spec
+};
+}
+
 var widget = that.widget_builder.build_widget(field_spec, section.widgets);
 
+if (section.$field_adapter  !field_spec.adapter) {
+field_spec.adapter = section.$field_adapter;
+}
+
 //spec.$factory refers to widget factory
 if(field_spec.$factory) delete field_spec.$factory;
 
@@ -714,7 +726,7 @@ exp.details_facet = IPA.details_facet = function(spec, no_init) {
 var fields = that.fields.get_fields();
 for (var i=0; ifields.length; i++) {
 var field = fields[i];
-field.load(data.result.result);
+field.load(data);
 }
 that.policies.post_load(data);
 that.post_load.notify([data], that);
@@ -1467,6 +1479,10 @@ exp.boolean_state_evaluator = IPA.boolean_state_evaluator = function(spec) {
  */
 that.field_name = spec.field;
 
+that.param = spec.param || that.field_name;
+
+that.adapter = builder.build('adapter', spec.adapter || 'adapter', { context: that });
+
 /**
  * State to set when value is `true`
  * @property {string}
@@ -1504,10 +1520,10 @@ exp.boolean_state_evaluator = IPA.boolean_state_evaluator = function(spec) {
 that.on_event = function(data) {
 
 var old_state = that.state;
-var record = data.result.result;
 that.state = [];
 
-var value =