2010-09-29 15:57:07 -05:00
|
|
|
/* Authors:
|
|
|
|
* Adam Young <ayoung@redhat.com>
|
|
|
|
*
|
|
|
|
* 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-29 15:57:07 -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-29 15:57:07 -05:00
|
|
|
*/
|
|
|
|
|
2013-04-12 10:29:29 -05:00
|
|
|
define(['freeipa/ipa', 'freeipa/jquery','freeipa/facet', 'freeipa/facets', 'freeipa/details',
|
|
|
|
'freeipa/entity'], function(IPA, $, mod_facet, facets) {
|
2012-12-04 12:34:21 -06:00
|
|
|
return function() {
|
|
|
|
|
2011-03-18 15:43:54 -05:00
|
|
|
var details_container;
|
|
|
|
|
2010-09-29 15:57:07 -05:00
|
|
|
|
2011-01-19 20:10:18 -06:00
|
|
|
module('details', {
|
|
|
|
setup: function() {
|
2011-02-02 16:18:35 -06:00
|
|
|
IPA.ajax_options.async = false;
|
|
|
|
|
2013-04-12 10:29:29 -05:00
|
|
|
facets.register({
|
|
|
|
type: 'details',
|
|
|
|
factory: IPA.details_facet,
|
|
|
|
pre_ops: [
|
|
|
|
mod_facet.facet_preops.details
|
|
|
|
]
|
|
|
|
});
|
|
|
|
|
2011-11-09 18:48:04 -06:00
|
|
|
IPA.init({
|
|
|
|
url: 'data',
|
|
|
|
on_error: function(xhr, text_status, error_thrown) {
|
2011-02-02 16:18:35 -06:00
|
|
|
ok(false, "ipa_init() failed: "+error_thrown);
|
|
|
|
}
|
2011-11-09 18:48:04 -06:00
|
|
|
});
|
2011-02-02 16:18:35 -06:00
|
|
|
|
2011-03-18 15:43:54 -05:00
|
|
|
details_container = $('<div id="details"/>').appendTo(document.body);
|
|
|
|
|
2011-11-16 21:07:20 -06:00
|
|
|
IPA.register('user', function(spec) {
|
|
|
|
|
|
|
|
return IPA.entity({
|
|
|
|
name: 'user',
|
|
|
|
metadata: IPA.metadata.objects.user
|
|
|
|
});
|
|
|
|
});
|
2011-01-19 20:10:18 -06:00
|
|
|
},
|
|
|
|
teardown: function() {
|
2011-03-18 15:43:54 -05:00
|
|
|
details_container.remove();
|
2013-04-12 10:29:29 -05:00
|
|
|
facets.remove('details');
|
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.details_section.create().", function() {
|
2010-09-29 15:57:07 -05:00
|
|
|
|
2011-12-01 08:58:49 -06:00
|
|
|
var facet = IPA.details_facet({
|
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
|
|
|
entity: IPA.get_entity('user'),
|
2011-12-01 08:58:49 -06:00
|
|
|
sections: [
|
|
|
|
{
|
|
|
|
name:'IDIDID',
|
|
|
|
label:'NAMENAMENAME',
|
|
|
|
fields: [
|
|
|
|
'cn', 'uid', 'mail'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
});
|
|
|
|
|
|
|
|
var section = facet.widgets.get_widget('IDIDID');
|
2010-10-13 12:07:43 -05:00
|
|
|
|
2011-12-01 08:58:49 -06:00
|
|
|
ok(section !== null, 'Verifying section existence.');
|
2010-10-13 12:07:43 -05:00
|
|
|
|
2011-12-01 08:58:49 -06:00
|
|
|
var fields = section.widgets.get_widgets();
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
var container = $("<div/>");
|
2010-11-09 14:22:31 -06:00
|
|
|
section.create(container);
|
2010-10-13 12:07:43 -05:00
|
|
|
|
2011-08-10 20:03:02 -05:00
|
|
|
var table = $('table', container);
|
2010-10-13 12:07:43 -05:00
|
|
|
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
same(
|
2011-08-10 20:03:02 -05:00
|
|
|
table.length, 1,
|
2011-12-01 08:58:49 -06:00
|
|
|
'Verifying table');
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
|
2011-08-10 20:03:02 -05:00
|
|
|
var rows = $('tr', table);
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
same(
|
2011-08-10 20:03:02 -05:00
|
|
|
rows.length, fields.length,
|
2011-12-01 08:58:49 -06:00
|
|
|
'Verifying table rows');
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
|
|
|
|
for (var i=0; i<fields.length; i++) {
|
2010-11-16 18:10:40 -06:00
|
|
|
var field = fields[i];
|
|
|
|
|
2011-08-10 20:03:02 -05:00
|
|
|
var field_label = $('.field-label[name='+field.name+']', container);
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
same(
|
2011-08-10 20:03:02 -05:00
|
|
|
field_label.text(), field.label+':',
|
2011-12-01 08:58:49 -06:00
|
|
|
'Verifying label for field '+field.name);
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
|
2011-08-10 20:03:02 -05:00
|
|
|
var field_container = $('.field[name='+field.name+']', container);
|
2010-11-16 18:10:40 -06:00
|
|
|
|
|
|
|
ok(
|
2011-07-15 12:18:59 -05:00
|
|
|
field_container.length,
|
2011-12-01 08:58:49 -06:00
|
|
|
'Verifying container for field '+field.name);
|
2010-11-16 18:10:40 -06:00
|
|
|
|
|
|
|
ok(
|
2011-08-10 20:03:02 -05:00
|
|
|
field_container.hasClass('widget'),
|
2011-12-01 08:58:49 -06:00
|
|
|
'Verifying field '+field.name+' was created');
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
}
|
|
|
|
});
|
2010-10-13 12:07:43 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
test("Testing details lifecycle: create, load.", function(){
|
2010-10-13 12:07:43 -05:00
|
|
|
|
2011-11-18 19:47:39 -06:00
|
|
|
var data = {};
|
|
|
|
data.result = {};
|
|
|
|
data.result.result = {};
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
|
2011-04-12 02:13:30 -05:00
|
|
|
IPA.command({
|
|
|
|
entity: 'user',
|
|
|
|
method: 'show',
|
|
|
|
args: ['kfrog'],
|
|
|
|
on_success: function(data, text_status, xhr) {
|
|
|
|
ok(true, "IPA.command() succeeded.");
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
},
|
2011-04-12 02:13:30 -05:00
|
|
|
on_error: function(xhr, text_status, error_thrown) {
|
|
|
|
ok(false, "IPA.command() failed: "+error_thrown);
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
}
|
2011-04-12 02:13:30 -05:00
|
|
|
}).execute();
|
2010-10-13 12:07:43 -05:00
|
|
|
|
2011-05-27 12:04:20 -05:00
|
|
|
var save_called = false;
|
2011-02-03 21:42:50 -06:00
|
|
|
var load_called = false;
|
|
|
|
|
2010-10-13 12:07:43 -05:00
|
|
|
var load_success_called = false;
|
|
|
|
var load_failure_called = false;
|
|
|
|
var update_success_called = false;
|
|
|
|
var update_failure_called = false;
|
|
|
|
|
|
|
|
|
|
|
|
function save_password(){
|
2011-02-03 21:42:50 -06:00
|
|
|
save_called = true;
|
2010-10-13 12:07:43 -05:00
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
|
|
|
function load_manager(){
|
2011-02-03 21:42:50 -06:00
|
|
|
load_called = true;
|
2010-10-13 12:07:43 -05:00
|
|
|
}
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
|
2011-12-01 08:58:49 -06:00
|
|
|
function test_field(spec) {
|
|
|
|
var that = IPA.field(spec);
|
2011-03-18 15:43:54 -05:00
|
|
|
|
2011-12-01 08:58:49 -06:00
|
|
|
that.load = function(record) {
|
2011-03-18 15:43:54 -05:00
|
|
|
load_called = true;
|
2011-12-01 08:58:49 -06:00
|
|
|
that.field_load(record);
|
2011-03-18 15:43:54 -05:00
|
|
|
};
|
2011-04-11 13:49:36 -05:00
|
|
|
|
2011-12-01 08:58:49 -06:00
|
|
|
return that;
|
|
|
|
}
|
|
|
|
|
|
|
|
function test_widget(spec) {
|
|
|
|
var that = IPA.input_widget(spec);
|
|
|
|
|
|
|
|
that.widget_save = that.save;
|
|
|
|
|
|
|
|
that.save = function() {
|
2011-03-18 15:43:54 -05:00
|
|
|
save_called = true;
|
2011-12-01 08:58:49 -06:00
|
|
|
return that.widget_save();
|
2011-03-18 15:43:54 -05:00
|
|
|
};
|
2011-12-01 08:58:49 -06:00
|
|
|
|
|
|
|
return that;
|
2011-03-18 15:43:54 -05:00
|
|
|
}
|
2011-01-19 20:10:18 -06:00
|
|
|
|
2011-12-01 08:58:49 -06:00
|
|
|
IPA.field_factories['test'] = test_field;
|
|
|
|
IPA.widget_factories['test'] = test_widget;
|
|
|
|
|
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.details_facet({
|
2011-11-17 12:09:00 -06:00
|
|
|
sections: [
|
|
|
|
{
|
|
|
|
name: 'identity',
|
|
|
|
label: IPA.messages.details.identity,
|
|
|
|
fields: [ 'title', 'givenname', 'sn', 'cn', 'displayname', 'initials' ]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'contact',
|
|
|
|
label: 'contact',
|
|
|
|
fields: [
|
|
|
|
{
|
2011-12-01 08:58:49 -06:00
|
|
|
type: 'test',
|
2011-11-17 12:09:00 -06:00
|
|
|
name:'test'
|
|
|
|
},
|
|
|
|
{
|
2011-12-01 08:58:49 -06:00
|
|
|
type: 'multivalued',
|
2011-11-17 12:09:00 -06:00
|
|
|
name:'mail'
|
|
|
|
},
|
|
|
|
{
|
2011-12-01 08:58:49 -06:00
|
|
|
type: 'multivalued',
|
2011-11-17 12:09:00 -06:00
|
|
|
name:'telephonenumber'
|
|
|
|
},
|
|
|
|
{
|
2011-12-01 08:58:49 -06:00
|
|
|
type: 'multivalued',
|
2011-11-17 12:09:00 -06:00
|
|
|
name:'pager'
|
|
|
|
},
|
|
|
|
{
|
2011-12-01 08:58:49 -06:00
|
|
|
type: 'multivalued',
|
2011-11-17 12:09:00 -06:00
|
|
|
name:'mobile'
|
|
|
|
},
|
|
|
|
{
|
2011-12-01 08:58:49 -06:00
|
|
|
type: 'multivalued',
|
2011-11-17 12:09:00 -06:00
|
|
|
name:'facsimiletelephonenumber'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
return that;
|
|
|
|
});
|
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
|
|
|
|
2011-11-17 12:09:00 -06:00
|
|
|
var entity = IPA.get_entity('user');
|
2013-04-08 09:58:51 -05:00
|
|
|
var container = $('<div/>', {}).appendTo(details_container);
|
2011-04-28 19:17:58 -05:00
|
|
|
var facet = entity.get_facet('details');
|
2013-04-08 09:58:51 -05:00
|
|
|
facet.container_node = container[0];
|
|
|
|
facet.create();
|
2011-04-11 13:49:36 -05:00
|
|
|
|
2011-11-18 19:47:39 -06:00
|
|
|
facet.load(data);
|
2010-10-13 12:07:43 -05:00
|
|
|
|
2013-04-08 09:58:51 -05:00
|
|
|
var contact = $('.details-section[name=contact]', facet.domNode);
|
2010-10-13 12:07:43 -05:00
|
|
|
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
ok(
|
2011-08-10 20:03:02 -05:00
|
|
|
contact.length,
|
2011-12-01 08:58:49 -06:00
|
|
|
'Verifying section for contact is created');
|
2010-10-13 12:07:43 -05:00
|
|
|
|
2013-04-08 09:58:51 -05:00
|
|
|
var identity = $('.details-section[name=identity]', facet.domNode);
|
2010-10-13 12:07:43 -05:00
|
|
|
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
ok(
|
2011-08-10 20:03:02 -05:00
|
|
|
identity.length,
|
2011-12-01 08:58:49 -06:00
|
|
|
'Verifying section for identity is created');
|
2010-10-13 12:07:43 -05:00
|
|
|
|
2011-08-10 20:03:02 -05:00
|
|
|
var rows = $('tr', identity);
|
2010-10-13 12:07:43 -05:00
|
|
|
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
same(
|
2011-08-10 20:03:02 -05:00
|
|
|
rows.length, 6,
|
2011-12-01 08:58:49 -06:00
|
|
|
'Verifying rows for identity');
|
2010-10-13 12:07:43 -05:00
|
|
|
|
2011-02-03 21:42:50 -06:00
|
|
|
ok (load_called, 'load manager called');
|
2010-10-13 12:07:43 -05:00
|
|
|
|
2011-12-01 08:58:49 -06:00
|
|
|
var field = facet.fields.get_field('test');
|
2011-05-27 12:04:20 -05:00
|
|
|
field.set_dirty(true);
|
|
|
|
|
2010-11-18 20:17:14 -06:00
|
|
|
facet.update(
|
2011-12-01 08:58:49 -06:00
|
|
|
function(){update_success_called = true;},
|
|
|
|
function(){update_failure_called = true;});
|
2010-10-13 12:07:43 -05:00
|
|
|
|
|
|
|
ok (update_success_called,'update success called');
|
|
|
|
ok (!update_failure_called,'update failure not called');
|
2011-02-03 21:42:50 -06:00
|
|
|
ok (save_called, 'save called');
|
2010-09-29 15:57:07 -05:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2011-12-01 08:58:49 -06:00
|
|
|
test("Testing IPA.details_section_create again()",function() {
|
|
|
|
|
|
|
|
var facet = IPA.details_facet({
|
|
|
|
entity: IPA.get_entity('user'),
|
|
|
|
sections: [
|
|
|
|
{
|
|
|
|
name:'IDIDID',
|
|
|
|
label:'NAMENAMENAME',
|
|
|
|
fields: [
|
|
|
|
{
|
|
|
|
name: 'cn',
|
|
|
|
label: 'Entity Name'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'description',
|
|
|
|
label: 'Description'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'number',
|
|
|
|
label: 'Entity ID'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
});
|
|
|
|
|
|
|
|
var section = facet.widgets.get_widget('IDIDID');
|
|
|
|
ok(section !== null, 'Verifying section existence.');
|
|
|
|
var fields = section.widgets.get_widgets();
|
2010-11-05 12:11:56 -05:00
|
|
|
|
|
|
|
var container = $("<div title='entity'/>");
|
|
|
|
var details = $("<div/>");
|
|
|
|
container.append(details);
|
|
|
|
|
2011-11-18 19:47:39 -06:00
|
|
|
var data = {};
|
|
|
|
data.result = {};
|
|
|
|
data.result.result = {};
|
2010-11-09 14:22:31 -06:00
|
|
|
|
|
|
|
section.create(container);
|
2011-11-18 19:47:39 -06:00
|
|
|
facet.load(data);
|
2010-11-05 12:11:56 -05:00
|
|
|
|
2011-08-10 20:03:02 -05:00
|
|
|
var table = $('table', container);
|
2010-11-15 11:10:55 -06:00
|
|
|
|
|
|
|
same(
|
2011-08-10 20:03:02 -05:00
|
|
|
table.length, 1,
|
2011-12-01 08:58:49 -06:00
|
|
|
'Verifying table');
|
2010-11-15 11:10:55 -06:00
|
|
|
|
2011-08-10 20:03:02 -05:00
|
|
|
var rows = $('tr', table);
|
2010-11-15 11:10:55 -06:00
|
|
|
same(
|
2011-08-10 20:03:02 -05:00
|
|
|
rows.length, fields.length,
|
2011-12-01 08:58:49 -06:00
|
|
|
'Verifying table rows');
|
2010-11-05 12:11:56 -05:00
|
|
|
|
2011-08-10 20:03:02 -05:00
|
|
|
for (var i=0; i<fields.length; i++) {
|
|
|
|
var field = fields[i];
|
2010-11-15 11:10:55 -06:00
|
|
|
|
2011-08-10 20:03:02 -05:00
|
|
|
var field_label = $('.field-label[name='+field.name+']', container);
|
|
|
|
same(
|
|
|
|
field_label.text(), field.label+':',
|
2011-12-01 08:58:49 -06:00
|
|
|
'Verifying label for field '+field.name);
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2011-08-10 20:03:02 -05:00
|
|
|
var field_container = $('.field[name='+field.name+']', container);
|
|
|
|
|
|
|
|
ok(
|
|
|
|
field_container.length,
|
2011-12-01 08:58:49 -06:00
|
|
|
'Verifying container for field '+field.name);
|
2011-08-10 20:03:02 -05:00
|
|
|
|
|
|
|
ok(
|
|
|
|
field_container.hasClass('widget'),
|
2011-12-01 08:58:49 -06:00
|
|
|
'Verifying field '+field.name+' was created');
|
2011-08-10 20:03:02 -05:00
|
|
|
}
|
2010-11-05 12:11:56 -05:00
|
|
|
});
|
2012-12-04 12:34:21 -06:00
|
|
|
|
|
|
|
};});
|