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.
This commit is contained in:
Endi S. Dewata
2010-11-09 14:22:31 -06:00
committed by Adam Young
parent 569f4e1a5c
commit 65c9442e26
18 changed files with 1503 additions and 1008 deletions

View File

@@ -272,7 +272,7 @@ function ipa_association_widget(spec) {
'name': 'add',
'value': IPA.messages.button.enroll
}).appendTo(buttons);
}
};
that.setup = function(container) {
@@ -302,7 +302,6 @@ function ipa_association_widget(spec) {
var dialog = ipa_association_adder_dialog({
'title': title,
'parent': container,
'entity_name': that.entity_name,
'pkey': pkey,
'other_entity': that.other_entity,
@@ -318,7 +317,9 @@ function ipa_association_widget(spec) {
}
});
dialog.open();
dialog.init();
dialog.open(container);
};
that.remove = function(container) {
@@ -336,7 +337,6 @@ function ipa_association_widget(spec) {
var dialog = ipa_association_deleter_dialog({
'title': title,
'parent': container,
'entity_name': that.entity_name,
'pkey': pkey,
'other_entity': that.other_entity,
@@ -353,7 +353,40 @@ function ipa_association_widget(spec) {
}
});
dialog.open();
dialog.init();
dialog.open(container);
};
that.refresh = function(container) {
function on_success(data, text_status, xhr) {
that.tbody.empty();
var column_name = that.columns[0].name;
var values = data.result.result[column_name];
//TODO, this is masking an error where the wrong
//direction association is presented upon page reload.
//if the values is unset, it is because
//form.associationColumns[0] doesn't exist in the results
if (!values) return;
for (var i = 0; i<values.length; i++){
var record = that.get_record(data.result.result, i);
that.add_row(container, record);
}
}
function on_error(xhr, text_status, error_thrown) {
var div = $('#'+that.id, container).empty();
div.append('<p>Error: '+error_thrown.name+'</p>');
div.append('<p>'+error_thrown.title+'</p>');
div.append('<p>'+error_thrown.message+'</p>');
}
var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
ipa_cmd('show', [pkey], {'rights': true}, on_success, on_error, that.entity_name);
};
return that;
@@ -373,13 +406,15 @@ function ipa_association_facet(spec) {
return pkey != that.pkey || other_entity != that.other_entity;
};
that.create = function(container) {
that.setup_views(container);
};
that.setup = function(container, unspecified) {
that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
that.other_entity = $.bbq.getState(that.entity_name + '-enroll', true) || '';
that.setup_views(container);
//TODO I18N
var header_message = that.other_entity + '(s) enrolled in ' +
that.entity_name + ' ' + that.pkey;
@@ -403,12 +438,6 @@ function ipa_association_facet(spec) {
return that;
}
function association_list_create(obj_name, jobj)
{
search_create(obj_name, [], jobj);
}
function ipa_deleter_dialog_setup() {
var that = this;