diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-08-19 10:20:40 -0500 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2011-08-23 16:11:42 +0000 |
commit | fca0f4dd6576f82376a7d98cfc95641c75cd68cb (patch) | |
tree | 51aee3c15a7e84219031b2980123569af6d81ff7 /install | |
parent | a797f907ee43bb73fb649f200a27183c44a885a0 (diff) | |
download | freeipa-fca0f4dd6576f82376a7d98cfc95641c75cd68cb.tar.gz freeipa-fca0f4dd6576f82376a7d98cfc95641c75cd68cb.tar.xz freeipa-fca0f4dd6576f82376a7d98cfc95641c75cd68cb.zip |
Updated add and delete association dialog titles.
The association table widget and facet have been modified to accept
titles for the add and delete dialogs. The table and facet definitions
have been modified to specify the appropriate titles.
Some unused code have been removed.
Ticket #1629
Diffstat (limited to 'install')
-rw-r--r-- | install/ui/association.js | 45 | ||||
-rw-r--r-- | install/ui/entity.js | 3 | ||||
-rw-r--r-- | install/ui/hbac.js | 110 | ||||
-rw-r--r-- | install/ui/host.js | 23 | ||||
-rw-r--r-- | install/ui/service.js | 18 | ||||
-rw-r--r-- | install/ui/sudo.js | 222 | ||||
-rw-r--r-- | install/ui/test/data/ipa_init.json | 22 |
7 files changed, 167 insertions, 276 deletions
diff --git a/install/ui/association.js b/install/ui/association.js index 4ee4e72ce..4ee36934d 100644 --- a/install/ui/association.js +++ b/install/ui/association.js @@ -278,6 +278,11 @@ IPA.association_config = function (spec) { IPA.association_table_widget = function (spec) { spec = spec || {}; + + var index = spec.name.indexOf('_'); + spec.attribute_member = spec.attribute_member || spec.name.substring(0, index); + spec.other_entity = spec.other_entity || spec.name.substring(index+1); + spec.managed_entity_name = spec.other_entity; var that = IPA.table_widget(spec); @@ -289,6 +294,9 @@ IPA.association_table_widget = function (spec) { that.add_method = spec.add_method || 'add_member'; that.remove_method = spec.remove_method || 'remove_member'; + that.add_title = spec.add_title || IPA.messages.association.add.member; + that.remove_title = spec.remove_title || IPA.messages.association.remove.member; + that.adder_columns = $.ordered_map(); that.get_adder_column = function(name) { @@ -489,11 +497,9 @@ IPA.association_table_widget = function (spec) { that.create_add_dialog = function() { var pkey = IPA.nav.get_state(that.entity.name+'-pkey'); var label = IPA.metadata.objects[that.other_entity].label; - var title = IPA.messages.association.add; - title = title.replace( - '${entity}', - that.entity.metadata.label_singular); + var title = that.add_title; + title = title.replace('${entity}', that.entity.metadata.label_singular); title = title.replace('${primary_key}', pkey); title = title.replace('${other_entity}', label); @@ -561,11 +567,9 @@ IPA.association_table_widget = function (spec) { var pkey = IPA.nav.get_state(that.entity.name+'-pkey'); var label = IPA.metadata.objects[that.other_entity].label; - var title = IPA.messages.association.remove; - title = title.replace( - '${entity}', - that.entity.metadata.label_singular); + var title = that.remove_title; + title = title.replace('${entity}', that.entity.metadata.label_singular); title = title.replace('${primary_key}', pkey); title = title.replace('${other_entity}', label); @@ -671,8 +675,8 @@ IPA.association_facet = function (spec) { link must be set before the call to the base class, to affect the table. */ spec.link = spec.link === undefined ? true : spec.link; - spec.managed_entity_name = spec.other_entity; + var that = IPA.table_facet(spec); that.entity = spec.entity; @@ -690,6 +694,9 @@ IPA.association_facet = function (spec) { that.add_method = spec.add_method || 'add_member'; that.remove_method = spec.remove_method || 'remove_member'; + that.add_title = spec.add_title || IPA.messages.association.add.member; + that.remove_title = spec.remove_title || IPA.messages.association.remove.member; + that.adder_columns = $.ordered_map(); that.page_length = spec.page_length === undefined ? 20 : spec.page_length; @@ -724,7 +731,7 @@ IPA.association_facet = function (spec) { var i; var pkey_name; - if (that.other_entity){ + if (that.other_entity) { pkey_name = IPA.metadata.objects[that.other_entity].primary_key; } @@ -736,6 +743,12 @@ IPA.association_facet = function (spec) { }); } + if (!that.adder_columns.length) { + that.create_adder_column({ + name: pkey_name, + primary_key: true + }); + } var label = IPA.metadata.objects[that.other_entity] ? IPA.metadata.objects[that.other_entity].label : that.other_entity; @@ -911,11 +924,9 @@ IPA.association_facet = function (spec) { var pkey = IPA.nav.get_state(that.entity.name+'-pkey'); var label = IPA.metadata.objects[that.other_entity] ? IPA.metadata.objects[that.other_entity].label : that.other_entity; - var title = IPA.messages.association.add; - title = title.replace( - '${entity}', - that.entity.metadata.label_singular); + var title = that.add_title; + title = title.replace('${entity}', that.entity.metadata.label_singular); title = title.replace('${primary_key}', pkey); title = title.replace('${other_entity}', label); @@ -970,11 +981,9 @@ IPA.association_facet = function (spec) { } var pkey = IPA.nav.get_state(that.entity.name+'-pkey'); - var title = IPA.messages.association.remove; - title = title.replace( - '${entity}', - that.entity.metadata.label_singular); + var title = that.remove_title; + title = title.replace('${entity}', that.entity.metadata.label_singular); title = title.replace('${primary_key}', pkey); title = title.replace('${other_entity}', label); diff --git a/install/ui/entity.js b/install/ui/entity.js index 6317eebf5..ce028a2eb 100644 --- a/install/ui/entity.js +++ b/install/ui/entity.js @@ -795,6 +795,9 @@ IPA.entity_builder = function(){ spec.other_entity = spec.other_entity || spec.name.substring(index+1); + spec.add_title = IPA.messages.association.add[spec.attribute_member]; + spec.remove_title = IPA.messages.association.remove[spec.attribute_member]; + spec.facet_group = spec.facet_group || spec.attribute_member; diff --git a/install/ui/hbac.js b/install/ui/hbac.js index 0e775aa0b..274c52d68 100644 --- a/install/ui/hbac.js +++ b/install/ui/hbac.js @@ -134,44 +134,6 @@ IPA.entity_factories.hbacsvcgroup = function() { build(); }; -IPA.hbacsvcgroup_member_hbacsvc_table_widget = function(spec) { - - spec = spec || {}; - - var that = IPA.association_table_widget(spec); - - - var column = that.create_column({ - name: 'cn', - primary_key: true, - width: '150px', - entity:that.entity, - link: true - }); - - that.create_column({ - name: 'description', - entity:that.entity, - - width: '350px' - }); - - that.create_adder_column({ - name: 'cn', - primary_key: true, - width: '100px' - }); - - that.create_adder_column({ - name: 'description', - width: '100px' - }); - - return that; -}; - - - IPA.hbacrule_details_facet = function(spec) { spec = spec || {}; @@ -224,15 +186,21 @@ IPA.hbacrule_details_facet = function(spec) { })); section.add_field(IPA.rule_association_table_widget({ id: that.entity.name+'-memberuser_user', - name: 'memberuser_user', category: category, - other_entity: 'user', add_method: 'add_user', - remove_method: 'remove_user' + name: 'memberuser_user', + category: category, + add_method: 'add_user', + remove_method: 'remove_user', + add_title: IPA.messages.association.add.member, + remove_title: IPA.messages.association.remove.member })); section.add_field(IPA.rule_association_table_widget({ id: that.entity.name+'-memberuser_group', - name: 'memberuser_group', category: category, - other_entity: 'group', add_method: 'add_user', - remove_method: 'remove_user' + name: 'memberuser_group', + category: category, + add_method: 'add_user', + remove_method: 'remove_user', + add_title: IPA.messages.association.add.member, + remove_title: IPA.messages.association.remove.member })); return section; } @@ -259,15 +227,21 @@ IPA.hbacrule_details_facet = function(spec) { })); section.add_field(IPA.rule_association_table_widget({ id: that.entity.name+'-memberhost_host', - name: 'memberhost_host', category: category, - other_entity: 'host', add_method: 'add_host', - remove_method: 'remove_host' + name: 'memberhost_host', + category: category, + add_method: 'add_host', + remove_method: 'remove_host', + add_title: IPA.messages.association.add.member, + remove_title: IPA.messages.association.remove.member })); section.add_field(IPA.rule_association_table_widget({ id: that.entity.name+'-memberhost_hostgroup', - name: 'memberhost_hostgroup', category: category, - other_entity: 'hostgroup', add_method: 'add_host', - remove_method: 'remove_host' + name: 'memberhost_hostgroup', + category: category, + add_method: 'add_host', + remove_method: 'remove_host', + add_title: IPA.messages.association.add.member, + remove_title: IPA.messages.association.remove.member })); return section; } @@ -295,15 +269,21 @@ IPA.hbacrule_details_facet = function(spec) { })); section.add_field(IPA.rule_association_table_widget({ id: that.entity.name+'-memberservice_hbacsvc', - name: 'memberservice_hbacsvc', category: category, - other_entity: 'hbacsvc', add_method: 'add_service', - remove_method: 'remove_service' + name: 'memberservice_hbacsvc', + category: category, + add_method: 'add_service', + remove_method: 'remove_service', + add_title: IPA.messages.association.add.member, + remove_title: IPA.messages.association.remove.member })); section.add_field(IPA.rule_association_table_widget({ id: that.entity.name+'-memberservice_hbacsvcgroup', - name: 'memberservice_hbacsvcgroup', category: category, - other_entity: 'hbacsvcgroup', add_method: 'add_service', - remove_method: 'remove_service' + name: 'memberservice_hbacsvcgroup', + category: category, + add_method: 'add_service', + remove_method: 'remove_service', + add_title: IPA.messages.association.add.member, + remove_title: IPA.messages.association.remove.member })); return section; } @@ -330,15 +310,21 @@ IPA.hbacrule_details_facet = function(spec) { })); section.add_field(IPA.rule_association_table_widget({ id: that.entity.name+'-sourcehost_host', - name: 'sourcehost_host', category: category, - other_entity: 'host', add_method: 'add_sourcehost', - remove_method: 'remove_sourcehost' + name: 'sourcehost_host', + category: category, + add_method: 'add_sourcehost', + remove_method: 'remove_sourcehost', + add_title: IPA.messages.association.add.sourcehost, + remove_title: IPA.messages.association.remove.sourcehost })); section.add_field(IPA.rule_association_table_widget({ id: that.entity.name+'-sourcehost_hostgroup', - name: 'sourcehost_hostgroup', category: category, - other_entity: 'hostgroup', add_method: 'add_sourcehost', - remove_method: 'remove_sourcehost' + name: 'sourcehost_hostgroup', + category: category, + add_method: 'add_sourcehost', + remove_method: 'remove_sourcehost', + add_title: IPA.messages.association.add.sourcehost, + remove_title: IPA.messages.association.remove.sourcehost })); return section; } diff --git a/install/ui/host.js b/install/ui/host.js index 05484a030..5a786b016 100644 --- a/install/ui/host.js +++ b/install/ui/host.js @@ -73,8 +73,9 @@ IPA.entity_factories.host = function () { ] }]}). association_facet({ - factory: IPA.host_managedby_host_facet, - name: 'managedby_host' + name: 'managedby_host', + add_method: 'add_managedby', + remove_method: 'remove_managedby' }). association_facet({ name: 'memberof_hostgroup', @@ -622,21 +623,3 @@ IPA.host_certificate_status_widget = function (spec) { return that; }; - -IPA.host_managedby_host_facet = function (spec) { - - spec = spec || {}; - - var that = IPA.association_facet(spec); - - that.add_method = 'add_managedby'; - that.remove_method = 'remove_managedby'; - - that.create_adder_column({ - name: 'fqdn', - primary_key: true, - width: '200px' - }); - - return that; -}; diff --git a/install/ui/service.js b/install/ui/service.js index 6128dd1f6..eef909115 100644 --- a/install/ui/service.js +++ b/install/ui/service.js @@ -64,7 +64,6 @@ IPA.entity_factories.service = function() { }] }]}). association_facet({ - factory: IPA.service_managedby_host_facet, name: 'managedby_host', add_method: 'add_host', remove_method: 'remove_host' @@ -340,20 +339,3 @@ IPA.service_certificate_status_widget = function (spec) { return that; }; - -IPA.service_managedby_host_facet = function(spec) { - - spec = spec || {}; - - var that = IPA.association_facet(spec); - - that.create_adder_column({ - name: 'fqdn', - label: IPA.messages.objects.service.host, - primary_key: true, - width: '200px' - }); - - - return that; -};
\ No newline at end of file diff --git a/install/ui/sudo.js b/install/ui/sudo.js index 095480a9a..375ca93ac 100644 --- a/install/ui/sudo.js +++ b/install/ui/sudo.js @@ -124,117 +124,8 @@ IPA.entity_factories.sudocmdgroup = function() { build(); }; - -/* -* TODO: user the serial associator to perform back end operations. -*/ -IPA.sudocmd_member_sudocmdgroup_table_widget = function(spec) { - - spec = spec || {}; - - var that = IPA.association_table_widget(spec); - - that.get_records = function(on_success, on_error) { - - var length = that.values.length; - if (!length) return; - - if (length > 100) { - length = 100; - } - - if (!that.values.length) return; - - var batch = IPA.batch_command({ - 'name': that.entity.name+'_'+that.name+'_show', - 'on_success': on_success, - 'on_error': on_error - }); - - for (var i=0; i<length; i++) { - var value = that.values[i]; - - var command = IPA.command({ - entity: that.other_entity, - method: 'show', - args: [value], - options: { - all: true, - rights: true - } - }); - - batch.add_command(command); - } - - batch.execute(); - }; - - that.add = function(values, on_success, on_error) { - - if (!values.length) return; - - var batch = IPA.batch_command({ - 'name': that.entity.name+'_'+that.name+'_add', - 'on_success': on_success, - 'on_error': on_error - }); - - var pkey = IPA.nav.get_state(that.entity.name+'-pkey'); - - for (var i=0; i<values.length; i++) { - var value = values[i]; - - var command = IPA.command({ - entity: that.other_entity, - method: 'add_member', - args: [value] - }); - - command.set_option('sudocmd', pkey); - - batch.add_command(command); - } - - batch.execute(); - }; - - that.remove = function(values, on_success, on_error) { - - if (!values.length) return; - - var batch = IPA.batch_command({ - 'name': that.entity.name+'_'+that.name+'_remove', - 'on_success': on_success, - 'on_error': on_error - }); - - var pkey = IPA.nav.get_state(that.entity.name+'-pkey'); - - for (var i=0; i<values.length; i++) { - var value = values[i]; - - var command = IPA.command({ - entity: that.other_entity, - method: 'remove_member', - args: [value] - }); - - command.set_option('sudocmd', pkey); - - batch.add_command(command); - } - - batch.execute(); - }; - - return that; -}; - - IPA.sudo = {}; - IPA.sudorule_details_facet = function(spec) { spec = spec || {}; @@ -294,21 +185,25 @@ IPA.sudorule_details_facet = function(spec) { name: 'usercategory' })); section.add_field(IPA.sudorule_association_table_widget({ - 'id': that.entity.name+'-memberuser_user', + id: that.entity.name+'-memberuser_user', entity: that.entity, - 'name': 'memberuser_user', 'category': category, - 'other_entity': 'user', - 'add_method': 'add_user', - 'remove_method': 'remove_user', - 'external': 'externaluser' + name: 'memberuser_user', + category: category, + add_method: 'add_user', + remove_method: 'remove_user', + external: 'externaluser', + add_title: IPA.messages.association.add.member, + remove_title: IPA.messages.association.remove.member })); section.add_field(IPA.sudorule_association_table_widget({ - 'id': that.entity.name+'-memberuser_group', + id: that.entity.name+'-memberuser_group', entity: that.entity, - 'name': 'memberuser_group', 'category': category, - 'other_entity': 'group', - 'add_method': 'add_user', - 'remove_method': 'remove_user' + name: 'memberuser_group', + category: category, + add_method: 'add_user', + remove_method: 'remove_user', + add_title: IPA.messages.association.add.member, + remove_title: IPA.messages.association.remove.member })); return section; } @@ -334,17 +229,25 @@ IPA.sudorule_details_facet = function(spec) { name: 'hostcategory' })); section.add_field(IPA.sudorule_association_table_widget({ - 'id': that.entity.name+'-memberhost_host', + id: that.entity.name+'-memberhost_host', entity: that.entity, - 'name': 'memberhost_host', 'category': category, - 'other_entity': 'host', 'add_method': 'add_host', 'remove_method': 'remove_host', - 'external': 'externalhost' + name: 'memberhost_host', + category: category, + add_method: 'add_host', + remove_method: 'remove_host', + external: 'externalhost', + add_title: IPA.messages.association.add.member, + remove_title: IPA.messages.association.remove.member })); section.add_field(IPA.sudorule_association_table_widget({ - 'id': that.entity.name+'-memberhost_hostgroup', + id: that.entity.name+'-memberhost_hostgroup', entity: that.entity, - 'name': 'memberhost_hostgroup', 'category': category, - 'other_entity': 'hostgroup', 'add_method': 'add_host', 'remove_method': 'remove_host' + name: 'memberhost_hostgroup', + category: category, + add_method: 'add_host', + remove_method: 'remove_host', + add_title: IPA.messages.association.add.member, + remove_title: IPA.messages.association.remove.member })); return section; } @@ -778,35 +681,39 @@ IPA.sudo.rule_details_command_section = function(spec) { })); that.add_field(IPA.rule_association_table_widget({ - 'id': that.entity.name+'-memberallowcmd_sudocmd', - 'name': 'memberallowcmd_sudocmd', - 'category': that.category, - 'other_entity': 'sudocmd', - 'add_method': 'add_allow_command', - 'remove_method': 'remove_allow_command' + id: that.entity.name+'-memberallowcmd_sudocmd', + name: 'memberallowcmd_sudocmd', + category: that.category, + add_method: 'add_allow_command', + remove_method: 'remove_allow_command', + add_title: IPA.messages.association.add.memberallowcmd, + remove_title: IPA.messages.association.remove.memberallowcmd })); that.add_field(IPA.rule_association_table_widget({ - 'id': that.entity.name+'-memberallowcmd_sudocmdgroup', - 'name': 'memberallowcmd_sudocmdgroup', - 'category': that.category, - 'other_entity': 'sudocmdgroup', - 'add_method': 'add_allow_command', - 'remove_method': 'remove_allow_command' + id: that.entity.name+'-memberallowcmd_sudocmdgroup', + name: 'memberallowcmd_sudocmdgroup', + category: that.category, + add_method: 'add_allow_command', + remove_method: 'remove_allow_command', + add_title: IPA.messages.association.add.memberallowcmd, + remove_title: IPA.messages.association.remove.memberallowcmd })); that.add_field(IPA.rule_association_table_widget({ - 'id': that.entity.name+'-memberdenycmd_sudocmd', - 'name': 'memberdenycmd_sudocmd', - 'other_entity': 'sudocmd', - 'add_method': 'add_deny_command', - 'remove_method': 'remove_deny_command' + id: that.entity.name+'-memberdenycmd_sudocmd', + name: 'memberdenycmd_sudocmd', + add_method: 'add_deny_command', + remove_method: 'remove_deny_command', + add_title: IPA.messages.association.add.memberdenycmd, + remove_title: IPA.messages.association.remove.memberdenycmd })); that.add_field(IPA.rule_association_table_widget({ - 'id': that.entity.name+'-memberdenycmd_sudocmdgroup', - 'name': 'memberdenycmd_sudocmdgroup', - 'other_entity': 'sudocmdgroup', - 'add_method': 'add_deny_command', - 'remove_method': 'remove_deny_command' + id: that.entity.name+'-memberdenycmd_sudocmdgroup', + name: 'memberdenycmd_sudocmdgroup', + add_method: 'add_deny_command', + remove_method: 'remove_deny_command', + add_title: IPA.messages.association.add.memberdenycmd, + remove_title: IPA.messages.association.remove.memberdenycmd })); } @@ -945,17 +852,19 @@ IPA.sudo.rule_details_runas_section = function(spec) { id: that.entity.name+'-runasruser_user', name: 'ipasudorunas_user', category: category, - other_entity: 'user', add_method: 'add_runasuser', - remove_method: 'remove_runasuser' + remove_method: 'remove_runasuser', + add_title: IPA.messages.association.add.ipasudorunas, + remove_title: IPA.messages.association.remove.ipasudorunas })); that.add_field(IPA.sudorule_association_table_widget({ id: that.entity.name+'-runasuser_group', name: 'ipasudorunas_group', category: category, - other_entity: 'group', add_method: 'add_runasuser', - remove_method: 'remove_runasuser' + remove_method: 'remove_runasuser', + add_title: IPA.messages.association.add.ipasudorunas, + remove_title: IPA.messages.association.remove.ipasudorunas })); category = that.add_field( @@ -977,9 +886,10 @@ IPA.sudo.rule_details_runas_section = function(spec) { id: that.entity.name+'-runasgroup_group', name: 'ipasudorunasgroup_group', category: category, - other_entity: 'group', add_method: 'add_runasgroup', - remove_method: 'remove_runasgroup' + remove_method: 'remove_runasgroup', + add_title: IPA.messages.association.add.ipasudorunasgroup, + remove_title: IPA.messages.association.remove.ipasudorunasgroup })); } @@ -1118,7 +1028,7 @@ IPA.sudorule_association_table_widget = function(spec) { var pkey = IPA.nav.get_state(that.entity.name+'-pkey'); - var title = IPA.messages.association.add; + var title = that.add_title; title = title.replace('${other_entity}', IPA.metadata.objects[that.other_entity].label); title = title.replace('${entity}', IPA.metadata.objects[that.entity.name].label_singular); title = title.replace('${primary_key}', pkey); diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json index 8524a2572..0738df061 100644 --- a/install/ui/test/data/ipa_init.json +++ b/install/ui/test/data/ipa_init.json @@ -15840,12 +15840,30 @@ "401": "Your Kerberos ticket is no longer valid. Please run kinit and then click 'Retry'. If this is your first time running the IPA Web UI <a href='/ipa/config/unauthorized.html'>follow these directions</a> to configure your browser." }, "association": { - "add": "Add ${other_entity} into ${entity} ${primary_key}", + "add": { + "ipasudorunas": "Add RunAs ${other_entity} into ${entity} ${primary_key}", + "ipasudorunasgroup": "Add RunAs Groups into ${entity} ${primary_key}", + "member": "Add ${other_entity} into ${entity} ${primary_key}", + "memberallowcmd": "Add Allow ${other_entity} into ${entity} ${primary_key}", + "memberdenycmd": "Add Deny ${other_entity} into ${entity} ${primary_key}", + "memberof": "Add ${entity} ${primary_key} into ${other_entity}", + "managedby": "Add ${other_entity} Managing ${entity} ${primary_key}", + "sourcehost": "Add Source ${other_entity} into ${entity} ${primary_key}" + }, "direct_enrollment": "Direct Enrollment", "indirect_enrollment": "Indirect Enrollment", "no_entries": "No entries.", "paging": "Showing ${start} to ${end} of ${total} entries.", - "remove": "Remove ${other_entity} from ${entity} ${primary_key}", + "remove": { + "ipasudorunas": "Remove RunAs ${other_entity} from ${entity} ${primary_key}", + "ipasudorunasgroup": "Remove RunAs Groups from ${entity} ${primary_key}", + "member": "Remove ${other_entity} from ${entity} ${primary_key}", + "memberallowcmd": "Remove Allow ${other_entity} from ${entity} ${primary_key}", + "memberdenycmd": "Remove Deny ${other_entity} from ${entity} ${primary_key}", + "memberof": "Remove ${entity} ${primary_key} from ${other_entity}", + "managedby": "Remove ${other_entity} Managing ${entity} ${primary_key}", + "sourcehost": "Remove Source ${other_entity} from ${entity} ${primary_key}" + }, "show_results": "Show Results" }, "buttons": { |