diff options
author | Adam Young <ayoung@redhat.com> | 2010-11-29 14:26:55 -0500 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2010-12-01 15:21:02 -0500 |
commit | 47d61e6cabc7a9053a7878ea3b8676ad59415f39 (patch) | |
tree | cdad5adb403a04ee7549248bf20bcdc31d017a4f /install/static | |
parent | 20b1e0a75ec832d906e7f66d2b306aabdce03901 (diff) | |
download | freeipa-47d61e6cabc7a9053a7878ea3b8676ad59415f39.tar.gz freeipa-47d61e6cabc7a9053a7878ea3b8676ad59415f39.tar.xz freeipa-47d61e6cabc7a9053a7878ea3b8676ad59415f39.zip |
action panel sibling added function to get sibling entities from the tab set. remove explicit sibling code from entity pages Modified the Label fields on HBAC and SUDO to make them appear cleaner in the UI
Diffstat (limited to 'install/static')
-rw-r--r-- | install/static/entity.js | 147 | ||||
-rwxr-xr-x | install/static/hbac.js | 36 | ||||
-rwxr-xr-x | install/static/hbacsvc.js | 22 | ||||
-rwxr-xr-x | install/static/hbacsvcgroup.js | 23 | ||||
-rwxr-xr-x | install/static/sudocmd.js | 17 | ||||
-rwxr-xr-x | install/static/sudocmdgroup.js | 20 | ||||
-rwxr-xr-x | install/static/sudorule.js | 37 | ||||
-rw-r--r-- | install/static/test/data/ipa_init.json | 109 | ||||
-rw-r--r-- | install/static/webui.js | 2 |
9 files changed, 164 insertions, 249 deletions
diff --git a/install/static/entity.js b/install/static/entity.js index 5d59b3c72..9b62ce375 100644 --- a/install/static/entity.js +++ b/install/static/entity.js @@ -367,40 +367,89 @@ function ipa_entity_setup(container) { facet.refresh(); } + + +/*Returns the entity requested, as well as: + any nested tabs underneath it or + its parent tab and the others nested at the same level*/ + +IPA.nested_tabs = function(entity_name){ + + var siblings = []; + + 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){ + siblings.push(entity_name); + 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){ + siblings.push (nested_entities[nested_index].name); + } + } + }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){ + siblings.push(top_tab.children[subtab_index].name); + for (var nested_index2 = 0; + nested_index2 < nested_entities.length; + nested_index2 += 1){ + siblings.push(nested_entities[nested_index2].name); + } + } + } + } + } + } + } + } + return siblings; +} + + + function ipa_facet_create_action_panel(container) { var that = this; var entity_name = that.entity_name; - var action_panel = $('<div/>', { "class": "action-panel", html: $('<h3>',{ text: IPA.metadata[entity_name].label }) }).appendTo(container); - function build_link(other_facet,label){ var li = $('<li/>', { "class" : other_facet.display_class, title: other_facet.name, text: label, click: function(entity_name, other_facet_name) { - return function() { - if($(this).hasClass('entity-facet-disabled')){ - return false; - } - var this_pkey = $('input[id=pkey]', action_panel).val(); - IPA.switch_and_show_page( - entity_name, other_facet_name, - this_pkey); - + return function() { + if($(this).hasClass('entity-facet-disabled')){ return false; - }; - }(entity_name, other_facet_name) - }); + } + var this_pkey = $('input[id=pkey]', action_panel).val(); + IPA.switch_and_show_page( + entity_name, other_facet_name, + this_pkey); + return false; + }; + }(entity_name, other_facet_name) + }); return li; } - /*Note, for debugging purposes, it is useful to set var pkey_type = 'text';*/ var pkey_type = 'hidden'; $('<input/>', { @@ -408,36 +457,62 @@ function ipa_facet_create_action_panel(container) { id:'pkey', name:'pkey' }).appendTo(action_panel); - var ul = $('<ul/>', {'class': 'action'}).appendTo(action_panel); - var entity = IPA.get_entity(entity_name); var facet_name = ipa_current_facet(entity); - var other_facet = entity.facets[0]; var other_facet_name = other_facet.name; - var main_facet = build_link(other_facet,other_facet.label); - - /*assumeing for now that entities with only a single facet - do not have search*/ - if (entity.facets.length > 0 ){ - main_facet.text( 'List ' + IPA.metadata[entity_name].label); - } - main_facet.appendTo(ul); - - ul.append($('<li><span class="action-controls"/></li>')); - for (var i=1; i<entity.facets.length; i++) { - other_facet = entity.facets[i]; - other_facet_name = other_facet.name; - - ul.append(build_link(other_facet,other_facet.label)); + var nested_tabs = IPA.nested_tabs(entity_name); + var main_facet = build_link(other_facet,other_facet.label) + for (var nested_index = 0 ; + nested_index < nested_tabs.length; + nested_index += 1){ + if (nested_tabs[nested_index] === entity_name){ + /*assume for now that entities with only a single facet + do not have search*/ + if (entity.facets.length > 0 ){ + main_facet.text( 'List ' + IPA.metadata[entity_name].label); + } + main_facet.appendTo(ul); + + ul.append($('<li><span class="action-controls"/></li>')); + for (var i=1; i<entity.facets.length; i++) { + other_facet = entity.facets[i]; + other_facet_name = other_facet.name; + + if (other_facet.label) { + ul.append(build_link(other_facet,other_facet.label)); + } else { // For now empty label indicates an association facet + var attribute_members = IPA.metadata[entity_name].attribute_members; + for (var attribute_member in attribute_members) { + var other_entities = attribute_members[attribute_member]; + for (var j = 0; j < other_entities.length; j++) { + var other_entity = other_entities[j]; + var label = IPA.metadata[other_entity].label; + ul.append(build_link(other_facet,label,other_entity)); + } + } + } + } + }else{ + $('<li/>', { + title: nested_tabs[nested_index], + text: IPA.metadata[nested_tabs[nested_index]].label, + "class": "search-facet", + click: function() { + var state = {}; + state[nested_tabs[0]+'-entity'] = + this.title; + nav_push_state(state); + return false; + } + }).appendTo(ul); + } } - /*When we land on the search page, disable all facets - that require a pkey until one is selected*/ + that require a pkey until one is selected*/ if (facet_name === 'search'){ $('.entity-facet', action_panel).addClass('entity-facet-disabled'); } - return action_panel; } diff --git a/install/static/hbac.js b/install/static/hbac.js index a6162b8bf..0d6ed7373 100755 --- a/install/static/hbac.js +++ b/install/static/hbac.js @@ -120,50 +120,18 @@ function ipa_hbac_search_facet(spec) { 'label': 'Cull Disabled Rules' })); */ - var action_panel = that.get_action_panel(); - - var ul = $('ul', action_panel); - - $('<li/>', { - title: 'hbacsvc', - text: 'HBAC Services' - }).appendTo(ul); - - $('<li/>', { - title: 'hbacsvcgroup', - text: 'HBAC Service Groups' - }).appendTo(ul); that.search_facet_create(container); - // TODO: replace with IPA.metadata[that.entity_name].label + container.children().last().prepend( - $('<h2/>', { 'html': 'HBAC Rules' })); + $('<h2/>', { 'html': IPA.metadata.hbac.label })); container.children().last().prepend('<br/><br/>'); }; that.setup = function(container) { - that.search_facet_setup(container); - - var action_panel = that.get_action_panel(); - - var li = $('li[title=hbacsvc]', action_panel); - li.click(function() { - var state = {}; - state['hbac-entity'] = 'hbacsvc'; - nav_push_state(state); - return false; - }); - - li = $('li[title=hbacsvcgroup]', action_panel); - li.click(function() { - var state = {}; - state['hbac-entity'] = 'hbacsvcgroup'; - nav_push_state(state); - return false; - }); }; return that; diff --git a/install/static/hbacsvc.js b/install/static/hbacsvc.js index c4140272e..a0ef75d14 100755 --- a/install/static/hbacsvc.js +++ b/install/static/hbacsvc.js @@ -89,29 +89,9 @@ function ipa_hbacsvc_search_facet(spec) { }; that.create = function(container) { - - var action_panel = that.get_action_panel(); - - var ul = $('ul', action_panel); - - /*Note that we add the rules at the top of the action panel - so that the HBAC entities always show in the same order.*/ - - $('<li/>', { - title: 'hbac', - text: 'HBAC Rules' - }).prependTo(ul); - - $('<li/>', { - title: 'hbacsvcgroup', - text: 'HBAC Service Groups' - }).appendTo(ul); - that.search_facet_create(container); - - // TODO: replace with IPA.metadata[that.entity_name].label container.children().last().prepend( - $('<h2/>', { 'html': 'HBAC Services' })); + $('<h2/>', { 'html': IPA.metadata.hbacsvc.label })); container.children().last().prepend('<br/><br/>'); }; diff --git a/install/static/hbacsvcgroup.js b/install/static/hbacsvcgroup.js index 914c73543..f06fe4f9d 100755 --- a/install/static/hbacsvcgroup.js +++ b/install/static/hbacsvcgroup.js @@ -102,31 +102,10 @@ function ipa_hbacsvcgroup_search_facet(spec) { }; that.create = function(container) { - - var action_panel = that.get_action_panel(); - - var ul = $('ul', action_panel); - - /*Note that we add these at the top of the action panel - so that the HBAC entities always show in the same order.*/ - $('<li/>', { - title: 'hbacsvc', - text: 'HBAC Services' - }).prependTo(ul); - - $('<li/>', { - title: 'hbac', - text: 'HBAC Rules' - }).prependTo(ul); - - that.search_facet_create(container); - - // TODO: replace with IPA.metadata[that.entity_name].label container.children().last().prepend( - $('<h2/>', { 'html': 'HBAC Service Groups' })); + $('<h2/>', { 'html':IPA.metadata.hbacsvcgroup.label })); container.children().last().prepend('<br/><br/>'); - }; that.setup = function(container) { diff --git a/install/static/sudocmd.js b/install/static/sudocmd.js index 0e335627e..3ad71eb52 100755 --- a/install/static/sudocmd.js +++ b/install/static/sudocmd.js @@ -90,25 +90,10 @@ function ipa_sudocmd_search_facet(spec) { that.create = function(container) { - var action_panel = that.get_action_panel(); - - var ul = $('ul', action_panel); - - $('<li/>', { - title: 'sudorule', - text: 'SUDO Rules' - }).prependTo(ul); - - $('<li/>', { - title: 'sudocmdgroup', - text: 'SUDO Command Groups' - }).appendTo(ul); - that.search_facet_create(container); - // TODO: replace with IPA.metadata[that.entity_name].label container.children().last().prepend( - $('<h2/>', { 'html': 'SUDO Commands' })); + $('<h2/>', { 'html': IPA.metadata.sudocmd.label })); container.children().last().prepend('<br/><br/>'); }; diff --git a/install/static/sudocmdgroup.js b/install/static/sudocmdgroup.js index c8b7edf8d..22762aec0 100755 --- a/install/static/sudocmdgroup.js +++ b/install/static/sudocmdgroup.js @@ -103,28 +103,10 @@ function ipa_sudocmdgroup_search_facet(spec) { that.create = function(container) { - var action_panel = that.get_action_panel(); - - var ul = $('ul', action_panel); - - /*Make sure that these go at the top of the action panel - and in the same order as on the other SUDO entity pages */ - $('<li/>', { - title: 'sudocmd', - text: 'SUDO Command' - }).prependTo(ul); - - $('<li/>', { - title: 'sudorule', - text: 'SUDO Rules' - }).prependTo(ul); - - that.search_facet_create(container); - // TODO: replace with IPA.metadata[that.entity_name].label container.children().last().prepend( - $('<h2/>', { 'html': 'SUDO Command Groups' })); + $('<h2/>', { 'html': IPA.metadata.sudocmdgroup.label })); container.children().last().prepend('<br/><br/>'); }; diff --git a/install/static/sudorule.js b/install/static/sudorule.js index 023cafde2..9e0e4e589 100755 --- a/install/static/sudorule.js +++ b/install/static/sudorule.js @@ -91,51 +91,16 @@ function ipa_sudorule_search_facet(spec) { }; that.create = function(container) { - - var action_panel = that.get_action_panel(); - - var ul = $('ul', action_panel); - - $('<li/>', { - title: 'sudocmd', - text: 'SUDO Commands' - }).appendTo(ul); - - $('<li/>', { - title: 'sudocmdgroup', - text: 'SUDO Command Groups' - }).appendTo(ul); - that.search_facet_create(container); - // TODO: replace with IPA.metadata[that.entity_name].label container.children().last().prepend( - $('<h2/>', { 'html': 'SUDO Rules' })); + $('<h2/>', { 'html': IPA.metadata.sudorule.label })); container.children().last().prepend('<br/><br/>'); }; that.setup = function(container) { - that.search_facet_setup(container); - - var action_panel = that.get_action_panel(); - - var li = $('li[title=sudocmd]', action_panel); - li.click(function() { - var state = {}; - state['sudorule-entity'] = 'sudocmd'; - nav_push_state(state); - return false; - }); - - li = $('li[title=sudocmdgroup]', action_panel); - li.click(function() { - var state = {}; - state['sudorule-entity'] = 'sudocmdgroup'; - nav_push_state(state); - return false; - }); }; return that; diff --git a/install/static/test/data/ipa_init.json b/install/static/test/data/ipa_init.json index 84fc02cc0..1de684904 100644 --- a/install/static/test/data/ipa_init.json +++ b/install/static/test/data/ipa_init.json @@ -6,37 +6,6 @@ "results": [ { "error": null, - "messages": { - "ajax": { - "401": "Your kerberos ticket no longer valid.Please run KInit and then click 'retry'If this is your first time running the IPA Web UI<a href='/ipa/errors/ssbrowser.html'> Follow these directions</a> to configure your browser." - }, - "button": { - "add": "Add", - "enroll": "Enroll", - "find": "Find", - "remove": "Delete", - "reset": "Reset", - "update": "Update" - }, - "details": { - "account": "Account Details", - "contact": "Contact Details", - "employee": " Employee Information", - "identity": "Identity Details", - "mailing": "Mailing Address", - "misc": "Misc. Information", - "to_top": "Back to Top" - }, - "login": { - "header": "Logged In As" - }, - "search": { - "delete_confirm": "Do you really want to delete the selected entries?", - "quick_links": "Quick Links", - "select_all": "Select All", - "unselect_all": "Unselect All" - } - }, "metadata": { "aci": { "__base64__": "" @@ -1090,11 +1059,11 @@ "include": null, "label": "Group name", "length": null, - "maxlength": 33, + "maxlength": 255, "minlength": null, "multivalue": false, "name": "cn", - "pattern": "^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,30}[a-zA-Z0-9_.$-]?$", + "pattern": "^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,252}[a-zA-Z0-9_.$-]?$", "pattern_errmsg": "may only include letters, numbers, _, -, . and $", "primary_key": true, "query": false, @@ -1638,7 +1607,7 @@ "objectclass", "aci" ], - "label": "Services", + "label": "HBAC Services", "methods": [ "add", "del", @@ -1807,6 +1776,9 @@ "enrolledby": [ "user" ], + "managedby": [ + "host" + ], "memberof": [ "hostgroup", "netgroup", @@ -1824,7 +1796,8 @@ "nsosversion", "usercertificate", "memberof", - "krblastpwdchange" + "krblastpwdchange", + "managedby" ], "hidden_attributes": [ "objectclass", @@ -1833,10 +1806,12 @@ "label": "Hosts", "methods": [ "add", + "add_managedby", "del", "disable", "find", "mod", + "remove_managedby", "show" ], "name": "host", @@ -2559,6 +2534,9 @@ ], "uuid_attribute": "ipauniqueid" }, + "pkinit": { + "__base64__": "" + }, "pwpolicy": { "attribute_members": {}, "container_dn": "cn=AYOUNG.BOSTON.DEVEL.REDHAT.COM,cn=kerberos", @@ -2972,7 +2950,7 @@ "objectclass", "aci" ], - "label": "SudoCmds", + "label": "SUDO Commands", "methods": [ "add", "del", @@ -3071,7 +3049,7 @@ "objectclass", "aci" ], - "label": "Sudo Command Groups", + "label": "SUDO Command Groups", "methods": [ "add", "add_member", @@ -3232,7 +3210,7 @@ "objectclass", "aci" ], - "label": "SudoRule", + "label": "SUDO", "methods": [ "add", "add_allow_command", @@ -3699,11 +3677,11 @@ "include": null, "label": "User login", "length": null, - "maxlength": 33, + "maxlength": 255, "minlength": null, "multivalue": false, "name": "uid", - "pattern": "^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,30}[a-zA-Z0-9_.$-]?$", + "pattern": "^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,252}[a-zA-Z0-9_.$-]?$", "pattern_errmsg": "may only include letters, numbers, _, -, . and $", "primary_key": true, "query": false, @@ -4145,19 +4123,19 @@ "Administrator" ], "gidnumber": [ - "1010626268" + "757995011" ], "homedirectory": [ "/home/admin" ], "ipauniqueid": [ - "73321718-f35011df-8e89dc8d-0b6df103" + "297bbe44-f810-11df-8f59-525400674dcd" ], "krblastpwdchange": [ - "20101118201738Z" + "20101124211850Z" ], "krbpasswordexpiration": [ - "20110216201738Z" + "20110222211850Z" ], "krbprincipalname": [ "admin@AYOUNG.BOSTON.DEVEL.REDHAT.COM" @@ -4198,7 +4176,7 @@ "admin" ], "uidnumber": [ - "1010626268" + "757995011" ] } ], @@ -4206,18 +4184,18 @@ "truncated": false }, { - "count": 64, + "count": 67, "error": null, "result": { "basedn": "dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com", - "bin": "/var/www", + "bin": "/home/ayoung/devel/freeipa", "ca_agent_port": 9443, "ca_ee_port": 9444, "ca_host": "ipa.ayoung.boston.devel.redhat.com", "ca_port": 9180, - "conf": "/etc/ipa/server.conf", - "conf_default": "/etc/ipa/default.conf", - "confdir": "/etc/ipa", + "conf": "/root/.ipa/lite.conf", + "conf_default": "/root/.ipa/default.conf", + "confdir": "/root/.ipa", "config_loaded": true, "container_accounts": "cn=accounts", "container_applications": "cn=applications,cn=configs,cn=policies", @@ -4243,39 +4221,42 @@ "container_taskgroup": "cn=taskgroups,cn=accounts", "container_user": "cn=users,cn=accounts", "container_virtual": "cn=virtual operations", - "context": "server", + "context": "lite", "debug": false, "domain": "ayoung.boston.devel.redhat.com", - "dot_ipa": "/var/www/.ipa", + "dot_ipa": "/root/.ipa", "enable_ra": true, "fallback": true, - "home": "/var/www", + "home": "/root", "host": "ipa.ayoung.boston.devel.redhat.com", "in_server": true, - "in_tree": false, + "in_tree": true, "interactive": true, - "ipalib": "/usr/lib/python2.6/site-packages/ipalib", + "ipalib": "/home/ayoung/devel/freeipa/ipalib", "ldap_uri": "ldapi://%2fvar%2frun%2fslapd-AYOUNG-BOSTON-DEVEL-REDHAT-COM.socket", - "log": null, - "logdir": "/var/log/ipa", + "lite_host": "127.0.0.1", + "lite_pem": "/root/.ipa/lite.pem", + "lite_port": 8888, + "log": "/root/.ipa/log/lite.log", + "logdir": "/root/.ipa/log", "mode": "production", "mount_ipa": "/ipa/", "mount_jsonserver": "json", "mount_xmlserver": "xml", "prompt_all": false, - "ra_plugin": "dogtag", + "ra_plugin": "selfsign", "realm": "AYOUNG.BOSTON.DEVEL.REDHAT.COM", "rpc_json_uri": "http://localhost:8888/ipa/json", - "script": "/var/www/mod_wsgi", - "site_packages": "/usr/lib/python2.6/site-packages", - "startup_traceback": false, + "script": "/home/ayoung/devel/freeipa/lite-server.py", + "site_packages": "/home/ayoung/devel/freeipa", + "startup_traceback": true, "verbose": 0, "webui_assets_dir": null, "webui_prod": true, - "xmlrpc_uri": "https://ipa.ayoung.boston.devel.redhat.com/ipa/xml" + "xmlrpc_uri": "http://localhost:8888/ipa/xml" }, - "summary": "64 variables", - "total": 64 + "summary": "67 variables", + "total": 67 } ] } diff --git a/install/static/webui.js b/install/static/webui.js index 0e3adb27d..4b2156c01 100644 --- a/install/static/webui.js +++ b/install/static/webui.js @@ -38,7 +38,7 @@ var admin_tab_set = [ {name:'hbacsvc', setup: ipa_entity_setup}, {name:'hbacsvcgroup', setup: ipa_entity_setup} ]}, - {name:'sudorule', setup: ipa_entity_setup,children:[ + {name:'sudorule', label:'SUDO', setup: ipa_entity_setup,children:[ {name:'sudocmd', setup: ipa_entity_setup}, {name:'sudocmdgroup', setup: ipa_entity_setup} ]}, |