diff --git a/install/ui/src/freeipa/facet.js b/install/ui/src/freeipa/facet.js
index df54ceaba..17033f96c 100644
--- a/install/ui/src/freeipa/facet.js
+++ b/install/ui/src/freeipa/facet.js
@@ -28,6 +28,7 @@ define([
'dojo/on',
'dojo/Stateful',
'dojo/Evented',
+ './_base/Builder',
'./ipa',
'./jquery',
'./navigation',
@@ -36,7 +37,7 @@ define([
'./field',
'./widget'
], function(declare, lang, construct, on, Stateful, Evented,
- IPA, $, navigation, text) {
+ Builder, IPA, $, navigation, text) {
/**
* Facet represents the content of currently displayed page.
@@ -102,8 +103,6 @@ exp.facet_spec = {};
exp.facet = IPA.facet = function(spec, no_init) {
spec = spec || {};
- spec.state = spec.state || {};
- $.extend(spec.state, { factory: IPA.state });
var that = new Evented();
@@ -119,8 +118,8 @@ exp.facet = IPA.facet = function(spec, no_init) {
that.disable_breadcrumb = spec.disable_breadcrumb;
that.disable_facet_tabs = spec.disable_facet_tabs;
- that.action_state = IPA.build(spec.state);
- that.actions = IPA.build({ actions: spec.actions }, IPA.action_holder_builder);
+ that.action_state = IPA.build(spec.state, {}, { factory: exp.state });
+ that.actions = exp.action_holder_builder.build({ actions: spec.actions });
that.header_actions = spec.header_actions;
that.header = spec.header || IPA.facet_header({ facet: that });
@@ -1716,15 +1715,6 @@ exp.action = IPA.action = function(spec) {
return that;
};
-exp.action_builder = IPA.action_builder = function(spec) {
-
- spec = spec || {};
- spec.factory = spec.factory || IPA.action;
- var that = IPA.builder(spec);
- return that;
-};
-
-
exp.action_holder = IPA.action_holder = function(spec) {
spec = spec || {};
@@ -1738,7 +1728,7 @@ exp.action_holder = IPA.action_holder = function(spec) {
var i, action, actions;
that.facet = facet;
- actions = IPA.build(spec.actions, IPA.action_builder) || [];
+ actions = exp.action_builder.build(spec.actions);
for (i=0; i.
*/
-define(['./jquery', './json2','./_base/i18n', './_base/metadata_provider', './text'],
- function($, JSON, i18n, metadata_provider, text) {
+define(['./jquery',
+ './json2',
+ './_base/Builder',
+ './_base/i18n',
+ './_base/metadata_provider',
+ './text'],
+ function($, JSON, Builder, i18n, metadata_provider, text) {
var IPA = function() {
@@ -1144,88 +1149,11 @@ IPA.concurrent_command = function(spec) {
return that;
};
-IPA.builder = function(spec) {
+IPA.builder = new Builder();
- spec = spec || {};
+IPA.build = function(spec, context, overrides) {
- var that = {};
-
- that.factory = spec.factory || IPA.default_factory;
-
- that.build = function(spec) {
-
- var factory = spec.factory || that.factory;
-
- //when spec is a factory function
- if (!spec.factory && typeof spec === 'function') {
- factory = spec;
- spec = {};
- }
-
- var obj = factory(spec);
- return obj;
- };
-
- that.build_objects = function(specs) {
-
- var objects = [];
-
- for (var i=0; i