On 06/29/2011 09:37 AM, Adam Young wrote:
Better solution than the algorithm in 256 for nested entities.

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

From 6c634f13a705766ba118e52207886fc2c5980612 Mon Sep 17 00:00:00 2001
From: Adam Young <ayo...@redhat.com>
Date: Wed, 29 Jun 2011 09:26:49 -0400
Subject: [PATCH] containing entity pkeys

Instead of looking for a match on the entity name, use the nesting structure
of containing entites to grab their pkeys.

https://fedorahosted.org/freeipa/ticket/674
---
 install/ui/navigation.js |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/install/ui/navigation.js b/install/ui/navigation.js
index d0b45cc3ca285d9715c919d3060736c614dd8e03..45f7dfb78adf2349a02a55292dc5acc394fc857c 100644
--- a/install/ui/navigation.js
+++ b/install/ui/navigation.js
@@ -115,14 +115,26 @@ IPA.navigation = function(spec) {
         while(state[key]){
             var value = state[key];
             url_state[key] = value;
-            var entity = value;
-            for (var key2 in state){
-                if ((key2 === entity) || (key2.search('^'+entity) > -1)){
-                    url_state[key2] = state[key2];
-                }
-            }
             key = value;
         }
+
+        /*We are at the leaf node, which is the sleected entity.*/
+        var entity = value;
+        for (var key2 in state){
+            if ((key2 === entity) || (key2.search('^'+entity) > -1)){
+                url_state[key2] = state[key2];
+            }
+        }
+
+        /* Trace back up the nested entities for their pkey-s as well*/
+        var current_entity = IPA.get_entity(entity);
+        while(current_entity !== null){
+            url_state[current_entity.name+'-pkey'] =
+                state[current_entity.name+'-pkey'];
+            current_entity = current_entity.containing_entity;
+        }
+
+
         $.bbq.pushState(url_state,2);
         return true;
     };
-- 
1.7.5.2

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to