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/entity.js | 145 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 114 insertions(+), 31 deletions(-) (limited to 'install/ui/entity.js') diff --git a/install/ui/entity.js b/install/ui/entity.js index 8af4af96..889b6be3 100644 --- a/install/ui/entity.js +++ b/install/ui/entity.js @@ -147,20 +147,9 @@ IPA.table_facet = function(spec) { var that = IPA.facet(spec); - that.columns = $.ordered_map(); - - that.__defineGetter__('entity_name', function() { - return that._entity_name; - }); - - that.__defineSetter__('entity_name', function(entity_name) { - that._entity_name = entity_name; + that.managed_entity_name = spec.managed_entity_name || that.entity_name; - var columns = that.columns.values; - for (var i=0; i',{ + text:$.bbq.getState(current_entity.name + '-pkey', true) || + '', + title: current_entity.name, + click: function() { + var entity = IPA.get_entity((this.title)); + IPA.nav.show_page(entity.name, 'default'); + $('a', that.facet_tabs).removeClass('selected'); + return false; + } + })); + + current_entity = current_entity.containing_entity; + } + + that.title_container.empty(); + var h3 = $('

').appendTo(that.title_container); + + h3.empty(); + h3.append(IPA.current_entity.title); + h3.append(': '); + + for (var i = 0; i < breadcrumb.length; i+=1){ + h3.append(breadcrumb[i]); + h3.append(' > '); + } + h3.append( + $('', { + 'class': 'entity-pkey', + text:value + })); } else { - that.pkey.css('display', 'none'); + that.title_container.empty(); + var span = $('

',{ + text:IPA.current_entity.metadata.label + }).appendTo(that.title_container); } }; @@ -554,7 +603,12 @@ IPA.entity_header = function(spec) { return false; } - IPA.nav.show_page(that.entity.name, 'search'); + var current_entity = that.entity; + while(current_entity.containing_entity){ + current_entity = current_entity.containing_entity; + } + + IPA.nav.show_page(current_entity.name, 'search'); $('a', that.facet_tabs).removeClass('selected'); return false; } @@ -655,12 +709,9 @@ IPA.entity_builder = function(){ }; that.facet = function(spec) { - spec.entity_name = entity.name; - facet = spec.factory(spec); entity.add_facet(facet); - return that; }; @@ -672,6 +723,19 @@ IPA.entity_builder = function(){ var factory = spec.factory || IPA.search_facet; facet = factory(spec); entity.add_facet(facet); + add_redirect_info(); + + return that; + }; + + that.nested_search_facet = function(spec) { + + spec.entity_name = entity.name; + spec.label = spec.label || IPA.messages.facets.search; + + var factory = spec.factory || IPA.nested_search_facet; + facet = factory(spec); + entity.add_facet(facet); return that; }; @@ -701,22 +765,29 @@ IPA.entity_builder = function(){ spec.entity_name = entity.name; 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.attribute_member = spec.attribute_member || + spec.name.substring(0, index); + spec.other_entity = spec.other_entity || + spec.name.substring(index+1); - spec.facet_group = spec.facet_group || spec.attribute_member; + spec.facet_group = spec.facet_group || + spec.attribute_member; - if (spec.facet_group == 'memberindirect' || spec.facet_group == 'memberofindirect') { + if (spec.facet_group == 'memberindirect' || + spec.facet_group == 'memberofindirect') { spec.read_only = true; } - spec.label = spec.label || (IPA.metadata.objects[spec.other_entity] ? IPA.metadata.objects[spec.other_entity].label : spec.other_entity); + spec.label = spec.label || + (IPA.metadata.objects[spec.other_entity] ? + IPA.metadata.objects[spec.other_entity].label : spec.other_entity); if (!spec.title) { - if (spec.facet_group == 'member' || spec.facet_group == 'memberindirect') { + if (spec.facet_group == 'member' || + spec.facet_group == 'memberindirect') { spec.title = IPA.messages.association.member; - - } else if (spec.facet_group == 'memberof' || spec.facet_group == 'memberofindirect') { + } else if (spec.facet_group == 'memberof' || + spec.facet_group == 'memberofindirect') { spec.title = IPA.messages.association.memberof; } } @@ -794,6 +865,18 @@ IPA.entity_builder = function(){ } }; + function add_redirect_info(facet_name){ + if (!entity.redirect_facet){ + entity.redirect_facet = 'search'; + } + } + + that.containing_entity = function(entity_name) { + add_redirect_info(); + entity.containing_entity = IPA.get_entity(entity_name); + return that; + }; + that.dialog = function(spec) { var dialog; if (spec instanceof Object){ -- cgit