summaryrefslogtreecommitdiffstats
path: root/install/ui
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-11-02 14:07:07 -0500
committerPetr Vobornik <pvoborni@redhat.com>2011-11-04 16:51:54 +0100
commit8ca348b99e350862418ac2fe0addfb0e354ea57e (patch)
tree0b91d8548037f5e10b6c491d7c1b969ce7a1ba57 /install/ui
parent5db9fed8a5c62a65adf43f1d8c24a0e061f6b301 (diff)
downloadfreeipa-8ca348b99e350862418ac2fe0addfb0e354ea57e.tar.gz
freeipa-8ca348b99e350862418ac2fe0addfb0e354ea57e.tar.xz
freeipa-8ca348b99e350862418ac2fe0addfb0e354ea57e.zip
Added extensible UI framework.
The entity definitions have been converted into classes. The entity init() method will use the builder to construct the facets and dialogs. The UI can be customized by creating a subclass of the original entity in extension.js and then overriding the init() method. Ticket #2043
Diffstat (limited to 'install/ui')
-rw-r--r--install/ui/aci.js87
-rw-r--r--install/ui/automount.js56
-rw-r--r--install/ui/dns.js38
-rw-r--r--install/ui/entitle.js31
-rw-r--r--install/ui/entity.js10
-rw-r--r--install/ui/group.js22
-rw-r--r--install/ui/hbac.js56
-rw-r--r--install/ui/host.js20
-rw-r--r--install/ui/hostgroup.js20
-rw-r--r--install/ui/index.html2
-rw-r--r--install/ui/ipa.js29
-rw-r--r--install/ui/netgroup.js20
-rw-r--r--install/ui/policy.js46
-rw-r--r--install/ui/serverconfig.js21
-rw-r--r--install/ui/service.js21
-rw-r--r--install/ui/sudo.js55
-rw-r--r--install/ui/user.js19
17 files changed, 355 insertions, 198 deletions
diff --git a/install/ui/aci.js b/install/ui/aci.js
index 5ffb2108b..92c5dcf02 100644
--- a/install/ui/aci.js
+++ b/install/ui/aci.js
@@ -23,11 +23,15 @@
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
-IPA.entity_factories.permission = function() {
+IPA.aci = {};
- return IPA.entity_builder().
- entity('permission').
- facet_groups([ 'privilege' , 'settings' ]).
+IPA.aci.permission_entity = function(spec) {
+
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
+
+ params.builder.facet_groups([ 'privilege' , 'settings' ]).
search_facet({
columns:['cn']
}).
@@ -78,15 +82,19 @@ IPA.entity_factories.permission = function() {
label: IPA.messages.objects.permission.target
}
]
- }).
- build();
+ });
+ };
+
+ return that;
};
+IPA.aci.privilege_entity = function(spec) {
+
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
-IPA.entity_factories.privilege = function() {
- return IPA.entity_builder().
- entity('privilege').
- facet_groups([ 'role', 'settings', 'permission' ]).
+ params.builder.facet_groups([ 'role', 'settings', 'permission' ]).
search_facet({
columns: [
'cn',
@@ -130,16 +138,19 @@ IPA.entity_factories.privilege = function() {
name: 'description'
}
]
- }).
- build();
+ });
+ };
+ return that;
};
+IPA.aci.role_entity = function(spec) {
+
+ var that = IPA.entity(spec);
-IPA.entity_factories.role = function() {
- return IPA.entity_builder().
- entity('role').
- facet_groups([ 'member', 'settings', 'privilege' ]).
+ that.init = function(params) {
+
+ params.builder.facet_groups([ 'member', 'settings', 'privilege' ]).
search_facet({
columns: [
'cn',
@@ -176,15 +187,19 @@ IPA.entity_factories.role = function() {
name: 'description'
}
]
- }).
- build();
+ });
+ };
+
+ return that;
};
+IPA.aci.selfservice_entity = function(spec) {
-IPA.entity_factories.selfservice = function() {
- return IPA.entity_builder().
- entity('selfservice').
- search_facet({
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
+
+ params.builder.search_facet({
columns:['aciname']}).
details_facet({
sections:[{
@@ -204,15 +219,19 @@ IPA.entity_factories.selfservice = function() {
object_type:'user',
name:'attrs'
}]
- }).
- build();
+ });
+ };
+
+ return that;
};
+IPA.aci.delegation_entity = function(spec) {
-IPA.entity_factories.delegation = function() {
- return IPA.entity_builder().
- entity('delegation').
- search_facet({
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
+
+ params.builder.search_facet({
columns:['aciname']}).
details_facet({sections:[
{
@@ -261,8 +280,10 @@ IPA.entity_factories.delegation = function() {
object_type: 'user',
join: true
}]
- }).
- build();
+ });
+ };
+
+ return that;
};
@@ -738,3 +759,9 @@ IPA.target_section = function(spec) {
return that;
};
+
+IPA.register('permission', IPA.aci.permission_entity);
+IPA.register('privilege', IPA.aci.privilege_entity);
+IPA.register('role', IPA.aci.role_entity);
+IPA.register('selfservice', IPA.aci.selfservice_entity);
+IPA.register('delegation', IPA.aci.delegation_entity);
diff --git a/install/ui/automount.js b/install/ui/automount.js
index b692e5831..054d2aee4 100644
--- a/install/ui/automount.js
+++ b/install/ui/automount.js
@@ -23,13 +23,15 @@
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
+IPA.automount = {};
-/**Automount*/
+IPA.automount.location_entity = function(spec) {
-IPA.entity_factories.automountlocation = function() {
- return IPA.entity_builder().
- entity({ name: 'automountlocation' }).
- facet_groups([ 'automountmap', 'settings' ]).
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
+
+ params.builder.facet_groups([ 'automountmap', 'settings' ]).
search_facet({
title: IPA.metadata.objects.automountlocation.label,
columns:['cn']
@@ -52,14 +54,19 @@ IPA.entity_factories.automountlocation = function() {
}).
adder_dialog({
fields: [ 'cn' ]
- }).
- build();
+ });
+ };
+
+ return that;
};
-IPA.entity_factories.automountmap = function() {
- return IPA.entity_builder().
- entity({ name: 'automountmap' }).
- containing_entity('automountlocation').
+IPA.automount.map_entity = function(spec) {
+
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
+
+ params.builder.containing_entity('automountlocation').
facet_groups([ 'automountkey', 'settings' ]).
nested_search_facet({
facet_group: 'automountkey',
@@ -135,14 +142,19 @@ IPA.entity_factories.automountmap = function() {
]
}
]
- }).
- build();
+ });
+ };
+
+ return that;
};
-IPA.entity_factories.automountkey = function() {
- return IPA.entity_builder().
- entity({ name: 'automountkey' }).
- containing_entity('automountmap').
+IPA.automount.key_entity = function(spec) {
+
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
+
+ params.builder.containing_entity('automountmap').
details_facet({
sections: [
{
@@ -188,8 +200,10 @@ IPA.entity_factories.automountkey = function() {
return false;
},
fields:['automountkey','automountinformation']
- }).
- build();
+ });
+ };
+
+ return that;
};
IPA.automount_key_column = function(spec) {
@@ -275,3 +289,7 @@ IPA.get_option_values = function(){
});
return values;
};
+
+IPA.register('automountlocation', IPA.automount.location_entity);
+IPA.register('automountmap', IPA.automount.map_entity);
+IPA.register('automountkey', IPA.automount.key_entity);
diff --git a/install/ui/dns.js b/install/ui/dns.js
index b7de11bd6..2cf5cd4a9 100644
--- a/install/ui/dns.js
+++ b/install/ui/dns.js
@@ -23,8 +23,11 @@
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js, widget.js */
-/* DNS */
-IPA.entity_factories.dnszone = function() {
+IPA.dns = {};
+
+IPA.dns.zone_entity = function(spec) {
+
+ var that = IPA.entity(spec);
if (!IPA.dns_enabled) {
var except = {
@@ -33,9 +36,9 @@ IPA.entity_factories.dnszone = function() {
throw except;
}
- return IPA.entity_builder().
- entity('dnszone').
- facet_groups([ 'dnsrecord', 'settings' ]).
+ that.init = function(params) {
+
+ params.builder.facet_groups([ 'dnsrecord', 'settings' ]).
search_facet({
title: IPA.metadata.objects.dnszone.label,
columns: [ 'idnsname' ]
@@ -140,8 +143,10 @@ IPA.entity_factories.dnszone = function() {
]
}
]
- }).
- build();
+ });
+ };
+
+ return that;
};
IPA.dnszone_details_facet = function(spec) {
@@ -429,7 +434,9 @@ IPA.dns_record_search_load = function (result) {
}
};
-IPA.entity_factories.dnsrecord = function() {
+IPA.dns.record_entity = function(spec) {
+
+ var that = IPA.entity(spec);
if (!IPA.dns_enabled) {
var except = {
@@ -438,9 +445,9 @@ IPA.entity_factories.dnsrecord = function() {
throw except;
}
- return IPA.entity_builder().
- entity('dnsrecord').
- containing_entity('dnszone').
+ that.init = function(params) {
+
+ params.builder.containing_entity('dnszone').
details_facet({
post_update_hook:function(data){
var result = data.result.result;
@@ -604,8 +611,10 @@ IPA.entity_factories.dnsrecord = function() {
required: true
}
]
- }).
- build();
+ });
+ };
+
+ return that;
};
IPA.dnsrecord_redirection_dialog = function(spec) {
@@ -710,3 +719,6 @@ IPA.dnsrecord_get_delete_values = function() {
return value_array;
};
+
+IPA.register('dnszone', IPA.dns.zone_entity);
+IPA.register('dnsrecord', IPA.dns.record_entity);
diff --git a/install/ui/entitle.js b/install/ui/entitle.js
index 8bd6c456c..d2039c4b5 100644
--- a/install/ui/entitle.js
+++ b/install/ui/entitle.js
@@ -29,16 +29,17 @@ IPA.entitle.unregistered = 'unregistered';
IPA.entitle.online = 'online';
IPA.entitle.offline = 'offline';
-IPA.entity_factories.entitle = function() {
+IPA.entitle.entity = function(spec) {
- var builder = IPA.entity_builder();
+ spec = spec || {};
- builder.
- entity({
- factory: IPA.entitle.entity,
- name: 'entitle'
- }).
- facet_groups([ 'account', 'certificates' ]).
+ var that = IPA.entity(spec);
+
+ that.status = IPA.entitle.unregistered;
+
+ that.init = function(params) {
+
+ params.builder.facet_groups([ 'account', 'certificates' ]).
details_facet({
factory: IPA.entitle.details_facet,
label: IPA.messages.objects.entitle.account,
@@ -171,17 +172,7 @@ IPA.entity_factories.entitle = function() {
}
]
});
-
- return builder.build();
-};
-
-IPA.entitle.entity = function(spec) {
-
- spec = spec || {};
-
- var that = IPA.entity(spec);
-
- that.status = IPA.entitle.unregistered;
+ };
that.get_accounts = function(on_success, on_error) {
@@ -751,3 +742,5 @@ IPA.entitle.download_widget = function(spec) {
return that;
};
+
+IPA.register('entitle', IPA.entitle.entity);
diff --git a/install/ui/entity.js b/install/ui/entity.js
index ce086bd1c..75f781e62 100644
--- a/install/ui/entity.js
+++ b/install/ui/entity.js
@@ -52,6 +52,9 @@ IPA.entity = function(spec) {
that.redirect_facet = spec.redirect_facet;
that.containing_entity = null;
+ that.init = function(params) {
+ };
+
that.get_containing_entity = function() {
return that.containing_entity ?
IPA.get_entity(that.containing_entity) : null;
@@ -282,7 +285,7 @@ IPA.nested_tabs = function(entity_name) {
return siblings;
};
-IPA.entity_builder = function(){
+IPA.entity_builder = function() {
var that = {};
@@ -523,10 +526,7 @@ IPA.entity_builder = function(){
};
that.build = function(){
- var item = entity;
- entity = null;
-
- return item;
+ return entity;
};
return that;
diff --git a/install/ui/group.js b/install/ui/group.js
index 418724e87..305fb4007 100644
--- a/install/ui/group.js
+++ b/install/ui/group.js
@@ -24,11 +24,15 @@
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
-IPA.entity_factories.group = function () {
+IPA.group = {};
- return IPA.entity_builder().
- entity('group').
- search_facet({
+IPA.group.entity = function(spec) {
+
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
+
+ params.builder.search_facet({
columns: [
'cn',
'gidnumber',
@@ -117,8 +121,10 @@ IPA.entity_factories.group = function () {
},
'gidnumber'
]
- }).
- build();
+ });
+ };
+
+ return that;
};
IPA.group_nonposix_checkbox_widget = function (spec) {
@@ -136,7 +142,7 @@ IPA.group_nonposix_checkbox_widget = function (spec) {
return that;
};
-IPA.group_adder_dialog = function (spec) {
+IPA.group_adder_dialog = function(spec) {
spec = spec || {};
@@ -161,3 +167,5 @@ IPA.group_adder_dialog = function (spec) {
return that;
};
+
+IPA.register('group', IPA.group.entity);
diff --git a/install/ui/hbac.js b/install/ui/hbac.js
index 4199c269f..31f789a84 100644
--- a/install/ui/hbac.js
+++ b/install/ui/hbac.js
@@ -23,10 +23,15 @@
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
-IPA.entity_factories.hbacrule = function() {
- return IPA.entity_builder().
- entity('hbacrule').
- search_facet({
+IPA.hbac = {};
+
+IPA.hbac.rule_entity = function(spec) {
+
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
+
+ params.builder.search_facet({
search_all: true,
columns: [
'cn',
@@ -39,14 +44,19 @@ IPA.entity_factories.hbacrule = function() {
}).
adder_dialog({
fields: [ 'cn' ]
- }).
- build();
+ });
+ };
+
+ return that;
};
-IPA.entity_factories.hbacsvc = function() {
- return IPA.entity_builder().
- entity('hbacsvc').
- search_facet({
+IPA.hbac.service_entity = function(spec) {
+
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
+
+ params.builder.search_facet({
columns: [
'cn',
'description'
@@ -99,15 +109,19 @@ IPA.entity_factories.hbacsvc = function() {
name: 'description'
}
]
- }).
- build();
+ });
+ };
+
+ return that;
};
+IPA.hbac.service_group_entity = function(spec) {
+
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
-IPA.entity_factories.hbacsvcgroup = function() {
- return IPA.entity_builder().
- entity('hbacsvcgroup').
- search_facet({
+ params.builder.search_facet({
columns: [
'cn',
'description'
@@ -159,8 +173,10 @@ IPA.entity_factories.hbacsvcgroup = function() {
name: 'description'
}
]
- }).
- build();
+ });
+ };
+
+ return that;
};
IPA.hbacrule_details_facet = function(spec) {
@@ -557,3 +573,7 @@ IPA.hbacrule_details_facet = function(spec) {
return that;
};
+
+IPA.register('hbacrule', IPA.hbac.rule_entity);
+IPA.register('hbacsvc', IPA.hbac.service_entity);
+IPA.register('hbacsvcgroup', IPA.hbac.service_group_entity);
diff --git a/install/ui/host.js b/install/ui/host.js
index fe0829414..857f85434 100644
--- a/install/ui/host.js
+++ b/install/ui/host.js
@@ -24,11 +24,15 @@
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
-IPA.entity_factories.host = function () {
+IPA.host = {};
- return IPA.entity_builder().
- entity('host').
- search_facet({
+IPA.host.entity = function(spec) {
+
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
+
+ params.builder.search_facet({
columns: [
'fqdn',
'description',
@@ -166,8 +170,10 @@ IPA.entity_factories.host = function () {
}).
deleter_dialog({
factory: IPA.host_deleter_dialog
- }).
- build();
+ });
+ };
+
+ return that;
};
IPA.host_fqdn_section = function(spec) {
@@ -779,3 +785,5 @@ IPA.host_certificate_status_widget = function (spec) {
return that;
};
+
+IPA.register('host', IPA.host.entity);
diff --git a/install/ui/hostgroup.js b/install/ui/hostgroup.js
index f01e5b5e8..58e25e3f1 100644
--- a/install/ui/hostgroup.js
+++ b/install/ui/hostgroup.js
@@ -22,12 +22,15 @@
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
+IPA.hostgroup = {};
-IPA.entity_factories.hostgroup = function() {
+IPA.hostgroup.entity = function(spec) {
- return IPA.entity_builder().
- entity('hostgroup').
- search_facet({
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
+
+ params.builder.search_facet({
columns: [
'cn',
'description'
@@ -77,9 +80,10 @@ IPA.entity_factories.hostgroup = function() {
name: 'description'
}
]
- }).
- build();
-};
-
+ });
+ };
+ return that;
+};
+IPA.register('hostgroup', IPA.hostgroup.entity);
diff --git a/install/ui/index.html b/install/ui/index.html
index d1aab0c47..cb014815b 100644
--- a/install/ui/index.html
+++ b/install/ui/index.html
@@ -38,7 +38,7 @@
<script type="text/javascript" src="aci.js"></script>
<script type="text/javascript" src="entitle.js"></script>
-
+ <script type="text/javascript" src="extension.js"></script>
<script type="text/javascript" src="develop.js"></script>
<script type="text/javascript" src="webui.js"></script>
diff --git a/install/ui/ipa.js b/install/ui/ipa.js
index 0ce783dbc..c0aa98b98 100644
--- a/install/ui/ipa.js
+++ b/install/ui/ipa.js
@@ -25,7 +25,7 @@
/* REQUIRES: jquery.ordered-map.js */
/*global $:true, location:true */
-var IPA = ( function () {
+var IPA = function() {
var that = {
jsonrpc_id: 0
@@ -172,22 +172,37 @@ var IPA = ( function () {
batch.execute();
};
+ that.register = function(name, factory) {
+ that.entity_factories[name] = factory;
+ };
+
that.get_entities = function() {
return that.entities.values;
};
-
-
that.get_entity = function(name) {
var entity = that.entities.get(name);
- if (!entity){
+ if (!entity) {
var factory = that.entity_factories[name];
- if (!factory){
+ if (!factory) {
return null;
}
+
try {
- entity = factory();
+ var builder = that.entity_builder();
+
+ builder.entity({
+ factory: factory,
+ name: name
+ });
+
+ entity = builder.build();
+ entity.init({
+ builder: builder
+ });
+
that.add_entity(entity);
+
} catch (e) {
if (e.expected){
/*expected exceptions thrown by builder just mean that
@@ -256,7 +271,7 @@ var IPA = ( function () {
};
return that;
-}());
+}();
/**
* Call an IPA command over JSON-RPC.
diff --git a/install/ui/netgroup.js b/install/ui/netgroup.js
index a99c6c7ef..dcec180fe 100644
--- a/install/ui/netgroup.js
+++ b/install/ui/netgroup.js
@@ -22,11 +22,15 @@
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
-IPA.entity_factories.netgroup = function() {
+IPA.netgroup = {};
- return IPA.entity_builder().
- entity('netgroup').
- search_facet({
+IPA.netgroup.entity = function(spec) {
+
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
+
+ params.builder.search_facet({
columns: [
'cn',
'description'
@@ -76,6 +80,10 @@ IPA.entity_factories.netgroup = function() {
name: 'description'
}
]
- }).
- build();
+ });
+ };
+
+ return that;
};
+
+IPA.register('netgroup', IPA.netgroup.entity);
diff --git a/install/ui/policy.js b/install/ui/policy.js
index 8a0571394..4726608c2 100644
--- a/install/ui/policy.js
+++ b/install/ui/policy.js
@@ -23,11 +23,15 @@
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
-/**pwpolicy*/
-IPA.entity_factories.pwpolicy = function() {
- return IPA.entity_builder().
- entity('pwpolicy').
- search_facet({
+IPA.pwpolicy = {};
+
+IPA.pwpolicy.entity = function(spec) {
+
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
+
+ params.builder.search_facet({
columns:['cn','cospriority']}).
details_facet({
sections:[
@@ -63,18 +67,21 @@ IPA.entity_factories.pwpolicy = function() {
'cospriority'
],
height: 300
- }).
- build();
+ });
+ };
+
+ return that;
};
-/**
- krbtpolicy
- Does not have search
-*/
-IPA.entity_factories.krbtpolicy = function() {
- return IPA.entity_builder().
- entity('krbtpolicy').
- details_facet({
+IPA.krbtpolicy = {};
+
+IPA.krbtpolicy.entity = function(spec) {
+
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
+
+ params.builder.details_facet({
title: IPA.metadata.objects.krbtpolicy.label,
sections: [
{
@@ -86,6 +93,11 @@ IPA.entity_factories.krbtpolicy = function() {
}
],
needs_update: true
- }).
- build();
+ });
+ };
+
+ return that;
};
+
+IPA.register('pwpolicy', IPA.pwpolicy.entity);
+IPA.register('krbtpolicy', IPA.krbtpolicy.entity);
diff --git a/install/ui/serverconfig.js b/install/ui/serverconfig.js
index be2a3df94..9ecf190c4 100644
--- a/install/ui/serverconfig.js
+++ b/install/ui/serverconfig.js
@@ -23,14 +23,15 @@
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
+IPA.config = {};
+IPA.config.entity = function(spec) {
-/* Configuration */
+ var that = IPA.entity(spec);
-IPA.entity_factories.config = function(){
- return IPA.entity_builder().
- entity('config').
- details_facet({
+ that.init = function(params) {
+
+ params.builder.details_facet({
title: IPA.metadata.objects.config.label,
sections: [
{
@@ -80,6 +81,10 @@ IPA.entity_factories.config = function(){
}
],
needs_update: true
- }).
- build();
-}; \ No newline at end of file
+ });
+ };
+
+ return that;
+};
+
+IPA.register('config', IPA.config.entity);
diff --git a/install/ui/service.js b/install/ui/service.js
index 5f88f8f10..7dc73488e 100644
--- a/install/ui/service.js
+++ b/install/ui/service.js
@@ -23,11 +23,15 @@
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
-IPA.entity_factories.service = function() {
+IPA.service = {};
- return IPA.entity_builder().
- entity('service').
- search_facet({
+IPA.service.entity = function(spec) {
+
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
+
+ params.builder.search_facet({
columns: [ 'krbprincipalname' ]
}).
details_facet({
@@ -81,10 +85,11 @@ IPA.entity_factories.service = function() {
adder_dialog({
factory: IPA.service_adder_dialog,
height: 350
- }).
- build();
-};
+ });
+ };
+ return that;
+};
IPA.service_adder_dialog = function(spec) {
@@ -341,3 +346,5 @@ IPA.service_certificate_status_widget = function (spec) {
return that;
};
+
+IPA.register('service', IPA.service.entity);
diff --git a/install/ui/sudo.js b/install/ui/sudo.js
index 1c79e0336..862478c60 100644
--- a/install/ui/sudo.js
+++ b/install/ui/sudo.js
@@ -22,12 +22,15 @@
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
+IPA.sudo = {};
+
+IPA.sudo.rule_entity = function(spec) {
-IPA.entity_factories.sudorule = function() {
+ var that = IPA.entity(spec);
- return IPA.entity_builder().
- entity('sudorule').
- search_facet({
+ that.init = function(params) {
+
+ params.builder.search_facet({
columns: [
'cn',
'ipaenabledflag',
@@ -39,15 +42,19 @@ IPA.entity_factories.sudorule = function() {
}).
adder_dialog({
fields: [ 'cn' ]
- }).
- build();
+ });
+ };
+
+ return that;
};
-IPA.entity_factories.sudocmd = function() {
+IPA.sudo.command_entity = function(spec) {
+
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
- return IPA.entity_builder().
- entity('sudocmd').
- search_facet({
+ params.builder.search_facet({
columns: [
'sudocmd',
'description'
@@ -100,15 +107,19 @@ IPA.entity_factories.sudocmd = function() {
name: 'description'
}
]
- }).
- build();
+ });
+ };
+ return that;
};
-IPA.entity_factories.sudocmdgroup = function() {
- return IPA.entity_builder().
- entity('sudocmdgroup').
- search_facet({
+IPA.sudo.command_group_entity = function(spec) {
+
+ var that = IPA.entity(spec);
+
+ that.init = function(params) {
+
+ params.builder.search_facet({
columns: [
'cn',
'description'
@@ -160,11 +171,11 @@ IPA.entity_factories.sudocmdgroup = function() {
name: 'description'
}
]
- }).
- build();
-};
+ });
+ };
-IPA.sudo = {};
+ return that;
+};
IPA.sudorule_details_facet = function(spec) {
@@ -1186,3 +1197,7 @@ IPA.sudo.rule_association_adder_dialog = function(spec) {
return that;
};
+
+IPA.register('sudorule', IPA.sudo.rule_entity);
+IPA.register('sudocmd', IPA.sudo.command_entity);
+IPA.register('sudocmdgroup', IPA.sudo.command_group_entity);
diff --git a/install/ui/user.js b/install/ui/user.js
index 8e2205686..8207bf091 100644
--- a/install/ui/user.js
+++ b/install/ui/user.js
@@ -23,19 +23,20 @@
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
+IPA.user = {};
-IPA.entity_factories.user = function() {
+IPA.user.entity = function(spec) {
+
+ var that = IPA.entity(spec);
var link = true;
if (IPA.nav && IPA.nav.name == 'self-service') {
link = false;
}
- var builder = IPA.entity_builder();
+ that.init = function(params) {
- builder.
- entity('user').
- search_facet({
+ params.builder.search_facet({
columns: [
'uid',
'givenname',
@@ -105,7 +106,8 @@ IPA.entity_factories.user = function() {
{
name: 'misc',
fields: ['carlicense']
- }]}).
+ }]
+ }).
association_facet({
name: 'memberof_group',
associator: IPA.serial_associator,
@@ -167,8 +169,9 @@ IPA.entity_factories.user = function() {
}
]
});
+ };
- return builder.build();
+ return that;
};
IPA.user_adder_dialog = function(spec) {
@@ -461,3 +464,5 @@ IPA.user_password_widget = function(spec) {
return that;
};
+
+IPA.register('user', IPA.user.entity);