Set pkeys to add,remove dialog
https://fedorahosted.org/freeipa/ticket/3236
This commit is contained in:
1 parent
99fc3d597a
commit
8751b1a3db
3 files changed
+19
-20
No files matched your search
@@ -38,6 +38,7 @@ IPA.entity_adder_dialog = function(spec) {
|
||||
that.command = null;
|
||||
that.added = IPA.observer();
|
||||
that.subject = spec.subject || that.entity.metadata.label_singular;
|
||||
that.pkey_prefix = spec.pkey_prefix || [];
|
||||
|
||||
that.show_edit_page = spec.show_edit_page || show_edit_page;
|
||||
|
||||
@@ -127,9 +128,9 @@ IPA.entity_adder_dialog = function(spec) {
|
||||
pkey = pkey[0];
|
||||
}
|
||||
|
||||
var pkeys = that.facet.get_pkeys();
|
||||
var pkeys = that.pkey_prefix.slice(0);
|
||||
pkeys.push(pkey);
|
||||
navigation.show_entity(that.entity.name, 'default', [pkeys]);
|
||||
navigation.show_entity(that.entity.name, 'default', pkeys);
|
||||
}
|
||||
|
||||
that.create_add_command = function(record) {
|
||||
@@ -142,7 +143,7 @@ IPA.entity_adder_dialog = function(spec) {
|
||||
retry: that.retry
|
||||
});
|
||||
|
||||
command.add_args(that.entity.get_primary_key_prefix());
|
||||
command.add_args(that.pkey_prefix.slice(0));
|
||||
|
||||
var fields = that.fields.get_fields();
|
||||
for (var j=0; j<fields.length; j++) {
|
||||
|
||||
@@ -191,7 +191,7 @@ IPA.automount.key_entity = function(spec) {
|
||||
show_edit_page : function(entity, result){
|
||||
var key = result.automountkey[0];
|
||||
var info = result.automountinformation[0];
|
||||
var pkeys = that.facet.get_pkeys();
|
||||
var pkeys = this.pkey_prefix.slice(0);
|
||||
pkeys.push(key);
|
||||
|
||||
var args = {
|
||||
|
||||
@@ -111,6 +111,14 @@ IPA.search_facet = function(spec, no_init) {
|
||||
that.create_control_buttons(that.controls);
|
||||
};
|
||||
|
||||
that.managed_entity_pkey_prefix = function() {
|
||||
|
||||
if (that.entity !== that.managed_entity) {
|
||||
return that.get_pkeys();
|
||||
}
|
||||
return that.get_pkey_prefix();
|
||||
};
|
||||
|
||||
that.show = function() {
|
||||
that.facet_show();
|
||||
|
||||
@@ -124,6 +132,7 @@ IPA.search_facet = function(spec, no_init) {
|
||||
that.show_add_dialog = function() {
|
||||
var dialog = that.managed_entity.get_dialog('add');
|
||||
dialog.facet = that;
|
||||
dialog.pkey_prefix = that.managed_entity_pkey_prefix();
|
||||
dialog.open(that.container);
|
||||
};
|
||||
|
||||
@@ -147,6 +156,7 @@ IPA.search_facet = function(spec, no_init) {
|
||||
dialog.entity_name = that.managed_entity.name;
|
||||
dialog.entity = that.managed_entity;
|
||||
dialog.facet = that;
|
||||
dialog.pkey_prefix = that.managed_entity_pkey_prefix();
|
||||
|
||||
title = IPA.messages.dialogs.remove_title;
|
||||
var label = that.managed_entity.metadata.label;
|
||||
@@ -177,9 +187,9 @@ IPA.search_facet = function(spec, no_init) {
|
||||
};
|
||||
|
||||
that.get_refresh_command_args = function() {
|
||||
|
||||
var filter = that.state.filter || '';
|
||||
// use only prefix, we are looking for records of current entity
|
||||
var args = that.get_pkey_prefix();
|
||||
var args = that.managed_entity_pkey_prefix();
|
||||
args.push(filter);
|
||||
return args;
|
||||
};
|
||||
@@ -264,24 +274,20 @@ IPA.search_deleter_dialog = function(spec) {
|
||||
spec = spec || {};
|
||||
|
||||
var that = IPA.deleter_dialog(spec);
|
||||
that.pkey_prefix = spec.pkey_prefix || [];
|
||||
|
||||
that.create_command = function() {
|
||||
var batch = IPA.batch_command({
|
||||
error_message: IPA.messages.search.partial_delete
|
||||
});
|
||||
|
||||
var pkeys = that.facet.get_pkeys();
|
||||
pkeys.pop();
|
||||
|
||||
for (var i=0; i<that.values.length; i++) {
|
||||
var command = IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: 'del'
|
||||
});
|
||||
|
||||
for (var j=0; j<pkeys.length; j++) {
|
||||
command.add_arg(pkeys[j]);
|
||||
}
|
||||
if (that.pkey_prefix.length) command.add_args(that.pkey_prefix);
|
||||
|
||||
var value = that.values[i];
|
||||
if (value instanceof Object) {
|
||||
@@ -361,14 +367,6 @@ IPA.nested_search_facet = function(spec) {
|
||||
that.search_facet_refresh();
|
||||
};
|
||||
|
||||
that.get_refresh_command_args = function() {
|
||||
var filter = that.state.filter || '';
|
||||
// use full pkeys, we are looking for nested entity's records
|
||||
var args = that.get_pkeys();
|
||||
args.push(filter);
|
||||
return args;
|
||||
};
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user