summaryrefslogtreecommitdiffstats
path: root/install/ui
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2013-02-08 13:05:17 +0100
committerPetr Vobornik <pvoborni@redhat.com>2013-05-06 16:22:18 +0200
commit8751b1a3dbb2a5a7bc9d984aeb5adb3be012c6f4 (patch)
tree661f5fd3d5b80e38b409aa998a5592bead39758b /install/ui
parent99fc3d597af0cf07db1379b87ef2f635100dc89f (diff)
downloadfreeipa-8751b1a3dbb2a5a7bc9d984aeb5adb3be012c6f4.tar.gz
freeipa-8751b1a3dbb2a5a7bc9d984aeb5adb3be012c6f4.tar.xz
freeipa-8751b1a3dbb2a5a7bc9d984aeb5adb3be012c6f4.zip
Set pkeys to add,remove dialog
https://fedorahosted.org/freeipa/ticket/3236
Diffstat (limited to 'install/ui')
-rw-r--r--install/ui/src/freeipa/add.js7
-rw-r--r--install/ui/src/freeipa/automount.js2
-rw-r--r--install/ui/src/freeipa/search.js30
3 files changed, 19 insertions, 20 deletions
diff --git a/install/ui/src/freeipa/add.js b/install/ui/src/freeipa/add.js
index a2b60435e..a91232887 100644
--- a/install/ui/src/freeipa/add.js
+++ b/install/ui/src/freeipa/add.js
@@ -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++) {
diff --git a/install/ui/src/freeipa/automount.js b/install/ui/src/freeipa/automount.js
index aead97d16..8df1f822a 100644
--- a/install/ui/src/freeipa/automount.js
+++ b/install/ui/src/freeipa/automount.js
@@ -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 = {
diff --git a/install/ui/src/freeipa/search.js b/install/ui/src/freeipa/search.js
index 8a993f04a..8bdce7f26 100644
--- a/install/ui/src/freeipa/search.js
+++ b/install/ui/src/freeipa/search.js
@@ -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;
};