2010-09-24 18:50:29 -05:00
|
|
|
/* Authors:
|
|
|
|
* Endi Sukma Dewata <edewata@redhat.com>
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
* Adam Young <ayoung@redhat.com>
|
2010-09-24 18:50:29 -05:00
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Red Hat
|
|
|
|
* see file 'COPYING' for use and warranty information
|
|
|
|
*
|
2010-12-09 06:59:11 -06:00
|
|
|
* 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, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2010-09-24 18:50:29 -05:00
|
|
|
*
|
|
|
|
* 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
|
2010-12-09 06:59:11 -06:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2010-09-24 18:50:29 -05:00
|
|
|
*/
|
|
|
|
|
2011-03-18 15:43:54 -05:00
|
|
|
|
|
|
|
var entities_container;
|
|
|
|
|
2011-01-19 20:10:18 -06:00
|
|
|
module('entity',{
|
|
|
|
setup: function() {
|
2011-03-18 15:43:54 -05:00
|
|
|
|
|
|
|
IPA.ajax_options.async = false;
|
|
|
|
|
2011-11-09 18:48:04 -06:00
|
|
|
IPA.init({
|
|
|
|
url: 'data',
|
|
|
|
on_success: function(data, text_status, xhr) {
|
2011-03-18 15:43:54 -05:00
|
|
|
|
2011-11-17 12:09:00 -06:00
|
|
|
IPA.register('user', function(spec) {
|
|
|
|
|
|
|
|
var that = IPA.entity(spec);
|
|
|
|
|
2011-11-16 21:07:20 -06:00
|
|
|
that.init = function() {
|
|
|
|
that.entity_init();
|
2011-11-17 12:09:00 -06:00
|
|
|
|
2011-11-16 21:07:20 -06:00
|
|
|
that.builder.search_facet({
|
|
|
|
columns: [ 'uid' ]
|
|
|
|
});
|
2011-11-17 12:09:00 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
return that;
|
|
|
|
});
|
2011-03-18 15:43:54 -05:00
|
|
|
},
|
2011-11-09 18:48:04 -06:00
|
|
|
on_error: function(xhr, text_status, error_thrown) {
|
2011-03-18 15:43:54 -05:00
|
|
|
ok(false, "ipa_init() failed: "+error_thrown);
|
|
|
|
}
|
2011-11-09 18:48:04 -06:00
|
|
|
});
|
2011-03-18 15:43:54 -05:00
|
|
|
|
|
|
|
entities_container = $('<div id="entities"/>').appendTo(document.body);
|
|
|
|
|
2011-01-19 20:10:18 -06:00
|
|
|
},
|
|
|
|
teardown: function() {
|
2011-03-18 15:43:54 -05:00
|
|
|
entities_container.remove();
|
|
|
|
|
2011-01-19 20:10:18 -06:00
|
|
|
}
|
|
|
|
});
|
2010-10-25 18:55:57 -05:00
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
test('Testing IPA.entity_set_search_definition().', function() {
|
2010-09-24 18:50:29 -05:00
|
|
|
|
|
|
|
var uid_callback = function() {
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
2011-11-17 12:09:00 -06:00
|
|
|
var entity = IPA.get_entity('user');
|
2011-03-18 15:43:54 -05:00
|
|
|
|
2011-04-28 19:17:58 -05:00
|
|
|
var entity_container = $('<div/>', {
|
|
|
|
name: 'user',
|
|
|
|
title: 'User',
|
|
|
|
'class': 'entity'
|
|
|
|
}).appendTo(entities_container);
|
2011-04-07 16:14:58 -05:00
|
|
|
|
2011-04-28 19:17:58 -05:00
|
|
|
entity.create(entity_container);
|
|
|
|
|
|
|
|
var facet = entity.get_facet('search');
|
2011-04-07 16:14:58 -05:00
|
|
|
|
2011-04-28 19:17:58 -05:00
|
|
|
var facet_container = $('<div/>', {
|
|
|
|
name: facet.name,
|
|
|
|
'class': 'facet'
|
|
|
|
});
|
2011-03-18 15:43:54 -05:00
|
|
|
|
2011-04-28 19:17:58 -05:00
|
|
|
facet.create(facet_container);
|
2010-09-24 18:50:29 -05:00
|
|
|
|
2010-10-27 22:32:30 -05:00
|
|
|
var column = facet.get_columns()[0];
|
2010-09-24 18:50:29 -05:00
|
|
|
ok(
|
2010-10-27 22:32:30 -05:00
|
|
|
column,
|
2011-12-01 08:58:49 -06:00
|
|
|
'column is not null');
|
2010-09-24 18:50:29 -05:00
|
|
|
|
|
|
|
equals(
|
2010-10-27 22:32:30 -05:00
|
|
|
column.name, 'uid',
|
2011-12-01 08:58:49 -06:00
|
|
|
'column.name');
|
2010-09-24 18:50:29 -05:00
|
|
|
|
|
|
|
equals(
|
2011-03-18 15:43:54 -05:00
|
|
|
column.label, 'User login',
|
2011-12-01 08:58:49 -06:00
|
|
|
'column.label');
|
2010-09-24 18:50:29 -05:00
|
|
|
|
|
|
|
});
|
|
|
|
|