From 57f9a297b6a43168316e2c6be945ca210fe7f3e6 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Sat, 21 May 2011 02:14:59 -0500 Subject: [PATCH] Fixed Add and Edit without primary key. The IPA.add_dialog has been modified such that if the user clicks the Add and Edit button it will read the primary key returned by the add operation and use it to open the details page. Ticket #1108 --- install/ui/add.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/install/ui/add.js b/install/ui/add.js index fcd320edf..097753f48 100644 --- a/install/ui/add.js +++ b/install/ui/add.js @@ -40,7 +40,7 @@ IPA.add_dialog = function (spec) { that.save(record); that.add( record, - function() { + function(data, text_status, xhr) { var entity = IPA.get_entity(that.entity_name); var facet = entity.get_facet('search'); var table = facet.table; @@ -56,7 +56,7 @@ IPA.add_dialog = function (spec) { that.save(record); that.add( record, - function() { + function(data, text_status, xhr) { var entity = IPA.get_entity(that.entity_name); var facet = entity.get_facet('search'); var table = facet.table; @@ -71,11 +71,17 @@ IPA.add_dialog = function (spec) { that.save(record); that.add( record, - function() { + function(data, text_status, xhr) { that.close(); var pkey_name = IPA.metadata.objects[that.entity_name].primary_key; - var pkey = record[pkey_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, 'details', pkey); }