diff options
author | Endi S. Dewata <edewata@redhat.com> | 2010-11-09 14:22:31 -0600 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2010-11-11 12:23:05 -0500 |
commit | 65c9442e2697f9e5d8b6cc2b7c22a6b8da426247 (patch) | |
tree | a998aa317a59102646fada66a4944d022ff2afa5 /install/static/hbacsvc.js | |
parent | 569f4e1a5cb3ff4cf3a7bf3c2aa5fdfa9ced0134 (diff) | |
download | freeipa-65c9442e2697f9e5d8b6cc2b7c22a6b8da426247.tar.gz freeipa-65c9442e2697f9e5d8b6cc2b7c22a6b8da426247.tar.xz freeipa-65c9442e2697f9e5d8b6cc2b7c22a6b8da426247.zip |
HBAC Services
The HBAC Service search and details pages have been added under the HBAC
tab. This requires some changes to the framework.
Currently the navigation framework doesn't support multiple entities under
one tab. As a temporary solution, an 'entity' URL parameter is used to
determine the entity to be displayed. This parameter is now only used by
HBAC tab, but its use might be expanded later. The navigation framework
needs be redesigned to provide more flexibility.
The search page in all entities except DNS records have been changed to
use the ipa_search_widget. The Select/Unselect All checbox and Delete
button now work correctly and consistently.
The Add dialog has been enhanced to render and work in a more consistent
way while still supporting custom widgets & layouts. For the search page,
the Add button will refresh the search results and clear the fields in
the dialog box.
The framework now provides some extension points which can be overriden
by the subclasses:
- init(): for initialization and configuration
- create(): for creating the layout dynamically or from template
- setup(): for setting the look and feel
- load(): for loading the data
Entity and facet initialization is now done after IPA.init(). This is to
ensure the metadata is loaded first so the entities and facets can use
localized messages/labels/titles.
The group entity has been partially converted to use the new framework.
The unit tests have been updated accordingly.
Diffstat (limited to 'install/static/hbacsvc.js')
-rwxr-xr-x | install/static/hbacsvc.js | 177 |
1 files changed, 177 insertions, 0 deletions
diff --git a/install/static/hbacsvc.js b/install/static/hbacsvc.js new file mode 100755 index 00000000..268ce4c5 --- /dev/null +++ b/install/static/hbacsvc.js @@ -0,0 +1,177 @@ +/* Authors: + * Endi Sukma Dewata <edewata@redhat.com> + * + * Copyright (C) 2010 Red Hat + * see file 'COPYING' for use and warranty information + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2 only + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */ + +function ipa_hbacsvc() { + + var that = ipa_entity({ + 'name': 'hbacsvc' + }); + + that.super_init = that.super('init'); + + that.init = function() { + + var dialog = ipa_hbacsvc_add_dialog({ + 'name': 'add', + 'title': 'Add New HBAC Service' + }); + that.add_dialog(dialog); + dialog.init(); + + var facet = ipa_hbacsvc_search_facet({ + 'name': 'search', + 'label': 'Search' + }); + that.add_facet(facet); + + facet = ipa_hbacsvc_details_facet({ + 'name': 'details', + 'label': 'Details' + }); + that.add_facet(facet); + + that.super_init(); + }; + + return that; +} + +IPA.add_entity(ipa_hbacsvc()); + +function ipa_hbacsvc_add_dialog(spec) { + + spec = spec || {}; + + var that = ipa_add_dialog(spec); + + that.super_init = that.super('init'); + + that.init = function() { + + this.super_init(); + + this.add_field(ipa_text_widget({name:'cn', label:'Name'})); + this.add_field(ipa_text_widget({name:'description', label:'Description'})); + }; + + return that; +} + +function ipa_hbacsvc_search_facet(spec) { + + spec = spec || {}; + + var that = ipa_search_facet(spec); + + that.super_init = that.super('init'); + that.super_create = that.super('create'); + that.super_setup = that.super('setup'); + + that.init = function() { + + that.create_column({name:'cn', label:'Service', primary_key: true}); + that.create_column({name:'description', label:'Description'}); + + that.create_column({ + name: 'quick_links', + label: 'Quick Links', + setup: ipa_hbacsvc_quick_links + }); + + that.super_init(); + }; + + that.create = function(container) { + + var that = this; + + var right_buttons = $('<span/>', { + 'style': 'float: right;' + }).appendTo(container); + + right_buttons.append(ipa_button({ + 'label': 'HBAC Rules', + 'click': function() { + var state = {}; + state['entity'] = 'hbac'; + nav_push_state(state); + return false; + } + })); + container.append('<br/><br/>'); + + that.super_create(container); + }; + + return that; +} + + +function ipa_hbacsvc_quick_links(container, name, value, record) { + + var that = this; + + var pkey = IPA.metadata[that.entity_name].primary_key; + var pkey_value = record[pkey]; + + var link = $('<a/>', { + 'href': '#details', + 'title': 'Details', + 'text': 'Details', + 'click': function() { + var state = {}; + state[that.entity_name+'-facet'] = 'details'; + state[that.entity_name+'-pkey'] = pkey_value; + nav_push_state(state); + return false; + } + }); + + var span = $('span[name="'+name+'"]', container); + span.html(link); +} + +function ipa_hbacsvc_details_facet(spec) { + + spec = spec || {}; + + var that = ipa_details_facet(spec); + + that.super_init = that.super('init'); + that.super_create = that.super('create'); + that.super_setup = that.super('setup'); + + that.init = function() { + + var section = that.create_section({ + 'name': 'general', + 'label': 'General' + }); + + section.create_field({ 'name': 'cn', 'label': 'Name' }); + section.create_field({ 'name': 'description', 'label': 'Description' }); + + that.super_init(); + }; + + return that; +}
\ No newline at end of file |