mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 15:40:01 -06:00
Refactored facet.load().
The load() in IPA.facet has been modified to accept the complete data returned by the server instead of just the result. This is needed by HBAC Test to access other attributes returned in the test result. Ticket #388
This commit is contained in:
parent
a8ea42bda8
commit
caa9d52666
@ -716,7 +716,7 @@ IPA.permission_target_policy = function (widget_name) {
|
||||
for (var i=0; i<targets.length; i++) {
|
||||
var target = targets[i];
|
||||
|
||||
if(data[target]) {
|
||||
if(data.result.result[target]) {
|
||||
that.select_target(target);
|
||||
} else {
|
||||
that.set_target_visible(target, false);
|
||||
|
@ -30,7 +30,6 @@ IPA.entity_adder_dialog = function(spec) {
|
||||
var that = IPA.dialog(spec);
|
||||
|
||||
that.method = spec.method || 'add';
|
||||
that.pre_execute_hook = spec.pre_execute_hook;
|
||||
that.on_error = spec.on_error ;
|
||||
that.retry = typeof spec.retry !== 'undefined' ? spec.retry : true;
|
||||
that.command = null;
|
||||
@ -107,26 +106,18 @@ IPA.entity_adder_dialog = function(spec) {
|
||||
IPA.nav.show_entity_page(that.entity, 'default', pkey);
|
||||
}
|
||||
|
||||
that.add = function(on_success, on_error) {
|
||||
that.create_add_command = function(record) {
|
||||
|
||||
var pkey_name = that.entity.metadata.primary_key;
|
||||
|
||||
var command = IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: that.method,
|
||||
retry: that.retry,
|
||||
on_success: on_success,
|
||||
on_error: on_error
|
||||
retry: that.retry
|
||||
});
|
||||
that.command = command;
|
||||
|
||||
command.add_args(that.entity.get_primary_key_prefix());
|
||||
|
||||
if (!that.validate()) return;
|
||||
|
||||
var record = {};
|
||||
that.save(record);
|
||||
|
||||
var fields = that.fields.get_fields();
|
||||
for (var j=0; j<fields.length; j++) {
|
||||
var field = fields[j];
|
||||
@ -145,11 +136,21 @@ IPA.entity_adder_dialog = function(spec) {
|
||||
}
|
||||
}
|
||||
|
||||
if (that.pre_execute_hook) {
|
||||
that.pre_execute_hook(command);
|
||||
}
|
||||
return command;
|
||||
};
|
||||
|
||||
command.execute();
|
||||
that.add = function(on_success, on_error) {
|
||||
|
||||
if (!that.validate()) return;
|
||||
|
||||
var record = {};
|
||||
that.save(record);
|
||||
|
||||
that.command = that.create_add_command(record);
|
||||
that.command.on_success = on_success;
|
||||
that.command.on_error = on_error;
|
||||
|
||||
that.command.execute();
|
||||
};
|
||||
|
||||
that.create = function() {
|
||||
@ -172,6 +173,7 @@ IPA.entity_adder_dialog = function(spec) {
|
||||
|
||||
// methods that should be invoked by subclasses
|
||||
that.entity_adder_dialog_create = that.create;
|
||||
that.entity_adder_dialog_create_add_command = that.create_add_command;
|
||||
|
||||
init();
|
||||
|
||||
|
@ -753,11 +753,6 @@ IPA.association_facet = function (spec) {
|
||||
var column;
|
||||
var i;
|
||||
|
||||
var adder_columns = spec.adder_columns || [];
|
||||
for (i=0; i<adder_columns.length; i++) {
|
||||
that.create_adder_column(adder_columns[i]);
|
||||
}
|
||||
|
||||
var pkey_name;
|
||||
if (that.other_entity) {
|
||||
pkey_name = IPA.metadata.objects[that.other_entity].primary_key;
|
||||
@ -765,12 +760,24 @@ IPA.association_facet = function (spec) {
|
||||
|
||||
if (!that.columns.length){
|
||||
that.create_column({
|
||||
name: pkey_name,
|
||||
primary_key: true,
|
||||
link: spec.link
|
||||
name: pkey_name
|
||||
});
|
||||
}
|
||||
|
||||
var columns = that.columns.values;
|
||||
for (i=0; i<columns.length; i++) {
|
||||
column = columns[i];
|
||||
column.link = spec.link;
|
||||
}
|
||||
|
||||
var other_entity = IPA.get_entity(that.other_entity);
|
||||
that.init_table(other_entity);
|
||||
|
||||
var adder_columns = spec.adder_columns || [];
|
||||
for (i=0; i<adder_columns.length; i++) {
|
||||
that.create_adder_column(adder_columns[i]);
|
||||
}
|
||||
|
||||
if (!that.adder_columns.length) {
|
||||
that.create_adder_column({
|
||||
name: pkey_name,
|
||||
@ -783,9 +790,6 @@ IPA.association_facet = function (spec) {
|
||||
column = adder_columns[i];
|
||||
column.entity_name = that.other_entity;
|
||||
}
|
||||
|
||||
var other_entity = IPA.get_entity(that.other_entity);
|
||||
that.init_table(other_entity);
|
||||
};
|
||||
|
||||
that.get_records_command_name = function() {
|
||||
@ -882,10 +886,6 @@ IPA.association_facet = function (spec) {
|
||||
}
|
||||
};
|
||||
|
||||
that.create_content = function(container) {
|
||||
that.table.create(container);
|
||||
};
|
||||
|
||||
that.show = function() {
|
||||
that.facet_show();
|
||||
|
||||
@ -903,7 +903,7 @@ IPA.association_facet = function (spec) {
|
||||
title = title.replace('${primary_key}', pkey);
|
||||
title = title.replace('${other_entity}', label);
|
||||
|
||||
var pkeys = that.data[that.get_attribute_name()];
|
||||
var pkeys = that.data.result.result[that.get_attribute_name()];
|
||||
|
||||
var dialog = IPA.association_adder_dialog({
|
||||
title: title,
|
||||
@ -995,8 +995,8 @@ IPA.association_facet = function (spec) {
|
||||
dialog.open(that.container);
|
||||
};
|
||||
|
||||
that.load_pkeys = function(result) {
|
||||
that.pkeys = that.data[that.get_attribute_name()] || [];
|
||||
that.get_pkeys = function(data) {
|
||||
return data.result.result[that.get_attribute_name()] || [];
|
||||
};
|
||||
|
||||
that.refresh = function() {
|
||||
@ -1020,10 +1020,13 @@ IPA.association_facet = function (spec) {
|
||||
});
|
||||
|
||||
command.on_success = function(data, text_status, xhr) {
|
||||
that.load(data.result.result);
|
||||
that.load(data);
|
||||
};
|
||||
|
||||
command.on_error = that.on_error;
|
||||
command.on_error = function(xhr, text_status, error_thrown) {
|
||||
that.redirect_error(error_thrown);
|
||||
that.report_error(error_thrown);
|
||||
};
|
||||
|
||||
command.execute();
|
||||
};
|
||||
|
@ -160,6 +160,7 @@ IPA.automount.key_entity = function(spec) {
|
||||
|
||||
that.builder.containing_entity('automountmap').
|
||||
details_facet({
|
||||
factory: IPA.automount.key_details_facet,
|
||||
sections: [
|
||||
{
|
||||
name:'identity',
|
||||
@ -173,24 +174,7 @@ IPA.automount.key_entity = function(spec) {
|
||||
]
|
||||
}
|
||||
],
|
||||
disable_breadcrumb: false,
|
||||
pre_execute_hook : function (command){
|
||||
var entity_name = this.entity_name;
|
||||
var info = IPA.nav.get_state(entity_name + '-info');
|
||||
var key = IPA.nav.get_state(entity_name + '-pkey');
|
||||
|
||||
|
||||
if (command.args.length ==3){
|
||||
command.args.pop();
|
||||
}
|
||||
if (command.method === 'mod'){
|
||||
command.options['newautomountinformation'] =
|
||||
command.options['automountinformation'];
|
||||
|
||||
}
|
||||
command.options['automountkey'] = key;
|
||||
command.options['automountinformation'] = info;
|
||||
}
|
||||
disable_breadcrumb: false
|
||||
}).
|
||||
adder_dialog({
|
||||
show_edit_page : function(entity, result){
|
||||
@ -210,6 +194,44 @@ IPA.automount.key_entity = function(spec) {
|
||||
return that;
|
||||
};
|
||||
|
||||
IPA.automount.key_details_facet = function(spec) {
|
||||
|
||||
var that = IPA.details_facet(spec);
|
||||
|
||||
that.create_update_command = function() {
|
||||
|
||||
var command = that.details_facet_create_update_command();
|
||||
|
||||
command.args.pop();
|
||||
|
||||
var key = IPA.nav.get_state(that.entity.name + '-pkey');
|
||||
var info = IPA.nav.get_state(that.entity.name + '-info');
|
||||
|
||||
command.options.newautomountinformation = command.options.automountinformation;
|
||||
command.options.automountkey = key;
|
||||
command.options.automountinformation = info;
|
||||
|
||||
return command;
|
||||
};
|
||||
|
||||
that.create_refresh_command = function() {
|
||||
|
||||
var command = that.details_facet_create_refresh_command();
|
||||
|
||||
command.args.pop();
|
||||
|
||||
var key = IPA.nav.get_state(that.entity.name + '-pkey');
|
||||
var info = IPA.nav.get_state(that.entity.name + '-info');
|
||||
|
||||
command.options.automountkey = key;
|
||||
command.options.automountinformation = info;
|
||||
|
||||
return command;
|
||||
};
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
IPA.automount_key_column = function(spec) {
|
||||
|
||||
var that = IPA.column(spec);
|
||||
|
@ -173,7 +173,7 @@ IPA.facet_policy = function() {
|
||||
that.post_create = function() {
|
||||
};
|
||||
|
||||
that.post_load = function() {
|
||||
that.post_load = function(data) {
|
||||
};
|
||||
|
||||
return that;
|
||||
@ -235,8 +235,6 @@ IPA.details_facet = function(spec) {
|
||||
var that = IPA.facet(spec);
|
||||
|
||||
that.entity = spec.entity;
|
||||
that.pre_execute_hook = spec.pre_execute_hook;
|
||||
that.post_update_hook = spec.post_update_hook;
|
||||
that.update_command_name = spec.update_command_name || 'mod';
|
||||
that.command_mode = spec.command_mode || 'save'; // [save, info]
|
||||
|
||||
@ -274,7 +272,7 @@ IPA.details_facet = function(spec) {
|
||||
if (!pkey_name){
|
||||
return pkey;
|
||||
}
|
||||
var pkey_val = that.data[pkey_name];
|
||||
var pkey_val = that.data.result.result[pkey_name];
|
||||
if (pkey_val instanceof Array) {
|
||||
pkey.push(pkey_val[0]);
|
||||
} else {
|
||||
@ -457,7 +455,7 @@ IPA.details_facet = function(spec) {
|
||||
var fields = that.fields.get_fields();
|
||||
for (var i=0; i<fields.length; i++) {
|
||||
var field = fields[i];
|
||||
field.load(data);
|
||||
field.load(data.result.result);
|
||||
}
|
||||
that.policies.post_load(data);
|
||||
that.enable_update(false);
|
||||
@ -515,17 +513,7 @@ IPA.details_facet = function(spec) {
|
||||
|
||||
|
||||
that.on_update_success = function(data, text_status, xhr) {
|
||||
|
||||
if (data.error)
|
||||
return;
|
||||
|
||||
if (that.post_update_hook) {
|
||||
that.post_update_hook(data, text_status);
|
||||
return;
|
||||
}
|
||||
|
||||
var result = data.result.result;
|
||||
that.load(result);
|
||||
that.load(data);
|
||||
};
|
||||
|
||||
that.on_update_error = function(xhr, text_status, error_thrown) {
|
||||
@ -543,7 +531,7 @@ IPA.details_facet = function(spec) {
|
||||
}
|
||||
};
|
||||
|
||||
that.create_fields_update_command = function(update_info, on_win, on_fail) {
|
||||
that.create_fields_update_command = function(update_info) {
|
||||
|
||||
var args = that.get_primary_key();
|
||||
var command = IPA.command({
|
||||
@ -553,9 +541,7 @@ IPA.details_facet = function(spec) {
|
||||
options: {
|
||||
all: true,
|
||||
rights: true
|
||||
},
|
||||
on_success: on_win,
|
||||
on_error: on_fail
|
||||
}
|
||||
});
|
||||
|
||||
//set command options
|
||||
@ -564,12 +550,10 @@ IPA.details_facet = function(spec) {
|
||||
return command;
|
||||
};
|
||||
|
||||
that.create_batch_update_command = function(update_info, on_win, on_fail) {
|
||||
that.create_batch_update_command = function(update_info) {
|
||||
|
||||
var batch = IPA.batch_command({
|
||||
'name': that.entity.name + '_details_update',
|
||||
'on_success': on_win,
|
||||
'on_error': on_fail
|
||||
name: that.entity.name + '_details_update'
|
||||
});
|
||||
|
||||
var new_update_info = IPA.update_info_builder.copy(update_info);
|
||||
@ -599,21 +583,11 @@ IPA.details_facet = function(spec) {
|
||||
dialog.open();
|
||||
};
|
||||
|
||||
that.update = function(on_win, on_fail) {
|
||||
|
||||
var on_success = function(data, text_status, xhr) {
|
||||
that.on_update_success(data, text_status, xhr);
|
||||
if (on_win) on_win.call(this, data, text_status, xhr);
|
||||
};
|
||||
|
||||
var on_error = function(xhr, text_status, error_thrown) {
|
||||
that.on_update_error(xhr, text_status, error_thrown);
|
||||
if (on_fail) on_fail.call(this, xhr, text_status, error_thrown);
|
||||
};
|
||||
that.create_update_command = function() {
|
||||
|
||||
var command, update_info;
|
||||
|
||||
if(that.command_mode === 'info') {
|
||||
if (that.command_mode === 'info') {
|
||||
update_info = that.get_update_info();
|
||||
} else {
|
||||
update_info = that.save_as_update_info(true, true);
|
||||
@ -621,19 +595,28 @@ IPA.details_facet = function(spec) {
|
||||
|
||||
if (update_info.commands.length <= 0) {
|
||||
//normal command
|
||||
command = that.create_fields_update_command(update_info,
|
||||
on_success,
|
||||
on_error);
|
||||
command = that.create_fields_update_command(update_info);
|
||||
} else {
|
||||
//batch command
|
||||
command = that.create_batch_update_command(update_info,
|
||||
on_success,
|
||||
on_error);
|
||||
command = that.create_batch_update_command(update_info);
|
||||
}
|
||||
|
||||
if (that.pre_execute_hook){
|
||||
that.pre_execute_hook(command);
|
||||
}
|
||||
return command;
|
||||
};
|
||||
|
||||
that.update = function(on_success, on_error) {
|
||||
|
||||
var command = that.create_update_command();
|
||||
|
||||
command.on_success = function(data, text_status, xhr) {
|
||||
that.on_update_success(data, text_status, xhr);
|
||||
if (on_success) on_success.call(this, data, text_status, xhr);
|
||||
};
|
||||
|
||||
command.on_error = function(xhr, text_status, error_thrown) {
|
||||
that.on_update_error(xhr, text_status, error_thrown);
|
||||
if (on_error) on_error.call(this, xhr, text_status, error_thrown);
|
||||
};
|
||||
|
||||
command.execute();
|
||||
};
|
||||
@ -642,9 +625,7 @@ IPA.details_facet = function(spec) {
|
||||
return that.entity.name+'_show';
|
||||
};
|
||||
|
||||
that.refresh = function() {
|
||||
|
||||
that.pkey = IPA.nav.get_state(that.entity.name+'-pkey');
|
||||
that.create_refresh_command = function() {
|
||||
|
||||
var command = IPA.command({
|
||||
name: that.get_refresh_command_name(),
|
||||
@ -655,21 +636,30 @@ IPA.details_facet = function(spec) {
|
||||
|
||||
if (that.pkey) {
|
||||
command.args = that.get_primary_key(true);
|
||||
}
|
||||
|
||||
} else if (that.entity.redirect_facet) {
|
||||
return command;
|
||||
};
|
||||
|
||||
that.refresh = function() {
|
||||
|
||||
that.pkey = IPA.nav.get_state(that.entity.name+'-pkey');
|
||||
|
||||
if (!that.pkey && that.entity.redirect_facet) {
|
||||
that.redirect();
|
||||
return;
|
||||
}
|
||||
|
||||
var command = that.create_refresh_command();
|
||||
|
||||
command.on_success = function(data, text_status, xhr) {
|
||||
that.load(data.result.result);
|
||||
that.load(data);
|
||||
};
|
||||
|
||||
command.on_error = that.on_error;
|
||||
|
||||
if (that.pre_execute_hook) {
|
||||
that.pre_execute_hook(command);
|
||||
}
|
||||
command.on_error = function(xhr, text_status, error_thrown) {
|
||||
that.redirect_error(error_thrown);
|
||||
that.report_error(error_thrown);
|
||||
};
|
||||
|
||||
command.execute();
|
||||
};
|
||||
@ -733,7 +723,9 @@ IPA.details_facet = function(spec) {
|
||||
|
||||
that.init();
|
||||
|
||||
that.details_facet_create_content = that.create_content;
|
||||
// methods that should be invoked by subclasses
|
||||
that.details_facet_create_update_command = that.create_update_command;
|
||||
that.details_facet_create_refresh_command = that.create_refresh_command;
|
||||
that.details_facet_load = that.load;
|
||||
|
||||
return that;
|
||||
|
@ -496,174 +496,158 @@ IPA.dns.record_entity = function(spec) {
|
||||
|
||||
that.builder.containing_entity('dnszone').
|
||||
details_facet({
|
||||
post_update_hook:function(data){
|
||||
var result = data.result.result;
|
||||
if (result.idnsname) {
|
||||
this.load(result);
|
||||
} else {
|
||||
this.reset();
|
||||
var dialog = IPA.dnsrecord_redirection_dialog();
|
||||
dialog.open(this.container);
|
||||
}
|
||||
},
|
||||
factory: IPA.dns.record_details_facet,
|
||||
disable_breadcrumb: false,
|
||||
sections:[
|
||||
{
|
||||
name:'identity',
|
||||
label: IPA.messages.details.identity,
|
||||
fields:[
|
||||
{
|
||||
sections: [
|
||||
{
|
||||
name: 'identity',
|
||||
label: IPA.messages.details.identity,
|
||||
fields: [
|
||||
{
|
||||
type: 'dnsrecord_host_link',
|
||||
name: 'idnsname',
|
||||
other_entity:'host',
|
||||
label:IPA.get_entity_param(
|
||||
'dnsrecord', 'idnsname').label
|
||||
}
|
||||
other_entity: 'host',
|
||||
label: IPA.get_entity_param(
|
||||
'dnsrecord', 'idnsname').label
|
||||
}
|
||||
]
|
||||
},
|
||||
},
|
||||
{
|
||||
name:'standard',
|
||||
label:IPA.messages.objects.dnsrecord.standard,
|
||||
fields:[
|
||||
name: 'standard',
|
||||
label: IPA.messages.objects.dnsrecord.standard,
|
||||
fields: [
|
||||
{
|
||||
type: 'multivalued',
|
||||
name: 'arecord',
|
||||
metadata: {primary_key: false},
|
||||
label:'A'
|
||||
metadata: { primary_key: false },
|
||||
label: 'A'
|
||||
},
|
||||
{
|
||||
type: 'multivalued',
|
||||
name: 'aaaarecord',
|
||||
metadata: {primary_key: false},
|
||||
label:'AAAA'
|
||||
metadata: { primary_key: false },
|
||||
label: 'AAAA'
|
||||
},
|
||||
{
|
||||
type: 'multivalued',
|
||||
name: 'ptrrecord',
|
||||
metadata: {primary_key: false},
|
||||
label:'PTR'
|
||||
metadata: { primary_key: false },
|
||||
label: 'PTR'
|
||||
},
|
||||
{
|
||||
type: 'multivalued',
|
||||
name: 'srvrecord',
|
||||
metadata: {primary_key: false},
|
||||
label:'SRV'
|
||||
metadata: { primary_key: false },
|
||||
label: 'SRV'
|
||||
},
|
||||
{
|
||||
type: 'multivalued',
|
||||
name: 'txtrecord',
|
||||
metadata: {primary_key: false},
|
||||
label:'TXT'
|
||||
metadata: { primary_key: false },
|
||||
label: 'TXT'
|
||||
},
|
||||
{
|
||||
type: 'multivalued',
|
||||
name: 'cnamerecord',
|
||||
metadata: {primary_key: false},
|
||||
label:'CNAME'
|
||||
metadata: { primary_key: false },
|
||||
label: 'CNAME'
|
||||
},
|
||||
{
|
||||
type: 'multivalued',
|
||||
label:'MX',
|
||||
metadata: {primary_key: false},
|
||||
name:"mxrecord"
|
||||
metadata: { primary_key: false },
|
||||
name: 'mxrecord'
|
||||
},
|
||||
{
|
||||
type: 'multivalued',
|
||||
label:'NS',
|
||||
metadata: {primary_key: false},
|
||||
name:"nsrecord"
|
||||
metadata: { primary_key: false },
|
||||
name: 'nsrecord'
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
name:'unusual',
|
||||
label:IPA.messages.objects.dnsrecord.other,
|
||||
fields:[
|
||||
name: 'other',
|
||||
label: IPA.messages.objects.dnsrecord.other,
|
||||
fields: [
|
||||
{
|
||||
type: 'multivalued',
|
||||
label:'AFSDB',
|
||||
metadata: {primary_key: false},
|
||||
name: "afsdbrecord"
|
||||
name: 'afsdbrecord',
|
||||
metadata: { primary_key: false },
|
||||
label: 'AFSDB'
|
||||
},
|
||||
{
|
||||
type: 'multivalued',
|
||||
label:'CERT',
|
||||
metadata: {primary_key: false},
|
||||
name:"certrecord"
|
||||
name: 'certrecord',
|
||||
metadata: { primary_key: false },
|
||||
label: 'CERT'
|
||||
},
|
||||
{
|
||||
type: 'multivalued',
|
||||
label:'DNAME',
|
||||
metadata: {primary_key: false},
|
||||
name:"dnamerecord"
|
||||
name: 'dnamerecord',
|
||||
metadata: { primary_key: false },
|
||||
label: 'DNAME'
|
||||
},
|
||||
{
|
||||
type: 'multivalued',
|
||||
label:'DSRECORD',
|
||||
metadata: {primary_key: false},
|
||||
name:"dsrecord"
|
||||
name: 'dsrecord',
|
||||
metadata: { primary_key: false },
|
||||
label: 'DSRECORD'
|
||||
},
|
||||
{
|
||||
type: 'multivalued',
|
||||
label:'KEY',
|
||||
metadata: {primary_key: false},
|
||||
name:"keyrecord"
|
||||
name: 'keyrecord',
|
||||
metadata: { primary_key: false },
|
||||
label: 'KEY'
|
||||
},
|
||||
{
|
||||
type: 'multivalued',
|
||||
label:'KX',
|
||||
metadata: {primary_key: false},
|
||||
name:"kxrecord"
|
||||
name: 'kxrecord',
|
||||
metadata: { primary_key: false },
|
||||
label: 'KX'
|
||||
},
|
||||
{
|
||||
type: 'multivalued',
|
||||
label:'LOC',
|
||||
metadata: {primary_key: false},
|
||||
name:"locrecord"
|
||||
name: 'locrecord',
|
||||
metadata: { primary_key: false },
|
||||
label: 'LOC'
|
||||
},
|
||||
{
|
||||
type: 'multivalued',
|
||||
label:'NAPTR',
|
||||
name:"naptrrecord"
|
||||
name: 'naptrrecord',
|
||||
metadata: { primary_key: false },
|
||||
label: 'NAPTR'
|
||||
},
|
||||
{
|
||||
type: 'multivalued',
|
||||
label:'NSEC',
|
||||
metadata: {primary_key: false},
|
||||
name:"nsecrecord"
|
||||
name: 'nsecrecord',
|
||||
metadata: { primary_key: false },
|
||||
label: 'NSEC'
|
||||
},
|
||||
{
|
||||
type: 'multivalued',
|
||||
label:'RRSIG',
|
||||
metadata: {primary_key: false},
|
||||
name:"rrsigrecord"
|
||||
name: 'rrsigrecord',
|
||||
metadata: { primary_key: false },
|
||||
label: 'RRSIG'
|
||||
},
|
||||
{
|
||||
type: 'multivalued',
|
||||
label:'SIG',
|
||||
metadata: {primary_key: false},
|
||||
name:"sigrecord"
|
||||
name: 'sigrecord',
|
||||
metadata: { primary_key: false },
|
||||
label: 'SIG'
|
||||
},
|
||||
{
|
||||
type: 'multivalued',
|
||||
label:'SSHFP',
|
||||
metadata: {primary_key: false},
|
||||
name:"sshfprecord"
|
||||
name: 'sshfprecord',
|
||||
metadata: { primary_key: false },
|
||||
label: 'SSHFP'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}).
|
||||
adder_dialog({
|
||||
pre_execute_hook: function(command) {
|
||||
var record_type = command.options.record_type;
|
||||
var record_data = command.options.record_data;
|
||||
|
||||
delete command.options.record_type;
|
||||
delete command.options.record_data;
|
||||
command.options[record_type] = record_data;
|
||||
},
|
||||
factory: IPA.dns.record_adder_dialog,
|
||||
fields: [
|
||||
'idnsname',
|
||||
{
|
||||
@ -684,6 +668,47 @@ IPA.dns.record_entity = function(spec) {
|
||||
return that;
|
||||
};
|
||||
|
||||
IPA.dns.record_adder_dialog = function(spec) {
|
||||
|
||||
var that = IPA.entity_adder_dialog(spec);
|
||||
|
||||
that.create_add_command = function(record) {
|
||||
|
||||
var command = that.entity_adder_dialog_create_add_command(record);
|
||||
|
||||
var record_type = command.options.record_type;
|
||||
var record_data = command.options.record_data;
|
||||
|
||||
delete command.options.record_type;
|
||||
delete command.options.record_data;
|
||||
|
||||
command.options[record_type] = record_data;
|
||||
|
||||
return command;
|
||||
};
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
IPA.dns.record_details_facet = function(spec) {
|
||||
|
||||
var that = IPA.details_facet(spec);
|
||||
|
||||
that.on_update_success = function(data, text_status, xhr) {
|
||||
|
||||
if (!data.result.result.idnsname) {
|
||||
that.reset();
|
||||
var dialog = IPA.dnsrecord_redirection_dialog();
|
||||
dialog.open(that.container);
|
||||
return;
|
||||
}
|
||||
|
||||
that.load(data);
|
||||
};
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
IPA.dnsrecord_redirection_dialog = function(spec) {
|
||||
spec = spec || {};
|
||||
spec.title = spec.title || IPA.messages.dialogs.redirection;
|
||||
|
@ -85,8 +85,8 @@ IPA.entitle.entity = function(spec) {
|
||||
}
|
||||
]
|
||||
}).
|
||||
search_facet({
|
||||
factory: IPA.entitle.search_facet,
|
||||
facet({
|
||||
factory: IPA.entitle.certificates_facet,
|
||||
name: 'certificates',
|
||||
label: IPA.messages.objects.entitle.certificates,
|
||||
facet_group: 'certificates',
|
||||
@ -365,7 +365,7 @@ IPA.entitle.details_facet = function(spec) {
|
||||
// that.register_offline_button.css('display', 'none');
|
||||
}
|
||||
|
||||
that.load(data.result.result);
|
||||
that.load(data);
|
||||
|
||||
summary.empty();
|
||||
}
|
||||
@ -375,13 +375,15 @@ IPA.entitle.details_facet = function(spec) {
|
||||
that.register_online_button.css('display', 'inline');
|
||||
// that.register_offline_button.css('display', 'inline');
|
||||
|
||||
var result = {
|
||||
var data = {};
|
||||
data.result = {};
|
||||
data.result.result = {
|
||||
uuid: '',
|
||||
product: '',
|
||||
quantity: 0,
|
||||
consumed: 0
|
||||
};
|
||||
that.load(result);
|
||||
that.load(data);
|
||||
|
||||
summary.empty();
|
||||
summary.append(error_thrown.name+': '+error_thrown.message);
|
||||
@ -395,13 +397,17 @@ IPA.entitle.details_facet = function(spec) {
|
||||
return that;
|
||||
};
|
||||
|
||||
IPA.entitle.search_facet = function(spec) {
|
||||
IPA.entitle.certificates_facet = function(spec) {
|
||||
|
||||
spec = spec || {};
|
||||
spec.disable_facet_tabs = false;
|
||||
spec.selectable = false;
|
||||
|
||||
var that = IPA.search_facet(spec);
|
||||
var that = IPA.table_facet(spec);
|
||||
|
||||
var init = function() {
|
||||
that.init_table(that.entity);
|
||||
};
|
||||
|
||||
that.create_header = function(container) {
|
||||
|
||||
@ -455,16 +461,7 @@ IPA.entitle.search_facet = function(spec) {
|
||||
that.import_button.css('display', 'inline');
|
||||
}
|
||||
|
||||
that.load(data.result.result);
|
||||
|
||||
var summary = $('span[name=summary]', that.table.tfoot).empty();
|
||||
if (data.result.truncated) {
|
||||
var message = IPA.messages.search.truncated;
|
||||
message = message.replace('${counter}', data.result.count);
|
||||
summary.text(message);
|
||||
} else {
|
||||
summary.text(data.result.summary);
|
||||
}
|
||||
that.load(data);
|
||||
}
|
||||
|
||||
function on_error(xhr, text_status, error_thrown) {
|
||||
@ -472,8 +469,7 @@ IPA.entitle.search_facet = function(spec) {
|
||||
that.consume_button.css('display', 'none');
|
||||
that.import_button.css('display', 'inline');
|
||||
|
||||
var summary = $('span[name=summary]', that.table.tfoot).empty();
|
||||
summary.append(error_thrown.name+': '+error_thrown.message);
|
||||
that.table.summary.text(error_thrown.name+': '+error_thrown.message);
|
||||
}
|
||||
|
||||
that.entity.get_status(
|
||||
@ -485,6 +481,8 @@ IPA.entitle.search_facet = function(spec) {
|
||||
on_error);
|
||||
};
|
||||
|
||||
init();
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
|
@ -107,7 +107,7 @@ IPA.facet = function(spec) {
|
||||
|
||||
that.load = function(data) {
|
||||
that.data = data;
|
||||
that.header.load(data);
|
||||
that.header.load(data.result.result);
|
||||
};
|
||||
|
||||
that.clear = function() {
|
||||
@ -141,21 +141,20 @@ IPA.facet = function(spec) {
|
||||
that.entity.redirect_facet);
|
||||
};
|
||||
|
||||
var redirect_errors = [4001];
|
||||
var redirect_error_codes = [4001];
|
||||
|
||||
that.on_error = function(xhr, text_status, error_thrown) {
|
||||
that.redirect_error = function(error_thrown) {
|
||||
|
||||
/*If the error is in talking to the server, don't attempt to redirect,
|
||||
as there is nothing any other facet can do either. */
|
||||
if (that.entity.redirect_facet) {
|
||||
for (var i=0; i<redirect_errors.length; i++) {
|
||||
if (error_thrown.code === redirect_errors[i]) {
|
||||
for (var i=0; i<redirect_error_codes.length; i++) {
|
||||
if (error_thrown.code === redirect_error_codes[i]) {
|
||||
that.redirect();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
that.report_error(error_thrown);
|
||||
};
|
||||
|
||||
|
||||
@ -439,22 +438,130 @@ IPA.table_facet = function(spec) {
|
||||
return that;
|
||||
};
|
||||
|
||||
that.load = function(result) {
|
||||
that.facet_load(result);
|
||||
that.create_content = function(container) {
|
||||
that.table.create(container);
|
||||
};
|
||||
|
||||
that.load = function(data) {
|
||||
that.facet_load(data);
|
||||
|
||||
that.table.current_page = 1;
|
||||
that.table.total_pages = 1;
|
||||
|
||||
if (that.pagination) {
|
||||
that.table.load_page(result);
|
||||
that.load_page(data);
|
||||
} else {
|
||||
that.table.load(result);
|
||||
that.load_all(data);
|
||||
}
|
||||
|
||||
that.table.current_page_input.val(that.table.current_page);
|
||||
that.table.total_pages_span.text(that.table.total_pages);
|
||||
};
|
||||
|
||||
|
||||
that.load_all = function(data) {
|
||||
|
||||
that.table.empty();
|
||||
|
||||
var result = data.result.result;
|
||||
for (var i=0; i<result.length; i++) {
|
||||
var record = that.table.get_record(result[i], 0);
|
||||
that.table.add_record(record);
|
||||
}
|
||||
|
||||
that.table.unselect_all();
|
||||
|
||||
if (data.result.truncated) {
|
||||
var message = IPA.messages.search.truncated;
|
||||
message = message.replace('${counter}', data.result.count);
|
||||
that.table.summary.text(message);
|
||||
} else {
|
||||
that.table.summary.text(data.result.summary);
|
||||
}
|
||||
};
|
||||
|
||||
that.get_pkeys = function(data){
|
||||
return [];
|
||||
};
|
||||
|
||||
that.load_page = function(data) {
|
||||
|
||||
that.pkeys = that.get_pkeys(data);
|
||||
|
||||
if (that.pkeys.length) {
|
||||
that.table.total_pages =
|
||||
Math.ceil(that.pkeys.length / that.table.page_length);
|
||||
} else {
|
||||
that.table.total_pages = 1;
|
||||
}
|
||||
|
||||
delete that.table.current_page;
|
||||
|
||||
var state = {};
|
||||
var page = parseInt(IPA.nav.get_state(that.entity_name+'-page'), 10) || 1;
|
||||
if (page < 1) {
|
||||
state[that.entity_name+'-page'] = 1;
|
||||
IPA.nav.push_state(state);
|
||||
return;
|
||||
} else if (page > that.table.total_pages) {
|
||||
state[that.entity_name+'-page'] = that.table.total_pages;
|
||||
IPA.nav.push_state(state);
|
||||
return;
|
||||
}
|
||||
that.table.current_page = page;
|
||||
|
||||
if (!that.pkeys || !that.pkeys.length) {
|
||||
that.table.empty();
|
||||
that.table.summary.text(IPA.messages.association.no_entries);
|
||||
that.table.unselect_all();
|
||||
return;
|
||||
}
|
||||
|
||||
that.pkeys.sort();
|
||||
var total = that.pkeys.length;
|
||||
|
||||
var start = (that.table.current_page - 1) * that.table.page_length + 1;
|
||||
var end = that.table.current_page * that.table.page_length;
|
||||
end = end > total ? total : end;
|
||||
|
||||
var summary = IPA.messages.association.paging;
|
||||
summary = summary.replace('${start}', start);
|
||||
summary = summary.replace('${end}', end);
|
||||
summary = summary.replace('${total}', total);
|
||||
that.table.summary.text(summary);
|
||||
|
||||
that.values = that.pkeys.slice(start-1, end);
|
||||
|
||||
var columns = that.table.columns.values;
|
||||
if (columns.length == 1) { // show pkey only
|
||||
var name = columns[0].name;
|
||||
that.table.empty();
|
||||
for (var i=0; i<that.values.length; i++) {
|
||||
var record = {};
|
||||
record[name] = that.values[i];
|
||||
that.table.add_record(record);
|
||||
}
|
||||
that.table.unselect_all();
|
||||
return;
|
||||
}
|
||||
|
||||
// get and show additional fields
|
||||
that.get_records(
|
||||
function(data, text_status, xhr) {
|
||||
var results = data.result.results;
|
||||
that.table.empty();
|
||||
for (var i=0; i<results.length; i++) {
|
||||
var record = results[i].result;
|
||||
that.table.add_record(record);
|
||||
}
|
||||
that.table.unselect_all();
|
||||
},
|
||||
function(xhr, text_status, error_thrown) {
|
||||
that.table.empty();
|
||||
var summary = that.table.summary.empty();
|
||||
summary.append(error_thrown.name+': '+error_thrown.message);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
that.get_records_command_name = function() {
|
||||
@ -518,7 +625,11 @@ IPA.table_facet = function(spec) {
|
||||
for (var i=0; i<columns.length; i++) {
|
||||
var column = columns[i];
|
||||
|
||||
if (column.link) {
|
||||
var metadata = IPA.get_entity_param(entity.name, column.name);
|
||||
column.primary_key = metadata && metadata.primary_key;
|
||||
column.link = (column.link === undefined ? true : column.link) && column.primary_key;
|
||||
|
||||
if (column.link && column.primary_key) {
|
||||
column.link_handler = function(value) {
|
||||
IPA.nav.show_page(entity.name, 'default', value);
|
||||
return false;
|
||||
@ -558,95 +669,6 @@ IPA.table_facet = function(spec) {
|
||||
state[that.entity_name+'-page'] = page;
|
||||
IPA.nav.push_state(state);
|
||||
};
|
||||
|
||||
that.table.load = function(result) {
|
||||
|
||||
that.table.empty();
|
||||
|
||||
for (var i=0; i<result.length; i++) {
|
||||
var record = that.table.get_record(result[i], 0);
|
||||
that.table.add_record(record);
|
||||
}
|
||||
|
||||
that.table.unselect_all();
|
||||
};
|
||||
|
||||
that.table.load_page = function(result) {
|
||||
|
||||
that.load_pkeys(result);
|
||||
|
||||
if (that.pkeys.length) {
|
||||
that.table.total_pages =
|
||||
Math.ceil(that.pkeys.length / that.table.page_length);
|
||||
} else {
|
||||
that.table.total_pages = 1;
|
||||
}
|
||||
|
||||
delete that.table.current_page;
|
||||
|
||||
var state = {};
|
||||
var page = parseInt(IPA.nav.get_state(that.entity_name+'-page'), 10) || 1;
|
||||
if (page < 1) {
|
||||
state[that.entity_name+'-page'] = 1;
|
||||
IPA.nav.push_state(state);
|
||||
return;
|
||||
} else if (page > that.table.total_pages) {
|
||||
state[that.entity_name+'-page'] = that.table.total_pages;
|
||||
IPA.nav.push_state(state);
|
||||
return;
|
||||
}
|
||||
that.table.current_page = page;
|
||||
|
||||
if (!that.pkeys || !that.pkeys.length) {
|
||||
that.table.empty();
|
||||
that.table.summary.text(IPA.messages.association.no_entries);
|
||||
return;
|
||||
}
|
||||
|
||||
that.pkeys.sort();
|
||||
var total = that.pkeys.length;
|
||||
|
||||
var start = (that.table.current_page - 1) * that.table.page_length + 1;
|
||||
var end = that.table.current_page * that.table.page_length;
|
||||
end = end > total ? total : end;
|
||||
|
||||
var summary = IPA.messages.association.paging;
|
||||
summary = summary.replace('${start}', start);
|
||||
summary = summary.replace('${end}', end);
|
||||
summary = summary.replace('${total}', total);
|
||||
that.table.summary.text(summary);
|
||||
|
||||
that.values = that.pkeys.slice(start-1, end);
|
||||
|
||||
var columns = that.table.columns.values;
|
||||
if (columns.length == 1) { // show pkey only
|
||||
var name = columns[0].name;
|
||||
that.table.empty();
|
||||
for (var i=0; i<that.values.length; i++) {
|
||||
var entry = {};
|
||||
entry[name] = that.values[i];
|
||||
that.table.add_record(entry);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// get and show additional fields
|
||||
that.get_records(
|
||||
function(data, text_status, xhr) {
|
||||
var results = data.result.results;
|
||||
that.table.empty();
|
||||
for (var i=0; i<results.length; i++) {
|
||||
var record = results[i].result;
|
||||
that.table.add_record(record);
|
||||
}
|
||||
},
|
||||
function(xhr, text_status, error_thrown) {
|
||||
that.table.empty();
|
||||
var summary = that.table.summary.empty();
|
||||
summary.append(error_thrown.name+': '+error_thrown.message);
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
init();
|
||||
@ -702,14 +724,16 @@ IPA.facet_builder = function(entity) {
|
||||
|
||||
that.build_facet = function(spec) {
|
||||
|
||||
var type = spec.type || 'details';
|
||||
//do common logic
|
||||
spec.entity = entity;
|
||||
|
||||
//prepare spec based on type
|
||||
var prepare_method = that.prepare_methods[type];
|
||||
if(prepare_method) {
|
||||
prepare_method.call(that, spec);
|
||||
var type = spec.type;
|
||||
if (type) {
|
||||
var prepare_method = that.prepare_methods[type];
|
||||
if (prepare_method) {
|
||||
prepare_method.call(that, spec);
|
||||
}
|
||||
}
|
||||
|
||||
//add facet
|
||||
|
@ -58,15 +58,11 @@ IPA.group.entity = function(spec) {
|
||||
association_facet({
|
||||
name: 'member_user',
|
||||
columns:[
|
||||
{
|
||||
name: 'uid',
|
||||
primary_key: true,
|
||||
link: true
|
||||
},
|
||||
{name: 'uidnumber'},
|
||||
{name: 'mail'},
|
||||
{name: 'telephonenumber'},
|
||||
{name: 'title'}
|
||||
'uid',
|
||||
'uidnumber',
|
||||
'mail',
|
||||
'telephonenumber',
|
||||
'title'
|
||||
],
|
||||
adder_columns:[
|
||||
{
|
||||
|
@ -89,12 +89,8 @@ IPA.hbac.service_entity = function(spec) {
|
||||
name: 'memberof_hbacsvcgroup',
|
||||
associator: IPA.serial_associator,
|
||||
columns:[
|
||||
{
|
||||
name: 'cn',
|
||||
primary_key: true,
|
||||
link: true
|
||||
},
|
||||
{ name: 'description' }
|
||||
'cn',
|
||||
'description'
|
||||
],
|
||||
adder_columns: [
|
||||
{
|
||||
@ -154,12 +150,8 @@ IPA.hbac.service_group_entity = function(spec) {
|
||||
association_facet({
|
||||
name: 'member_hbacsvc',
|
||||
columns:[
|
||||
{
|
||||
name: 'cn',
|
||||
primary_key: true,
|
||||
link: true
|
||||
},
|
||||
{ name: 'description' }
|
||||
'cn',
|
||||
'description'
|
||||
],
|
||||
adder_columns: [
|
||||
{
|
||||
|
@ -48,22 +48,9 @@ IPA.search_facet = function(spec) {
|
||||
|
||||
that.managed_entity = IPA.get_entity(that.managed_entity_name);
|
||||
|
||||
var columns = that.columns.values;
|
||||
for (var i=0; i<columns.length; i++) {
|
||||
var column = columns[i];
|
||||
|
||||
var metadata = IPA.get_entity_param(that.managed_entity_name, column.name);
|
||||
column.primary_key = metadata && metadata.primary_key;
|
||||
column.link = column.primary_key;
|
||||
}
|
||||
|
||||
that.init_table(that.managed_entity);
|
||||
};
|
||||
|
||||
that.create_content = function(container) {
|
||||
that.table.create(container);
|
||||
};
|
||||
|
||||
that.create_header = function(container) {
|
||||
|
||||
that.facet_create_header(container);
|
||||
@ -124,7 +111,6 @@ IPA.search_facet = function(spec) {
|
||||
}).appendTo(that.controls);
|
||||
};
|
||||
|
||||
|
||||
that.show = function() {
|
||||
that.facet_show();
|
||||
|
||||
@ -178,45 +164,24 @@ IPA.search_facet = function(spec) {
|
||||
IPA.nav.push_state(state);
|
||||
};
|
||||
|
||||
that.load_pkeys = function(result) {
|
||||
that.pkeys = [];
|
||||
that.get_pkeys = function(data) {
|
||||
var result = data.result.result;
|
||||
var pkey_name = that.managed_entity.metadata.primary_key;
|
||||
var pkeys = [];
|
||||
for (var i=0; i<result.length; i++) {
|
||||
var record = result[i];
|
||||
var values = record[that.managed_entity.metadata.primary_key];
|
||||
that.pkeys.push(values[0]);
|
||||
var values = record[pkey_name];
|
||||
pkeys.push(values[0]);
|
||||
}
|
||||
return that.pkeys;
|
||||
};
|
||||
|
||||
that.on_error = function(xhr, text_status, error_thrown) {
|
||||
that.report_error(error_thrown);
|
||||
return pkeys;
|
||||
};
|
||||
|
||||
that.get_search_command_name = function() {
|
||||
return that.managed_entity.name + '_find' + (that.pagination ? "_pkeys" : "");
|
||||
return that.managed_entity.name + '_find' + (that.pagination ? '_pkeys' : '');
|
||||
};
|
||||
|
||||
that.refresh = function() {
|
||||
|
||||
function on_success(data, text_status, xhr) {
|
||||
|
||||
that.load(data.result.result);
|
||||
|
||||
if (data.result.truncated) {
|
||||
var message = IPA.messages.search.truncated;
|
||||
message = message.replace('${counter}', data.result.count);
|
||||
that.table.summary.text(message);
|
||||
} else {
|
||||
that.table.summary.text(data.result.summary);
|
||||
}
|
||||
|
||||
that.table.current_page_input.val(that.table.current_page);
|
||||
that.table.total_pages_span.text(that.table.total_pages);
|
||||
|
||||
that.filter.focus();
|
||||
that.select_changed();
|
||||
}
|
||||
|
||||
var filter = [];
|
||||
var current_entity = that.managed_entity;
|
||||
filter.unshift(IPA.nav.get_state(current_entity.name+'-filter'));
|
||||
@ -233,9 +198,7 @@ IPA.search_facet = function(spec) {
|
||||
args: filter,
|
||||
options: {
|
||||
all: that.search_all
|
||||
},
|
||||
on_success: on_success,
|
||||
on_error: that.on_error
|
||||
}
|
||||
});
|
||||
|
||||
if (that.pagination) {
|
||||
@ -243,6 +206,15 @@ IPA.search_facet = function(spec) {
|
||||
command.set_option('sizelimit', 0);
|
||||
}
|
||||
|
||||
command.on_success = function(data, text_status, xhr) {
|
||||
that.filter.focus();
|
||||
that.load(data);
|
||||
};
|
||||
|
||||
command.on_error = function(xhr, text_status, error_thrown) {
|
||||
that.report_error(error_thrown);
|
||||
};
|
||||
|
||||
command.execute();
|
||||
};
|
||||
|
||||
@ -260,7 +232,6 @@ IPA.search_facet = function(spec) {
|
||||
init();
|
||||
|
||||
// methods that should be invoked by subclasses
|
||||
that.search_facet_create_content = that.create_content;
|
||||
that.search_facet_refresh = that.refresh;
|
||||
|
||||
return that;
|
||||
|
@ -87,12 +87,8 @@ IPA.sudo.command_entity = function(spec) {
|
||||
name: 'memberof_sudocmdgroup',
|
||||
associator: IPA.serial_associator,
|
||||
columns:[
|
||||
{
|
||||
name: 'cn',
|
||||
primary_key: true,
|
||||
link: true
|
||||
},
|
||||
{ name: 'description' }
|
||||
'cn',
|
||||
'description'
|
||||
],
|
||||
adder_columns: [
|
||||
{
|
||||
@ -152,12 +148,8 @@ IPA.sudo.command_group_entity = function(spec) {
|
||||
association_facet({
|
||||
name: 'member_sudocmd',
|
||||
columns: [
|
||||
{
|
||||
name: 'sudocmd',
|
||||
primary_key: true,
|
||||
link: true
|
||||
},
|
||||
{ name: 'description' }
|
||||
'sudocmd',
|
||||
'description'
|
||||
],
|
||||
adder_columns: [
|
||||
{
|
||||
|
@ -185,8 +185,13 @@ var get_visible_rows = function(section) {
|
||||
};
|
||||
|
||||
test("Testing aci grouptarget.", function() {
|
||||
var sample_data_filter_only = { targetgroup:"ipausers" };
|
||||
target_facet.load(sample_data_filter_only);
|
||||
var data = {};
|
||||
data.result = {};
|
||||
data.result.result = {
|
||||
targetgroup: 'ipausers'
|
||||
};
|
||||
|
||||
target_facet.load(data);
|
||||
|
||||
same(target_widget.target, 'targetgroup' , 'group control selected');
|
||||
|
||||
@ -200,9 +205,13 @@ test("Testing aci grouptarget.", function() {
|
||||
});
|
||||
|
||||
test("Testing type target.", function() {
|
||||
var sample_data = { type:"hostgroup" };
|
||||
var data = {};
|
||||
data.result = {};
|
||||
data.result.result = {
|
||||
type: 'hostgroup'
|
||||
};
|
||||
|
||||
target_facet.load(sample_data);
|
||||
target_facet.load(data);
|
||||
|
||||
same(target_widget.target, 'type', 'type selected');
|
||||
|
||||
@ -210,7 +219,7 @@ test("Testing type target.", function() {
|
||||
var record = {};
|
||||
target_facet.save(record);
|
||||
|
||||
same(record.type[0], sample_data.type,
|
||||
same(record.type[0], data.result.result.type,
|
||||
"saved type matches sample data");
|
||||
|
||||
same(get_visible_rows(target_widget), ['type', 'attrs'],
|
||||
@ -223,9 +232,13 @@ test("Testing type target.", function() {
|
||||
|
||||
test("Testing filter target.", function() {
|
||||
|
||||
var sample_data = { filter:"somevalue" };
|
||||
var data = {};
|
||||
data.result = {};
|
||||
data.result.result = {
|
||||
filter: 'somevalue'
|
||||
};
|
||||
|
||||
target_facet.load(sample_data);
|
||||
target_facet.load(data);
|
||||
|
||||
var record = {};
|
||||
target_facet.save(record);
|
||||
@ -234,21 +247,24 @@ test("Testing filter target.", function() {
|
||||
|
||||
same(get_visible_rows(target_widget), ['filter'], 'filter row visible');
|
||||
|
||||
ok(record.filter[0], sample_data.filter, 'filter set correctly');
|
||||
ok(record.filter[0], data.result.result.filter, 'filter set correctly');
|
||||
});
|
||||
|
||||
|
||||
|
||||
test("Testing subtree target.", function() {
|
||||
|
||||
var sample_data = {
|
||||
subtree:"ldap:///cn=*,cn=roles,cn=accounts,dc=example,dc=co"};
|
||||
var data = {};
|
||||
data.result = {};
|
||||
data.result.result = {
|
||||
subtree: 'ldap:///cn=*,cn=roles,cn=accounts,dc=example,dc=co'
|
||||
};
|
||||
|
||||
target_facet.load(sample_data);
|
||||
target_facet.load(data);
|
||||
var record = {};
|
||||
target_facet.save(record);
|
||||
|
||||
same(record.subtree[0], sample_data.subtree, 'subtree set correctly');
|
||||
same(record.subtree[0], data.result.result.subtree, 'subtree set correctly');
|
||||
|
||||
same(get_visible_rows(target_widget), ['subtree'], 'subtree row visible');
|
||||
});
|
||||
|
@ -112,7 +112,9 @@ test("Testing IPA.details_section.create().", function() {
|
||||
|
||||
test("Testing details lifecycle: create, load.", function(){
|
||||
|
||||
var result = {};
|
||||
var data = {};
|
||||
data.result = {};
|
||||
data.result.result = {};
|
||||
|
||||
IPA.command({
|
||||
entity: 'user',
|
||||
@ -242,7 +244,7 @@ test("Testing details lifecycle: create, load.", function(){
|
||||
|
||||
facet.create(facet_container);
|
||||
|
||||
facet.load(result);
|
||||
facet.load(data);
|
||||
|
||||
var contact = $('.details-section[name=contact]', facet_container);
|
||||
|
||||
@ -314,10 +316,12 @@ test("Testing IPA.details_section_create again()",function() {
|
||||
var details = $("<div/>");
|
||||
container.append(details);
|
||||
|
||||
var result = {};
|
||||
var data = {};
|
||||
data.result = {};
|
||||
data.result.result = {};
|
||||
|
||||
section.create(container);
|
||||
facet.load(result);
|
||||
facet.load(data);
|
||||
|
||||
var table = $('table', container);
|
||||
|
||||
|
@ -32,10 +32,7 @@ IPA.user.entity = function(spec) {
|
||||
that.init = function() {
|
||||
that.entity_init();
|
||||
|
||||
var link = true;
|
||||
if (IPA.nav && IPA.nav.name == 'self-service') {
|
||||
link = false;
|
||||
}
|
||||
var link = IPA.nav.name == 'self-service' ? false : undefined;
|
||||
|
||||
that.builder.search_facet({
|
||||
columns: [
|
||||
|
Loading…
Reference in New Issue
Block a user