From 1636d649264348526012b1f699284ad728e8a43d Mon Sep 17 00:00:00 2001 From: Adam Young Date: Fri, 6 May 2011 17:04:09 -0400 Subject: automount UI automount implemented using standard facets and containing_entity pkey generation sample data fixtures for automount. messages for automount and HBAC. modified form of the search facet used to nest the automount entities Add works for nested entities. Delete works for all but keys. Since the API for this is going to change, I'm not going to fix it pre-checkin. All the places the PKEY prefix is needed uses a single function. Added breadcrumb trail into title. update ipa_init sample data add redirect logic for pages without pkeys. add and delete link to appropriate entities for nested search facet. Using on demand entities. Fixed breadcrumbs. --- install/ui/details.js | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) (limited to 'install/ui/details.js') diff --git a/install/ui/details.js b/install/ui/details.js index ee5b55545..a62b97fbd 100644 --- a/install/ui/details.js +++ b/install/ui/details.js @@ -310,13 +310,26 @@ IPA.details_facet = function(spec) { } }; - that.get_primary_key = function() { - var pkey_name = IPA.metadata.objects[that.entity_name].primary_key; - if (that.record[pkey_name] instanceof Array){ - return that.record[pkey_name][0]; + /* the primary key used for show and update is built as an array. + for most entities, this will be a single element long, but for some + it requires the containing entities primary keys as well.*/ + that.get_primary_key = function(from_url) { + + var pkey = IPA.get_entity(that.entity_name).get_primary_key_prefix(); + + if (from_url){ + pkey.push(that.pkey); }else{ - return that.record[pkey_name]; + var pkey_name = IPA.metadata.objects[that.entity_name].primary_key; + var pkey_val = that.record[pkey_name]; + if (pkey_val instanceof Array){ + pkey.push( pkey_val[0]); + }else{ + pkey.push(pkey_val); + } } + + return pkey; }; that.create_header = function(container) { @@ -577,9 +590,7 @@ IPA.details_facet = function(spec) { } } - var pkey = that.get_primary_key(); - - var args = pkey ? [pkey] : []; + var args = that.get_primary_key(); var command = IPA.command({ entity: entity_name, @@ -597,7 +608,7 @@ IPA.details_facet = function(spec) { that.refresh = function() { - that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) ; + that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; var command = IPA.command({ entity: that.entity_name, @@ -609,9 +620,17 @@ IPA.details_facet = function(spec) { IPA.details_refresh_devel_hook(that.entity_name,command,that.pkey); } - if (that.pkey){ - command.args = [that.pkey]; + command.args = that.get_primary_key(true); + }else if (that.entity.redirect_facet) { + var current_entity = that.entity; + while (current_entity.containing_entity){ + current_entity = current_entity.containing_entity; + } + IPA.nav.show_page( + current_entity.name, + that.entity.redirect_facet); + return; } command.on_success = function(data, text_status, xhr) { -- cgit