mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
automountkey details
Adds hooks for navigation to the show page due to the unusual way that keys are accessed. https://fedorahosted.org/freeipa/ticket/1257
This commit is contained in:
parent
8810758c11
commit
cbffe1d65d
@ -33,8 +33,19 @@ IPA.add_dialog = function (spec) {
|
||||
that.title = spec.title;
|
||||
that._entity_name = spec.entity_name;
|
||||
that.method = spec.method || 'add';
|
||||
that.init = function() {
|
||||
|
||||
function show_edit_page(entity_name,result){
|
||||
var pkey_name = IPA.metadata.objects[entity_name].primary_key;
|
||||
var pkey = result[pkey_name];
|
||||
if (pkey instanceof Array) {
|
||||
pkey = pkey[0];
|
||||
}
|
||||
IPA.nav.show_page(that.entity_name, 'default', pkey);
|
||||
}
|
||||
|
||||
that.show_edit_page = spec.show_edit_page || show_edit_page;
|
||||
|
||||
that.init = function() {
|
||||
that.add_button(IPA.messages.buttons.add, function() {
|
||||
var record = {};
|
||||
that.save(record);
|
||||
@ -74,16 +85,9 @@ IPA.add_dialog = function (spec) {
|
||||
function(data, text_status, xhr) {
|
||||
that.close();
|
||||
|
||||
var pkey_name = IPA.metadata.objects[that.entity_name].primary_key;
|
||||
|
||||
var entity_name = that.entity_name;
|
||||
var result = data.result.result;
|
||||
var pkey = result[pkey_name];
|
||||
|
||||
if (pkey instanceof Array) {
|
||||
pkey = pkey[0];
|
||||
}
|
||||
|
||||
IPA.nav.show_page(that.entity_name, 'default', pkey);
|
||||
that.show_edit_page(entity_name,result);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
@ -66,8 +66,15 @@ IPA.entity_factories.automountmap = function() {
|
||||
label : IPA.metadata.objects.automountkey.label,
|
||||
name: 'keys',
|
||||
get_values: IPA.get_option_values,
|
||||
columns:['automountkey','automountinformation'],
|
||||
back_link_text: 'Back to Locations'
|
||||
back_link_text: 'Back to Locations',
|
||||
columns:[
|
||||
{
|
||||
factory: IPA.automount_key_column,
|
||||
name:'automountkey',
|
||||
label:IPA.get_entity_param('automountkey', 'automountkey').
|
||||
label
|
||||
},
|
||||
'automountinformation']
|
||||
}).
|
||||
details_facet({
|
||||
sections:[
|
||||
@ -114,17 +121,77 @@ IPA.entity_factories.automountkey = function() {
|
||||
{
|
||||
name:'identity',
|
||||
label: IPA.messages.details.identity,
|
||||
fields:['automountkey','automountinformation','description']
|
||||
fields:[
|
||||
{
|
||||
factory: IPA.text_widget,
|
||||
read_only: true,
|
||||
name: 'automountkey'
|
||||
},
|
||||
'automountinformation']
|
||||
}
|
||||
],
|
||||
back_link_text: 'Back to Locations'
|
||||
disable_breadcrumb: false,
|
||||
back_link_text: 'Back to Locations',
|
||||
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;
|
||||
}
|
||||
}).
|
||||
adder_dialog({
|
||||
show_edit_page : function(entity_name, result){
|
||||
var key = result.automountkey[0];
|
||||
var info = result.automountinformation[0];
|
||||
var state = IPA.nav.get_path_state(entity_name);
|
||||
state[entity_name + '-facet'] = 'default';
|
||||
state[entity_name + '-info'] = info;
|
||||
state[entity_name + '-pkey'] = key;
|
||||
IPA.nav.push_state(state);
|
||||
return false;
|
||||
},
|
||||
fields:['automountkey','automountinformation']
|
||||
}).
|
||||
build();
|
||||
};
|
||||
|
||||
IPA.automount_key_column = function(spec){
|
||||
var that = IPA.column(spec);
|
||||
|
||||
that.setup = function(container, record) {
|
||||
container.empty();
|
||||
var key = record.automountkey;
|
||||
var info = record.automountinformation;
|
||||
|
||||
$('<a/>', {
|
||||
href: '#'+key,
|
||||
html: key,
|
||||
click: function() {
|
||||
var state = IPA.nav.get_path_state(that.entity_name);
|
||||
state[that.entity_name + '-facet'] = 'default';
|
||||
state[that.entity_name + '-info'] = info;
|
||||
state[that.entity_name + '-pkey'] = key;
|
||||
IPA.nav.push_state(state);
|
||||
return false;
|
||||
}
|
||||
}).appendTo(container);
|
||||
|
||||
};
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
|
||||
IPA.automountmap_adder_dialog = function(spec){
|
||||
var that = IPA.add_dialog(spec);
|
||||
|
@ -266,6 +266,8 @@ IPA.details_facet = function(spec) {
|
||||
|
||||
var that = IPA.facet(spec);
|
||||
|
||||
that.pre_execute_hook = spec.pre_execute_hook;
|
||||
|
||||
that.label = spec.label || IPA.messages && IPA.messages.facets && IPA.messages.facets.details;
|
||||
that.facet_group = spec.facet_group || 'settings';
|
||||
|
||||
@ -336,8 +338,12 @@ IPA.details_facet = function(spec) {
|
||||
|
||||
that.create = function(container) {
|
||||
if (that.entity.facets.length == 1) {
|
||||
that.disable_breadcrumb = true;
|
||||
that.disable_facet_tabs = true;
|
||||
if (that.disable_breadcrumb === undefined) {
|
||||
that.disable_breadcrumb = true;
|
||||
}
|
||||
if (that.disable_facet_tabs === undefined) {
|
||||
that.disable_facet_tabs = true;
|
||||
}
|
||||
}
|
||||
|
||||
that.facet_create(container);
|
||||
@ -617,6 +623,10 @@ IPA.details_facet = function(spec) {
|
||||
|
||||
//alert(JSON.stringify(command.to_json()));
|
||||
|
||||
if (that.pre_execute_hook){
|
||||
that.pre_execute_hook(command);
|
||||
}
|
||||
|
||||
command.execute();
|
||||
};
|
||||
|
||||
@ -653,6 +663,10 @@ IPA.details_facet = function(spec) {
|
||||
|
||||
command.on_error = that.on_error;
|
||||
|
||||
if (that.pre_execute_hook){
|
||||
that.pre_execute_hook(command);
|
||||
}
|
||||
|
||||
command.execute();
|
||||
};
|
||||
|
||||
|
@ -55,6 +55,7 @@ IPA.admin_navigation = function(spec) {
|
||||
]},
|
||||
{entity: 'automountlocation', label: IPA.messages.tabs.automount},
|
||||
{entity: 'automountmap',hidden:true},
|
||||
{entity: 'automountkey',hidden:true},
|
||||
{entity: 'pwpolicy'},
|
||||
{entity: 'krbtpolicy'}
|
||||
]},
|
||||
|
Loading…
Reference in New Issue
Block a user