mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-25 08:21:05 -06:00
automount UI
automount implemented using standard facets and containing_entity pkey generation sample data fixtures for automount. messages for automount and HBAC. modified form of the search facet used to nest the automount entities Add works for nested entities. Delete works for all but keys. Since the API for this is going to change, I'm not going to fix it pre-checkin. All the places the PKEY prefix is needed uses a single function. Added breadcrumb trail into title. update ipa_init sample data add redirect logic for pages without pkeys. add and delete link to appropriate entities for nested search facet. Using on demand entities. Fixed breadcrumbs.
This commit is contained in:
parent
5288bdb79a
commit
1636d64926
@ -41,8 +41,8 @@ IPA.add_dialog = function (spec) {
|
||||
that.add(
|
||||
record,
|
||||
function(data, text_status, xhr) {
|
||||
var entity = IPA.get_entity(that.entity_name);
|
||||
var facet = entity.get_facet('search');
|
||||
var facet_name = IPA.current_facet(IPA.current_entity);
|
||||
var facet = IPA.current_entity.get_facet(facet_name);
|
||||
var table = facet.table;
|
||||
table.refresh();
|
||||
that.close();
|
||||
@ -57,8 +57,8 @@ IPA.add_dialog = function (spec) {
|
||||
that.add(
|
||||
record,
|
||||
function(data, text_status, xhr) {
|
||||
var entity = IPA.get_entity(that.entity_name);
|
||||
var facet = entity.get_facet('search');
|
||||
var facet_name = IPA.current_facet(IPA.current_entity);
|
||||
var facet = IPA.current_entity.get_facet(facet_name);
|
||||
var table = facet.table;
|
||||
table.refresh();
|
||||
that.reset();
|
||||
@ -97,6 +97,7 @@ IPA.add_dialog = function (spec) {
|
||||
|
||||
that.add = function(record, on_success, on_error) {
|
||||
|
||||
var field, value, pkey_prefix;
|
||||
var pkey_name = IPA.metadata.objects[that.entity_name].primary_key;
|
||||
|
||||
var command = IPA.command({
|
||||
@ -106,7 +107,11 @@ IPA.add_dialog = function (spec) {
|
||||
on_error: on_error
|
||||
});
|
||||
|
||||
var field, value;
|
||||
pkey_prefix = IPA.get_entity(that.entity_name).get_primary_key_prefix();
|
||||
|
||||
for (var h=0; h<pkey_prefix.length; h++) {
|
||||
command.add_arg(pkey_prefix[h]);
|
||||
}
|
||||
|
||||
var fields = that.fields.values;
|
||||
for (var i=0; i<fields.length; i++) {
|
||||
|
@ -1024,11 +1024,12 @@ IPA.association_facet = function (spec) {
|
||||
summary.append('<p>'+error_thrown.message+'</p>');
|
||||
}
|
||||
|
||||
var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
|
||||
var pkey = IPA.get_entity(that.entity_name).get_primary_key();
|
||||
|
||||
IPA.command({
|
||||
entity: that.entity_name,
|
||||
method: 'show',
|
||||
args: [pkey],
|
||||
args: pkey,
|
||||
options: {'all': true, 'rights': true},
|
||||
on_success: on_success,
|
||||
on_error: on_error
|
||||
|
@ -28,20 +28,74 @@
|
||||
|
||||
IPA.entity_factories.automountlocation = function() {
|
||||
return IPA.entity_builder().
|
||||
entity('automountlocation').
|
||||
entity({name:'automountlocation',
|
||||
title:IPA.messages.tabs.automount}).
|
||||
search_facet({
|
||||
columns:['cn']
|
||||
}).
|
||||
details_facet({sections:[{
|
||||
name:'identity',
|
||||
label: IPA.messages.details.identity,
|
||||
fields:['cn']
|
||||
}]}).
|
||||
standard_association_facets().
|
||||
nested_search_facet({
|
||||
facet_group: 'member',
|
||||
nested_entity : 'automountmap',
|
||||
label : IPA.metadata.objects.automountmap.label,
|
||||
name: 'maps',
|
||||
columns:['automountmapname']
|
||||
}).
|
||||
details_facet({
|
||||
sections:[
|
||||
{
|
||||
name:'identity',
|
||||
label: IPA.messages.details.identity,
|
||||
fields:['cn']
|
||||
}
|
||||
]}).
|
||||
adder_dialog({
|
||||
fields:['cn']
|
||||
}).
|
||||
build();
|
||||
};
|
||||
IPA.entity_factories.automountmap = function() {
|
||||
return IPA.entity_builder().
|
||||
entity({name:'automountmap',
|
||||
title:IPA.messages.tabs.automount}).
|
||||
containing_entity('automountlocation').
|
||||
nested_search_facet({
|
||||
facet_group: 'member',
|
||||
nested_entity : 'automountkey',
|
||||
label : IPA.metadata.objects.automountkey.label,
|
||||
name: 'keys',
|
||||
columns:['description']
|
||||
}).
|
||||
details_facet({
|
||||
sections:[
|
||||
{
|
||||
name:'identity',
|
||||
label: IPA.messages.details.identity,
|
||||
fields:['automountmapname','description']
|
||||
}
|
||||
]
|
||||
}).
|
||||
adder_dialog({
|
||||
fields:['automountmapname','description']
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
||||
|
||||
IPA.entity_factories.automountkey = function() {
|
||||
return IPA.entity_builder().
|
||||
entity({name:'automountkey',
|
||||
title:IPA.messages.tabs.automount}).
|
||||
containing_entity('automountmap').
|
||||
details_facet({
|
||||
sections:[
|
||||
{
|
||||
name:'identity',
|
||||
label: IPA.messages.details.identity,
|
||||
fields:['automountkey','automountinformation','description']
|
||||
}
|
||||
]
|
||||
}).
|
||||
adder_dialog({
|
||||
fields:['automountkey','automountinformation']
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
@ -310,13 +310,26 @@ IPA.details_facet = function(spec) {
|
||||
}
|
||||
};
|
||||
|
||||
that.get_primary_key = function() {
|
||||
var pkey_name = IPA.metadata.objects[that.entity_name].primary_key;
|
||||
if (that.record[pkey_name] instanceof Array){
|
||||
return that.record[pkey_name][0];
|
||||
/* the primary key used for show and update is built as an array.
|
||||
for most entities, this will be a single element long, but for some
|
||||
it requires the containing entities primary keys as well.*/
|
||||
that.get_primary_key = function(from_url) {
|
||||
|
||||
var pkey = IPA.get_entity(that.entity_name).get_primary_key_prefix();
|
||||
|
||||
if (from_url){
|
||||
pkey.push(that.pkey);
|
||||
}else{
|
||||
return that.record[pkey_name];
|
||||
var pkey_name = IPA.metadata.objects[that.entity_name].primary_key;
|
||||
var pkey_val = that.record[pkey_name];
|
||||
if (pkey_val instanceof Array){
|
||||
pkey.push( pkey_val[0]);
|
||||
}else{
|
||||
pkey.push(pkey_val);
|
||||
}
|
||||
}
|
||||
|
||||
return pkey;
|
||||
};
|
||||
|
||||
that.create_header = function(container) {
|
||||
@ -577,9 +590,7 @@ IPA.details_facet = function(spec) {
|
||||
}
|
||||
}
|
||||
|
||||
var pkey = that.get_primary_key();
|
||||
|
||||
var args = pkey ? [pkey] : [];
|
||||
var args = that.get_primary_key();
|
||||
|
||||
var command = IPA.command({
|
||||
entity: entity_name,
|
||||
@ -597,7 +608,7 @@ IPA.details_facet = function(spec) {
|
||||
|
||||
that.refresh = function() {
|
||||
|
||||
that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) ;
|
||||
that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
|
||||
|
||||
var command = IPA.command({
|
||||
entity: that.entity_name,
|
||||
@ -609,9 +620,17 @@ IPA.details_facet = function(spec) {
|
||||
IPA.details_refresh_devel_hook(that.entity_name,command,that.pkey);
|
||||
}
|
||||
|
||||
|
||||
if (that.pkey){
|
||||
command.args = [that.pkey];
|
||||
command.args = that.get_primary_key(true);
|
||||
}else if (that.entity.redirect_facet) {
|
||||
var current_entity = that.entity;
|
||||
while (current_entity.containing_entity){
|
||||
current_entity = current_entity.containing_entity;
|
||||
}
|
||||
IPA.nav.show_page(
|
||||
current_entity.name,
|
||||
that.entity.redirect_facet);
|
||||
return;
|
||||
}
|
||||
|
||||
command.on_success = function(data, text_status, xhr) {
|
||||
|
@ -147,21 +147,10 @@ IPA.table_facet = function(spec) {
|
||||
|
||||
var that = IPA.facet(spec);
|
||||
|
||||
that.managed_entity_name = spec.managed_entity_name || that.entity_name;
|
||||
|
||||
that.columns = $.ordered_map();
|
||||
|
||||
that.__defineGetter__('entity_name', function() {
|
||||
return that._entity_name;
|
||||
});
|
||||
|
||||
that.__defineSetter__('entity_name', function(entity_name) {
|
||||
that._entity_name = entity_name;
|
||||
|
||||
var columns = that.columns.values;
|
||||
for (var i=0; i<columns.length; i++) {
|
||||
columns[i].entity_name = entity_name;
|
||||
}
|
||||
});
|
||||
|
||||
that.get_columns = function() {
|
||||
return that.columns.values;
|
||||
};
|
||||
@ -171,7 +160,7 @@ IPA.table_facet = function(spec) {
|
||||
};
|
||||
|
||||
that.add_column = function(column) {
|
||||
column.entity_name = that.entity_name;
|
||||
column.entity_name = that.managed_entity_name;
|
||||
that.columns.put(column.name, column);
|
||||
};
|
||||
|
||||
@ -233,6 +222,7 @@ IPA.entity = function (spec) {
|
||||
that.metadata = spec.metadata;
|
||||
that.name = spec.name;
|
||||
that.label = spec.label || spec.metadata.label || spec.name;
|
||||
that.title = spec.title || that.label;
|
||||
|
||||
that.header = spec.header || IPA.entity_header({entity: that});
|
||||
|
||||
@ -244,6 +234,8 @@ IPA.entity = function (spec) {
|
||||
// current facet
|
||||
that.facet_name = null;
|
||||
|
||||
that.redirect_facet = spec.redirect_facet;
|
||||
that.containing_entity = null;
|
||||
that.get_dialog = function(name) {
|
||||
return that.dialogs.get(name);
|
||||
};
|
||||
@ -367,6 +359,28 @@ IPA.entity = function (spec) {
|
||||
that.facet.refresh();
|
||||
};
|
||||
|
||||
that.get_primary_key_prefix = function() {
|
||||
var pkey = [];
|
||||
var current_entity = that;
|
||||
current_entity = current_entity.containing_entity;
|
||||
while(current_entity !== null){
|
||||
pkey.unshift(
|
||||
$.bbq.getState(current_entity.name + '-pkey', true) || '');
|
||||
current_entity = current_entity.containing_entity;
|
||||
}
|
||||
return pkey;
|
||||
};
|
||||
|
||||
/*gets the primary key for trhe current entity out of the URL parameters */
|
||||
that.get_primary_key = function() {
|
||||
var pkey = that.get_primary_key_prefix();
|
||||
var current_entity = that;
|
||||
pkey.unshift(
|
||||
$.bbq.getState(current_entity.name + '-pkey', true) || '');
|
||||
return pkey;
|
||||
};
|
||||
|
||||
|
||||
that.entity_init = that.init;
|
||||
|
||||
return that;
|
||||
@ -375,7 +389,7 @@ IPA.entity = function (spec) {
|
||||
IPA.current_facet = function (entity){
|
||||
var facet_name = $.bbq.getState(entity.name + '-facet', true);
|
||||
var facets = entity.facets.values;
|
||||
if (!facet_name && facets.length) {
|
||||
if (!facet_name && facets.length) {
|
||||
facet_name = facets[0].name;
|
||||
}
|
||||
return facet_name;
|
||||
@ -471,12 +485,47 @@ IPA.entity_header = function(spec) {
|
||||
that.set_pkey = function(value) {
|
||||
|
||||
if (value) {
|
||||
var span = $('.entity-pkey', that.pkey);
|
||||
span.text(value);
|
||||
that.pkey.css('display', 'inline');
|
||||
var breadcrumb = [];
|
||||
var current_entity = IPA.current_entity.containing_entity;
|
||||
|
||||
while(current_entity){
|
||||
breadcrumb.unshift($('<a/>',{
|
||||
text:$.bbq.getState(current_entity.name + '-pkey', true) ||
|
||||
'',
|
||||
title: current_entity.name,
|
||||
click: function() {
|
||||
var entity = IPA.get_entity((this.title));
|
||||
IPA.nav.show_page(entity.name, 'default');
|
||||
$('a', that.facet_tabs).removeClass('selected');
|
||||
return false;
|
||||
}
|
||||
}));
|
||||
|
||||
current_entity = current_entity.containing_entity;
|
||||
}
|
||||
|
||||
that.title_container.empty();
|
||||
var h3 = $('<h3/>').appendTo(that.title_container);
|
||||
|
||||
h3.empty();
|
||||
h3.append(IPA.current_entity.title);
|
||||
h3.append(': ');
|
||||
|
||||
for (var i = 0; i < breadcrumb.length; i+=1){
|
||||
h3.append(breadcrumb[i]);
|
||||
h3.append(' > ');
|
||||
|
||||
}
|
||||
h3.append(
|
||||
$('<span/>', {
|
||||
'class': 'entity-pkey',
|
||||
text:value
|
||||
}));
|
||||
} else {
|
||||
that.pkey.css('display', 'none');
|
||||
that.title_container.empty();
|
||||
var span = $('<h3/>',{
|
||||
text:IPA.current_entity.metadata.label
|
||||
}).appendTo(that.title_container);
|
||||
}
|
||||
};
|
||||
|
||||
@ -554,7 +603,12 @@ IPA.entity_header = function(spec) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IPA.nav.show_page(that.entity.name, 'search');
|
||||
var current_entity = that.entity;
|
||||
while(current_entity.containing_entity){
|
||||
current_entity = current_entity.containing_entity;
|
||||
}
|
||||
|
||||
IPA.nav.show_page(current_entity.name, 'search');
|
||||
$('a', that.facet_tabs).removeClass('selected');
|
||||
return false;
|
||||
}
|
||||
@ -655,12 +709,9 @@ IPA.entity_builder = function(){
|
||||
};
|
||||
|
||||
that.facet = function(spec) {
|
||||
|
||||
spec.entity_name = entity.name;
|
||||
|
||||
facet = spec.factory(spec);
|
||||
entity.add_facet(facet);
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
@ -672,6 +723,19 @@ IPA.entity_builder = function(){
|
||||
var factory = spec.factory || IPA.search_facet;
|
||||
facet = factory(spec);
|
||||
entity.add_facet(facet);
|
||||
add_redirect_info();
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
that.nested_search_facet = function(spec) {
|
||||
|
||||
spec.entity_name = entity.name;
|
||||
spec.label = spec.label || IPA.messages.facets.search;
|
||||
|
||||
var factory = spec.factory || IPA.nested_search_facet;
|
||||
facet = factory(spec);
|
||||
entity.add_facet(facet);
|
||||
|
||||
return that;
|
||||
};
|
||||
@ -701,22 +765,29 @@ IPA.entity_builder = function(){
|
||||
spec.entity_name = entity.name;
|
||||
|
||||
var index = spec.name.indexOf('_');
|
||||
spec.attribute_member = spec.attribute_member || spec.name.substring(0, index);
|
||||
spec.other_entity = spec.other_entity || spec.name.substring(index+1);
|
||||
spec.attribute_member = spec.attribute_member ||
|
||||
spec.name.substring(0, index);
|
||||
spec.other_entity = spec.other_entity ||
|
||||
spec.name.substring(index+1);
|
||||
|
||||
spec.facet_group = spec.facet_group || spec.attribute_member;
|
||||
spec.facet_group = spec.facet_group ||
|
||||
spec.attribute_member;
|
||||
|
||||
if (spec.facet_group == 'memberindirect' || spec.facet_group == 'memberofindirect') {
|
||||
if (spec.facet_group == 'memberindirect' ||
|
||||
spec.facet_group == 'memberofindirect') {
|
||||
spec.read_only = true;
|
||||
}
|
||||
|
||||
spec.label = spec.label || (IPA.metadata.objects[spec.other_entity] ? IPA.metadata.objects[spec.other_entity].label : spec.other_entity);
|
||||
spec.label = spec.label ||
|
||||
(IPA.metadata.objects[spec.other_entity] ?
|
||||
IPA.metadata.objects[spec.other_entity].label : spec.other_entity);
|
||||
|
||||
if (!spec.title) {
|
||||
if (spec.facet_group == 'member' || spec.facet_group == 'memberindirect') {
|
||||
if (spec.facet_group == 'member' ||
|
||||
spec.facet_group == 'memberindirect') {
|
||||
spec.title = IPA.messages.association.member;
|
||||
|
||||
} else if (spec.facet_group == 'memberof' || spec.facet_group == 'memberofindirect') {
|
||||
} else if (spec.facet_group == 'memberof' ||
|
||||
spec.facet_group == 'memberofindirect') {
|
||||
spec.title = IPA.messages.association.memberof;
|
||||
}
|
||||
}
|
||||
@ -794,6 +865,18 @@ IPA.entity_builder = function(){
|
||||
}
|
||||
};
|
||||
|
||||
function add_redirect_info(facet_name){
|
||||
if (!entity.redirect_facet){
|
||||
entity.redirect_facet = 'search';
|
||||
}
|
||||
}
|
||||
|
||||
that.containing_entity = function(entity_name) {
|
||||
add_redirect_info();
|
||||
entity.containing_entity = IPA.get_entity(entity_name);
|
||||
return that;
|
||||
};
|
||||
|
||||
that.dialog = function(spec) {
|
||||
var dialog;
|
||||
if (spec instanceof Object){
|
||||
|
@ -273,7 +273,7 @@ IPA.host_provisioning_status_widget = function (spec) {
|
||||
name: that.entity_name+'_disable_'+pkey,
|
||||
entity: that.entity_name,
|
||||
method: 'disable',
|
||||
args: [pkey],
|
||||
args: pkey,
|
||||
options: { all: true, rights: true },
|
||||
on_success: on_success,
|
||||
on_error: on_error
|
||||
@ -291,7 +291,7 @@ IPA.host_provisioning_status_widget = function (spec) {
|
||||
var command = IPA.command({
|
||||
entity: that.entity_name,
|
||||
method: 'mod',
|
||||
args: [pkey],
|
||||
args: pkey,
|
||||
options: {
|
||||
all: true,
|
||||
rights: true,
|
||||
|
@ -826,11 +826,15 @@ table.scrollable tbody {
|
||||
}
|
||||
|
||||
.entity-header .entity-title {
|
||||
text-transform: uppercase;
|
||||
color:gray;
|
||||
padding-right:5em;
|
||||
}
|
||||
|
||||
|
||||
.entity-header .entity-title span{
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.entity-header .entity-title .entity-pkey {
|
||||
color:black;
|
||||
}
|
||||
|
@ -159,6 +159,7 @@ var IPA = ( function () {
|
||||
if (IPA.current_entity){
|
||||
var facet_name = IPA.current_facet(IPA.current_entity);
|
||||
var facet = IPA.current_entity.get_facet(facet_name);
|
||||
if (!facet) return false;
|
||||
|
||||
if (facet.is_dirty()){
|
||||
|
||||
|
@ -30,40 +30,47 @@ IPA.search_facet = function(spec) {
|
||||
|
||||
spec.name = spec.name || 'search';
|
||||
spec.display_class = 'search-facet';
|
||||
spec.managed_entity_name = spec.managed_entity_name || spec.entity_name;
|
||||
|
||||
var that = IPA.table_facet(spec);
|
||||
|
||||
that.search_all = spec.search_all || false;
|
||||
|
||||
that.setup_column = function(column) {
|
||||
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() {
|
||||
IPA.nav.show_page(that.entity_name, 'default', value);
|
||||
return false;
|
||||
};
|
||||
}(value)
|
||||
}).appendTo(container);
|
||||
};
|
||||
};
|
||||
|
||||
that.init = function() {
|
||||
|
||||
that.facet_init();
|
||||
that.managed_entity = IPA.get_entity(that.managed_entity_name);
|
||||
that.init_table(that.managed_entity);
|
||||
};
|
||||
|
||||
that.init_table = function(entity){
|
||||
|
||||
function setup_column(column,entity) {
|
||||
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() {
|
||||
IPA.nav.show_page(entity.name, 'default', value);
|
||||
return false;
|
||||
};
|
||||
}(value)
|
||||
}).appendTo(container);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
that.table = IPA.table_widget({
|
||||
id: that.entity_name+'-search',
|
||||
id: entity.name+'-search',
|
||||
name: 'search',
|
||||
label: IPA.metadata.objects[that.entity_name].label,
|
||||
entity_name: that.entity_name,
|
||||
label: IPA.metadata.objects[entity.name].label,
|
||||
entity_name: entity.name,
|
||||
search_all: that.search_all
|
||||
});
|
||||
|
||||
@ -71,11 +78,11 @@ IPA.search_facet = function(spec) {
|
||||
for (var i=0; i<columns.length; i++) {
|
||||
var column = columns[i];
|
||||
|
||||
var param_info = IPA.get_entity_param(that.entity_name, column.name);
|
||||
var param_info = IPA.get_entity_param(entity.name, column.name);
|
||||
column.primary_key = param_info && param_info['primary_key'];
|
||||
|
||||
if (column.primary_key) {
|
||||
that.setup_column(column);
|
||||
setup_column(column,entity);
|
||||
}
|
||||
|
||||
that.table.add_column(column);
|
||||
@ -148,7 +155,6 @@ IPA.search_facet = function(spec) {
|
||||
};
|
||||
|
||||
that.setup = function(container) {
|
||||
|
||||
that.facet_setup(container);
|
||||
};
|
||||
|
||||
@ -178,11 +184,16 @@ IPA.search_facet = function(spec) {
|
||||
};
|
||||
|
||||
that.add = function() {
|
||||
var dialog = that.entity.get_dialog('add');
|
||||
var dialog = that.managed_entity.get_dialog('add');
|
||||
dialog.open(that.container);
|
||||
};
|
||||
|
||||
|
||||
that.remove = function() {
|
||||
that.remove_instances(that.managed_entity);
|
||||
};
|
||||
|
||||
that.remove_instances = function(entity) {
|
||||
|
||||
var values = that.table.get_selected_values();
|
||||
|
||||
@ -200,7 +211,8 @@ IPA.search_facet = function(spec) {
|
||||
var dialog = IPA.deleter_dialog({
|
||||
'title': title,
|
||||
'parent': that.container,
|
||||
'values': values
|
||||
'values': values,
|
||||
entity_name: entity.name
|
||||
});
|
||||
|
||||
dialog.execute = function() {
|
||||
@ -216,11 +228,19 @@ IPA.search_facet = function(spec) {
|
||||
}
|
||||
});
|
||||
|
||||
var pkeys =
|
||||
entity.get_primary_key_prefix();
|
||||
|
||||
for (var i=0; i<values.length; i++) {
|
||||
var command = IPA.command({
|
||||
entity: that.entity_name,
|
||||
entity: entity.name,
|
||||
method: 'del'
|
||||
});
|
||||
|
||||
for (var k=0; k<pkeys.length; k++) {
|
||||
command.add_arg(pkeys[k]);
|
||||
}
|
||||
|
||||
command.add_arg(values[i]);
|
||||
batch.add_command(command);
|
||||
}
|
||||
@ -236,11 +256,15 @@ IPA.search_facet = function(spec) {
|
||||
that.find = function() {
|
||||
var filter = that.filter.val();
|
||||
var state = {};
|
||||
state[that.entity_name + '-filter'] = filter;
|
||||
state[that.managed_entity_name + '-filter'] = filter;
|
||||
IPA.nav.push_state(state);
|
||||
};
|
||||
|
||||
that.refresh = function() {
|
||||
that.search_refresh(that.entity);
|
||||
};
|
||||
|
||||
that.search_refresh = function(entity){
|
||||
|
||||
function on_success(data, text_status, xhr) {
|
||||
|
||||
@ -271,12 +295,21 @@ IPA.search_facet = function(spec) {
|
||||
summary.append('<p>'+error_thrown.message+'</p>');
|
||||
}
|
||||
|
||||
var filter = $.bbq.getState(that.entity_name + '-filter', true) || '';
|
||||
var filter = [];
|
||||
var current_entity = entity;
|
||||
filter.unshift($.bbq.getState(current_entity.name + '-filter', true) || '');
|
||||
current_entity = current_entity.containing_entity;
|
||||
while(current_entity !== null){
|
||||
filter.unshift(
|
||||
$.bbq.getState(current_entity.name + '-pkey', true) || '');
|
||||
current_entity = current_entity.containing_entity;
|
||||
}
|
||||
|
||||
|
||||
var command = IPA.command({
|
||||
entity: that.entity_name,
|
||||
entity: entity.name,
|
||||
method: 'find',
|
||||
args: [filter],
|
||||
args: filter,
|
||||
options: {
|
||||
all: that.search_all
|
||||
},
|
||||
@ -294,3 +327,49 @@ IPA.search_facet = function(spec) {
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
|
||||
/*TODO. this has much copied code from above. Refactor the search_facet
|
||||
To either be nested or not nested. */
|
||||
IPA.nested_search_facet = function(spec){
|
||||
spec.managed_entity_name = spec.nested_entity;
|
||||
var that = IPA.search_facet(spec);
|
||||
|
||||
that.show = function() {
|
||||
that.facet_show();
|
||||
|
||||
//that.entity.header.set_pkey(null);
|
||||
that.entity.header.back_link.css('visibility', 'visible');
|
||||
that.entity.header.facet_tabs.css('visibility', 'visible');
|
||||
|
||||
that.entity.header.set_pkey(
|
||||
$.bbq.getState(IPA.current_entity.name + '-pkey', true) || '');
|
||||
if (that.filter) {
|
||||
var filter =
|
||||
$.bbq.getState(that.managed_entity_name + '-filter', true) || '';
|
||||
that.filter.val(filter);
|
||||
}
|
||||
};
|
||||
|
||||
that.refresh = function(){
|
||||
|
||||
var pkey = $.bbq.getState(that.entity.name + '-pkey', true) || '';
|
||||
|
||||
if ((!pkey) && (that.entity.redirect_facet)) {
|
||||
|
||||
var current_entity = that.entity;
|
||||
while (current_entity.containing_entity){
|
||||
current_entity = current_entity.containing_entity;
|
||||
}
|
||||
|
||||
IPA.nav.show_page(
|
||||
current_entity.name,
|
||||
that.entity.redirect_facet);
|
||||
return;
|
||||
}
|
||||
|
||||
that.search_refresh(that.managed_entity);
|
||||
};
|
||||
|
||||
return that;
|
||||
};
|
||||
|
24
install/ui/test/data/automountkey_add.json
Normal file
24
install/ui/test/data/automountkey_add.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"error": null,
|
||||
"id": null,
|
||||
"result": {
|
||||
"result": {
|
||||
"automountinformation": [
|
||||
"mountinfogoeshere"
|
||||
],
|
||||
"automountkey": [
|
||||
"/var/log/ipa"
|
||||
],
|
||||
"description": [
|
||||
"/var/log/ipa mountinfogoeshere"
|
||||
],
|
||||
"dn": "description=/var/log/ipa mountinfogoeshere,automountmapname=auto.master,cn=default,cn=automount,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
|
||||
"objectclass": [
|
||||
"automount",
|
||||
"top"
|
||||
]
|
||||
},
|
||||
"summary": null,
|
||||
"value": "auto.master"
|
||||
}
|
||||
}
|
43
install/ui/test/data/automountkey_find.json
Normal file
43
install/ui/test/data/automountkey_find.json
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"error": null,
|
||||
"id": 0,
|
||||
"result": {
|
||||
"count": 2,
|
||||
"result": [
|
||||
{
|
||||
"automountinformation": [
|
||||
"/var/log/dirsrv"
|
||||
],
|
||||
"automountkey": [
|
||||
"nfsserver:/var/log/dirsrv"
|
||||
],
|
||||
"description": [
|
||||
"nfsserver:/var/log/dirsrv /var/log/dirsrv"
|
||||
],
|
||||
"dn": "description=nfsserver:/var/log/dirsrv /var/log/dirsrv,automountmapname=auto.log,cn=bos,cn=automount,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
|
||||
"objectclass": [
|
||||
"automount",
|
||||
"top"
|
||||
]
|
||||
},
|
||||
{
|
||||
"automountinformation": [
|
||||
"/var/log/ipa"
|
||||
],
|
||||
"automountkey": [
|
||||
"nfsserver:/var/log/ipa"
|
||||
],
|
||||
"description": [
|
||||
"nfsserver:/var/log/ipa /var/log/ipa"
|
||||
],
|
||||
"dn": "description=nfsserver:/var/log/ipa /var/log/ipa,automountmapname=auto.log,cn=bos,cn=automount,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
|
||||
"objectclass": [
|
||||
"automount",
|
||||
"top"
|
||||
]
|
||||
}
|
||||
],
|
||||
"summary": null,
|
||||
"truncated": false
|
||||
}
|
||||
}
|
32
install/ui/test/data/automountkey_show.json
Normal file
32
install/ui/test/data/automountkey_show.json
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"error": null,
|
||||
"id": null,
|
||||
"result": {
|
||||
"result": {
|
||||
"attributelevelrights": {
|
||||
"aci": "rscwo",
|
||||
"automountinformation": "rscwo",
|
||||
"automountkey": "rscwo",
|
||||
"description": "rscwo",
|
||||
"nsaccountlock": "rscwo",
|
||||
"objectclass": "rscwo"
|
||||
},
|
||||
"automountinformation": [
|
||||
"auto.home"
|
||||
],
|
||||
"automountkey": [
|
||||
"/home"
|
||||
],
|
||||
"description": [
|
||||
"/home auto.home"
|
||||
],
|
||||
"dn": "description=/home auto.home,automountmapname=auto.master,cn=default,cn=automount,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
|
||||
"objectclass": [
|
||||
"automount",
|
||||
"top"
|
||||
]
|
||||
},
|
||||
"summary": null,
|
||||
"value": "/home auto.home"
|
||||
}
|
||||
}
|
18
install/ui/test/data/automountlocation_add.json
Normal file
18
install/ui/test/data/automountlocation_add.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"error": null,
|
||||
"id": null,
|
||||
"result": {
|
||||
"result": {
|
||||
"cn": [
|
||||
"YYZ"
|
||||
],
|
||||
"dn": "cn=yyz,cn=automount,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
|
||||
"objectclass": [
|
||||
"nscontainer",
|
||||
"top"
|
||||
]
|
||||
},
|
||||
"summary": null,
|
||||
"value": "YYZ"
|
||||
}
|
||||
}
|
17
install/ui/test/data/automountlocation_del.json
Normal file
17
install/ui/test/data/automountlocation_del.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"error": null,
|
||||
"id": null,
|
||||
"result": {
|
||||
"count": 1,
|
||||
"results": [
|
||||
{
|
||||
"error": null,
|
||||
"result": {
|
||||
"failed": ""
|
||||
},
|
||||
"summary": null,
|
||||
"value": "YYZ"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -1,17 +1,35 @@
|
||||
{
|
||||
"error": null,
|
||||
"id": 6,
|
||||
"error": null,
|
||||
"id": null,
|
||||
"result": {
|
||||
"count": 1,
|
||||
"count": 4,
|
||||
"result": [
|
||||
{
|
||||
"cn": [
|
||||
"BOS"
|
||||
],
|
||||
"dn": "cn=bos,cn=automount,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com"
|
||||
},
|
||||
{
|
||||
"cn": [
|
||||
"BRNO"
|
||||
],
|
||||
"dn": "cn=brno,cn=automount,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com"
|
||||
},
|
||||
{
|
||||
"cn": [
|
||||
"default"
|
||||
],
|
||||
],
|
||||
"dn": "cn=default,cn=automount,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com"
|
||||
},
|
||||
{
|
||||
"cn": [
|
||||
"RDU"
|
||||
],
|
||||
"dn": "cn=rdu,cn=automount,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com"
|
||||
}
|
||||
],
|
||||
"summary": null,
|
||||
],
|
||||
"summary": null,
|
||||
"truncated": false
|
||||
}
|
||||
}
|
18
install/ui/test/data/automountmap_add.json
Normal file
18
install/ui/test/data/automountmap_add.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"error": null,
|
||||
"id": null,
|
||||
"result": {
|
||||
"result": {
|
||||
"automountmapname": [
|
||||
"auto.log"
|
||||
],
|
||||
"dn": "automountmapname=auto.log,cn=mtv,cn=automount,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
|
||||
"objectclass": [
|
||||
"automountmap",
|
||||
"top"
|
||||
]
|
||||
},
|
||||
"summary": null,
|
||||
"value": "auto.log"
|
||||
}
|
||||
}
|
17
install/ui/test/data/automountmap_del.json
Normal file
17
install/ui/test/data/automountmap_del.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"error": null,
|
||||
"id": null,
|
||||
"result": {
|
||||
"count": 1,
|
||||
"results": [
|
||||
{
|
||||
"error": null,
|
||||
"result": {
|
||||
"failed": ""
|
||||
},
|
||||
"summary": null,
|
||||
"value": "auto.log"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
51
install/ui/test/data/automountmap_find.json
Normal file
51
install/ui/test/data/automountmap_find.json
Normal file
@ -0,0 +1,51 @@
|
||||
{
|
||||
"error": null,
|
||||
"id": 0,
|
||||
"result": {
|
||||
"count": 4,
|
||||
"result": [
|
||||
{
|
||||
"automountmapname": [
|
||||
"auto.direct"
|
||||
],
|
||||
"dn": "automountmapname=auto.direct,cn=bos,cn=automount,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
|
||||
"objectclass": [
|
||||
"automountmap",
|
||||
"top"
|
||||
]
|
||||
},
|
||||
{
|
||||
"automountmapname": [
|
||||
"auto.home"
|
||||
],
|
||||
"dn": "automountmapname=auto.home,cn=bos,cn=automount,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
|
||||
"objectclass": [
|
||||
"automountmap",
|
||||
"top"
|
||||
]
|
||||
},
|
||||
{
|
||||
"automountmapname": [
|
||||
"auto.log"
|
||||
],
|
||||
"dn": "automountmapname=auto.log,cn=bos,cn=automount,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
|
||||
"objectclass": [
|
||||
"automountmap",
|
||||
"top"
|
||||
]
|
||||
},
|
||||
{
|
||||
"automountmapname": [
|
||||
"auto.master"
|
||||
],
|
||||
"dn": "automountmapname=auto.master,cn=bos,cn=automount,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
|
||||
"objectclass": [
|
||||
"automountmap",
|
||||
"top"
|
||||
]
|
||||
}
|
||||
],
|
||||
"summary": null,
|
||||
"truncated": false
|
||||
}
|
||||
}
|
14
install/ui/test/data/automountmap_show.json
Normal file
14
install/ui/test/data/automountmap_show.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"error": null,
|
||||
"id": null,
|
||||
"result": {
|
||||
"result": {
|
||||
"automountmapname": [
|
||||
"live"
|
||||
],
|
||||
"dn": "automountmapname=live,cn=bos,cn=automount,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com"
|
||||
},
|
||||
"summary": null,
|
||||
"value": "live"
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -11,6 +11,8 @@
|
||||
<script type="text/javascript" src="../ipa.js"></script>
|
||||
<script type="text/javascript" src="../entity.js"></script>
|
||||
<script type="text/javascript" src="../navigation.js"></script>
|
||||
<script type="text/javascript" src="../search.js"></script>
|
||||
<script type="text/javascript" src="../widget.js"></script>
|
||||
<script type="text/javascript" src="navigation_tests.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -41,10 +41,14 @@ test("Testing IPA.navigation.create().", function() {
|
||||
var entity;
|
||||
var user_mock_called = false;
|
||||
var group_mock_called = false;
|
||||
//Force reset of entities
|
||||
IPA.entities = $.ordered_map();
|
||||
|
||||
IPA.entity_factories.user = function() {
|
||||
var that = IPA.entity({name: 'user',
|
||||
metadata:IPA.metadata.objects.user});
|
||||
that.add_facet(IPA.search_facet({'entity_name':'user'}));
|
||||
|
||||
that.setup = function(container){
|
||||
user_mock_called = true;
|
||||
same(container.attr('name'), 'user', 'user container name');
|
||||
|
@ -51,7 +51,11 @@ IPA.admin_navigation = function(spec) {
|
||||
{entity: 'sudocmd'},
|
||||
{entity: 'sudocmdgroup'}
|
||||
]},
|
||||
// {entity: 'automountlocation'},
|
||||
{name: 'automount', label: IPA.messages.tabs.automount, children: [
|
||||
{entity: 'automountlocation'},
|
||||
{entity: 'automountmap'},
|
||||
{entity: 'automountkey'}
|
||||
]},
|
||||
{entity: 'pwpolicy'},
|
||||
{entity: 'krbtpolicy'}
|
||||
]},
|
||||
|
@ -1047,7 +1047,12 @@ IPA.column = function (spec) {
|
||||
that.init = function() {
|
||||
if (that.entity_name && !that.label) {
|
||||
var param_info = IPA.get_entity_param(that.entity_name, that.name);
|
||||
if (param_info) that.label = param_info.label;
|
||||
if (param_info) {
|
||||
that.label = param_info.label;
|
||||
}else{
|
||||
alert('cannot find label for ' + that.entity_name + ' ' +
|
||||
that.name);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -1124,12 +1129,14 @@ IPA.table_widget = function (spec) {
|
||||
var table = $('<table/>', {
|
||||
'class': 'search-table'
|
||||
}).appendTo(container);
|
||||
that.table = table;
|
||||
|
||||
if (that.scrollable) {
|
||||
table.addClass('scrollable');
|
||||
}
|
||||
|
||||
var thead = $('<thead/>').appendTo(table);
|
||||
that.thead = thead;
|
||||
|
||||
var tr = $('<tr/>').appendTo(thead);
|
||||
|
||||
@ -1176,6 +1183,7 @@ IPA.table_widget = function (spec) {
|
||||
}
|
||||
|
||||
var tbody = $('<tbody/>').appendTo(table);
|
||||
that.tbody = tbody;
|
||||
|
||||
if (that.height) {
|
||||
tbody.css('height', that.height);
|
||||
@ -1207,6 +1215,7 @@ IPA.table_widget = function (spec) {
|
||||
}
|
||||
|
||||
var tfoot = $('<tfoot/>').appendTo(table);
|
||||
that.tfoot = tfoot;
|
||||
|
||||
tr = $('<tr/>').appendTo(tfoot);
|
||||
|
||||
@ -1224,10 +1233,10 @@ IPA.table_widget = function (spec) {
|
||||
|
||||
that.widget_setup(container);
|
||||
|
||||
that.table = $('table', that.container);
|
||||
that.thead = $('thead', that.table);
|
||||
that.tbody = $('tbody', that.table);
|
||||
that.tfoot = $('tfoot', that.table);
|
||||
// that.table = $('table', that.container);
|
||||
// that.thead = $('thead', that.table);
|
||||
// that.tbody = $('tbody', that.table);
|
||||
// that.tfoot = $('tfoot', that.table);
|
||||
|
||||
var select_all_checkbox = $('input[name=select]', that.thead);
|
||||
select_all_checkbox.attr('title', IPA.messages.search.select_all);
|
||||
|
@ -186,7 +186,7 @@ class automountlocation(LDAPObject):
|
||||
object_name_plural = 'automount locations'
|
||||
object_class = ['nscontainer']
|
||||
default_attributes = ['cn']
|
||||
label = _('Automount')
|
||||
label = _('Automount Locations')
|
||||
|
||||
|
||||
takes_params = (
|
||||
|
@ -100,7 +100,13 @@ class i18n_messages(Command):
|
||||
},
|
||||
"automountlocation": {
|
||||
"add":_("Add Automount Location"),
|
||||
"identity":_("Automount Location Settings"),
|
||||
"identity":_("Automount Location Settings")
|
||||
},
|
||||
"automountmap": {
|
||||
"add":_("Add Automount Map")
|
||||
},
|
||||
"automountkey": {
|
||||
"add":_("Add Automount Key")
|
||||
},
|
||||
"cert": {
|
||||
"unspecified":_("Unspecified"),
|
||||
@ -372,8 +378,9 @@ class i18n_messages(Command):
|
||||
"audit": _("Audit"),
|
||||
"ipaserver":_("IPA Server"),
|
||||
"sudo":_("Sudo"),
|
||||
"hbac":_("HBAC"),
|
||||
"role":_("Role Based Access Control")
|
||||
"hbac":_("Host Based Access Control"),
|
||||
"role":_("Role Based Access Control"),
|
||||
"automount":_("Automount")
|
||||
},
|
||||
"association":{
|
||||
"add":_("Add ${other_entity} into ${entity} ${primary_key}"),
|
||||
|
Loading…
Reference in New Issue
Block a user