From 6948c0813dff35afadd63bc0647271f00bfc566f Mon Sep 17 00:00:00 2001 From: Adam Young Date: Thu, 31 Mar 2011 15:32:29 -0400 Subject: code review fixes this version includes using spec for detail_facets --- install/ui/aci.js | 49 ++++++++++++++++++++-------------------- install/ui/automount.js | 8 +++---- install/ui/details.js | 4 ++-- install/ui/develop.js | 2 +- install/ui/dns.js | 8 +++---- install/ui/entity.js | 47 ++++++++++++++------------------------ install/ui/group.js | 8 +++---- install/ui/hbac.js | 14 ++++++------ install/ui/host.js | 12 +++++----- install/ui/hostgroup.js | 8 +++---- install/ui/jsl.conf | 1 - install/ui/netgroup.js | 8 +++---- install/ui/policy.js | 24 +++++++++++--------- install/ui/serverconfig.js | 8 ++++--- install/ui/service.js | 13 ++++++----- install/ui/sudo.js | 16 ++++++------- install/ui/test/details_tests.js | 13 ++++------- install/ui/test/entity_tests.js | 5 ---- install/ui/user.js | 18 +++++++-------- 19 files changed, 124 insertions(+), 142 deletions(-) (limited to 'install/ui') diff --git a/install/ui/aci.js b/install/ui/aci.js index d51741245..e7e0c563d 100644 --- a/install/ui/aci.js +++ b/install/ui/aci.js @@ -38,13 +38,13 @@ IPA.entity_factories.permission = function() { }, { factory: IPA.target_section, - section: 'target', + name: 'target', label: IPA.messages.objects.permission.target, undo: false }]}). - details_facet([ + details_facet({sections:[ { - section:'identity', + name:'identity', fields: [{ factory: IPA.text_widget, name: 'cn', @@ -52,15 +52,15 @@ IPA.entity_factories.permission = function() { }] }, { - section:'rights', + name:'rights', factory:IPA.rights_section }, { - section:'target', + name:'target', factory:IPA.target_section, label: IPA.messages.objects.permission.target - }]). - standard_associations(). + }]}). + standard_association_facets(). build(); }; @@ -71,12 +71,13 @@ IPA.entity_factories.privilege = function() { search_facet({ columns:['cn','description'], add_fields:['cn', 'description']}). - details_facet([ - { - section:'identity', + details_facet({ + sections: + [{ + name:'identity', label: IPA.messages.details.identity, fields:['cn','description'] - }]). + }]}). association_facet({ name: 'member_role', add_method: 'add_privilege', @@ -88,7 +89,7 @@ IPA.entity_factories.privilege = function() { add_method: 'add_permission', remove_method: 'remove_permission' }). - standard_associations(). + standard_association_facets(). build(); }; @@ -100,17 +101,17 @@ IPA.entity_factories.role = function() { search_facet({ columns:['cn','description'], add_fields:['cn', 'description']}). - details_facet([ + details_facet({sections:[ { - section:'identity', + name:'identity', label:IPA.messages.objects.role.identity, - fields:['cn','description']}]). + fields:['cn','description']}]}). association_facet({ name: 'memberof_privilege', add_method: 'add_privilege', remove_method: 'remove_privilege' }). - standard_associations(). + standard_association_facets(). build(); }; @@ -127,9 +128,9 @@ IPA.entity_factories.selfservice = function() { name:'attrs', undo: false }]}). - details_facet([ - { - section:'general', + details_facet({ + sections:[{ + name:'general', label: IPA.messages.details.general, fields: [ 'aciname', @@ -137,7 +138,7 @@ IPA.entity_factories.selfservice = function() { factory:IPA.attributes_widget, object_type:'user', name:'attrs' - }]}]). + }]}]}). build(); }; @@ -163,9 +164,9 @@ IPA.entity_factories.delegation = function() { name: 'attrs', object_type: 'user', join: true, undo: false }]}). - details_facet([ + details_facet({sections:[ { - section:'general', + name:'general', label: IPA.messages.details.general, fields:[ 'aciname', @@ -182,8 +183,8 @@ IPA.entity_factories.delegation = function() { factory:IPA.attributes_widget, name: 'attrs', object_type: 'user', join: true - }]}]). - standard_associations(). + }]}]}). + standard_association_facets(). build(); }; diff --git a/install/ui/automount.js b/install/ui/automount.js index a0da4c8c1..7cbe4fe0e 100644 --- a/install/ui/automount.js +++ b/install/ui/automount.js @@ -33,12 +33,12 @@ IPA.entity_factories.automountlocation = function() { columns:['cn'], add_fields:['cn'] }). - details_facet([{ - section:'identity', + details_facet({sections:[{ + name:'identity', label: IPA.messages.objects.automountlocation.identity, fields:['cn'] - }]). - standard_associations(). + }]}). + standard_association_facets(). build(); }; diff --git a/install/ui/details.js b/install/ui/details.js index 1dccb830e..40dd6d4f8 100644 --- a/install/ui/details.js +++ b/install/ui/details.js @@ -579,8 +579,8 @@ IPA.details_refresh = function() { options: { 'all': true, 'rights': true } }); - if (IPA.refresh_devel_hook){ - IPA.refresh_devel_hook(that.entity_name,command,that.pkey); + if (IPA.details_refresh_devel_hook){ + IPA.details_refresh_devel_hook(that.entity_name,command,that.pkey); } diff --git a/install/ui/develop.js b/install/ui/develop.js index 5095905d7..9f0c8dd5a 100644 --- a/install/ui/develop.js +++ b/install/ui/develop.js @@ -4,7 +4,7 @@ if (window.location.protocol == 'file:') { IPA.json_url = "test/data"; IPA.use_static_files = true; - IPA.refresh_devel_hook = function(entity_name,command,pkey){ + IPA.details_refresh_devel_hook = function(entity_name,command,pkey){ if ((entity_name === 'host')||(entity_name === 'permission')){ command.name = entity_name+'_show_'+pkey; command.method = entity_name+'_show'; diff --git a/install/ui/dns.js b/install/ui/dns.js index e1fce532e..1af95f726 100644 --- a/install/ui/dns.js +++ b/install/ui/dns.js @@ -32,8 +32,8 @@ IPA.entity_factories.dnszone = function() { columns:['idnsname'], add_fields: ['idnsname','idnssoamname','idnssoarname'] }). - details_facet([{ - section:'identity', + details_facet({sections:[{ + name:'identity', fields:[ 'idnsname', 'idnszoneactive', @@ -47,12 +47,12 @@ IPA.entity_factories.dnszone = function() { 'dnsttl', 'dnsclass', 'idnsallowdynupdate', - 'idnsupdatepolicy']}]). + 'idnsupdatepolicy']}]}). facet(IPA.records_facet({ 'name': 'records', 'label': IPA.metadata.objects.dnsrecord.label })). - standard_associations(). + standard_association_facets(). build(); }; diff --git a/install/ui/entity.js b/install/ui/entity.js index 31be28600..9e37a1271 100644 --- a/install/ui/entity.js +++ b/install/ui/entity.js @@ -530,22 +530,16 @@ IPA. facet_create_action_panel = function(container) { IPA.entity_builder = function(){ var that = {}; - - var entity_name ; var entity = null; var current_facet = null; - function section(spec){ var current_section = null; - spec.entity_name = entity_name; + spec.entity_name = entity.name; - if (spec.section){ - spec.name = spec.section; - if (!spec.label){ - var obj_messages = IPA.messages.objects[entity_name]; - spec.label = obj_messages[spec.section]; - } + if (!spec.label){ + var obj_messages = IPA.messages.objects[entity.name]; + spec.label = obj_messages[spec.name]; } if (spec.factory){ @@ -553,7 +547,7 @@ IPA.entity_builder = function(){ }else{ current_section = IPA.details_list_section(spec); } - + current_facet.add_section(current_section); var fields = spec.fields; if (fields){ var i; @@ -561,23 +555,20 @@ IPA.entity_builder = function(){ for (i =0; i < fields.length; i += 1){ field = fields[i]; if (field instanceof Object){ - field.entity_name = entity_name; + field.entity_name = entity.name; current_section.add_field(field.factory(field)); }else{ field = IPA.text_widget({ name:field, - entity_name:entity_name + entity_name:entity.name }); current_section.add_field(field); } } } - current_facet.add_section(current_section); } that.entity = function(name){ - entity_name = name; - that.entity_name = name; entity = IPA.entity({name: name}); return that; }; @@ -587,8 +578,11 @@ IPA.entity_builder = function(){ return that; }; - that.details_facet = function (sections){ - current_facet =IPA.details_facet({entity_name:entity_name}); + that.details_facet = function (spec){ + var sections = spec.sections; + spec.sections = null; + spec.entity_name = entity.name; + current_facet =IPA.details_facet(spec); entity.facet(current_facet); var i; @@ -599,10 +593,6 @@ IPA.entity_builder = function(){ return that; }; - that.get_current_facet = function(){ - return current_facet; - }; - that.facet = function (facet){ current_facet = facet; entity.facet(facet); @@ -611,11 +601,9 @@ IPA.entity_builder = function(){ that.search_facet = function (spec){ current_facet = IPA.search_facet({ - entity_name:that.entity_name, + entity_name:entity.name, search_all: spec.search_all || false }); - //once everything usese this mechanism, inline the init code - current_facet.init(); var columns = spec.columns; var i; @@ -630,7 +618,7 @@ IPA.entity_builder = function(){ IPA.add_dialog({ 'name': 'add', 'title': IPA.messages.objects.user.add, - entity_name: entity_name + entity_name: entity.name }); current_facet.dialog(current_dialog); @@ -653,7 +641,7 @@ IPA.entity_builder = function(){ field.section = null; current_dialog.add_section(factory(field)); }else{ - field.entity_name = entity_name; + field.entity_name = entity.name; factory = field.factory; current_dialog.field(factory(field)); } @@ -661,19 +649,18 @@ IPA.entity_builder = function(){ current_dialog.text(add_fields[i]); } } - entity.facet(current_facet); return that; }; that.association_facet = function(spec){ - spec.entity_name = entity_name; + spec.entity_name = entity.name; entity.facet(IPA.association_facet(spec)); return that; }; - that.standard_associations = function(){ + that.standard_association_facets = function(){ entity.standard_associations(); return that; }; diff --git a/install/ui/group.js b/install/ui/group.js index cc443cc53..7c7488f10 100644 --- a/install/ui/group.js +++ b/install/ui/group.js @@ -42,11 +42,11 @@ IPA.entity_factories.group = function () { }, 'gidnumber'] }). - details_facet( + details_facet({sections: [{ - section:'details', + name:'details', fields:['cn','description','gidnumber'] - }]). + }]}). facet( IPA.association_facet({ 'name': 'member_user', columns:[ @@ -85,6 +85,6 @@ IPA.entity_factories.group = function () { name: 'memberof_role', associator: IPA.serial_associator }). - standard_associations(). + standard_association_facets(). build(); }; diff --git a/install/ui/hbac.js b/install/ui/hbac.js index 4b9fe1ed3..a0c353af3 100644 --- a/install/ui/hbac.js +++ b/install/ui/hbac.js @@ -54,10 +54,10 @@ IPA.entity_factories.hbacsvc = function () { search_facet({ columns:['cn','description'], add_fields:['cn','description']}). - details_facet([{ - section : 'general', + details_facet({sections:[{ + name: 'general', label: IPA.messages.details.general, - fields:[ 'cn', 'description']}]). + fields:[ 'cn', 'description']}]}). build(); }; @@ -68,14 +68,14 @@ IPA.entity_factories.hbacsvcgroup = function () { search_facet({ columns:['cn', 'description'], add_fields:['cn', 'description']}). - details_facet([ + details_facet({sections:[ { - section: 'general', + name: 'general', label: IPA.messages.details.general, fields:['cn','description'] }, { - section: 'services', + name: 'services', label: IPA.messages.objects.hbacsvcgroup.services, fields:[{ factory: IPA.hbacsvcgroup_member_hbacsvc_table_widget, @@ -84,7 +84,7 @@ IPA.entity_factories.hbacsvcgroup = function () { other_entity: 'hbacsvc', save_values: false }] - }]). + }]}). build(); }; diff --git a/install/ui/host.js b/install/ui/host.js index 3f9c05d1d..dc1c0ee15 100644 --- a/install/ui/host.js +++ b/install/ui/host.js @@ -36,9 +36,9 @@ IPA.entity_factories.host = function () { }], add_fields: ['fqdn', {factory:IPA.force_host_add_checkbox_widget}] }). - details_facet([ + details_facet({sections:[ { - section:'details', + name:'details', fields: [ 'fqdn', 'krbprincipalname', @@ -51,7 +51,7 @@ IPA.entity_factories.host = function () { 'description' ] }, { - section:'enrollment', + name:'enrollment', fields:[ { factory: IPA.host_provisioning_status_widget, @@ -61,7 +61,7 @@ IPA.entity_factories.host = function () { ] }, { - section :'certificate', + name:'certificate', fields:[ { factory: IPA.host_certificate_status_widget, @@ -69,7 +69,7 @@ IPA.entity_factories.host = function () { label: IPA.messages.objects.host.status } ] - }]). + }]}). facet(IPA.host_managedby_host_facet({ name: 'managedby_host' })). @@ -85,7 +85,7 @@ IPA.entity_factories.host = function () { name: 'memberof_role', associator: IPA.serial_associator }). - standard_associations(). + standard_association_facets(). build(); }; diff --git a/install/ui/hostgroup.js b/install/ui/hostgroup.js index 46f2ab68c..a1b5ede2e 100644 --- a/install/ui/hostgroup.js +++ b/install/ui/hostgroup.js @@ -29,16 +29,16 @@ IPA.entity_factories.hostgroup = function() { entity('hostgroup'). search_facet({columns:['cn','description'], add_fields:['cn','description']}). - details_facet([{ - section:'identity', + details_facet({sections:[{ + name:'identity', label: IPA.messages.objects.hostgroup.identity, fields:['cn','description'] - }]). + }]}). association_facet({ name: 'memberof_hostgroup', associator: IPA.serial_associator }). - standard_associations(). + standard_association_facets(). build(); }; diff --git a/install/ui/jsl.conf b/install/ui/jsl.conf index a32d814b1..9321d4022 100644 --- a/install/ui/jsl.conf +++ b/install/ui/jsl.conf @@ -124,7 +124,6 @@ # To add a set of files, use "+process FileName", "+process Folder\Path\*.js", # or "+process Folder\Path\*.htm". # -+process core.js +process ipa.js +process widget.js +process dialog.js diff --git a/install/ui/netgroup.js b/install/ui/netgroup.js index 9389d0197..aa6141911 100644 --- a/install/ui/netgroup.js +++ b/install/ui/netgroup.js @@ -28,13 +28,13 @@ IPA.entity_factories.netgroup = function() { search_facet({ columns:['cn','description'], add_fields:['cn', 'description']}). - details_facet([{ - section:'identity', - fields:['cn','description','nisdomainname']}]). + details_facet({sections:[{ + name:'identity', + fields:['cn','description','nisdomainname']}]}). association_facet({ name: 'memberof_netgroup', associator: IPA.serial_associator }). - standard_associations(). + standard_association_facets(). build(); }; diff --git a/install/ui/policy.js b/install/ui/policy.js index ec202138c..ec2cb78a7 100644 --- a/install/ui/policy.js +++ b/install/ui/policy.js @@ -30,13 +30,14 @@ IPA.entity_factories.pwpolicy = function() { search_facet({ columns:['cn'], add_fields:['cn', 'cospriority']}). - details_facet([ - { - section : 'identity', - fields:['krbmaxpwdlife','krbminpwdlife','krbpwdhistorylength', - 'krbpwdmindiffchars','krbpwdminlength'] - }]). - standard_associations(). + details_facet({ + sections:[ + { + name : 'identity', + fields:['krbmaxpwdlife','krbminpwdlife','krbpwdhistorylength', + 'krbpwdmindiffchars','krbpwdminlength'] + }]}). + standard_association_facets(). build(); }; @@ -47,9 +48,10 @@ IPA.entity_factories.pwpolicy = function() { IPA.entity_factories.krbtpolicy = function() { return IPA.entity_builder(). entity('krbtpolicy'). - details_facet([{ - section: 'identity', - fields:[ 'krbmaxrenewableage','krbmaxticketlife' ] - }]). + details_facet({ + sections:[{ + name: 'identity', + fields:[ 'krbmaxrenewableage','krbmaxticketlife' ] + }]}). build(); }; diff --git a/install/ui/serverconfig.js b/install/ui/serverconfig.js index 4d1042314..3c2b33e23 100644 --- a/install/ui/serverconfig.js +++ b/install/ui/serverconfig.js @@ -30,8 +30,10 @@ IPA.entity_factories.config = function(){ return IPA.entity_builder(). entity('config'). - details_facet([{ - section: 'ipaserver', + details_facet({ + sections: + [{ + name: 'ipaserver', label: IPA.messages.objects.config.ipaserver, fields: [{ @@ -43,6 +45,6 @@ IPA.entity_factories.config = function(){ 'ipadefaultprimarygroup','ipagroupsearchfields', 'ipahomesrootdir','ipamaxusernamelength', 'ipamigrationenabled','ipasearchrecordslimit', - 'ipasearchtimelimit','ipausersearchfields']}]). + 'ipasearchtimelimit','ipausersearchfields']}]}). build(); }; \ No newline at end of file diff --git a/install/ui/service.js b/install/ui/service.js index 8590550ae..363152518 100644 --- a/install/ui/service.js +++ b/install/ui/service.js @@ -36,9 +36,9 @@ IPA.entity_factories.service = function() { title: IPA.messages.objects.service.add, width: '450px' }))). - details_facet([ + details_facet({sections:[ { - section: 'details', + name: 'details', fields:['krbprincipalname', { factory:IPA.service_name_widget, @@ -54,7 +54,7 @@ IPA.entity_factories.service = function() { }] }, { - section : 'provisioning', + name: 'provisioning', fields:[{ factory:IPA.service_provisioning_status_widget, name: 'provisioning_status', @@ -62,19 +62,20 @@ IPA.entity_factories.service = function() { }] }, { - section: 'certificate', + name: 'certificate', fields:[{ factory:IPA.service_certificate_status_widget, name: 'certificate_status', label: IPA.messages.objects.service.status }] - }]). + }]}). facet(IPA.service_managedby_host_facet({ name: 'managedby_host', add_method: 'add_host', remove_method: 'remove_host' })). - standard_associations().build(); + standard_association_facets(). + build(); }; diff --git a/install/ui/sudo.js b/install/ui/sudo.js index 742895a44..0f2e8491e 100644 --- a/install/ui/sudo.js +++ b/install/ui/sudo.js @@ -44,14 +44,14 @@ IPA.entity_factories.sudocmd = function () { search_facet({ columns:['sudocmd','description'], add_fields:['sudocmd','description']}). - details_facet([ + details_facet({sections:[ { - section : 'general', + name: 'general', label: IPA.messages.details.general, fields:['sudocmd','description'] }, { - section: 'groups', + name: 'groups', label: IPA.messages.objects.sudocmd.groups, factory: IPA.details_section, fields:[{ @@ -84,7 +84,7 @@ IPA.entity_factories.sudocmd = function () { } ] }] - }]). + }]}). build(); }; @@ -96,15 +96,15 @@ IPA.entity_factories.sudocmdgroup = function () { columns:['cn','description'], add_fields:['cn','description'] }). - details_facet([ + details_facet({sections:[ { - section: 'general', + name: 'general', label: IPA.messages.dialogs.general, fields:['cn','description'] }, { - section: 'commands', + name: 'commands', factory: IPA.details_section, fields: [{ factory: IPA.association_table_widget, @@ -136,7 +136,7 @@ IPA.entity_factories.sudocmdgroup = function () { } ] }] - }]). + }]}). build(); }; diff --git a/install/ui/test/details_tests.js b/install/ui/test/details_tests.js index 6cc8fd72d..d3c18d435 100644 --- a/install/ui/test/details_tests.js +++ b/install/ui/test/details_tests.js @@ -29,11 +29,6 @@ module('details', { "data", true, function(data, text_status, xhr) { - IPA.metadata = data.result.results[0]; - IPA.messages = data.result.results[1].messages; - IPA.whoami = data.result.results[2].result[0]; - IPA.env = data.result.results[3].result; - IPA.dns_enabled = data.result.results[4].result; }, function(xhr, text_status, error_thrown) { ok(false, "ipa_init() failed: "+error_thrown); @@ -181,14 +176,14 @@ test("Testing details lifecycle: create, setup, load.", function(){ var entity = IPA. entity_builder(). entity('user'). - details_facet([ + details_facet({sections:[ { - section: 'identity', + name: 'identity', label: IPA.messages.details.identity, fields:['title','givenname','sn','cn','displayname', 'initials'] }, { - section: 'contact', + name: 'contact', label:'contact', fields: [ {factory: test_widget,name:'test'}, @@ -200,7 +195,7 @@ test("Testing details lifecycle: create, setup, load.", function(){ {factory: IPA.multivalued_text_widget, name:'facsimiletelephonenumber'}] }, - ]).build(); + ]}).build(); entity.init(); var facet = entity.get_facet('details'); diff --git a/install/ui/test/entity_tests.js b/install/ui/test/entity_tests.js index 5f7ba9e73..86e44cd67 100644 --- a/install/ui/test/entity_tests.js +++ b/install/ui/test/entity_tests.js @@ -30,11 +30,6 @@ module('entity',{ "data", true, function(data, text_status, xhr) { - IPA.metadata = data.result.results[0]; - IPA.messages = data.result.results[1].messages; - IPA.whoami = data.result.results[2].result[0]; - IPA.env = data.result.results[3].result; - IPA.dns_enabled = data.result.results[4].result; IPA.entity_factories.user = function(){ return IPA. diff --git a/install/ui/user.js b/install/ui/user.js index a922f9f89..c88fe78d6 100644 --- a/install/ui/user.js +++ b/install/ui/user.js @@ -33,21 +33,21 @@ IPA.entity_factories.user = function() { add_fields: ['uid','givenname','sn'], search_all: true }). - details_facet([ + details_facet({sections:[ { - section: 'identity', + name: 'identity', label: IPA.messages.details.identity, fields:['title','givenname','sn','cn','displayname', 'initials'] }, { - section: 'account', + name: 'account', fields:[{factory:IPA.user_status_widget,name:'nsaccountlock'}, 'uid', {factory: IPA.user_password_widget,name:'userpassword'}, 'uidnumber','gidnumber','loginshell','homedirectory'] }, { - section: 'contact', + name: 'contact', fields: [ {factory: IPA.multivalued_text_widget, name:'mail'}, {factory: IPA.multivalued_text_widget, name:'telephonenumber'}, @@ -56,17 +56,17 @@ IPA.entity_factories.user = function() { {factory: IPA.multivalued_text_widget, name:'facsimiletelephonenumber'}] }, { - section: 'mailing', + name: 'mailing', fields: ['street','l','st','postalcode'] }, { - section: 'employee', + name: 'employee', fields: ['ou','manager'] }, { - section: 'misc', + name: 'misc', fields:['carlicense'] - }]). + }]}). association_facet({ name: 'memberof_group', associator: IPA.serial_associator @@ -79,7 +79,7 @@ IPA.entity_factories.user = function() { name: 'memberof_role', associator: IPA.serial_associator }). - standard_associations(); + standard_association_facets(); var entity = builder.build(); -- cgit