summaryrefslogtreecommitdiffstats
path: root/install/ui/group.js
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2011-03-18 16:43:54 -0400
committerAdam Young <ayoung@redhat.com>2011-03-31 17:29:33 -0400
commit4270e26adb56b6d1b7a9e80433581b82519d9eec (patch)
treedcb0982b741d92c0be37e262e70b7cd0969e06d0 /install/ui/group.js
parentdb91321fd2c94680361ae8196ba9227615f92c39 (diff)
downloadfreeipa-4270e26adb56b6d1b7a9e80433581b82519d9eec.tar.gz
freeipa-4270e26adb56b6d1b7a9e80433581b82519d9eec.tar.xz
freeipa-4270e26adb56b6d1b7a9e80433581b82519d9eec.zip
define entities using builder and more declarative syntax
merged hbac and sudo in to single files associaton facet and table supports linking
Diffstat (limited to 'install/ui/group.js')
-rw-r--r--install/ui/group.js168
1 files changed, 59 insertions, 109 deletions
diff --git a/install/ui/group.js b/install/ui/group.js
index d2e35e258..cc443cc53 100644
--- a/install/ui/group.js
+++ b/install/ui/group.js
@@ -26,115 +26,65 @@
IPA.entity_factories.group = function () {
- return IPA.entity({
- 'name': 'group'
- }).
- facet(
- IPA.search_facet().
- column({name: 'cn'}).
- column({name: 'gidnumber'}).
- column({name: 'description'}).
- dialog(
- IPA.add_dialog({
- 'name': 'add',
- 'title': IPA.messages.objects.group.add
- }).
- field(IPA.text_widget({name: 'cn', undo: false})).
- field(IPA.text_widget({name: 'description', undo: false})).
- field(IPA.checkbox_widget({
- name: 'posix',
- label: IPA.messages.objects.group.posix,
- undo: false,
- checked: 'checked'})).
- field(IPA.text_widget({name: 'gidnumber', undo: false})))).
- facet(
- IPA.details_facet().
- section(
- IPA.stanza({
- name: 'details',
- label: IPA.messages.objects.group.details
- }).
- input({name: 'cn' }).
- input({name: 'description'}).
- input({name: 'gidnumber' }))).
- facet(
- IPA.group_member_user_facet({
- 'name': 'member_user'
- })).
- facet(
- IPA.association_facet({
+ return IPA.entity_builder().
+ entity('group').
+ search_facet({
+ columns:['cn','gidnumber','description'],
+ add_fields: [
+ 'cn',
+ 'description',
+ {
+ factory:IPA.checkbox_widget,
+ name: 'posix',
+ label: IPA.messages.objects.group.posix,
+ undo: false,
+ checked: 'checked'
+ },
+ 'gidnumber']
+ }).
+ details_facet(
+ [{
+ section:'details',
+ fields:['cn','description','gidnumber']
+ }]).
+ facet( IPA.association_facet({
+ 'name': 'member_user',
+ columns:[
+ {
+ name: 'uid',
+ primary_key: true,
+ link_entity: true
+ },
+ {name: 'uidnumber'},
+ {name: 'mail'},
+ {name: 'telephonenumber'},
+ {name: 'title'}
+ ],
+ adder_columns:[
+ {
+ name: 'cn',
+ width: '100px'
+ },
+ {
+ name: 'uid',
+ primary_key: true,
+ width: '100px'
+ }
+ ]
+
+ })).
+ association_facet({
name: 'memberof_group',
associator: IPA.serial_associator
- })).
- facet(
- IPA.association_facet({
- name: 'memberof_netgroup',
- associator: IPA.serial_associator
- })).
- facet(
- IPA.association_facet({
- name: 'memberof_role',
- associator: IPA.serial_associator
- })).
- standard_associations();
+ }).
+ association_facet({
+ name: 'memberof_netgroup',
+ associator: IPA.serial_associator
+ }).
+ association_facet({
+ name: 'memberof_role',
+ associator: IPA.serial_associator
+ }).
+ standard_associations().
+ build();
};
-
-
-IPA.group_member_user_facet = function (spec) {
-
- spec = spec || {};
-
- var that = IPA.association_facet(spec);
-
- that.init = function() {
-
- that.create_column({name: 'cn'});
-
- var column = that.create_column({
- name: 'uid',
- primary_key: true
- });
-
- column.setup = function(container, record) {
- container.empty();
-
- var value = record[column.name];
- value = value ? value.toString() : '';
-
- $('<a/>', {
- 'href': '#'+value,
- 'html': value,
- 'click': function (value) {
- return function() {
- var state = IPA.tab_state(that.other_entity);
- state[that.other_entity + '-facet'] = 'details';
- state[that.other_entity + '-pkey'] = value;
- $.bbq.pushState(state);
- return false;
- };
- }(value)
- }).appendTo(container);
- };
-
- that.create_column({name: 'uidnumber'});
- that.create_column({name: 'mail'});
- that.create_column({name: 'telephonenumber'});
- that.create_column({name: 'title'});
-
- that.create_adder_column({
- name: 'cn',
- width: '100px'
- });
-
- that.create_adder_column({
- name: 'uid',
- primary_key: true,
- width: '100px'
- });
-
- that.association_facet_init();
- };
-
- return that;
-
-}; \ No newline at end of file