mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Moved adder dialog box into entity.
The adder dialog box definition has been moved from search facet into entity to make it accessible from other facets.
This commit is contained in:
committed by
Endi Sukma Dewata
parent
bc6f9accd9
commit
3528b4eca3
@@ -28,20 +28,8 @@ IPA.entity_factories.permission = function() {
|
||||
return IPA.entity_builder().
|
||||
entity('permission').
|
||||
search_facet({
|
||||
columns:['cn'],
|
||||
add_fields:[
|
||||
'cn',
|
||||
{
|
||||
factory:IPA.rights_widget,
|
||||
name: 'permissions',
|
||||
join: true, undo: false
|
||||
},
|
||||
{
|
||||
factory: IPA.target_section,
|
||||
name: 'target',
|
||||
label: IPA.messages.objects.permission.target,
|
||||
undo: false
|
||||
}]}).
|
||||
columns:['cn']
|
||||
}).
|
||||
details_facet({sections:[
|
||||
{
|
||||
name:'identity',
|
||||
@@ -61,6 +49,21 @@ IPA.entity_factories.permission = function() {
|
||||
label: IPA.messages.objects.permission.target
|
||||
}]}).
|
||||
standard_association_facets().
|
||||
adder_dialog({
|
||||
fields:[
|
||||
'cn',
|
||||
{
|
||||
factory:IPA.rights_widget,
|
||||
name: 'permissions',
|
||||
join: true, undo: false
|
||||
},
|
||||
{
|
||||
factory: IPA.target_section,
|
||||
name: 'target',
|
||||
label: IPA.messages.objects.permission.target,
|
||||
undo: false
|
||||
}]
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
||||
@@ -69,8 +72,7 @@ IPA.entity_factories.privilege = function() {
|
||||
return IPA.entity_builder().
|
||||
entity('privilege').
|
||||
search_facet({
|
||||
columns:['cn','description'],
|
||||
add_fields:['cn', 'description']}).
|
||||
columns:['cn','description']}).
|
||||
details_facet({
|
||||
sections:
|
||||
[{
|
||||
@@ -90,6 +92,9 @@ IPA.entity_factories.privilege = function() {
|
||||
remove_method: 'remove_permission'
|
||||
}).
|
||||
standard_association_facets().
|
||||
adder_dialog({
|
||||
fields:['cn', 'description']
|
||||
}).
|
||||
build();
|
||||
|
||||
};
|
||||
@@ -99,8 +104,7 @@ IPA.entity_factories.role = function() {
|
||||
return IPA.entity_builder().
|
||||
entity('role').
|
||||
search_facet({
|
||||
columns:['cn','description'],
|
||||
add_fields:['cn', 'description']}).
|
||||
columns:['cn','description']}).
|
||||
details_facet({sections:[
|
||||
{
|
||||
name:'identity',
|
||||
@@ -112,6 +116,9 @@ IPA.entity_factories.role = function() {
|
||||
remove_method: 'remove_privilege'
|
||||
}).
|
||||
standard_association_facets().
|
||||
adder_dialog({
|
||||
fields:['cn', 'description']
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
||||
@@ -120,14 +127,7 @@ IPA.entity_factories.selfservice = function() {
|
||||
return IPA.entity_builder().
|
||||
entity('selfservice').
|
||||
search_facet({
|
||||
columns:['aciname'],
|
||||
add_fields:[
|
||||
'aciname',
|
||||
{factory:IPA.attributes_widget,
|
||||
object_type:'user',
|
||||
name:'attrs',
|
||||
undo: false
|
||||
}]}).
|
||||
columns:['aciname']}).
|
||||
details_facet({
|
||||
sections:[{
|
||||
name:'general',
|
||||
@@ -139,6 +139,15 @@ IPA.entity_factories.selfservice = function() {
|
||||
object_type:'user',
|
||||
name:'attrs'
|
||||
}]}]}).
|
||||
adder_dialog({
|
||||
fields:[
|
||||
'aciname',
|
||||
{factory:IPA.attributes_widget,
|
||||
object_type:'user',
|
||||
name:'attrs',
|
||||
undo: false
|
||||
}]
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
||||
@@ -147,23 +156,7 @@ IPA.entity_factories.delegation = function() {
|
||||
return IPA.entity_builder().
|
||||
entity('delegation').
|
||||
search_facet({
|
||||
columns:['aciname'],
|
||||
add_fields:[
|
||||
'aciname',
|
||||
{
|
||||
factory:IPA.entity_select_widget,
|
||||
name: 'group', entity: 'group', undo: false
|
||||
},
|
||||
{
|
||||
factory:IPA.entity_select_widget,
|
||||
name: 'memberof', entity: 'group',
|
||||
join: true, undo: false
|
||||
},
|
||||
{
|
||||
factory:IPA.attributes_widget,
|
||||
name: 'attrs', object_type: 'user',
|
||||
join: true, undo: false
|
||||
}]}).
|
||||
columns:['aciname']}).
|
||||
details_facet({sections:[
|
||||
{
|
||||
name:'general',
|
||||
@@ -185,6 +178,24 @@ IPA.entity_factories.delegation = function() {
|
||||
join: true
|
||||
}]}]}).
|
||||
standard_association_facets().
|
||||
adder_dialog({
|
||||
fields:[
|
||||
'aciname',
|
||||
{
|
||||
factory:IPA.entity_select_widget,
|
||||
name: 'group', entity: 'group', undo: false
|
||||
},
|
||||
{
|
||||
factory:IPA.entity_select_widget,
|
||||
name: 'memberof', entity: 'group',
|
||||
join: true, undo: false
|
||||
},
|
||||
{
|
||||
factory:IPA.attributes_widget,
|
||||
name: 'attrs', object_type: 'user',
|
||||
join: true, undo: false
|
||||
}]
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
||||
|
@@ -30,8 +30,7 @@ IPA.entity_factories.automountlocation = function() {
|
||||
return IPA.entity_builder().
|
||||
entity('automountlocation').
|
||||
search_facet({
|
||||
columns:['cn'],
|
||||
add_fields:['cn']
|
||||
columns:['cn']
|
||||
}).
|
||||
details_facet({sections:[{
|
||||
name:'identity',
|
||||
@@ -39,6 +38,9 @@ IPA.entity_factories.automountlocation = function() {
|
||||
fields:['cn']
|
||||
}]}).
|
||||
standard_association_facets().
|
||||
adder_dialog({
|
||||
fields:['cn']
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
||||
|
@@ -276,12 +276,23 @@ IPA.dialog = function(spec) {
|
||||
if (field_spec instanceof Object) {
|
||||
var factory = field_spec.factory || IPA.text_widget;
|
||||
field = factory(field_spec);
|
||||
} else {
|
||||
var field_name = field_spec;
|
||||
field = IPA.text_widget({ name: field_name, undo: false });
|
||||
}
|
||||
|
||||
that.add_field(field);
|
||||
/* This is a bit of a hack, and is here to support ACI
|
||||
permissions. The target section is a group of several
|
||||
widgets together. It makes more sense to do them as a
|
||||
section than as a widget. However, since they can be mixed
|
||||
into the flow with the other widgets, the section needs to
|
||||
be defined here with the fields to get the order correct.*/
|
||||
if (field.section) {
|
||||
that.add_section(field);
|
||||
} else {
|
||||
that.add_field(field);
|
||||
}
|
||||
|
||||
} else {
|
||||
field = IPA.text_widget({ name: field_spec, undo: false });
|
||||
that.add_field(field);
|
||||
}
|
||||
}
|
||||
|
||||
return that;
|
||||
|
@@ -29,8 +29,7 @@ IPA.entity_factories.dnszone = function() {
|
||||
return IPA.entity_builder().
|
||||
entity('dnszone').
|
||||
search_facet({
|
||||
columns:['idnsname'],
|
||||
add_fields: ['idnsname','idnssoamname','idnssoarname', {factory:IPA.force_dnszone_add_checkbox_widget}]
|
||||
columns:['idnsname']
|
||||
}).
|
||||
details_facet({sections:[{
|
||||
name:'identity',
|
||||
@@ -54,6 +53,13 @@ IPA.entity_factories.dnszone = function() {
|
||||
'label': IPA.metadata.objects.dnsrecord.label
|
||||
}).
|
||||
standard_association_facets().
|
||||
adder_dialog({
|
||||
fields: [
|
||||
'idnsname',
|
||||
'idnssoamname',
|
||||
'idnssoarname',
|
||||
{factory:IPA.force_dnszone_add_checkbox_widget}]
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
||||
|
@@ -601,6 +601,13 @@ IPA.entity_builder = function(){
|
||||
return that;
|
||||
};
|
||||
|
||||
that.adder_dialog = function(spec) {
|
||||
spec.factory = spec.factory || IPA.add_dialog;
|
||||
spec.name = spec.name || 'add';
|
||||
spec.title = spec.title || IPA.messages.objects.user.add;
|
||||
return that.dialog(spec);
|
||||
};
|
||||
|
||||
that.details_facet = function (spec){
|
||||
var sections = spec.sections;
|
||||
spec.sections = null;
|
||||
@@ -628,45 +635,6 @@ IPA.entity_builder = function(){
|
||||
search_all: spec.search_all || false,
|
||||
columns: spec.columns
|
||||
});
|
||||
|
||||
var current_dialog =
|
||||
IPA.add_dialog({
|
||||
'name': 'add',
|
||||
'title': IPA.messages.objects.user.add,
|
||||
entity_name: entity.name
|
||||
});
|
||||
|
||||
facet.dialog(current_dialog);
|
||||
|
||||
var add_fields = spec.add_fields;
|
||||
if (add_fields) {
|
||||
for (var i = 0; i < add_fields.length; i += 1){
|
||||
var field = add_fields[i];
|
||||
if (field instanceof Object){
|
||||
/* This is a bit of a hack ,and is here to support ACI
|
||||
permissions. The target section is a group of secveral
|
||||
widgets together. It makes more sense to do them as a
|
||||
seciont than as a widgit. However, since they can be mixed
|
||||
into the flow with the other widgets, the section needs to
|
||||
be definied here with the fields to get the order correct.*/
|
||||
var factory;
|
||||
if (field.section){
|
||||
factory = field.factory;
|
||||
field.factory = null;
|
||||
field.name = field.section;
|
||||
field.section = null;
|
||||
current_dialog.add_section(factory(field));
|
||||
}else{
|
||||
field.entity_name = entity.name;
|
||||
factory = field.factory || IPA.text_widget;
|
||||
current_dialog.field(factory(field));
|
||||
}
|
||||
}else{
|
||||
current_dialog.text(add_fields[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
entity.facet(facet);
|
||||
return that;
|
||||
};
|
||||
|
@@ -29,18 +29,7 @@ IPA.entity_factories.group = function () {
|
||||
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']
|
||||
columns:['cn','gidnumber','description']
|
||||
}).
|
||||
details_facet({sections:
|
||||
[{
|
||||
@@ -86,5 +75,18 @@ IPA.entity_factories.group = function () {
|
||||
associator: IPA.serial_associator
|
||||
}).
|
||||
standard_association_facets().
|
||||
adder_dialog({
|
||||
fields: [
|
||||
'cn',
|
||||
'description',
|
||||
{
|
||||
factory:IPA.checkbox_widget,
|
||||
name: 'posix',
|
||||
label: IPA.messages.objects.group.posix,
|
||||
undo: false,
|
||||
checked: 'checked'
|
||||
},
|
||||
'gidnumber']
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
@@ -27,8 +27,14 @@ IPA.entity_factories.hbacrule = function () {
|
||||
entity('hbacrule').
|
||||
search_facet({
|
||||
columns:['cn','usercategory','hostcategory','ipaenabledflag',
|
||||
'servicecategory','sourcehostcategory'],
|
||||
add_fields:[
|
||||
'servicecategory','sourcehostcategory']
|
||||
}).
|
||||
facet({
|
||||
factory: IPA.hbacrule_details_facet,
|
||||
'name': 'details'
|
||||
}).
|
||||
adder_dialog({
|
||||
fields:[
|
||||
'cn',
|
||||
{
|
||||
factory: IPA.radio_widget,
|
||||
@@ -41,10 +47,7 @@ IPA.entity_factories.hbacrule = function () {
|
||||
'label': IPA.messages.objects.hbacrule.deny
|
||||
}],
|
||||
'undo': false
|
||||
}]}).
|
||||
facet({
|
||||
factory: IPA.hbacrule_details_facet,
|
||||
'name': 'details'
|
||||
}]
|
||||
}).
|
||||
build();
|
||||
};
|
||||
@@ -53,12 +56,14 @@ IPA.entity_factories.hbacsvc = function () {
|
||||
return IPA.entity_builder().
|
||||
entity('hbacsvc').
|
||||
search_facet({
|
||||
columns:['cn','description'],
|
||||
add_fields:['cn','description']}).
|
||||
columns:['cn','description']}).
|
||||
details_facet({sections:[{
|
||||
name: 'general',
|
||||
label: IPA.messages.details.general,
|
||||
fields:[ 'cn', 'description']}]}).
|
||||
adder_dialog({
|
||||
fields:['cn','description']
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
||||
@@ -67,8 +72,7 @@ IPA.entity_factories.hbacsvcgroup = function () {
|
||||
return IPA.entity_builder().
|
||||
entity('hbacsvcgroup').
|
||||
search_facet({
|
||||
columns:['cn', 'description'],
|
||||
add_fields:['cn', 'description']}).
|
||||
columns:['cn', 'description']}).
|
||||
details_facet({sections:[
|
||||
{
|
||||
name: 'general',
|
||||
@@ -86,6 +90,9 @@ IPA.entity_factories.hbacsvcgroup = function () {
|
||||
save_values: false
|
||||
}]
|
||||
}]}).
|
||||
adder_dialog({
|
||||
fields:['cn', 'description']
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
||||
|
@@ -33,8 +33,7 @@ IPA.entity_factories.host = function () {
|
||||
name: 'krblastpwdchange',
|
||||
label: IPA.messages.objects.host.enrolled,
|
||||
format: IPA.utc_date_column_format
|
||||
}],
|
||||
add_fields: ['fqdn', {factory:IPA.force_host_add_checkbox_widget}]
|
||||
}]
|
||||
}).
|
||||
details_facet({sections:[
|
||||
{
|
||||
@@ -87,6 +86,9 @@ IPA.entity_factories.host = function () {
|
||||
associator: IPA.serial_associator
|
||||
}).
|
||||
standard_association_facets().
|
||||
adder_dialog({
|
||||
fields: ['fqdn', {factory:IPA.force_host_add_checkbox_widget}]
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
||||
|
@@ -27,8 +27,7 @@ IPA.entity_factories.hostgroup = function() {
|
||||
|
||||
return IPA.entity_builder().
|
||||
entity('hostgroup').
|
||||
search_facet({columns:['cn','description'],
|
||||
add_fields:['cn','description']}).
|
||||
search_facet({columns:['cn','description']}).
|
||||
details_facet({sections:[{
|
||||
name:'identity',
|
||||
label: IPA.messages.objects.hostgroup.identity,
|
||||
@@ -39,6 +38,9 @@ IPA.entity_factories.hostgroup = function() {
|
||||
associator: IPA.serial_associator
|
||||
}).
|
||||
standard_association_facets().
|
||||
adder_dialog({
|
||||
fields:['cn','description']
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
||||
|
@@ -26,8 +26,7 @@ IPA.entity_factories.netgroup = function() {
|
||||
return IPA.entity_builder().
|
||||
entity('netgroup').
|
||||
search_facet({
|
||||
columns:['cn','description'],
|
||||
add_fields:['cn', 'description']}).
|
||||
columns:['cn','description']}).
|
||||
details_facet({sections:[{
|
||||
name:'identity',
|
||||
fields:['cn','description','nisdomainname']}]}).
|
||||
@@ -36,5 +35,8 @@ IPA.entity_factories.netgroup = function() {
|
||||
associator: IPA.serial_associator
|
||||
}).
|
||||
standard_association_facets().
|
||||
adder_dialog({
|
||||
fields:['cn', 'description']
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
@@ -28,8 +28,7 @@ IPA.entity_factories.pwpolicy = function() {
|
||||
return IPA.entity_builder().
|
||||
entity('pwpolicy').
|
||||
search_facet({
|
||||
columns:['cn'],
|
||||
add_fields:['cn', 'cospriority']}).
|
||||
columns:['cn']}).
|
||||
details_facet({
|
||||
sections:[
|
||||
{
|
||||
@@ -38,6 +37,9 @@ IPA.entity_factories.pwpolicy = function() {
|
||||
'krbpwdmindiffchars','krbpwdminlength']
|
||||
}]}).
|
||||
standard_association_facets().
|
||||
adder_dialog({
|
||||
fields:['cn', 'cospriority']
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
||||
|
@@ -300,7 +300,7 @@ IPA.search_facet = function(spec) {
|
||||
};
|
||||
|
||||
that.add = function() {
|
||||
var dialog = that.get_dialog('add');
|
||||
var dialog = that.entity.get_dialog('add');
|
||||
dialog.open(that.container);
|
||||
};
|
||||
|
||||
|
@@ -30,12 +30,6 @@ IPA.entity_factories.service = function() {
|
||||
search_facet({
|
||||
columns: [ 'krbprincipalname' ]
|
||||
}).
|
||||
dialog({
|
||||
factory: IPA.service_add_dialog,
|
||||
name: 'add',
|
||||
title: IPA.messages.objects.service.add,
|
||||
width: '450px'
|
||||
}).
|
||||
details_facet({sections:[
|
||||
{
|
||||
name: 'details',
|
||||
@@ -76,6 +70,10 @@ IPA.entity_factories.service = function() {
|
||||
remove_method: 'remove_host'
|
||||
}).
|
||||
standard_association_facets().
|
||||
adder_dialog({
|
||||
factory: IPA.service_add_dialog,
|
||||
width: '450px'
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
||||
|
@@ -28,13 +28,15 @@ IPA.entity_factories.sudorule = function () {
|
||||
return IPA.entity_builder().
|
||||
entity('sudorule').
|
||||
search_facet({
|
||||
columns:['cn','description','cmdcategory'],
|
||||
add_fields:['cn']
|
||||
columns:['cn','description','cmdcategory']
|
||||
}).
|
||||
facet({
|
||||
factory: IPA.sudorule_details_facet,
|
||||
'name': 'details'
|
||||
}).
|
||||
adder_dialog({
|
||||
fields:['cn']
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
||||
@@ -43,8 +45,7 @@ IPA.entity_factories.sudocmd = function () {
|
||||
return IPA.entity_builder().
|
||||
entity( 'sudocmd').
|
||||
search_facet({
|
||||
columns:['sudocmd','description'],
|
||||
add_fields:['sudocmd','description']}).
|
||||
columns:['sudocmd','description']}).
|
||||
details_facet({sections:[
|
||||
{
|
||||
name: 'general',
|
||||
@@ -86,6 +87,9 @@ IPA.entity_factories.sudocmd = function () {
|
||||
]
|
||||
}]
|
||||
}]}).
|
||||
adder_dialog({
|
||||
fields:['sudocmd','description']
|
||||
}).
|
||||
build();
|
||||
|
||||
};
|
||||
@@ -94,8 +98,7 @@ IPA.entity_factories.sudocmdgroup = function () {
|
||||
return IPA.entity_builder().
|
||||
entity('sudocmdgroup').
|
||||
search_facet({
|
||||
columns:['cn','description'],
|
||||
add_fields:['cn','description']
|
||||
columns:['cn','description']
|
||||
}).
|
||||
details_facet({sections:[
|
||||
{
|
||||
@@ -138,6 +141,9 @@ IPA.entity_factories.sudocmdgroup = function () {
|
||||
]
|
||||
}]
|
||||
}]}).
|
||||
adder_dialog({
|
||||
fields:['cn','description']
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
||||
|
@@ -36,8 +36,7 @@ module('entity',{
|
||||
entity_builder().
|
||||
entity('user').
|
||||
search_facet({
|
||||
columns:['uid'],
|
||||
add_fields:[]}).
|
||||
columns:['uid']}).
|
||||
build();
|
||||
};
|
||||
IPA.start_entities();
|
||||
@@ -67,8 +66,7 @@ test('Testing IPA.entity_set_search_definition().', function() {
|
||||
entity_builder().
|
||||
entity('user').
|
||||
search_facet({
|
||||
columns:['uid'],
|
||||
add_fields:[]}).
|
||||
columns:['uid']}).
|
||||
build();
|
||||
entity.init();
|
||||
|
||||
|
@@ -30,7 +30,6 @@ IPA.entity_factories.user = function() {
|
||||
entity('user').
|
||||
search_facet({
|
||||
columns:['uid','cn','uidnumber','mail','telephonenumber','title'],
|
||||
add_fields: ['uid','givenname','sn'],
|
||||
search_all: true
|
||||
}).
|
||||
details_facet({sections:[
|
||||
@@ -79,7 +78,10 @@ IPA.entity_factories.user = function() {
|
||||
name: 'memberof_role',
|
||||
associator: IPA.serial_associator
|
||||
}).
|
||||
standard_association_facets();
|
||||
standard_association_facets().
|
||||
adder_dialog({
|
||||
fields: ['uid','givenname','sn']
|
||||
});
|
||||
|
||||
|
||||
var entity = builder.build();
|
||||
|
Reference in New Issue
Block a user