summaryrefslogtreecommitdiffstats
path: root/install/static
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2010-12-07 12:17:12 -0600
committerAdam Young <ayoung@redhat.com>2010-12-07 17:54:04 -0500
commitdeb94b150dc48d3af2a461e7d325f7c68cceefef (patch)
treec63fbb43db12a3c3b0de65e482af17ef17622bc6 /install/static
parent9e5fdcb3a4af41282e72d314b65341d9aa209e23 (diff)
downloadfreeipa-deb94b150dc48d3af2a461e7d325f7c68cceefef.tar.gz
freeipa-deb94b150dc48d3af2a461e7d325f7c68cceefef.tar.xz
freeipa-deb94b150dc48d3af2a461e7d325f7c68cceefef.zip
Navigation updates
The entity.default_facet has been removed, instead the first facet registered to the entity will be considered as the default facet. So, the 'setup' parameter has been removed from tab definitions because it's no longer necessary. The ipa_details_only_setup() has been removed as well. An 'entity' parameter has been added to tab definitions to specify which entity corresponds to a tab item. The tab label has been changed to use entity label if available. Some hard-coded labels have been removed. The unit tests have been updated.
Diffstat (limited to 'install/static')
-rw-r--r--install/static/details.js2
-rw-r--r--install/static/entity.js14
-rw-r--r--install/static/navigation.js19
-rw-r--r--install/static/policy.js2
-rw-r--r--install/static/serverconfig.js24
-rw-r--r--install/static/test/details_tests.js50
-rw-r--r--install/static/test/navigation_tests.js26
-rw-r--r--install/static/webui.js38
8 files changed, 89 insertions, 86 deletions
diff --git a/install/static/details.js b/install/static/details.js
index cc1a4e19d..d9dc96bce 100644
--- a/install/static/details.js
+++ b/install/static/details.js
@@ -533,10 +533,8 @@ function ipa_details_setup(container) {
function ipa_details_refresh() {
var that = this;
- var entity = IPA.get_entity(that.entity_name);
that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
- if (!that.pkey && !entity.default_facet) return;
function on_success(data, text_status, xhr) {
that.load(data.result.result);
diff --git a/install/static/entity.js b/install/static/entity.js
index 9372d917e..340490ac8 100644
--- a/install/static/entity.js
+++ b/install/static/entity.js
@@ -189,6 +189,10 @@ function ipa_entity(spec) {
that.init = function() {
+ if (!that.label) {
+ that.label = IPA.metadata[that.name].label;
+ }
+
if (that.autogenerate_associations) {
that.create_association_facets();
}
@@ -332,12 +336,12 @@ function ipa_entity_set_facet_definition(entity_name, list) {
}
}
-function ipa_details_only_setup(container){
- ipa_entity_setup.call(this, container, 'details');
-}
-
function ipa_current_facet(entity){
- return $.bbq.getState(entity.name + '-facet', true) || entity.default_facet || 'search';
+ var facet_name = $.bbq.getState(entity.name + '-facet', true);
+ if (!facet_name && entity.facets.length) {
+ facet_name = entity.facets[0].name;
+ }
+ return facet_name;
}
function ipa_entity_setup(container) {
diff --git a/install/static/navigation.js b/install/static/navigation.js
index aa03becc4..8089e2eaf 100644
--- a/install/static/navigation.js
+++ b/install/static/navigation.js
@@ -76,8 +76,9 @@ function nav_generate_tabs(nls, container, tabclass, depth)
var tab = nls[i];
var label = tab.name;
- if ((IPA.metadata[tab.name]) && (IPA.metadata[tab.name].label)){
- label = IPA.metadata[tab.name].label;
+ if (tab.entity) {
+ var entity = IPA.get_entity(tab.entity);
+ label = entity.label;
}
var li = nav_create_tab_li(tab.name, label);
@@ -86,14 +87,12 @@ function nav_generate_tabs(nls, container, tabclass, depth)
var div = nav_create_tab_div(tab.name);
container.append(div);
- if (tab.children && depth === 1) {
- nav_generate_tabs(tab.children, div, tabclass, depth +1 );
- } else {
+ if (tab.entity) {
div.addClass('entity-container');
+ }
- var entity = ipa_get_entity(tab.name);
- entity.label = tab.label;
- entity.setup = tab.setup;
+ if (tab.children && depth === 1) {
+ nav_generate_tabs(tab.children, div, tabclass, depth +1 );
}
}
}
@@ -133,8 +132,8 @@ function _nav_update_tabs(nls, container,depth)
if (tab.children && depth === 1 ) {
_nav_update_tabs(tab.children, container2,depth+1);
- } else if (tab.setup) {
- var entity_name = tab.name;
+ } else if (tab.entity) {
+ var entity_name = tab.entity;
var nested_entity = nav_get_state(entity_name+'-entity');
diff --git a/install/static/policy.js b/install/static/policy.js
index df3970738..5425ae3d1 100644
--- a/install/static/policy.js
+++ b/install/static/policy.js
@@ -594,7 +594,5 @@ ipa_entity_set_details_definition('krbtpolicy', [
input({name:'krbmaxticketlife'})
]);
-IPA.get_entity('krbtpolicy').default_facet = 'details';
-
ipa_entity_set_association_definition('krbtpolicy', {
});
diff --git a/install/static/serverconfig.js b/install/static/serverconfig.js
index eef51ac35..c7dbf4149 100644
--- a/install/static/serverconfig.js
+++ b/install/static/serverconfig.js
@@ -50,19 +50,17 @@ ipa_entity_set_details_definition('aci', [
/* Configuration */
ipa_entity_set_details_definition('config',[
- ipa_stanza({name:'ipaserver', lable:'Configuration'}).
+ ipa_stanza({name:'ipaserver', label:'Configuration'}).
input({name:'cn', label:'Name'}).
input({name:'description', label:'Description'}).
- input({name:'ipacertificatesubjectbase', label:'Certificat Subject Base'}).
- input({name: 'ipadefaultloginshell', label:'Default Login Shell'}).
- input({name:'ipadefaultprimarygroup', label:'Default Primary Group'}).
- input({name:'ipagroupsearchfields', label:'Group Search Fields'}).
- input({name:'ipahomesrootdir', label:'Home Root Dir'}).
- input({name:'ipamaxusernamelength', label:'Max Username Length'}).
- input({name:'ipamigrationenabled', label:'Migration enabled?'}).
- input({name:'ipasearchrecordslimit', label:'Search Record Limit'}).
- input({name:'ipasearchtimelimit', label:'Search Time Limit'}).
- input({name:'ipausersearchfields', label:'User Search Fields'})
+ input({name:'ipacertificatesubjectbase'}).
+ input({name:'ipadefaultloginshell'}).
+ input({name:'ipadefaultprimarygroup'}).
+ input({name:'ipagroupsearchfields'}).
+ input({name:'ipahomesrootdir'}).
+ input({name:'ipamaxusernamelength'}).
+ input({name:'ipamigrationenabled'}).
+ input({name:'ipasearchrecordslimit'}).
+ input({name:'ipasearchtimelimit'}).
+ input({name:'ipausersearchfields'})
]);
-
-IPA.get_entity('config').default_facet = 'details';
diff --git a/install/static/test/details_tests.js b/install/static/test/details_tests.js
index baa884e28..3dee5357f 100644
--- a/install/static/test/details_tests.js
+++ b/install/static/test/details_tests.js
@@ -35,9 +35,9 @@ test("Testing ipa_details_section.create().", function() {
);
var section = ipa_details_list_section({name:'IDIDID', label:'NAMENAMENAME'}).
- input({name:'cn', label:'Entity Name'}).
- input({name:'description', label:'Description'}).
- input({name:'number', label:'Entity ID'});
+ input({name:'cn'}).
+ input({name:'description'}).
+ input({name:'number'});
var fields = section.fields;
@@ -147,32 +147,32 @@ test("Testing details lifecycle: create, setup, load.", function(){
var obj_name = 'user';
ipa_entity_set_details_definition(obj_name, [
ipa_stanza({name:'identity', label:'Identity Details'}).
- input({name:'title', label: 'Title'}).
- input({name:'givenname', label:'First Name'}).
- input({name:'sn', label:'Last Name'}).
- input({name:'cn', label:'Full Name'}).
- input({name:'displayname', label:'Dispaly Name'}).
- input({name:'initials', label:'Initials'}),
+ input({name:'title'}).
+ input({name:'givenname'}).
+ input({name:'sn'}).
+ input({name:'cn'}).
+ input({name:'displayname'}).
+ input({name:'initials'}),
ipa_stanza({name:'account', label:'Account Details'}).
- input({name:'status', label:'Account Status', setup: setup_status}).
- input({name:'uid', label:'Login'}).
- input({name:'userpassword', label:'Password', save: save_password}).
- input({name:'uidnumber', label:'UID'}).
- input({name:'gidnumber', label:'GID'}).
- input({name:'homedirectory', label:'homedirectory'}),
+ input({name:'status', setup: setup_status}).
+ input({name:'uid'}).
+ input({name:'userpassword', save: save_password}).
+ input({name:'uidnumber'}).
+ input({name:'gidnumber'}).
+ input({name:'homedirectory'}),
ipa_stanza({name:'contact', label:'Contact Details'}).
- input({name:'mail', label:'E-mail Address'}).
- input({name:'telephonenumber', label:'Numbers'}),
- ipa_stanza({name:'address', label:'Mailing Address'}).
- input({name:'street', label:'Address'}).
- input({name:'location', label:'City'}).
- input({name:'state', label:'State', setup: setup_st}).
- input({name:'postalcode', label:'ZIP'}),
+ input({name:'mail'}).
+ input({name:'telephonenumber'}),
+ ipa_stanza({name:'address'}).
+ input({name:'street'}).
+ input({name:'location'}).
+ input({name:'state', setup: setup_st}).
+ input({name:'postalcode'}),
ipa_stanza({name:'employee', label:'Employee Information'}).
- input({name:'ou', label:'Org. Unit'}).
- input({name:'manager', label:'Manager', load: load_manager}),
+ input({name:'ou'}).
+ input({name:'manager', load: load_manager}),
ipa_stanza({name:'misc', label:'Misc. Information'}).
- input({name:'carlicense', label:'Car License'})
+ input({name:'carlicense'})
]);
var entity = ipa_get_entity(obj_name);
diff --git a/install/static/test/navigation_tests.js b/install/static/test/navigation_tests.js
index 68d4694f6..0d6f322d1 100644
--- a/install/static/test/navigation_tests.js
+++ b/install/static/test/navigation_tests.js
@@ -26,20 +26,26 @@ test("Testing nav_create().", function() {
var mock_tabs_lists =
[
{ name:'identity', label:'IDENTITY', children: [
- {name:'user', label:'Users', setup:mock_setup_user},
- {name:'group', label:'Users', setup:mock_setup_group}
+ {name:'user', entity:'user'},
+ {name:'group', entity:'group'}
]}];
- function mock_setup_user (jobj){
+
+ var entity = ipa_entity({name: 'user'});
+ entity.setup = function(container){
user_mock_called = true;
- same(jobj[0].id,'user','user id');
- same(jobj[0].nodeName,'DIV','user div');
- }
- function mock_setup_group (jobj){
+ same(container[0].id,'user','user id');
+ same(container[0].nodeName,'DIV','user div');
+ };
+ IPA.add_entity(entity);
+
+ entity = ipa_entity({name: 'group'});
+ entity.setup = function(container){
group_mock_called = true;
- same(jobj[0].id,'group','group id');
- same(jobj[0].nodeName,'DIV','group Div');
+ same(container[0].id,'group','group id');
+ same(container[0].nodeName,'DIV','group Div');
+ };
+ IPA.add_entity(entity);
- }
IPA.metadata = {};
var navigation = $('<div id="navigation"/>').appendTo(document.body);
var user_mock_called = false;
diff --git a/install/static/webui.js b/install/static/webui.js
index 26f600981..1c917d57d 100644
--- a/install/static/webui.js
+++ b/install/static/webui.js
@@ -25,36 +25,36 @@
var admin_tab_set = [
{name:'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:'user', entity:'user'},
+ {name:'group', entity:'group'},
+ {name:'host', entity:'host'},
+ {name:'hostgroup', entity:'hostgroup'},
+ {name:'netgroup', entity:'netgroup'},
+ {name:'service', entity:'service'}
]},
{name:'policy', children:[
- {name:'dnszone', setup: ipa_entity_setup},
- {name:'hbac', setup: ipa_entity_setup, children:[
- {name:'hbacsvc', setup: ipa_entity_setup},
- {name:'hbacsvcgroup', setup: ipa_entity_setup}
+ {name:'dnszone', entity:'dnszone'},
+ {name:'hbac', entity:'hbac', children:[
+ {name:'hbacsvc', entity:'hbacsvc'},
+ {name:'hbacsvcgroup', entity:'hbacsvcgroup'}
]},
- {name:'sudorule', label:'SUDO', setup: ipa_entity_setup,children:[
- {name:'sudocmd', setup: ipa_entity_setup},
- {name:'sudocmdgroup', setup: ipa_entity_setup}
+ {name:'sudorule', entity:'sudorule',children:[
+ {name:'sudocmd', entity:'sudocmd'},
+ {name:'sudocmdgroup', entity:'sudocmdgroup'}
]},
- {name:'automountlocation', setup: ipa_entity_setup},
- {name:'pwpolicy', setup: ipa_entity_setup},
- {name:'krbtpolicy', setup:ipa_details_only_setup}
+ {name:'automountlocation', entity:'automountlocation'},
+ {name:'pwpolicy', entity:'pwpolicy'},
+ {name:'krbtpolicy', entity:'krbtpolicy'}
]},
{name:'ipaserver', children: [
- {name:'config', setup: ipa_details_only_setup}
+ {name:'config', entity:'config'}
]}
];
var self_serv_tab_set =
[
- { name:'identity', label:'IDENTITY', children: [
- {name:'user', label:'Users', setup:ipa_entity_setup}]}];
+ { name:'identity', children: [
+ {name:'user', entity:'user'}]}];
IPA.tab_state = function(entity_name){