Commit Graph

12 Commits

Author SHA1 Message Date
Adam Young
10f3c0825b entity i18n
Updated the user,group,host, hostgroup, netgroup, service, and all policy
entities to use the newer framework functions, in order to
replaced the old array style definitions which did not support i18n.
update a few of the newer framerwork functions to get the lables from the
meta data.

Fixed the unit tests which were expecting a details facet for users,
no longer automatically created
2010-12-06 12:52:47 -05:00
Endi S. Dewata
c90bff232d Multicolumn association facet
The association facet has been modified to support multiple columns.
By default the facet will have one column which is the primary key of
the associated object (e.g. username of a group member), so the
existing code will work like before. Other fields (e.g. user's full
name) can be added by subclassing the ipa_association_facet class and
specifying the additional columns to display. These additional fields
will be retrieved using a batch operation.

Previously a single association facet instance will be used for all
associations in an entity. Now each association will have its own
association facet. This way each association facet can be customized
differently as needed. The <entity>-enroll URL parameter has been
removed because it's no longer needed.

The ipa_entity.create_association_facets() is provided to generate
the default association facets with one column for the primary key.

The column click handler has been moved out of ipa_column to provide
more flexibility for customization.

The get_action_panel() and get_client_area() have been modified to
search within the entity's container.

The group entity has been fully converted to use the new UI framework.

Association facets that have been modified to use multiple columns are:
 - User Group's member_user
 - HBAC Service Group's member_hbacsvc
 - SUDO Command Group's member_sudocmd
 - Service's managedby_host

New test data files have been added. Unit tests have been updated.
2010-11-30 14:58:30 -05:00
Endi S. Dewata
27d8529a84 Fixed action panel queries
Previously the queries for action panel were done globally. Since each
entity container has its own action panel, the queries will return multiple
results. This is fixed by qualifying the query to run within the entity
container.

The query has also been moved into ipa_facet.get_action_panel(). Entities
that do not have their own entity container (e.g. HBAC services and service
groups) will need to override this method to get the action panel from the
right entity container (e.g. HBAC rules).

The facet.setup_views() has been renamed to facet.create_action_panel().
New test data for SUDO rules have been added.
2010-11-22 15:28:42 -05:00
Adam Young
632639b62d action select
if exactly one entity is selected, it enables the entity-facet links in the
action panel, and sets the pkey in bbq to the pkey of the selected
2010-11-17 21:50:03 -05:00
Adam Young
59a0c17c54 super to superior 2010-11-14 01:53:52 -05:00
Adam Young
821987fe67 layout
Closer to the layout from the spec
The facets have been moved to the action panel, to the left of the page
the facets are now rendered in an area of the screen with a client class
2010-11-14 01:53:41 -05:00
Endi S. Dewata
65c9442e26 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.
2010-11-11 12:23:05 -05:00
Endi S. Dewata
d99ebc0f37 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-04 14:22:32 -04:00
Endi S. Dewata
528145d5df Framework for custom UI
This patch introduces a new framework for implementing custom UI.
It consists of the following classes:

Main:
 - IPA: global namespace and object repository
 - ipa_entity: base class for entities
 - ipa_facet: base class for facets

Add dialog:
 - ipa_add_dialog: default add dialog
 - ipa_add_field: the fields used in the dialog

Search facet:
 - ipa_search_facet: default search facet
 - ipa_search_column: the columns in the search result

Details facet:
 - ipa_details_facet: default details facet
 - ipa_details_section: the sections in the details facet
 - ipa_details_field: the fields in the details facet

Association facet:
 - ipa_association_facet: default association facet
 - ipa_association_config: the association configurations

To use this framework, create a class extending the ipa_entity (e.g.
ipa_hbac). Use the create_* methods to create add dialog, search facet,
details facet, and association facet. The fields/columns for the dialog
and facets can be specified using the init() function. Custom UI can be
defined by overwriting the base methods (e.g. setup, save, load).
The entity must be added into the repository using IPA.add_entity().

The original ipa_entity_setup() has been generalized by moving facet-
specific codes into the corresponding facet. Some facet names are still
hard-coded. This will be fixed in follow-up patches.

Some global variables have been removed because their function has been
replaced by the object repository:
 - ipa_entity_add_list
 - ipa_entity_search_list
 - ipa_entity_details_list
 - window_hash_cache

Some functions and variables have been moved into IPA namespace:
 - ipa_json_url -> IPA.json_url
 - ipa_use_static_files -> IPA.use_static_files
 - ipa_ajax_options -> IPA.ajax_options
 - ipa_objs -> IPA.metadata
 - ipa_messages -> IPA.messages
 - ipa_dialog -> IPA.error_dialog
 - ipa_init() -> IPA.init()

Initially the HBAC and Service entities have been rewritten to use the
new framework. The DNS is partially converted, the ipa_records_facet
is used to define custom records facet.

Other entities can still work using the old framework. The old framework
has been modified to be a wrapper for the new framework. Eventually all
entities will be converted to use the new framework.

Some unit tests have been modified to use the new framework.
2010-10-28 09:28:17 -04:00
Endi S. Dewata
aa7ecb6f5f Autogenerating Quick Links.
ipa_entity_quick_links() has been added to generate quick links
automatically from object's attribute_members, the same logic used
for generating facet list. The search definition for each entity
has been updated to use the new function. A unit test has been
added for this function.
2010-10-01 16:17:51 -04:00
Endi Sukma Dewata
d966056bb0 Test suite for association.
New test cases have been added to test SerialAssociator and
BulkAssociator using mockup objects. Also fixed a bug in BulkAssociator.

Moved switch_view() out of ipa_entity_generate_views() in entity.js
to allow unit testing using mockup objects. Updated the test case
to validate click event on facets.
2010-09-28 10:20:14 -04:00
Endi Sukma Dewata
346615d4a0 Test framework for Web UI.
Test framework for Web UI has been created using qUnit. The test files
are located in install/static/test. The main page is index.html which
contains links to all test suites (xxx_tests.html). The test cases are
stored in xxx_tests.js. All test suites can be executed at once using
all_tests.html. The test data is stored in data folder. This patch
includes test suites for ipa.js and entity.js.

Some variables and functions in ipa.js have been modified to accomodate
testing (e.g. JSON URL, error handler, synchronous operation). The
sampledata has been moved to test/data. The develop.js and webui.js also
have been modified accordingly.
2010-09-24 19:50:29 -04:00