summaryrefslogtreecommitdiffstats
path: root/install/static/webui.js
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2010-09-28 19:20:02 -0400
committerAdam Young <ayoung@redhat.com>2010-09-29 09:30:09 -0400
commit09555fae17dcd142c4b39643e3f7d376ed8d4841 (patch)
treed6c38eb9740a05e473fcec0f5069d7467cf53347 /install/static/webui.js
parentd201a4350d8ce0adb97e8f161ab916bb6bc066a5 (diff)
downloadfreeipa-09555fae17dcd142c4b39643e3f7d376ed8d4841.tar.gz
freeipa-09555fae17dcd142c4b39643e3f7d376ed8d4841.tar.xz
freeipa-09555fae17dcd142c4b39643e3f7d376ed8d4841.zip
tab objects
Convert the tab lists to arrays of objects with four potential fields: tab[0] -> tab.name tab[1] -> tab.label tab[2] -> tab.setup or tab.children Added unit tests for nav_setup and nav_select_tab
Diffstat (limited to 'install/static/webui.js')
-rw-r--r--install/static/webui.js50
1 files changed, 27 insertions, 23 deletions
diff --git a/install/static/webui.js b/install/static/webui.js
index aa17b414..331ec82e 100644
--- a/install/static/webui.js
+++ b/install/static/webui.js
@@ -21,26 +21,30 @@
/* REQUIRES: everything, this file puts it all togheter */
/* tabs definition for IPA webUI */
-var admin_tabs_lists = [
- ['identity', 'IDENTITY', [
- ['user', 'Users', ipa_entity_setup],
- ['group', 'Groups', ipa_entity_setup],
- ['host', 'Hosts', ipa_entity_setup],
- ['hostgroup', 'Hostgroups', ipa_entity_setup],
- ['netgroup', 'Netgroups', ipa_entity_setup],
- ['service', 'Services', ipa_entity_setup],
- ]],
- ['policy', 'POLICY', unimplemented_tab],
- ['config', 'CONFIG', [
- ['rolegroup', 'Rolegroups', ipa_entity_setup]
- ]]
+
+
+var admin_tab_set = [
+ {name:'identity', label:'IDENTITY', children:[
+ {name:'user', label:'Users', setup: ipa_entity_setup},
+ {name:'group', label:'Groups', setup: ipa_entity_setup},
+ {name:'host', label:'Hosts', setup: ipa_entity_setup},
+ {name:'hostgroup', label:'Hostgroups', setup: ipa_entity_setup},
+ {name:'netgroup', label:'Netgroups', setup: ipa_entity_setup},
+ {name:'service', label:'Services', setup: ipa_entity_setup},
+ ]},
+ {name:'policy', label:'POLICY', setup: unimplemented_tab},
+ {name:'config', label:'CONFIG', children: [
+ {name:'rolegroup', label:'Rolegroups', setup: ipa_entity_setup}
+ ]}
];
+
+
var self_serv_tabs_lists =
[
- ['identity', 'IDENTITY', [
- ['user', 'Users', ipa_entity_setup]]]];
+ { name:'identity', label:'IDENTITY', children: [
+ {name:'user', label:'Users', setup:ipa_entity_setup}]}];
var nav_tabs_lists;
@@ -59,9 +63,9 @@ $(function() {
{'user-facet':'details', 'user-pkey':whoami_pkey},2);
if (whoami.hasOwnProperty('memberof_rolegroup') &&
whoami.memberof_rolegroup.length > 0){
- nav_tabs_lists = admin_tabs_lists;
+ nav_tabs_lists = admin_tab_set;
}else{
- nav_tabs_lists = self_serv_tabs_lists;
+ nav_tabs_lists = self_serv_tab_set;
var state = {'user-pkey':whoami_pkey ,
'user-facet': jQuery.bbq.getState('user-facet') ||
@@ -106,12 +110,12 @@ function window_hashchange(evt)
for (var i = 0; i < nav_tabs_lists.length; ++i) {
var t = nav_tabs_lists[i];
- if (typeof t[2] != 'function' && t[2].length) {
- for (var j = 0; j < t[2].length; ++j) {
- var tt = t[2][j];
- var obj_name = tt[0];
- var entity_setup = tt[2];
- var div = $('#' + tt[0]);
+ if (!(t.setup) && t.children) {
+ for (var j = 0; j < t.children.length; ++j) {
+ var tt = t.children[j];
+ var obj_name = tt.name;
+ var entity_setup = tt.setup;
+ var div = $('#' + tt.name);
var state = obj_name + '-facet';
var facet = $.bbq.getState(state, true) || 'search';