Re: [Freeipa-devel] [PATCH] 0100-top-nav-index

2010-11-29 Thread Endi Sukma Dewata

On 11/25/2010 8:24 PM, Adam Young wrote:

Updated version that doesn't break SUDO or HBAC. The third level nesting
in the tabs set is only used for this kind of navigation now, but should
be used for Action panel shortly.


Conditional ACK... :)

There are some additional changes that need to be done to get SUDO 
navigation working properly. Please take a look at the attached patch. 
If this is OK we can commit both patches together.


--
Endi S. Dewata
From 45394c8afaace87d3e17eed723239f38b4d4a2f5 Mon Sep 17 00:00:00 2001
From: Endi S. Dewata edew...@redhat.com
Date: Mon, 29 Nov 2010 11:52:08 -0600
Subject: [PATCH] Fixed navigation problem with nested entities.

Replaced _entity with -entity in IPA.tab_state().
Replaced sudo-entity with sudorule-entity.
---
 install/static/navigation.js   |2 +-
 install/static/sudocmd.js  |4 ++--
 install/static/sudocmdgroup.js |4 ++--
 install/static/sudorule.js |4 ++--
 install/static/webui.js|2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/install/static/navigation.js b/install/static/navigation.js
index 240ee959208247e73bd8707f78041d48734c2785..98c13a923677ec734f11550bc2c42b7027f830a3 100644
--- a/install/static/navigation.js
+++ b/install/static/navigation.js
@@ -138,7 +138,7 @@ function _nav_update_tabs(nls, container,depth)
 
 // TODO: do not hard-code
 if (entity_name == 'hbac'  nav_get_state('hbac-entity')) entity_name = nav_get_state('hbac-entity');
-if (entity_name == 'sudorule'  nav_get_state('sudo-entity')) entity_name = nav_get_state('sudo-entity');
+if (entity_name == 'sudorule'  nav_get_state('sudorule-entity')) entity_name = nav_get_state('sudorule-entity');
 
 var entity = IPA.get_entity(entity_name);
 entity.setup(container2);
diff --git a/install/static/sudocmd.js b/install/static/sudocmd.js
index 4255a31e3b415811b32c0bb88b26029d1b7194b8..b4492c254cfddb5621fc3a5ff96737243a97ce4e 100755
--- a/install/static/sudocmd.js
+++ b/install/static/sudocmd.js
@@ -125,7 +125,7 @@ function ipa_sudocmd_search_facet(spec) {
 var li = $('li[title=sudorule]', action_panel);
 li.click(function() {
 var state = {};
-state['sudo-entity'] = 'sudorule';
+state['sudorule-entity'] = 'sudorule';
 nav_push_state(state);
 return false;
 });
@@ -133,7 +133,7 @@ function ipa_sudocmd_search_facet(spec) {
 li = $('li[title=sudocmdgroup]', action_panel);
 li.click(function() {
 var state = {};
-state['sudo-entity'] = 'sudocmdgroup';
+state['sudorule-entity'] = 'sudocmdgroup';
 nav_push_state(state);
 return false;
 });
diff --git a/install/static/sudocmdgroup.js b/install/static/sudocmdgroup.js
index 6fddafb155e144d1f1f167262832679189239ab5..2e53ce791816859f5aad0afddc2ba8b4baf0225b 100755
--- a/install/static/sudocmdgroup.js
+++ b/install/static/sudocmdgroup.js
@@ -140,7 +140,7 @@ function ipa_sudocmdgroup_search_facet(spec) {
 var li = $('li[title=sudorule]', action_panel);
 li.click(function() {
 var state = {};
-state['sudo-entity'] = 'sudorule';
+state['sudorule-entity'] = 'sudorule';
 nav_push_state(state);
 return false;
 });
@@ -148,7 +148,7 @@ function ipa_sudocmdgroup_search_facet(spec) {
 li = $('li[title=sudocmd]', action_panel);
 li.click(function() {
 var state = {};
-state['sudo-entity'] = 'sudocmd';
+state['sudorule-entity'] = 'sudocmd';
 nav_push_state(state);
 return false;
 });
diff --git a/install/static/sudorule.js b/install/static/sudorule.js
index f936ebcde8198575e48d06257d44f0ae23ace366..023cafde29a1f0c35c043642e798cf9f27363fd4 100755
--- a/install/static/sudorule.js
+++ b/install/static/sudorule.js
@@ -124,7 +124,7 @@ function ipa_sudorule_search_facet(spec) {
 var li = $('li[title=sudocmd]', action_panel);
 li.click(function() {
 var state = {};
-state['sudo-entity'] = 'sudocmd';
+state['sudorule-entity'] = 'sudocmd';
 nav_push_state(state);
 return false;
 });
@@ -132,7 +132,7 @@ function ipa_sudorule_search_facet(spec) {
 li = $('li[title=sudocmdgroup]', action_panel);
 li.click(function() {
 var state = {};
-state['sudo-entity'] = 'sudocmdgroup';
+state['sudorule-entity'] = 'sudocmdgroup';
 nav_push_state(state);
 return false;
 });
diff --git a/install/static/webui.js b/install/static/webui.js
index 093d32b22b4adc079054256e364f01aaeeccbbbd..0e3adb27d6d6418211738c77a44db4010b5b184e 100644
--- a/install/static/webui.js
+++ b/install/static/webui.js
@@ -83,7 +83,7 @@ IPA.tab_state = function(entity_name){
 if 

Re: [Freeipa-devel] [PATCH] 0100-top-nav-index

2010-11-29 Thread Endi Sukma Dewata

On 11/29/2010 12:08 PM, Endi Sukma Dewata wrote:

On 11/25/2010 8:24 PM, Adam Young wrote:

Updated version that doesn't break SUDO or HBAC. The third level nesting
in the tabs set is only used for this kind of navigation now, but should
be used for Action panel shortly.


Conditional ACK... :)

There are some additional changes that need to be done to get SUDO
navigation working properly. Please take a look at the attached patch.
If this is OK we can commit both patches together.


ACKed on IRC. Pushed both patches to master.

--
Endi S. Dewata

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


Re: [Freeipa-devel] [PATCH] 0100-top-nav-index

2010-11-25 Thread Adam Young
Updated version that doesn't break SUDO or HBAC.  The third level 
nesting in the tabs set is only used for this kind of navigation now, 
but should be used for Action panel shortly.
From 2371a5b82d7f3184445bcbba32ca516747bb9c6e Mon Sep 17 00:00:00 2001
From: Adam Young ayo...@redhat.com
Date: Fri, 19 Nov 2010 15:57:40 -0500
Subject: [PATCH] top nav index
 allows links between differnt top level tabs by calculating the index of the top level tab for the target tab.

---
 install/static/associate.js |   15 +++
 install/static/webui.js |   27 ++-
 install/static/widget.js|   14 +++---
 3 files changed, 44 insertions(+), 12 deletions(-)

diff --git a/install/static/associate.js b/install/static/associate.js
index f0239a44e12670f5399d9dd30c99a5e553a2aba0..913b36449d117e6c53734102ef0eb26f22c5f182 100644
--- a/install/static/associate.js
+++ b/install/static/associate.js
@@ -247,12 +247,15 @@ function ipa_association_widget(spec) {
 
 that.create = function(container) {
 
-that.member_attribute = ipa_get_member_attribute(that.entity_name, that.other_entity);
+that.member_attribute = ipa_get_member_attribute(
+that.entity_name, that.other_entity);
 
 that.create_column({
-'name': that.member_attribute + '_' + that.other_entity,
-'label': IPA.metadata[that.other_entity].label,
-'primary_key': true
+name: that.member_attribute + '_' + that.other_entity,
+other_entity :  that.other_entity,
+label: IPA.metadata[that.other_entity].label,
+primary_key: true,
+link: true
 });
 
 that.superior_create(container);
@@ -472,6 +475,10 @@ function ipa_association_facet(spec) {
 that.table.refresh();
 };
 
+//TODO find out why this is needed
+that.refresh = function(){
+}
+
 return that;
 }
 
diff --git a/install/static/webui.js b/install/static/webui.js
index 17c08d8f46e4e943ee7033e038e5e2bf69e69ace..3b3646ca7a9290cf10e177494de57010eac226e1 100644
--- a/install/static/webui.js
+++ b/install/static/webui.js
@@ -54,6 +54,30 @@ var self_serv_tab_set =
 {name:'user', label:'Users', setup:ipa_entity_setup}]}];
 
 
+IPA.tab_state = function(entity_name){
+
+var state = {};
+
+for (var top_tab_index = 0;
+ top_tab_index  IPA.tab_set.length;
+ top_tab_index += 1){
+var top_tab =  IPA.tab_set[top_tab_index];
+for (var subtab_index = 0;
+ subtab_index  top_tab.children.length;
+ subtab_index += 1){
+if((top_tab.children[subtab_index].name) 
+   (top_tab.children[subtab_index].name === entity_name)){
+state.navigation =  top_tab_index;
+state[top_tab.name] =  subtab_index;
+return state;
+}
+}
+}
+}
+
+
+
+
 
 
 /* main (document onready event handler) */
@@ -78,9 +102,10 @@ $(function() {
 
 if (whoami.hasOwnProperty('memberof_rolegroup') 
 whoami.memberof_rolegroup.length  0){
+IPA.tab_set = admin_tab_set;
 nav_create(admin_tab_set, navigation, 'tabs');
-
 } else {
+IPA.tab_set = self_serv_tab_set;
 nav_create(self_serv_tab_set, navigation, 'tabs');
 
 var state = {'user-pkey':IPA.whoami_pkey ,
diff --git a/install/static/widget.js b/install/static/widget.js
index 060f258eb0a516fe11069ed7f55e83b5deb37112..c2184c64685d3bcd519710ffa015fcac64efefdf 100755
--- a/install/static/widget.js
+++ b/install/static/widget.js
@@ -421,6 +421,7 @@ function ipa_button_widget(spec) {
 return that;
 }
 
+
 function ipa_column_widget(spec) {
 
 spec = spec || {};
@@ -431,6 +432,7 @@ function ipa_column_widget(spec) {
 that.primary_key = spec.primary_key;
 that.setup = spec.setup || setup;
 that.link = spec.link;
+that.other_entity = spec.other_entity;
 
 function setup(container, name, value, record) {
 
@@ -445,13 +447,11 @@ function ipa_column_widget(spec) {
 'html': value,
 'click': function (value) {
 return function() {
-var state = {};
-state[that.entity_name + '-facet'] = 'details';
-state[that.entity_name + '-pkey'] = value;
-//Before this will work, we need to set the tab one level up
-//for example:
-//state['identity'] = 0;
-//but we have no way of getting the index.
+var target_entity = that.other_entity ||
+that.entity_name;
+var state = IPA.tab_state(target_entity);
+state[target_entity + '-facet'] = 'details';
+state[target_entity + '-pkey'] = value;
 
 

Re: [Freeipa-devel] [PATCH] 0100-top-nav-index

2010-11-23 Thread Adam Young

On 11/23/2010 02:15 PM, Endi Sukma Dewata wrote:

On 11/22/2010 10:41 AM, Adam Young wrote:

Without reordering things now, I propose we allow for a three level
structure in the tab_set. Top level will not be an entity. Second level
will be an entity. third level will be a nested entity.



Nested entities are not related in any way to the entity that they are
nested under except by convention. Thus, sudocmd and sudocmdgrps may get
nested under sudorules, but they could easily be placed as peers.
Contrast these with DNS records, that require the the DNS Zone value.



For 3 level deep nesting, we will need a naming scheme to make these
work. something like
#subtab=sudoruleentity=sudocmd

contrast this with

#entity=sudorule

Thus, the entity value always points to the object, not necessarily at
the leaf node of the navigation tree.


I agree that the navigation should be decoupled from entity make it 
more flexible. This is a more detailed proposal, I don't know if we 
can fully implement this within the schedule, but at least we can go 
toward this direction.


Currently the navigation tree always points to entities. This should 
be replaced by pages (you're calling it subtab). We can pick another 
name if this is confusing, but for now let's use these terms: the 
first level tabs are sections, the second level tabs are pages.


A page defines anything you see below the tabs, including client area 
and action panel. Each page can have one entity (e.g. users), multiple 
entities (e.g. hbac), or special cases (e.g. krbtpolicy, config).


We can have a base class (e.g. ipa_page) that defines the basic layout 
where the UI components are located (e.g. the action panel, client 
area, title, buttons), this way all pages will be consistent. Then we 
can create subclasses that will customize each component depending on 
the entity, facet, or entry being selected. Each page is responsible 
to read the parameters it needs from the URL.


We might also need a tree-like navigation for the action panel, but 
that's for another discussion.


If I understand this correctly, it is pretty much in line what I am 
thinking.  For a first round, and to get this patch submitted, I think I 
am going to add entires to the tab set under HBAC and sudo that will be 
used for navigating to those entities, even though it won't be used for 
populating the action panel.  The action panel work can follow on.


For now, and through this release, we will only have one layout, what 
you are calling ipa_page.




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


Re: [Freeipa-devel] [PATCH] 0100-top-nav-index

2010-11-22 Thread Adam Young

On 11/19/2010 06:53 PM, Endi Sukma Dewata wrote:

On 11/19/2010 4:09 PM, Adam Young wrote:




This will not work with entities that do not have associated tabs, 
e.g. hbacsvc, hbacsvcgroups, sudocmd, sudocmdgroups. For these 
entities the IPA.tab_state() will return undefined, so the 
ipa_column_widget.setup() will fail.


To reproduce this problem, try clicking the search results in hbacsvc 
or hbacsvcgroups. For some reason it will bring you to the user search 
page.


We need to figure out the proper way to handle these entities. It 
probably requires framework modification.



Been pondering this during the weekend.

I am not a huge fan of burying things like HBAC and Sudo entities so 
deep.  There is little reason to force a use to search for these things, 
and so I suspect, over time we will adjust the UI to let them float up 
higher in the navigation structure.



Without reordering things now, I propose we allow for a three level 
structure in the tab_set.  Top level will not be an entity.  Second 
level will be an entity.  third level will be a nested entity.


Nested entities are not related in any way to the entity that they are 
nested under except by convention.  Thus, sudocmd and sudocmdgrps may 
get nested under sudorules, but they could easily be placed as peers.  
Contrast these with DNS records, that require the  the DNS  Zone value.


For 3 level deep nesting, we will need a naming scheme to make these 
work.  something like

#subtab=sudoruleentity=sudocmd

contrast this with

#entity=sudorule

Thus, the entity value always points to the object, not necessarily at 
the leaf node of the navigation tree.


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


Re: [Freeipa-devel] [PATCH] 0100-top-nav-index

2010-11-22 Thread Dmitri Pal
Adam Young wrote:
 On 11/19/2010 06:53 PM, Endi Sukma Dewata wrote:
 On 11/19/2010 4:09 PM, Adam Young wrote:


 This will not work with entities that do not have associated tabs,
 e.g. hbacsvc, hbacsvcgroups, sudocmd, sudocmdgroups. For these
 entities the IPA.tab_state() will return undefined, so the
 ipa_column_widget.setup() will fail.

 To reproduce this problem, try clicking the search results in hbacsvc
 or hbacsvcgroups. For some reason it will bring you to the user
 search page.

 We need to figure out the proper way to handle these entities. It
 probably requires framework modification.

 Been pondering this during the weekend.

 I am not a huge fan of burying things like HBAC and Sudo entities so
 deep.  There is little reason to force a use to search for these
 things, and so I suspect, over time we will adjust the UI to let them
 float up higher in the navigation structure.


 Without reordering things now, I propose we allow for a three level
 structure in the tab_set.  Top level will not be an entity.  Second
 level will be an entity.  third level will be a nested entity.

 Nested entities are not related in any way to the entity that they are
 nested under except by convention.  Thus, sudocmd and sudocmdgrps may
 get nested under sudorules, but they could easily be placed as peers. 
 Contrast these with DNS records, that require the  the DNS  Zone value.

 For 3 level deep nesting, we will need a naming scheme to make these
 work.  something like
 #subtab=sudoruleentity=sudocmd

 contrast this with

 #entity=sudorule

 Thus, the entity value always points to the object, not necessarily at
 the leaf node of the navigation tree.

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


Do I read you right that instead of using actions menu you want to as
another row of the tabs at the top?
I am not sure I agree with this.

-- 
Thank you,
Dmitri Pal

Sr. Engineering Manager IPA project,
Red Hat Inc.


---
Looking to carve out IT costs?
www.redhat.com/carveoutcosts/

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


Re: [Freeipa-devel] [PATCH] 0100-top-nav-index

2010-11-22 Thread Dmitri Pal
Dmitri Pal wrote:
 Adam Young wrote:
   
 On 11/19/2010 06:53 PM, Endi Sukma Dewata wrote:
 
 On 11/19/2010 4:09 PM, Adam Young wrote:
   
 This will not work with entities that do not have associated tabs,
 e.g. hbacsvc, hbacsvcgroups, sudocmd, sudocmdgroups. For these
 entities the IPA.tab_state() will return undefined, so the
 ipa_column_widget.setup() will fail.

 To reproduce this problem, try clicking the search results in hbacsvc
 or hbacsvcgroups. For some reason it will bring you to the user
 search page.

 We need to figure out the proper way to handle these entities. It
 probably requires framework modification.

   
 Been pondering this during the weekend.

 I am not a huge fan of burying things like HBAC and Sudo entities so
 deep.  There is little reason to force a use to search for these
 things, and so I suspect, over time we will adjust the UI to let them
 float up higher in the navigation structure.


 Without reordering things now, I propose we allow for a three level
 structure in the tab_set.  Top level will not be an entity.  Second
 level will be an entity.  third level will be a nested entity.

 Nested entities are not related in any way to the entity that they are
 nested under except by convention.  Thus, sudocmd and sudocmdgrps may
 get nested under sudorules, but they could easily be placed as peers. 
 Contrast these with DNS records, that require the  the DNS  Zone value.

 For 3 level deep nesting, we will need a naming scheme to make these
 work.  something like
 #subtab=sudoruleentity=sudocmd

 contrast this with

 #entity=sudorule

 Thus, the entity value always points to the object, not necessarily at
 the leaf node of the navigation tree.

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


 
 Do I read you right that instead of using actions menu you want to as
   
use

 another row of the tabs at the top?
 I am not sure I agree with this.

   


-- 
Thank you,
Dmitri Pal

Sr. Engineering Manager IPA project,
Red Hat Inc.


---
Looking to carve out IT costs?
www.redhat.com/carveoutcosts/

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


Re: [Freeipa-devel] [PATCH] 0100-top-nav-index

2010-11-19 Thread Endi Sukma Dewata

On 11/19/2010 4:09 PM, Adam Young wrote:




This will not work with entities that do not have associated tabs, e.g. 
hbacsvc, hbacsvcgroups, sudocmd, sudocmdgroups. For these entities the 
IPA.tab_state() will return undefined, so the ipa_column_widget.setup() 
will fail.


To reproduce this problem, try clicking the search results in hbacsvc or 
hbacsvcgroups. For some reason it will bring you to the user search page.


We need to figure out the proper way to handle these entities. It 
probably requires framework modification.


--
Endi S. Dewata

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