diff options
author | Adam Young <ayoung@redhat.com> | 2010-11-19 15:57:40 -0500 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2010-11-29 21:13:26 -0500 |
commit | 7b91e9d83dd12c18ebe5d57f3fb86e1c27703b58 (patch) | |
tree | bd43147c1fde8019b8ff4870ec2b13620aebb1b8 /install | |
parent | b683c7261bcadc6899168d7cff8bd218a3501ba6 (diff) | |
download | freeipa-7b91e9d83dd12c18ebe5d57f3fb86e1c27703b58.tar.gz freeipa-7b91e9d83dd12c18ebe5d57f3fb86e1c27703b58.tar.xz freeipa-7b91e9d83dd12c18ebe5d57f3fb86e1c27703b58.zip |
top nav index allows links between differnt top level tabs by calculating the index of the top level tab for the target tab. new version creats third level navigation for nested entities, such as SUDO and HBAC
Diffstat (limited to 'install')
-rw-r--r-- | install/static/associate.js | 15 | ||||
-rw-r--r-- | install/static/navigation.js | 10 | ||||
-rw-r--r-- | install/static/webui.js | 48 | ||||
-rwxr-xr-x | install/static/widget.js | 14 |
4 files changed, 66 insertions, 21 deletions
diff --git a/install/static/associate.js b/install/static/associate.js index 01f7551a2..ddfd78c29 100644 --- a/install/static/associate.js +++ b/install/static/associate.js @@ -248,12 +248,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); @@ -466,6 +469,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/navigation.js b/install/static/navigation.js index e437e569b..240ee9592 100644 --- a/install/static/navigation.js +++ b/install/static/navigation.js @@ -86,7 +86,7 @@ function nav_generate_tabs(nls, container, tabclass, depth) var div = nav_create_tab_div(tab.name); container.append(div); - if (tab.children) { + if (tab.children && depth === 1) { nav_generate_tabs(tab.children, div, tabclass, depth +1 ); } else { div.addClass('entity-container'); @@ -116,10 +116,10 @@ function nav_create_tab_div(id) function nav_update_tabs() { - _nav_update_tabs(nav_tabs_lists, nav_container); + _nav_update_tabs(nav_tabs_lists, nav_container,1); } -function _nav_update_tabs(nls, container) +function _nav_update_tabs(nls, container,depth) { var id = container.attr('id'); var index = nav_get_state(id); @@ -130,8 +130,8 @@ function _nav_update_tabs(nls, container) var tab = nls[index]; var container2 = $('#' + tab.name); - if (tab.children) { - _nav_update_tabs(tab.children, container2); + if (tab.children && depth === 1 ) { + _nav_update_tabs(tab.children, container2,depth+1); } else if (tab.setup) { var entity_name = tab.name; diff --git a/install/static/webui.js b/install/static/webui.js index 5d1f36e5d..093d32b22 100644 --- a/install/static/webui.js +++ b/install/static/webui.js @@ -33,15 +33,20 @@ var admin_tab_set = [ {name:'service', label:'Services', setup: ipa_entity_setup} ]}, {name:'policy', children:[ - {name:'hbac', setup: ipa_entity_setup}, - {name:'sudorule', setup: ipa_entity_setup}, {name:'dns', setup: ipa_entity_setup}, + {name:'hbac', setup: ipa_entity_setup, children:[ + {name:'hbacsvc', setup: ipa_entity_setup}, + {name:'hbacsvcgroup', setup: ipa_entity_setup} + ]}, + {name:'sudorule', setup: ipa_entity_setup,children:[ + {name:'sudocmd', setup: ipa_entity_setup}, + {name:'sudocmdgroup', setup: ipa_entity_setup} + ]}, {name:'automountlocation', setup: ipa_entity_setup}, {name:'pwpolicy', setup: ipa_entity_setup}, {name:'krbtpolicy', setup:ipa_details_only_setup} ]}, {name:'ipaserver', children: [ -// {name:'aci', setup: ipa_entity_setup}, {name:'taskgroup', setup: ipa_entity_setup}, {name:'rolegroup', label:'Rolegroups', setup: ipa_entity_setup}, {name:'config', setup: ipa_details_only_setup} @@ -54,7 +59,39 @@ 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){ + if (top_tab.children[subtab_index].name === entity_name){ + state.navigation = top_tab_index; + state[top_tab.name] = subtab_index; + return state; + }else if (top_tab.children[subtab_index].children){ + var nested_entities = top_tab.children[subtab_index].children; + for (var nested_index = 0; + nested_index < nested_entities.length; + nested_index += 1){ + if (nested_entities[nested_index].name === entity_name){ + state.navigation = top_tab_index; + state[top_tab.name] = subtab_index; + state[ top_tab.children[subtab_index].name+'_entity'] = entity_name; + return state; + } + } + } + } + } + } +} /* main (document onready event handler) */ $(function() { @@ -78,9 +115,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 060f258eb..c2184c646 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; $.bbq.pushState(state); return false; |