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

--
Endi S. Dewata
From f426b0502f27a2d149a1e2d51ec887aefaffd6bf Mon Sep 17 00:00:00 2001
From: Endi S. Dewata <edew...@redhat.com>
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 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/install/ui/add.js b/install/ui/add.js
index fcd320edf559dc1e586712d71c34f95a422163e9..097753f48af3e503158f38de9a89be536a05edd7 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);
                 }
-- 
1.7.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to