summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2011-01-26 13:46:49 -0500
committerAdam Young <ayoung@redhat.com>2011-01-27 16:49:11 -0500
commitc3e065879056d85f0a769368c82b128a58c148e1 (patch)
tree628029b9ff1067408c6426d5def89a2086abf917 /install
parentf904df0f0dfd4734f978cdc3ddf5badabc067ed6 (diff)
downloadfreeipa-c3e065879056d85f0a769368c82b128a58c148e1.tar.gz
freeipa-c3e065879056d85f0a769368c82b128a58c148e1.tar.xz
freeipa-c3e065879056d85f0a769368c82b128a58c148e1.zip
declarative for aci
A couple of the ACI definitions were incorrect, and the end result was that fields were not getting initialized. USing the declarative approach cleaned up the cause. Also fixed a few broken unit tests
Diffstat (limited to 'install')
-rw-r--r--install/ui/aci.js340
-rw-r--r--install/ui/hbacrule.js2
-rw-r--r--install/ui/hbacsvc.js2
-rw-r--r--install/ui/hbacsvcgroup.js2
-rw-r--r--install/ui/serverconfig.js34
-rw-r--r--install/ui/test/details_tests.js6
-rw-r--r--install/ui/test/entity_tests.js11
-rw-r--r--install/ui/test/navigation_tests.js10
8 files changed, 124 insertions, 283 deletions
diff --git a/install/ui/aci.js b/install/ui/aci.js
index f7d7266f..1cc1611c 100644
--- a/install/ui/aci.js
+++ b/install/ui/aci.js
@@ -457,9 +457,6 @@ IPA.target_section = function () {
appendTo(dl);
}
-
-
-
that.create = function(container) {
var dl = $('<dl class="aci-target"/>').appendTo(container);
display_filter_target(dl);
@@ -563,111 +560,35 @@ IPA.target_section = function () {
IPA.entity_factories.permission = function () {
- var that = IPA.entity({
+ return IPA.entity({
'name': 'permission'
- });
-
- that.init = function() {
-
- var dialog = IPA.permission_add_dialog({
+ }).add_dialog(
+ IPA.add_dialog({
name: 'add',
- title: 'Add New Permission',
- entity_name: 'permission'
- });
- that.add_dialog(dialog);
- dialog.init();
-
- var facet = IPA.permission_search_facet({
- name: 'search',
- label: 'Search'
- });
- that.add_facet(facet);
-
- facet = IPA.permission_details_facet();
- that.add_facet(facet);
-
- that.entity_init();
- };
-
- return that;
-};
-
-
-
-IPA.permission_add_dialog = function (spec) {
-
- spec = spec || {};
-
- var that = IPA.add_dialog(spec);
-
- that.init = function() {
-
- that.add_field(IPA.text_widget({
- name: 'cn',
- undo: false
- }));
-
- that.add_field(IPA.text_widget({
- name: 'description',
- undo: false
- }));
-
- that.add_field(IPA.rights_widget({name:'permissions'}));
- that.add_field(IPA.hidden_widget({name:'filter','value':'objectClass=changethisvalue'}));
- that.add_dialog_init();
- };
-
-
- return that;
-};
-
-
-IPA.permission_search_facet = function (spec) {
-
- spec = spec || {};
- var that = IPA.search_facet(spec);
- that.init = function() {
- that.create_column({name:'cn'});
- that.create_column({name:'description'});
- that.search_facet_init();
- };
- return that;
-};
-
-
-IPA.permission_details_facet = function () {
-
- var spec = {
- name: 'details'
- };
- var that = IPA.details_facet(spec);
-
- that.init = function() {
-
- var section = that.add_section(IPA.details_list_section({
- name:'identity',label:'Identity' }));
- section.create_field({ name: 'cn', 'read_only': true });
- section.create_field({ name: 'description'});
-
- that.rights_section = IPA.rights_section();
- that.add_section(that.rights_section);
-
- that.target_section = IPA.target_section();
-
- that.add_section(that.target_section);
- that.details_facet_init();
- };
-
- that.superior_load = that.load;
-
- that.load = function(result) {
- that.superior_load(result);
- };
-
- that.superior_update = that.update;
- that.update = function(on_win, on_fail){
- that.superior_update(on_win, on_fail);
- };
+ title: 'Add New Permission'
+ }).
+ field(IPA.text_widget({
+ name: 'cn',
+ undo: false
+ })).
+ field(IPA.text_widget({
+ name: 'description',
+ undo: false
+ })).
+ field(IPA.rights_widget({name:'permissions'})).
+ field(IPA.hidden_widget(
+ {name:'filter','value':'objectClass=changethisvalue'}))).
+ facet(IPA.search_facet().
+ column({name:'cn'}).
+ column({name:'description'})).
+ facet(IPA.details_facet({ name: 'details' }).
+ section(
+ IPA.stanza({
+ name:'identity',label:'Identity' }).
+ input({ name: 'cn', 'read_only': true }).
+ input({ name: 'description'})).
+ section(IPA.rights_section()).
+ section(IPA.target_section()));
return that;
};
@@ -716,156 +637,89 @@ IPA.entity_factories.privilege = function() {
IPA.entity_factories.role = function() {
- var that = IPA.entity({
+ return IPA.entity({
'name': 'role'
- });
- that.init = function() {
- var search_facet = IPA.search_facet({
- name: 'search',
- label: 'Search',
- entity_name: that.name
- });
- search_facet.create_column({name:'cn'});
- search_facet.create_column({name:'description'});
- that.add_facet(search_facet);
-
- that.add_facet(function() {
- var that = IPA.details_facet({name:'details'});
- that.add_section(
- IPA.stanza({name:'identity', label:'Role Settings'}).
- input({name:'cn'}).
- input({name: 'description'}));
- return that;
- }());
-
- var dialog = IPA.add_dialog({
- name: 'add',
- title: 'Add Role'
- });
- that.add_dialog(dialog);
-
- dialog.add_field(IPA.text_widget({ name: 'cn', undo: false}));
- dialog.add_field(IPA.text_widget({ name: 'description', undo: false}));
- dialog.init();
-
- that.create_association_facets();
-
- that.entity_init();
- };
- return that;
+ }).
+ facet(IPA.search_facet().
+ column({name:'cn'}).
+ column({name:'description'})).
+ facet(
+ IPA.details_facet({name:'details'}).
+ section(
+ IPA.stanza({name:'identity', label:'Role Settings'}).
+ input({name:'cn'}).
+ input({name: 'description'}))).
+ add_dialog(
+ IPA.add_dialog({
+ name: 'add',
+ title: 'Add Role'
+ }).
+ field(IPA.text_widget({ name: 'cn', undo: false})).
+ field(IPA.text_widget({ name: 'description', undo: false}))).
+ standard_associations();
};
IPA.entity_factories.selfservice = function() {
- var that = IPA.entity({
+ return IPA.entity({
'name': 'selfservice'
- });
-
- that.add_facet(function () {
- var spec = {
- name: 'search',
- label: 'Search'
- };
- var that = IPA.search_facet(spec);
- that.init = function() {
- that.create_column({name:'aciname'});
- that.search_facet_init();
- };
- return that;
- }());
-
-
- that.add_facet(function(){
- var that = IPA.details_facet({'name':'details'});
-
- that.init = function() {
- that.add_section(
- IPA.stanza({name:'general', label:'General',
- entity_name:'selfservice'}).
- input({name:'aciname'}).
- custom_input(IPA.attribute_table_widget({
- object_type:'user',
- name:'attrs'
- })));
- };
- return that;
- }());
-
- that.parent_init = that.init;
- that.init = function(){
- that.parent_init();
- var dialog = IPA.add_dialog({
- name: 'add',
- title: 'Add Self Service Definition'
- });
- that.add_dialog(dialog);
- dialog.add_field(IPA.text_widget({ name: 'aciname', undo: false}));
- dialog.add_field(IPA.attribute_table_widget({
- object_type:'user',
- name:'attrs'
- }));
- dialog.init();
- };
- return that;
+ }).
+ facet(IPA.search_facet().
+ column({name:'aciname'})).
+ facet(
+ IPA.details_facet({'name':'details'}).
+ section(
+ IPA.stanza({name:'general', label:'General'}).
+ input({name:'aciname'}).
+ custom_input(IPA.attribute_table_widget({
+ object_type:'user',
+ name:'attrs'
+ })))).
+ add_dialog(
+ IPA.add_dialog({
+ name: 'add',
+ title: 'Add Self Service Definition'
+ }).
+ field(IPA.text_widget({ name: 'aciname', undo: false})).
+ field(IPA.attribute_table_widget({
+ object_type:'user',
+ name:'attrs'
+ })));
};
IPA.entity_factories.delegation = function() {
var that = IPA.entity({
'name': 'delegation'
- });
-
- that.add_facet(function () {
- var spec = {
- name: 'search',
- label: 'Search'
- };
- var that = IPA.search_facet(spec);
- that.init = function() {
- that.create_column({name:'aciname'});
- that.search_facet_init();
- };
- return that;
- }());
- that.add_facet(function(){
- var that = IPA.details_facet({'name':'details'});
- var section =
- IPA.stanza({name:'general', label:'General'}).
- input({name:'aciname'}).
- custom_input(IPA.entity_select_widget(
- {name:'group', entity:'group'})).
- custom_input(IPA.entity_select_widget(
- {name:'memberof', entity:'group'})).
- custom_input(
- IPA.rights_widget({
- id:'delegation_rights'})).
- custom_input(
- IPA.attribute_table_widget({
- name:'attrs'}));
- that.add_section(section);
- return that;
- }());
-
- that.super_init = that.init;
- that.init = function(){
- that.super_init();
- var dialog = IPA.add_dialog({
+ }).facet(
+ IPA.search_facet().
+ column({name:'aciname'})).
+ facet(
+ IPA.details_facet().
+ section(
+ IPA.stanza({name:'general', label:'General'}).
+ input({name:'aciname'}).
+ custom_input(IPA.entity_select_widget(
+ {name:'group', entity:'group'})).
+ custom_input(IPA.entity_select_widget(
+ {name:'memberof', entity:'group'})).
+ custom_input(
+ IPA.rights_widget({
+ id:'delegation_rights'})).
+ custom_input(
+ IPA.attribute_table_widget({
+ name:'attrs'})))).
+ add_dialog(IPA.add_dialog({
name: 'add',
- title: 'Add Delegation',
- entity_name: that.entity
- });
- that.add_dialog(dialog);
- dialog.add_field(IPA.text_widget({ name: 'aciname', undo: false}));
- dialog.add_field(IPA.entity_select_widget({name:'group',
- entity:'group'}));
- dialog.add_field(IPA.entity_select_widget({name:'memberof',
- entity:'group'}));
- dialog.add_field(IPA.attribute_table_widget({ name: 'attrs'}));
-
- dialog.init();
- that.create_association_facets();
- };
-
+ title: 'Add Delegation'
+ }).
+ field(IPA.text_widget({ name: 'aciname', undo: false})).
+ field(IPA.entity_select_widget({name:'group',
+ entity:'group'})).
+ field(IPA.entity_select_widget({name:'memberof',
+ entity:'group'})).
+ field(IPA.attribute_table_widget({ name: 'attrs'}))).
+ standard_associations();
return that;
};
diff --git a/install/ui/hbacrule.js b/install/ui/hbacrule.js
index 6983e792..6b6e1238 100644
--- a/install/ui/hbacrule.js
+++ b/install/ui/hbacrule.js
@@ -35,7 +35,7 @@ IPA.entity_factories.hbacrule = function () {
'title': 'Add New Rule'
});
that.add_dialog(dialog);
-
+
var facet = IPA.hbacrule_search_facet({
'name': 'search',
diff --git a/install/ui/hbacsvc.js b/install/ui/hbacsvc.js
index c190c8cd..f5104ce2 100644
--- a/install/ui/hbacsvc.js
+++ b/install/ui/hbacsvc.js
@@ -35,7 +35,7 @@ IPA.entity_factories.hbacsvc = function () {
'title': 'Add New HBAC Service'
});
that.add_dialog(dialog);
-
+
var facet = IPA.hbacsvc_search_facet({
'name': 'search',
'label': 'Search'
diff --git a/install/ui/hbacsvcgroup.js b/install/ui/hbacsvcgroup.js
index 381dcb0b..057c2364 100644
--- a/install/ui/hbacsvcgroup.js
+++ b/install/ui/hbacsvcgroup.js
@@ -41,7 +41,7 @@ IPA.entity_factories.hbacsvcgroup = function () {
'title': 'Add New HBAC Service Group'
});
that.add_dialog(dialog);
-
+
var facet = IPA.hbacsvcgroup_search_facet({
'name': 'search',
'label': 'Search'
diff --git a/install/ui/serverconfig.js b/install/ui/serverconfig.js
index dbf46df4..46e2e485 100644
--- a/install/ui/serverconfig.js
+++ b/install/ui/serverconfig.js
@@ -31,24 +31,20 @@ IPA.entity_factories.config = function(){
var that = IPA.entity({
name: 'config'
- });
-
- var details = IPA.details_facet();
-
- details.add_section(
- IPA.stanza({name:'ipaserver', label:'Configuration'}).
- input({name:'cn', label:'Name'}).
- input({name:'ipacertificatesubjectbase'}).
- input({name:'ipadefaultloginshell'}).
- input({name:'ipadefaultprimarygroup'}).
- input({name:'ipagroupsearchfields'}).
- input({name:'ipahomesrootdir'}).
- input({name:'ipamaxusernamelength'}).
- input({name:'ipamigrationenabled'}).
- input({name:'ipasearchrecordslimit'}).
- input({name:'ipasearchtimelimit'}).
- input({name:'ipausersearchfields'}));
-
- that.add_facet(details);
+ }).facet(
+ IPA.details_facet().
+ section(
+ IPA.stanza({name:'ipaserver', label:'Configuration'}).
+ input({name:'cn', label:'Name'}).
+ input({name:'ipacertificatesubjectbase'}).
+ input({name:'ipadefaultloginshell'}).
+ input({name:'ipadefaultprimarygroup'}).
+ input({name:'ipagroupsearchfields'}).
+ input({name:'ipahomesrootdir'}).
+ input({name:'ipamaxusernamelength'}).
+ input({name:'ipamigrationenabled'}).
+ input({name:'ipasearchrecordslimit'}).
+ input({name:'ipasearchtimelimit'}).
+ input({name:'ipausersearchfields'})));
return that;
}; \ No newline at end of file
diff --git a/install/ui/test/details_tests.js b/install/ui/test/details_tests.js
index 38609072..fb33808c 100644
--- a/install/ui/test/details_tests.js
+++ b/install/ui/test/details_tests.js
@@ -22,11 +22,11 @@
module('details', {
setup: function() {
var obj_name = 'user';
- IPA.register_entity(
+ IPA.entity_factories.user=
function(){
return IPA.entity({name:obj_name});
- });
- IPA.start_entities();
+ };
+ IPA.start_entities();
},
teardown: function() {
}
diff --git a/install/ui/test/entity_tests.js b/install/ui/test/entity_tests.js
index a5878a6c..1178b99f 100644
--- a/install/ui/test/entity_tests.js
+++ b/install/ui/test/entity_tests.js
@@ -20,7 +20,8 @@
module('entity',{
setup: function() {
- IPA.register_entity(function(){return IPA.entity({name:'user'})});
+ IPA.entity_factories.user = function(){
+ return IPA.entity({name:'user'})};
IPA.start_entities();
},
teardown: function() {
@@ -87,14 +88,6 @@ test('Testing ipa_facet_setup_views().', function() {
);
- IPA.register_entity(function(){
- var entity = IPA.entity({
- 'name': 'user'
- });
-
- return entity;
- });
-
IPA.start_entities();
var entity = IPA.get_entity('user');
diff --git a/install/ui/test/navigation_tests.js b/install/ui/test/navigation_tests.js
index 916259b4..9db0bb1c 100644
--- a/install/ui/test/navigation_tests.js
+++ b/install/ui/test/navigation_tests.js
@@ -31,7 +31,7 @@ test("Testing nav_create().", function() {
var entity;
- IPA.register_entity( function() {
+ IPA.entity_factories.user = function() {
var that = IPA.entity({name: 'user'});
that.setup = function(container){
user_mock_called = true;
@@ -39,10 +39,8 @@ test("Testing nav_create().", function() {
same(container[0].nodeName,'DIV','user div');
}
return that;
- });
-
- IPA.register_entity( function(){
-
+ };
+ IPA.entity_factories.group = function(){
var that = IPA.entity({name: 'group'});
that.setup = function(container){
group_mock_called = true;
@@ -50,7 +48,7 @@ test("Testing nav_create().", function() {
same(container[0].nodeName,'DIV','group Div');
};
return that;
- });
+ };
IPA.start_entities();