diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2013-04-11 17:02:48 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2013-05-06 16:22:24 +0200 |
commit | 3b77c63b2acfc36b4f8472018acc2d177c8fd0db (patch) | |
tree | aa4fcbf07a8404e317e3d75b9974ab1fbcb5d372 /install/ui | |
parent | 0dc4b133fb0795b9c55f8a9fc95b55bc4df7ebf2 (diff) | |
download | freeipa-3b77c63b2acfc36b4f8472018acc2d177c8fd0db.tar.gz freeipa-3b77c63b2acfc36b4f8472018acc2d177c8fd0db.tar.xz freeipa-3b77c63b2acfc36b4f8472018acc2d177c8fd0db.zip |
Use IPA.object() as a base factory for framework objects
https://fedorahosted.org/freeipa/ticket/3235
Diffstat (limited to 'install/ui')
-rw-r--r-- | install/ui/src/freeipa/association.js | 4 | ||||
-rwxr-xr-x | install/ui/src/freeipa/certificate.js | 2 | ||||
-rw-r--r-- | install/ui/src/freeipa/details.js | 18 | ||||
-rw-r--r-- | install/ui/src/freeipa/dialog.js | 4 | ||||
-rw-r--r-- | install/ui/src/freeipa/entity.js | 10 | ||||
-rw-r--r-- | install/ui/src/freeipa/facet.js | 18 | ||||
-rw-r--r-- | install/ui/src/freeipa/field.js | 8 | ||||
-rw-r--r-- | install/ui/src/freeipa/ipa.js | 8 | ||||
-rw-r--r-- | install/ui/src/freeipa/net.js | 2 | ||||
-rw-r--r-- | install/ui/src/freeipa/widget.js | 14 | ||||
-rw-r--r-- | install/ui/test/build_tests.js | 13 |
11 files changed, 52 insertions, 49 deletions
diff --git a/install/ui/src/freeipa/association.js b/install/ui/src/freeipa/association.js index 505cbbfd1..e378ad443 100644 --- a/install/ui/src/freeipa/association.js +++ b/install/ui/src/freeipa/association.js @@ -29,7 +29,7 @@ IPA.associator = function (spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.entity = IPA.get_entity(spec.entity); that.pkey = spec.pkey; @@ -327,7 +327,7 @@ IPA.association_config = function (spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.name = spec.name; that.associator = spec.associator; diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js index 442e1824b..db262159b 100755 --- a/install/ui/src/freeipa/certificate.js +++ b/install/ui/src/freeipa/certificate.js @@ -430,7 +430,7 @@ IPA.cert.loader = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.get_pkey = spec.get_pkey; that.get_name = spec.get_name; that.get_principal = spec.get_principal; diff --git a/install/ui/src/freeipa/details.js b/install/ui/src/freeipa/details.js index dffa187e9..69c85d54e 100644 --- a/install/ui/src/freeipa/details.js +++ b/install/ui/src/freeipa/details.js @@ -32,7 +32,7 @@ exp.collapsed_icon = IPA.collapsed_icon = 'collapsed-icon'; exp.details_builder = IPA.details_builder = function(spec) { - var that = {}; + var that = IPA.object(); that.widgets = spec.container.widgets; that.fields = spec.container.fields; @@ -104,7 +104,7 @@ exp.section_builder = IPA.section_builder = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.container = spec.container; that.section_factory = spec.section_factory || IPA.details_table_section; @@ -167,7 +167,7 @@ exp.section_builder = IPA.section_builder = function(spec) { exp.facet_policy = IPA.facet_policy = function() { - var that = {}; + var that = IPA.object(); that.init = function() { }; @@ -183,7 +183,7 @@ exp.facet_policy = IPA.facet_policy = function() { exp.facet_policies = IPA.facet_policies = function(spec) { - var that = {}; + var that = IPA.object(); that.container = spec.container; that.policies = []; @@ -721,7 +721,7 @@ exp.details_facet = IPA.details_facet = function(spec, no_init) { exp.update_info = IPA.update_info = function(spec) { - var that = {}; + var that = IPA.object(); that.fields = spec.fields || []; that.commands = spec.commands || []; @@ -741,7 +741,7 @@ exp.update_info = IPA.update_info = function(spec) { exp.command_info = IPA.command_info = function(spec) { - var that = {}; + var that = IPA.object(); that.command = spec.command; that.priority = spec.priority || IPA.config.default_priority; @@ -751,7 +751,7 @@ exp.command_info = IPA.command_info = function(spec) { exp.field_info = IPA.field_info = function(spec) { - var that = {}; + var that = IPA.object(); that.field = spec.field; that.value = spec.value; @@ -761,7 +761,7 @@ exp.field_info = IPA.field_info = function(spec) { exp.update_info_builder = IPA.update_info_builder = function() { - var that = {}; + var that = IPA.object(); that.new_update_info = function (fields, commands) { return IPA.update_info({ @@ -801,7 +801,7 @@ exp.update_info_builder = IPA.update_info_builder = function() { exp.command_builder = IPA.command_builder = function() { - var that = {}; + var that = IPA.object(); that.add_field_option = function(command, field, values) { if (!field || !values) return; diff --git a/install/ui/src/freeipa/dialog.js b/install/ui/src/freeipa/dialog.js index 2243c5ac0..36a143d23 100644 --- a/install/ui/src/freeipa/dialog.js +++ b/install/ui/src/freeipa/dialog.js @@ -54,7 +54,7 @@ IPA.dialog_button = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.name = spec.name; that.label = text.get(spec.label || spec.name); @@ -86,7 +86,7 @@ IPA.dialog = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.entity = IPA.get_entity(spec.entity); that.name = spec.name || 'dialog'; diff --git a/install/ui/src/freeipa/entity.js b/install/ui/src/freeipa/entity.js index 2470ac3f7..2d0e97f84 100644 --- a/install/ui/src/freeipa/entity.js +++ b/install/ui/src/freeipa/entity.js @@ -32,7 +32,7 @@ IPA.entity = function(spec) { IPA.details_facet_update_policy() ]; - var that = {}; + var that = IPA.object(); that.name = spec.name; that.label = text.get(spec.label); @@ -172,7 +172,7 @@ IPA.entity = function(spec) { IPA.entity_builder = function() { - var that = {}; + var that = IPA.object(); var entity = null; var facet_group = null; @@ -422,7 +422,7 @@ IPA.entity_builder = function() { IPA.dialog_builder = function(entity) { - var that = {}; + var that = IPA.object(); that.build_dialogs = function() { @@ -450,7 +450,7 @@ IPA.entity_policy = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.entity = spec.entity; @@ -462,7 +462,7 @@ IPA.entity_policy = function(spec) { IPA.entity_policies = function(spec) { - var that = {}; + var that = IPA.object(); that.entity = spec.entity; that.policies = []; diff --git a/install/ui/src/freeipa/facet.js b/install/ui/src/freeipa/facet.js index 958941291..3afe76e04 100644 --- a/install/ui/src/freeipa/facet.js +++ b/install/ui/src/freeipa/facet.js @@ -673,7 +673,7 @@ exp.facet_header = IPA.facet_header = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.facet = spec.facet; @@ -1004,7 +1004,7 @@ exp.facet_title = IPA.facet_title = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.update = function(data) { @@ -1432,7 +1432,7 @@ exp.facet_group = IPA.facet_group = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.name = spec.name; that.label = text.get(spec.label); @@ -1464,7 +1464,7 @@ exp.facet_group = IPA.facet_group = function(spec) { exp.facet_builder = IPA.facet_builder = function(entity) { - var that = {}; + var that = IPA.object(); that.prepare_methods = {}; @@ -1623,7 +1623,7 @@ exp.action = IPA.action = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.name = spec.name; that.label = text.get(spec.label); @@ -1719,7 +1719,7 @@ exp.action_holder = IPA.action_holder = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.actions = $.ordered_map(); @@ -1776,7 +1776,7 @@ exp.state = IPA.state = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.state = $.ordered_map(); @@ -1845,7 +1845,7 @@ exp.summary_evaluator = IPA.summary_evaluator = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.evaluate = function(state) { @@ -1880,7 +1880,7 @@ exp.state_evaluator = IPA.state_evaluator = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.name = spec.name || 'state_evaluator'; that.event_name = spec.event; diff --git a/install/ui/src/freeipa/field.js b/install/ui/src/freeipa/field.js index 0ba823d12..fe14204c0 100644 --- a/install/ui/src/freeipa/field.js +++ b/install/ui/src/freeipa/field.js @@ -28,7 +28,7 @@ define(['dojo/_base/array', './ipa', './jquery', './navigation', './text'], IPA.field = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.entity = IPA.get_entity(spec.entity); that.facet = spec.facet; @@ -416,7 +416,7 @@ IPA.validator = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.message = text.get(spec.message || '@i18n:widget.validation.error'); @@ -830,7 +830,7 @@ IPA.field_container = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.container = spec.container; //usually facet or dialog @@ -866,7 +866,7 @@ IPA.field_builder = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.default_factory = spec.default_factory || IPA.field; that.container = spec.container; diff --git a/install/ui/src/freeipa/ipa.js b/install/ui/src/freeipa/ipa.js index c8bf4daee..a92b23ac8 100644 --- a/install/ui/src/freeipa/ipa.js +++ b/install/ui/src/freeipa/ipa.js @@ -591,7 +591,7 @@ IPA.command = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.name = spec.name; @@ -1029,7 +1029,7 @@ IPA.batch_command = function (spec) { IPA.concurrent_command = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.commands = []; that.on_success = spec.on_success; @@ -1177,7 +1177,7 @@ IPA.default_factory = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); $.extend(that, spec); @@ -1443,7 +1443,7 @@ IPA.error_dialog = function(spec) { }; IPA.error_list = function() { - var that = {}; + var that = IPA.object(); that.clear = function() { that.errors = []; diff --git a/install/ui/src/freeipa/net.js b/install/ui/src/freeipa/net.js index 11a245c0b..03f2e7e73 100644 --- a/install/ui/src/freeipa/net.js +++ b/install/ui/src/freeipa/net.js @@ -32,7 +32,7 @@ NET.ip_address = function(spec) { }; } - var that = {}; + var that = IPA.object(); that.input = spec.address; diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index fc01bc082..6e934fa2b 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -33,7 +33,7 @@ IPA.widget = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.name = spec.name; that.id = spec.id; @@ -1247,7 +1247,7 @@ IPA.formatter = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.type = spec.type; // default is text @@ -1373,7 +1373,7 @@ IPA.column = function (spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.entity = IPA.get_entity(spec.entity); that.name = spec.name; @@ -3399,7 +3399,7 @@ IPA.header_widget = function(spec) { IPA.observer = function(spec) { - var that = {}; + var that = IPA.object(); that.listeners = []; @@ -3430,7 +3430,7 @@ IPA.observer = function(spec) { IPA.html_util = function() { - var that = {}; + var that = IPA.object(); that.id_count = 0; that.get_next_id = function(prefix) { @@ -3445,7 +3445,7 @@ IPA.widget_container = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.new_container_for_child = spec.new_container_for_child !== undefined ? spec.new_container_for_child : true; @@ -3523,7 +3523,7 @@ IPA.widget_builder = function(spec) { spec = spec || {}; - var that = {}; + var that = IPA.object(); that.default_factory = spec.default_factory || IPA.text_widget; that.container = spec.container; diff --git a/install/ui/test/build_tests.js b/install/ui/test/build_tests.js index 603f41fab..28af584e3 100644 --- a/install/ui/test/build_tests.js +++ b/install/ui/test/build_tests.js @@ -22,9 +22,10 @@ define([ 'dojo/_base/declare', 'freeipa/_base/Builder', 'freeipa/_base/Spec_mod', + 'freeipa/ipa', 'freeipa/spec_util' ], - function(declare, Builder, Spec_mod, su) { return function() { + function(declare, Builder, Spec_mod, IPA, su) { return function() { module('build',{ @@ -39,7 +40,7 @@ test('Testing builder', function() { var simple_factory = function(spec) { - var that = {}; + var that = IPA.object(); su.set(that, spec, 'foo', 'bar'); return that; }; @@ -56,13 +57,14 @@ test('Testing builder', function() { var o1 = b1.build({}); var o11 = b1.build({ foo: 'baz'}); + var o12 = b1.build(o11); var o2 = b2.build({}); var o21 = b2.build({ foo: 'baz'}); var o22 = b2.build(o21); - var r1 = { foo: 'bar' }; - var r11 = { foo: 'baz' }; + var r1 = simple_factory({}); + var r11 = simple_factory({ foo: 'baz' }); var r2 = new Simple_class({}); var r21 = new Simple_class({ foo:'baz'}); @@ -72,7 +74,8 @@ test('Testing builder', function() { deepEqual(o2, r2, 'Constructor, default'); deepEqual(o21, r21, 'Constructor, spec use'); - strictEqual(o21, o22, 'Don\'t build built object'); + strictEqual(o11, o12, 'Don\'t build built object - factory'); + strictEqual(o21, o22, 'Don\'t build built object - constructor'); }); |